[Android] Align item title to center when no subtitle
Nicolas Pomepuy
git at videolan.org
Mon Apr 1 17:59:09 CEST 2019
vlc-android | branch: 3.1.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Fri Mar 29 07:47:44 2019 +0100| [66f5db848153e9a45cd95f70fbe969c3384d3079] | committer: Geoffrey Métais
Align item title to center when no subtitle
(cherry picked from commit d35f7547475753b39a7243be5c8968c62aa10ec3)
> https://code.videolan.org/videolan/vlc-android/commit/66f5db848153e9a45cd95f70fbe969c3384d3079
---
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 80c450e87..52f204078 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
@@ -155,7 +156,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