[Android] Fix ListVews style

Geoffrey Métais git at videolan.org
Mon Apr 27 10:57:47 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr 24 15:54:51 2015 +0200| [0540df964ee6560b548e13b3f2e89dfbbcaffeb2] | committer: Geoffrey Métais

Fix ListVews style

- Fixes keyboard navigation
- Brings ripple effect on menu list items

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=0540df964ee6560b548e13b3f2e89dfbbcaffeb2
---

 vlc-android/res/layout/audio_album.xml                   |    3 ++-
 vlc-android/res/layout/audio_albums_songs.xml            |    8 +++++---
 vlc-android/res/layout/audio_browser.xml                 |   12 ++++++++----
 vlc-android/res/layout/main.xml                          |    2 ++
 vlc-android/res/values/styles.xml                        |    6 +++---
 vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java |    2 --
 6 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/vlc-android/res/layout/audio_album.xml b/vlc-android/res/layout/audio_album.xml
index 088bf43..db32779 100644
--- a/vlc-android/res/layout/audio_album.xml
+++ b/vlc-android/res/layout/audio_album.xml
@@ -18,7 +18,8 @@
         android:fastScrollEnabled="true"
         android:paddingBottom="@dimen/listview_bottom_padding"
         android:paddingLeft="10dp"
-        android:paddingRight="10dp"/>
+        android:paddingRight="10dp"
+        style="@style/Theme.VLC.List"/>
     <ImageView
         android:id="@+id/album_play"
         android:layout_width="wrap_content"
diff --git a/vlc-android/res/layout/audio_albums_songs.xml b/vlc-android/res/layout/audio_albums_songs.xml
index 6f0a8e7..ef74b84 100644
--- a/vlc-android/res/layout/audio_albums_songs.xml
+++ b/vlc-android/res/layout/audio_albums_songs.xml
@@ -20,7 +20,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
-        <ListView
+            <ListView
                 android:id="@+id/albums"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
@@ -32,7 +32,8 @@
                 android:nextFocusUp="@+id/ml_menu_search"
                 android:nextFocusDown="@id/albums"
                 android:nextFocusLeft="@id/albums"
-                android:nextFocusRight="@id/albums" />
+                android:nextFocusRight="@id/albums"
+                style="@style/Theme.VLC.List" />
 
             <ListView
                 android:id="@+id/songs"
@@ -46,7 +47,8 @@
                 android:nextFocusUp="@+id/ml_menu_search"
                 android:nextFocusDown="@id/songs"
                 android:nextFocusLeft="@id/songs"
-                android:nextFocusRight="@id/songs" />
+                android:nextFocusRight="@id/songs"
+                style="@style/Theme.VLC.List" />
         </android.support.v4.view.ViewPager>
     </org.videolan.vlc.widget.SwipeRefreshLayout>
 
diff --git a/vlc-android/res/layout/audio_browser.xml b/vlc-android/res/layout/audio_browser.xml
index 9c35bf8..562a4e0 100644
--- a/vlc-android/res/layout/audio_browser.xml
+++ b/vlc-android/res/layout/audio_browser.xml
@@ -43,7 +43,8 @@
                 android:nextFocusUp="@id/header"
                 android:nextFocusDown="@id/header"
                 android:nextFocusLeft="@id/artists_list"
-                android:nextFocusRight="@+id/albums_list" />
+                android:nextFocusRight="@+id/albums_list"
+                style="@style/Theme.VLC.List" />
             <ListView
                 android:id="@+id/albums_list"
                 android:layout_width="fill_parent"
@@ -57,7 +58,8 @@
                 android:nextFocusUp="@id/header"
                 android:nextFocusDown="@id/header"
                 android:nextFocusLeft="@id/artists_list"
-                android:nextFocusRight="@+id/songs_list" />
+                android:nextFocusRight="@+id/songs_list"
+                style="@style/Theme.VLC.List" />
             <ListView
                 android:id="@+id/songs_list"
                 android:layout_width="fill_parent"
