[Android] Fix focus issue on Amazon devices + improve chapter selection UI
Nicolas Pomepuy
git at videolan.org
Tue Nov 3 15:47:09 CET 2020
vlc-android | branch: 3.3.x | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Oct 27 14:11:42 2020 +0100| [62029d1222f084f6f8b762aa1b23cdb12fd8510f] | committer: Nicolas Pomepuy
Fix focus issue on Amazon devices + improve chapter selection UI
(cherry picked from commit 266c90a1d9627bd679dd3fa03575989118e9460e)
> https://code.videolan.org/videolan/vlc-android/commit/62029d1222f084f6f8b762aa1b23cdb12fd8510f
---
.../main/res/drawable/background_chapter_item.xml | 20 +++++++++++++-------
.../vlc-android/res/layout/chapter_list_item.xml | 1 +
.../vlc-android/res/layout/dialog_select_chapter.xml | 3 +--
.../res/layout/player_overlay_track_item.xml | 1 +
.../videolan/vlc/gui/dialogs/SelectChapterDialog.kt | 2 --
.../videolan/vlc/gui/dialogs/VideoTracksDialog.kt | 2 +-
6 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/application/resources/src/main/res/drawable/background_chapter_item.xml b/application/resources/src/main/res/drawable/background_chapter_item.xml
index 57d9fa4f2..3cdda8524 100644
--- a/application/resources/src/main/res/drawable/background_chapter_item.xml
+++ b/application/resources/src/main/res/drawable/background_chapter_item.xml
@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_selected="true" android:drawable="@color/orange500" />
- <item android:state_activated="true" android:drawable="@color/orange500" />
- <item android:state_focused="true" android:drawable="@color/orange300" />
- <item android:state_pressed="true" android:drawable="@color/orange500" />
-</selector>
-
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <selector>
+ <item android:state_selected="true">
+ <color android:color="@color/orange500"/>
+ </item>
+ <item>
+ <color android:color="@android:color/transparent"/>
+ </item>
+ </selector>
+ </item>
+ <item android:drawable="?attr/selectableItemBackground"/>
+</layer-list>
diff --git a/application/vlc-android/res/layout/chapter_list_item.xml b/application/vlc-android/res/layout/chapter_list_item.xml
index 0853b475f..25341b0a2 100644
--- a/application/vlc-android/res/layout/chapter_list_item.xml
+++ b/application/vlc-android/res/layout/chapter_list_item.xml
@@ -22,6 +22,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_chapter_item"
+ android:focusable="true"
android:onClick="@{holder::onClick}"
android:selected="@{selected}"
android:orientation="vertical">
diff --git a/application/vlc-android/res/layout/dialog_select_chapter.xml b/application/vlc-android/res/layout/dialog_select_chapter.xml
index 9a9cdda2f..cfef19b13 100644
--- a/application/vlc-android/res/layout/dialog_select_chapter.xml
+++ b/application/vlc-android/res/layout/dialog_select_chapter.xml
@@ -31,8 +31,7 @@
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:choiceMode="singleChoice"
- android:focusableInTouchMode="true"
- android:focusable="true"
+ android:focusable="false"
android:descendantFocusability="afterDescendants"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/application/vlc-android/res/layout/player_overlay_track_item.xml b/application/vlc-android/res/layout/player_overlay_track_item.xml
index c6f60a17f..081a66d7c 100644
--- a/application/vlc-android/res/layout/player_overlay_track_item.xml
+++ b/application/vlc-android/res/layout/player_overlay_track_item.xml
@@ -69,6 +69,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
+ android:focusable="true"
android:background="?attr/selectableItemBackgroundBorderless"
app:layout_constraintBottom_toBottomOf="@id/track_title"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.kt
index dafe83820..aafd4d6e4 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.kt
@@ -32,7 +32,6 @@ import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
-import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.videolan.medialibrary.Tools
import org.videolan.vlc.PlaybackService
@@ -52,7 +51,6 @@ class SelectChapterDialog : VLCBottomSheetDialogFragment(), IOnChapterSelectedLi
}
}
-
private lateinit var chapterList: RecyclerView
private var service: PlaybackService? = null
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VideoTracksDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VideoTracksDialog.kt
index cc2af2e6a..55bea3319 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VideoTracksDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VideoTracksDialog.kt
@@ -55,7 +55,7 @@ class VideoTracksDialog : VLCBottomSheetDialogFragment() {
private val coroutineContextProvider: CoroutineContextProvider
- override fun initialFocusedView(): View = binding.tracksSeparator2
+ override fun initialFocusedView(): View = binding.subtitleTracks.trackMore
lateinit var menuItemListener:(Int) -> Unit
lateinit var trackSelectionListener:(Int, TrackType) -> Unit
More information about the Android
mailing list