[Android] Android TV streams UI improvements
Nicolas Pomepuy
git at videolan.org
Tue May 18 11:09:20 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue May 18 07:22:58 2021 +0200| [e9bcd0b4ec69a93ccf921d9876cf45adf5696317] | committer: Nicolas Pomepuy
Android TV streams UI improvements
Add the overscan padding.
Better focus management.
> https://code.videolan.org/videolan/vlc-android/commit/e9bcd0b4ec69a93ccf921d9876cf45adf5696317
---
application/vlc-android/res/layout/mrl_item.xml | 48 +++++++++++++---------
.../src/org/videolan/vlc/gui/network/MRLAdapter.kt | 1 +
.../videolan/vlc/gui/network/MRLPanelFragment.kt | 4 ++
3 files changed, 34 insertions(+), 19 deletions(-)
diff --git a/application/vlc-android/res/layout/mrl_item.xml b/application/vlc-android/res/layout/mrl_item.xml
index 9f1a3c938..fa4d60af4 100644
--- a/application/vlc-android/res/layout/mrl_item.xml
+++ b/application/vlc-android/res/layout/mrl_item.xml
@@ -6,41 +6,51 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:maxLines="1"
- android:paddingLeft="10dp"
- android:paddingStart="10dp"
- android:paddingRight="10dp"
- android:paddingEnd="10dp"
- android:paddingBottom="5dp"
- android:paddingTop="5dp"
- android:background="?attr/selectableItemBackground"
- android:focusable="true"
- android:clickable="true">
+ android:focusable="false"
+ android:maxLines="1">
+
+ <View
+ android:id="@+id/selector"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:background="@drawable/rectangle_circle_right_white_selector"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/mrl_ctx"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/mrl_item_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/mrl_ctx"
- app:layout_constraintTop_toTopOf="parent"
+ android:layout_marginStart="16dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginEnd="16dp"
android:maxLines="2"
+ android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
android:textColor="?attr/font_default"
- android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium" />
+ app:layout_constraintEnd_toStartOf="@+id/mrl_ctx"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/mrl_item_uri"
android:layout_width="0dp"
android:layout_height="wrap_content"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/mrl_item_title"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/mrl_ctx"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:layout_marginBottom="8dp"
android:ellipsize="middle"
+ android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:maxLines="1"
android:singleLine="true"
- android:fontFamily="sans-serif" />
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/mrl_ctx"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/mrl_item_title" />
<ImageView
android:id="@+id/mrl_ctx"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/network/MRLAdapter.kt b/application/vlc-android/src/org/videolan/vlc/gui/network/MRLAdapter.kt
index e5db6578e..1477f46de 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/network/MRLAdapter.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/network/MRLAdapter.kt
@@ -129,6 +129,7 @@ internal class MRLAdapter(private val eventActor: SendChannel<MrlAction>, privat
itemView.setOnClickListener(this)
itemView.setOnLongClickListener { eventActor.offer(ShowContext(layoutPosition)) }
binding.mrlCtx.setOnClickListener { eventActor.offer(ShowContext(layoutPosition)) }
+ binding.selector.setOnClickListener { onClick(it) }
}
override fun onClick(v: View) {
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
index a58023f6c..3b9ff0fa8 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
@@ -76,6 +76,7 @@ class MRLPanelFragment : Fragment(), View.OnKeyListener, TextView.OnEditorAction
editText = binding.mrlEdit
editText.editText?.setOnKeyListener(this)
editText.editText?.setOnEditorActionListener(this)
+ editText.editText?.requestFocus()
adapter = MRLAdapter(getlistEventActor())
val recyclerView = binding.mrlList
@@ -90,6 +91,9 @@ class MRLPanelFragment : Fragment(), View.OnKeyListener, TextView.OnEditorAction
}
})
recyclerView.layoutManager = gridLayoutManager
+ val horizontalOverscan = resources.getDimension(R.dimen.tv_overscan_horizontal).toInt()
+ val verticalOverscan = resources.getDimension(R.dimen.tv_overscan_vertical).toInt()
+ binding.mrlRoot.setPadding(horizontalOverscan, verticalOverscan, horizontalOverscan, verticalOverscan)
} else {
recyclerView.layoutManager = LinearLayoutManager(activity)
recyclerView.addItemDecoration(DividerItemDecoration(activity, DividerItemDecoration.VERTICAL))
More information about the Android
mailing list