[Android] UI : enlightened menu item when selected

Alexandre Perraud git at videolan.org
Fri Feb 27 14:24:38 CET 2015


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Fri Feb 27 14:16:13 2015 +0100| [d9952a7c507ac8569cf7c788e34a80b831a96164] | committer: Alexandre Perraud

UI : enlightened menu item when selected

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

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

diff --git a/vlc-android/res/values/attrs.xml b/vlc-android/res/values/attrs.xml
index b9f5c55..fa3a519 100644
--- a/vlc-android/res/values/attrs.xml
+++ b/vlc-android/res/values/attrs.xml
@@ -10,6 +10,7 @@
     <attr name="background_actionbar" format="reference|color" />
     <attr name="background_menu_divider" format="reference|color" />
     <attr name="background_menu" format="reference|color" />
+    <attr name="background_menu_selected" format="reference|color" />
     <attr name="background_header" format="reference|color" />
     <attr name="background_player" format="reference|color" />
     <attr name="background_playlist" format="reference|color" />
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index 981773e..6e51bb2 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -32,7 +32,8 @@
         <item name="background_default_darker">@color/grey100</item>
         <item name="background_actionbar">@color/darkorange</item>
         <item name="background_menu_divider">@color/background_menu_divider</item>
-        <item name="background_menu">@color/background_menu</item>
+        <item name="background_menu">@color/grey200</item>
+        <item name="background_menu_selected">@color/grey300</item>
         <item name="background_player">@color/grey100</item>
         <item name="background_playlist">@color/background_playlist</item>
         <item name="background_header">@color/background_menu</item>
@@ -106,6 +107,7 @@
         <item name="background_actionbar">@color/grey875</item>
         <item name="background_menu_divider">@color/grey1</item>
         <item name="background_menu">@color/grey850</item>
+        <item name="background_menu_selected">@color/grey800</item>
         <item name="background_player">@color/grey850</item>
         <item name="background_playlist">@color/black2</item>
         <item name="background_header">@color/black3</item>
diff --git a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
index 3f9bcf5..20a7b80 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
@@ -134,11 +134,14 @@ public class SidebarAdapter extends BaseAdapter {
             img.setBounds(0, 0, dp_32, dp_32);
             textView.setCompoundDrawables(img, null, null, null);
         }
-        // Set in bold the current item.
-        if (TextUtils.equals(mCurrentFragmentId,sidebarEntry.id))
+        // Set in selected the current item.
+        if (TextUtils.equals(mCurrentFragmentId,sidebarEntry.id)) {
             textView.setTypeface(null, Typeface.BOLD);
-        else
+            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