[Android] Fix AuthorsActivity scroll on TV

Nicolas Pomepuy git at videolan.org
Mon Mar 28 13:06:24 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Mar 28 14:38:21 2022 +0200| [659b75020a6975e77f94057a16aaab3d56dd07f5] | committer: Duncan McNamara

Fix AuthorsActivity scroll on TV

Fixes #2456

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

 .../res/color/standard_selection_transparent.xml   | 30 ++++++++++++++++++++++
 .../res/layout/about_authors_activity.xml          |  3 +++
 .../vlc-android/res/layout/about_authors_item.xml  |  2 ++
 .../src/org/videolan/vlc/gui/AuthorsActivity.kt    | 11 ++++++--
 4 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/application/resources/src/main/res/color/standard_selection_transparent.xml b/application/resources/src/main/res/color/standard_selection_transparent.xml
new file mode 100644
index 000000000..07fbb5d2d
--- /dev/null
+++ b/application/resources/src/main/res/color/standard_selection_transparent.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+  ~ *************************************************************************
+  ~  standard_selection.xml
+  ~ **************************************************************************
+  ~ Copyright © 2020 VLC authors and VideoLAN
+  ~ Author: Nicolas POMEPUY
+  ~ This program is free software; you can redistribute it and/or modify
+  ~ it under the terms of the GNU General Public License as published by
+  ~ the Free Software Foundation; either version 2 of the License, or
+  ~ (at your option) any later version.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  ~ GNU General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU General Public License
+  ~ along with this program; if not, write to the Free Software
+  ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+  ~ ***************************************************************************
+  ~
+  ~
+  -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_selected="true" android:color="@color/orange200transparent" />
+    <item android:state_pressed="true" android:color="@color/orange200transparent" />
+    <item android:state_focused="true" android:color="@color/orange200transparent" />
+    <item android:color="@color/transparent" />
+</selector>
\ No newline at end of file
diff --git a/application/vlc-android/res/layout/about_authors_activity.xml b/application/vlc-android/res/layout/about_authors_activity.xml
index fa9eb0a48..82538f76d 100644
--- a/application/vlc-android/res/layout/about_authors_activity.xml
+++ b/application/vlc-android/res/layout/about_authors_activity.xml
@@ -24,6 +24,9 @@
                         android:id="@+id/authors_list"
                         android:layout_width="match_parent"
                         android:layout_height="match_parent"
+                        android:focusable="true"
+                        android:paddingBottom="54dp"
+                        android:clipToPadding="false"
                         app:layout_constraintEnd_toEndOf="parent"
                         app:layout_constraintStart_toStartOf="parent"
                         app:layout_constraintTop_toBottomOf="@+id/title"
diff --git a/application/vlc-android/res/layout/about_authors_item.xml b/application/vlc-android/res/layout/about_authors_item.xml
index 8addc893b..ce0860f51 100644
--- a/application/vlc-android/res/layout/about_authors_item.xml
+++ b/application/vlc-android/res/layout/about_authors_item.xml
@@ -15,6 +15,8 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:minHeight="48dp"
+                android:focusable="true"
+                android:foreground="?android:attr/selectableItemBackground"
                 android:gravity="center_horizontal"
                 android:orientation="vertical">
 
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/AuthorsActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/AuthorsActivity.kt
index ee021c0e2..2a77106b1 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/AuthorsActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/AuthorsActivity.kt
@@ -5,15 +5,19 @@ import android.view.LayoutInflater
 import android.view.MenuItem
 import android.view.ViewGroup
 import androidx.databinding.DataBindingUtil
-import androidx.lifecycle.*
+import androidx.lifecycle.lifecycleScope
 import androidx.recyclerview.widget.LinearLayoutManager
 import com.google.android.material.appbar.MaterialToolbar
-import com.squareup.moshi.*
+import com.squareup.moshi.JsonAdapter
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.Types
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.ObsoleteCoroutinesApi
 import kotlinx.coroutines.withContext
+import org.videolan.resources.AndroidDevices
 import org.videolan.resources.AppContextProvider
+import org.videolan.resources.util.applyOverscanMargin
 import org.videolan.vlc.R
 import org.videolan.vlc.databinding.AboutAuthorsActivityBinding
 import org.videolan.vlc.databinding.AboutAuthorsItemBinding
@@ -42,6 +46,9 @@ class AuthorsActivity : BaseActivity() {
 
         binding.authorsList.layoutManager = LinearLayoutManager(this)
         loadAuthors()
+        if (AndroidDevices.isTv) {
+            applyOverscanMargin(this)
+        }
 
     }
 



More information about the Android mailing list