Commit d35f7547 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Geoffrey Métais

Align item title to center when no subtitle

parent 228c3d14
......@@ -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"
......
......@@ -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))
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment