[Android] Organize layouts with keyboardNavigationClusters

Geoffrey Métais git at videolan.org
Tue Aug 22 17:44:30 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Aug 22 17:43:57 2017 +0200| [291d5a6810e32e142e52b0bcaf1066caed63dc7e] | committer: Geoffrey Métais

Organize layouts with keyboardNavigationClusters

> https://code.videolan.org/videolan/vlc-android/commit/291d5a6810e32e142e52b0bcaf1066caed63dc7e
---

 vlc-android/res/layout/audio_player.xml      |  4 +++-
 vlc-android/res/layout/main.xml              |  9 +++++++--
 vlc-android/res/layout/playlist_activity.xml | 10 +++++++---
 vlc-android/res/layout/secondary.xml         | 10 ++++++----
 vlc-android/res/layout/toolbar.xml           |  5 ++++-
 5 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index c5512353b..478ba4fe3 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -11,7 +11,9 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="?attr/background_default_darker"
-        android:clickable="true">
+        android:clickable="true"
+        android:keyboardNavigationCluster="true"
+        tools:targetApi="o">
         <ImageView
             android:id="@+id/backgroundView"
             android:layout_width="0dp"
diff --git a/vlc-android/res/layout/main.xml b/vlc-android/res/layout/main.xml
index 9f4104cdc..f2c417b6e 100644
--- a/vlc-android/res/layout/main.xml
+++ b/vlc-android/res/layout/main.xml
@@ -2,6 +2,7 @@
 <org.videolan.vlc.gui.view.HackyDrawerLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/root_container"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -22,7 +23,9 @@
             android:id="@+id/fragment_placeholder"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+            app:layout_behavior="@string/appbar_scrolling_view_behavior"
+            android:keyboardNavigationCluster="true"
+            tools:targetApi="o" />
 
         <android.support.v7.widget.ViewStubCompat
             android:id="@+id/scan_viewstub"
@@ -56,7 +59,9 @@
         android:layout_gravity="start"
         app:menu="@menu/navigation"
         app:itemTextColor="?attr/navigationview_item_color"
-        app:itemIconTint="?attr/navigationview_item_color" />
+        app:itemIconTint="?attr/navigationview_item_color"
+        android:keyboardNavigationCluster="true"
+        tools:targetApi="o" />
 
     <android.support.v7.widget.ViewStubCompat
         android:id="@+id/audio_playlist_tips"
diff --git a/vlc-android/res/layout/playlist_activity.xml b/vlc-android/res/layout/playlist_activity.xml
index 26fa8f6c7..e5e1b2f36 100644
--- a/vlc-android/res/layout/playlist_activity.xml
+++ b/vlc-android/res/layout/playlist_activity.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<layout>
+<layout xmlns:tools="http://schemas.android.com/tools">
     <data>
         <variable
             name="playlist"
@@ -29,7 +29,9 @@
                 vlc:contentScrim="?attr/background_actionbar"
                 vlc:expandedTitleMarginEnd="64dp"
                 vlc:expandedTitleMarginStart="48dp"
-                vlc:layout_scrollFlags="scroll|exitUntilCollapsed" >
+                vlc:layout_scrollFlags="scroll|exitUntilCollapsed"
+                android:keyboardNavigationCluster="true"
+                tools:targetApi="o"  >
                 <ImageView
                     android:id="@+id/playlist_cover"
                     android:layout_width="match_parent"
@@ -55,7 +57,9 @@
             android:id="@+id/container_list"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            vlc:layout_behavior="@string/appbar_scrolling_view_behavior">
+            vlc:layout_behavior="@string/appbar_scrolling_view_behavior"
+            android:keyboardNavigationCluster="true"
+            tools:targetApi="o"  >
             <org.videolan.vlc.gui.view.ContextMenuRecyclerView
                 android:id="@+id/songs"
                 android:layout_width="@dimen/default_content_width"
diff --git a/vlc-android/res/layout/secondary.xml b/vlc-android/res/layout/secondary.xml
index 5f20aa6a7..be9cfb5af 100644
--- a/vlc-android/res/layout/secondary.xml
+++ b/vlc-android/res/layout/secondary.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
-<merge
-    xmlns:android="http://schemas.android.com/apk/res/android"
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:vlc="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
-    android:layout_height="match_parent" >
+    android:layout_height="match_parent">
     <android.support.design.widget.CoordinatorLayout
         android:id="@+id/coordinator"
         android:layout_width="match_parent"
@@ -14,7 +14,9 @@
         <FrameLayout
             android:id="@+id/fragment_placeholder"
             android:layout_width="match_parent"
-            android:layout_height="match_parent" />
+            android:layout_height="match_parent"
+            android:keyboardNavigationCluster="true"
+            tools:targetApi="o" />
 
         <android.support.v7.widget.ViewStubCompat
             android:id="@+id/scan_viewstub"
diff --git a/vlc-android/res/layout/toolbar.xml b/vlc-android/res/layout/toolbar.xml
index 0ee27569c..43be7cac4 100644
--- a/vlc-android/res/layout/toolbar.xml
+++ b/vlc-android/res/layout/toolbar.xml
@@ -2,6 +2,7 @@
 <android.support.design.widget.AppBarLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/appbar"
     android:layout_width="match_parent"
     android:layout_height="?attr/actionBarSize"
@@ -18,5 +19,7 @@
         android:background="?attr/background_actionbar"
         app:navigationIcon="?attr/homeAsUpIndicator"
         app:titleMarginStart="@dimen/default_margin"
-        app:layout_scrollFlags="scroll|enterAlways" />
+        app:layout_scrollFlags="scroll|enterAlways"
+        android:keyboardNavigationCluster="true"
+        tools:targetApi="o" />
 </android.support.design.widget.AppBarLayout>
\ No newline at end of file



More information about the Android mailing list