[Android] Styles: add a style for the audio player control icons

Adrien Maglo git at videolan.org
Mon Mar 3 17:34:26 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Mar  3 17:32:53 2014 +0100| [133d37bf0227e974bd85e2855ca63afa96ed2ca6] | committer: Adrien Maglo

Styles: add a style for the audio player control icons

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

 vlc-android/res/layout/audio_player.xml                     |    8 ++++----
 vlc-android/res/values/attrs.xml                            |    4 ++++
 vlc-android/res/values/styles.xml                           |    8 ++++++++
 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java |   11 +++++++----
 4 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index 96f4766..3ed7ab2 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -76,7 +76,7 @@
             android:contentDescription="@string/pause"
             android:focusable="true"
             android:scaleType="fitXY"
-            android:src="@drawable/ic_pause" />
+            android:src="?attr/ic_pause" />
 
         <View
             android:layout_width="10dp"
@@ -171,7 +171,7 @@
             android:contentDescription="@string/previous"
             android:focusable="true"
             android:scaleType="fitXY"
-            android:src="@drawable/ic_previous" />
+            android:src="?attr/ic_previous" />
 
         <ImageButton
             android:id="@+id/play_pause"
@@ -183,7 +183,7 @@
             android:contentDescription="@string/pause"
             android:focusable="true"
             android:scaleType="fitXY"
-            android:src="@drawable/ic_pause" />
+            android:src="?attr/ic_pause" />
 
         <ImageButton
             android:id="@+id/next"
@@ -193,7 +193,7 @@
             android:contentDescription="@string/next"
             android:focusable="true"
             android:scaleType="fitXY"
-            android:src="@drawable/ic_next" />
+            android:src="?attr/ic_next" />
 
         <ImageButton
             android:id="@+id/repeat"
diff --git a/vlc-android/res/values/attrs.xml b/vlc-android/res/values/attrs.xml
index a81d99b..86ca592 100644
--- a/vlc-android/res/values/attrs.xml
+++ b/vlc-android/res/values/attrs.xml
@@ -36,6 +36,10 @@
     <attr name="ic_shuffle_normal" format="reference" />
     <attr name="ic_shuffle_pressed" format="reference" />
     <attr name="ic_audio_player_dots" format="reference" />
+    <attr name="ic_play" format="reference" />
+    <attr name="ic_pause" format="reference" />
+    <attr name="ic_previous" format="reference" />
+    <attr name="ic_next" 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 fdffc21..d58ec75 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -54,6 +54,10 @@
         <item name="ic_shuffle_normal">@drawable/ic_shuffle_normal</item>
         <item name="ic_shuffle_pressed">@drawable/ic_shuffle_pressed</item>
         <item name="ic_audio_player_dots">@drawable/dots_dark</item>
+        <item name="ic_play">@drawable/ic_play</item>
+        <item name="ic_pause">@drawable/ic_pause</item>
+        <item name="ic_previous">@drawable/ic_previous</item>
+        <item name="ic_next">@drawable/ic_next</item>
     </style>
 
     <style name="Theme.VLC.Black" parent="Theme.VLC">
@@ -77,6 +81,10 @@
         <item name="ic_repeat_normal">@drawable/ic_repeat_normal_w</item>
         <item name="ic_shuffle_normal">@drawable/ic_shuffle_normal_w</item>
         <item name="ic_audio_player_dots">@drawable/dots</item>
+        <item name="ic_play">@drawable/ic_play_w</item>
+        <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>
     </style>
 
     <style name="Theme.VLC.List">
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index 285f74c..203fe4c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -42,6 +42,7 @@ import org.videolan.vlc.widget.AudioMediaSwitcher.AudioMediaSwitcherListener;
 import android.media.AudioManager;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
 import android.util.Log;
 import android.view.ContextMenu;
 import android.view.LayoutInflater;
@@ -311,15 +312,17 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
         mHeaderMediaSwitcher.updateMedia();
         mCoverMediaSwitcher.updateMedia();
 
+        FragmentActivity act = getActivity();
+
         if (mAudioController.isPlaying()) {
-            mPlayPause.setImageResource(R.drawable.ic_pause);
+            mPlayPause.setImageResource(Util.getResourceFromAttribute(act, R.attr.ic_pause));
             mPlayPause.setContentDescription(getString(R.string.pause));
-            mHeaderPlayPause.setImageResource(R.drawable.ic_pause);
+            mHeaderPlayPause.setImageResource(Util.getResourceFromAttribute(act, R.attr.ic_pause));
             mHeaderPlayPause.setContentDescription(getString(R.string.pause));
         } else {
-            mPlayPause.setImageResource(R.drawable.ic_play);
+            mPlayPause.setImageResource(Util.getResourceFromAttribute(act, R.attr.ic_play));
             mPlayPause.setContentDescription(getString(R.string.play));
-            mHeaderPlayPause.setImageResource(R.drawable.ic_play);
+            mHeaderPlayPause.setImageResource(Util.getResourceFromAttribute(act, R.attr.ic_play));
             mHeaderPlayPause.setContentDescription(getString(R.string.play));
         }
         if (mAudioController.isShuffling()) {



More information about the Android mailing list