@@ -71,7 +73,8 @@
                 android:nextFocusUp="@id/header"
                 android:nextFocusDown="@id/header"
                 android:nextFocusLeft="@id/albums_list"
-                android:nextFocusRight="@+id/genres_list" />
+                android:nextFocusRight="@+id/genres_list"
+                style="@style/Theme.VLC.List" />
             <ListView
                 android:id="@+id/genres_list"
                 android:layout_width="fill_parent"
@@ -85,7 +88,8 @@
                 android:nextFocusUp="@id/header"
                 android:nextFocusDown="@id/header"
                 android:nextFocusLeft="@id/songs_list"
-                android:nextFocusRight="@+id/playlists_list" />
+                android:nextFocusRight="@+id/playlists_list"
+                style="@style/Theme.VLC.List" />
             <ListView
                 android:id="@+id/playlists_list"
                 android:layout_width="fill_parent"
diff --git a/vlc-android/res/layout/main.xml b/vlc-android/res/layout/main.xml
index efc58fd..219d270 100644
--- a/vlc-android/res/layout/main.xml
+++ b/vlc-android/res/layout/main.xml
@@ -86,6 +86,8 @@
             android:layout_height="match_parent"
             android:layout_gravity="start"
             android:focusable="true"
+            android:divider="@android:color/transparent"
+            android:dividerHeight="0dp"
             android:paddingTop="?attr/actionBarSize"
             android:nextFocusForward="@id/sidelist"
             android:nextFocusUp="@id/sidelist"
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index 09284be..8bf5f1e 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -12,7 +12,6 @@
         <item name="marginTopContent">50dp</item>
         <item name="toolbar_popup_style">@style/ThemeOverlay.AppCompat.Light</item>
 
-        <item name="android:listViewStyle">@style/Theme.VLC.List</item>
         <item name="android:gridViewStyle">@style/Theme.VLC.List</item>
         <item name="android:expandableListViewStyle">@style/Theme.VLC.List</item>
         <item name="android:dropDownListViewStyle">@style/Theme.VLC.List</item>
@@ -89,7 +88,6 @@
         <item name="marginTopContent">50dp</item>
         <item name="toolbar_popup_style">@style/ThemeOverlay.AppCompat.Dark</item>
 
-        <item name="android:listViewStyle">@style/Theme.VLC.List</item>
         <item name="android:gridViewStyle">@style/Theme.VLC.List</item>
         <item name="android:expandableListViewStyle">@style/Theme.VLC.List</item>
         <item name="android:dropDownListViewStyle">@style/Theme.VLC.List</item>
@@ -155,8 +153,10 @@
         <item name="ic_equalizer_normal_style">@drawable/ic_equalizer_normal_w</item>
     </style>
 
-    <style name="Theme.VLC.List">
+    <style name="Theme.VLC.List" parent="android:style/Widget.AbsListView">
         <item name="android:listSelector">@drawable/background_item</item>
+        <item name="android:divider">@android:color/transparent</item>
+        <item name="android:dividerHeight">0dp</item>
     </style>
 
     <style name="Theme.VLC.NoTitleBar" parent="Theme.AppCompat.Light">
diff --git a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
index 9b4f2af..b9636b9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
@@ -142,10 +142,8 @@ public class SidebarAdapter extends BaseAdapter {
         // Set in selected the current item.
         if (TextUtils.equals(mCurrentFragmentId,sidebarEntry.id)) {
             textView.setTypeface(null, Typeface.BOLD);
-            v.setBackgroundColor(Util.getColorFromAttribute(mContext, R.attr.background_menu_selected));
         } else {
             textView.setTypeface(null, Typeface.NORMAL);
-            v.setBackgroundColor(Util.getColorFromAttribute(mContext, R.attr.background_menu));
         }
 
         return v;



More information about the Android mailing list