[Android] Sidebar: use white icons with black theme

Adrien Maglo git at videolan.org
Mon Mar 17 15:54:44 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Mar 17 15:47:15 2014 +0100| [6b8911a722301870f0fe6f79987bd47e68890fc7] | committer: Adrien Maglo

Sidebar: use white icons with black theme

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

 vlc-android/res/values/attrs.xml                    |    4 ++++
 vlc-android/res/values/styles.xml                   |    8 ++++++++
 .../src/org/videolan/vlc/gui/SidebarAdapter.java    |   19 +++++++++++--------
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/vlc-android/res/values/attrs.xml b/vlc-android/res/values/attrs.xml
index b27afb5..fd061e8 100644
--- a/vlc-android/res/values/attrs.xml
+++ b/vlc-android/res/values/attrs.xml
@@ -40,6 +40,10 @@
     <attr name="ic_pause" format="reference" />
     <attr name="ic_previous" format="reference" />
     <attr name="ic_next" format="reference" />
+    <attr name="ic_menu_video" format="reference" />
+    <attr name="ic_menu_audio" format="reference" />
+    <attr name="ic_menu_folder" format="reference" />
+    <attr name="ic_menu_history" format="reference" />
 
     <attr name="mini_player_top_shadow" format="reference" />
     <attr name="audio_playlist_shadow" format="reference" />
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index 3554679..3e3fb2a 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -59,6 +59,10 @@
         <item name="ic_pause">@drawable/ic_pause</item>
         <item name="ic_previous">@drawable/ic_previous</item>
         <item name="ic_next">@drawable/ic_next</item>
+        <item name="ic_menu_video">@drawable/ic_menu_video</item>
+        <item name="ic_menu_audio">@drawable/ic_menu_audio</item>
+        <item name="ic_menu_folder">@drawable/ic_menu_folder</item>
+        <item name="ic_menu_history">@drawable/ic_menu_history</item>
 
         <item name="advanced_options_style">@style/Theme.VLC.AdvancedOptionsLight</item>
     </style>
@@ -114,6 +118,10 @@
         <item name="ic_pause">@drawable/ic_pause_w</item>
         <item name="ic_previous">@drawable/ic_previous_w</item>
         <item name="ic_next">@drawable/ic_next_w</item>
+        <item name="ic_menu_video">@drawable/ic_menu_video_w</item>
+        <item name="ic_menu_audio">@drawable/ic_menu_audio_w</item>
+        <item name="ic_menu_folder">@drawable/ic_menu_folder_w</item>
+        <item name="ic_menu_history">@drawable/ic_menu_history_w</item>
 
         <item name="advanced_options_style">@style/Theme.VLC.AdvancedOptionsBlack</item>
     </style>
diff --git a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
index 123e6e1..7f20ff1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
@@ -47,15 +47,16 @@ public class SidebarAdapter extends BaseAdapter {
     static class SidebarEntry {
         String id;
         String name;
-        int drawableID;
+        int attributeID;
 
-        public SidebarEntry(String _id, int _name, int _drawableID) {
+        public SidebarEntry(String _id, int _name, int _attributeID) {
             this.id = _id;
             this.name = VLCApplication.getAppContext().getString(_name);
-            this.drawableID = _drawableID;
+            this.attributeID = _attributeID;
         }
     }
 
+    private Context mContext;
     private LayoutInflater mInflater;
     static final List<SidebarEntry> entries;
     private HashMap<String, Fragment> mFragments;
@@ -63,10 +64,10 @@ public class SidebarAdapter extends BaseAdapter {
 
     static {
         SidebarEntry entries2[] = {
-            new SidebarEntry( "video", R.string.video, R.drawable.ic_menu_video ),
-            new SidebarEntry( "audio", R.string.audio, R.drawable.ic_menu_audio ),
-            new SidebarEntry( "directories", R.string.directories, R.drawable.ic_menu_folder ),
-            new SidebarEntry( "history", R.string.history, R.drawable.ic_menu_history ),
+            new SidebarEntry( "video", R.string.video, R.attr.ic_menu_video ),
+            new SidebarEntry( "audio", R.string.audio, R.attr.ic_menu_audio ),
+            new SidebarEntry( "directories", R.string.directories, R.attr.ic_menu_folder ),
+            new SidebarEntry( "history", R.string.history, R.attr.ic_menu_history ),
             //new SidebarEntry( "bookmarks", R.string.bookmarks, R.drawable.ic_bookmarks ),
             //new SidebarEntry( "playlists", R.string.playlists, R.drawable.icon ),
         };
@@ -74,6 +75,7 @@ public class SidebarAdapter extends BaseAdapter {
     }
 
     public SidebarAdapter(Context context) {
+        mContext = context;
         mInflater = LayoutInflater.from(context);
         mFragments = new HashMap<String, Fragment>(entries.size());
     }
@@ -103,7 +105,8 @@ public class SidebarAdapter extends BaseAdapter {
         }
         TextView textView = (TextView)v;
         textView.setText(sidebarEntry.name);
-        Drawable img = VLCApplication.getAppResources().getDrawable(sidebarEntry.drawableID);
+        Drawable img = VLCApplication.getAppResources().getDrawable(
+                Util.getResourceFromAttribute(mContext, sidebarEntry.attributeID));
         if (img != null) {
             int dp_32 = Util.convertDpToPx(32);
             img.setBounds(0, 0, dp_32, dp_32);



More information about the Android mailing list