[Android] Align item title to center when no subtitle

Nicolas Pomepuy git at videolan.org
Mon Apr 1 15:35:29 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Fri Mar 29 07:47:44 2019 +0100| [d35f7547475753b39a7243be5c8968c62aa10ec3] | committer: Geoffrey Métais

Align item title to center when no subtitle

> https://code.videolan.org/videolan/vlc-android/commit/d35f7547475753b39a7243be5c8968c62aa10ec3
---

 vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt | 8 ++++----
 vlc-android/src/org/videolan/vlc/util/Kextensions.kt   | 7 ++++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt b/vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt
index 324ef07ee..0da85a021 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt
@@ -21,15 +21,15 @@
 package org.videolan.vlc.gui.tv
 
 import android.app.Activity
-import androidx.lifecycle.Lifecycle
-import androidx.lifecycle.LifecycleObserver
-import androidx.lifecycle.OnLifecycleEvent
 import android.content.BroadcastReceiver
 import android.content.Context
 import android.content.Intent
 import android.content.IntentFilter
-import androidx.fragment.app.FragmentActivity
 import android.widget.TextView
+import androidx.fragment.app.FragmentActivity
+import androidx.lifecycle.Lifecycle
+import androidx.lifecycle.LifecycleObserver
+import androidx.lifecycle.OnLifecycleEvent
 import java.util.*
 
 private const val TAG = "VLC/TimeUpdater"
diff --git a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
index 16fd1bb4a..f8027c064 100644
--- a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -10,6 +10,7 @@ import android.content.res.Resources
 import android.net.Uri
 import android.os.Build
 import android.util.DisplayMetrics
+import android.view.View
 import android.widget.TextView
 import androidx.appcompat.widget.AppCompatTextView
 import androidx.core.text.PrecomputedTextCompat
@@ -160,7 +161,11 @@ fun <X, Y> CoroutineScope.map(
 
 @BindingAdapter("app:asyncText", requireAll = false)
 fun asyncText(view: TextView, text: CharSequence?) {
-    if (text.isNullOrEmpty()) return
+    if (text.isNullOrEmpty()) {
+        view.visibility = View.GONE
+        return
+    }
+    view.visibility = View.VISIBLE
     val params = TextViewCompat.getTextMetricsParams(view)
     (view as AppCompatTextView).setTextFuture(PrecomputedTextCompat.getTextFuture(text, params, null))
 }



More information about the Android mailing list