[Android] Styles: define style attributes for the icons of the repeat, shuffle and playlist image buttons
Adrien Maglo
git at videolan.org
Mon Mar 3 16:44:34 CET 2014
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Mar 3 16:13:16 2014 +0100| [fc9fa1c3efff2bf56c498b32c0f0fd41549979f4] | committer: Adrien Maglo
Styles: define style attributes for the icons of the repeat, shuffle and playlist image buttons
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=fc9fa1c3efff2bf56c498b32c0f0fd41549979f4
---
vlc-android/res/layout/audio_player.xml | 6 +++---
vlc-android/res/values/attrs.xml | 7 +++++++
vlc-android/res/values/styles.xml | 12 +++++++++++
.../org/videolan/vlc/gui/audio/AudioPlayer.java | 21 +++++++++++++-------
4 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index 90622ab..2b50e71 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -42,7 +42,7 @@
android:background="#00000000"
android:focusable="true"
android:scaleType="fitXY"
- android:src="@drawable/ic_playlist_pressed" />
+ android:src="?attr/ic_playlist_pressed" />
<ImageButton
android:id="@+id/adv_function"
@@ -161,7 +161,7 @@
android:contentDescription="@string/shuffle"
android:focusable="true"
android:scaleType="fitXY"
- android:src="@drawable/ic_shuffle_normal" />
+ android:src="?attr/ic_shuffle_normal" />
<ImageButton
android:id="@+id/previous"
@@ -203,7 +203,7 @@
android:contentDescription="@string/repeat"
android:focusable="true"
android:scaleType="fitXY"
- android:src="@drawable/ic_repeat_normal" />
+ android:src="?attr/ic_repeat_normal" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
diff --git a/vlc-android/res/values/attrs.xml b/vlc-android/res/values/attrs.xml
index 5d6b58c..f6e7084 100644
--- a/vlc-android/res/values/attrs.xml
+++ b/vlc-android/res/values/attrs.xml
@@ -28,6 +28,13 @@
<attr name="ic_jumpto_normal_style" format="reference" />
<attr name="ic_down_style" format="reference" />
<attr name="ic_up_style" format="reference" />
+ <attr name="ic_playlist_normal" format="reference" />
+ <attr name="ic_playlist_pressed" format="reference" />
+ <attr name="ic_repeat_normal" format="reference" />
+ <attr name="ic_repeat_pressed" format="reference" />
+ <attr name="ic_repeat_one" format="reference" />
+ <attr name="ic_shuffle_normal" format="reference" />
+ <attr name="ic_shuffle_pressed" 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 b7370aa..5fae791 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -43,6 +43,14 @@
<item name="audio_playlist_shadow">@drawable/audio_playlist_shadow</item>
<item name="header_fadein_overlay">@drawable/header_fadein_overlay</item>
<item name="header_fadeout_overlay">@drawable/header_fadeout_overlay</item>
+
+ <item name="ic_playlist_normal">@drawable/ic_playlist_normal</item>
+ <item name="ic_playlist_pressed">@drawable/ic_playlist_pressed</item>
+ <item name="ic_repeat_normal">@drawable/ic_repeat_normal</item>
+ <item name="ic_repeat_pressed">@drawable/ic_repeat_pressed</item>
+ <item name="ic_repeat_one">@drawable/ic_repeat_one</item>
+ <item name="ic_shuffle_normal">@drawable/ic_shuffle_normal</item>
+ <item name="ic_shuffle_pressed">@drawable/ic_shuffle_pressed</item>
</style>
<style name="Theme.VLC.Black" parent="Theme.VLC">
@@ -61,6 +69,10 @@
<item name="audio_playlist_shadow">@null</item>
<item name="header_fadein_overlay">@drawable/bt_header_fadein_overlay</item>
<item name="header_fadeout_overlay">@drawable/bt_header_fadeout_overlay</item>
+
+ <item name="ic_playlist_normal">@drawable/ic_playlist_normal_w</item>
+ <item name="ic_repeat_normal">@drawable/ic_repeat_normal_w</item>
+ <item name="ic_shuffle_normal">@drawable/ic_shuffle_normal_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 b71ecfb..285f74c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -208,9 +208,11 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
public void onClick(View v) {
mSwitcher.showNext();
if (mSwitcher.getDisplayedChild() == 0)
- mPlaylistSwitch.setImageResource(R.drawable.ic_playlist_pressed);
+ mPlaylistSwitch.setImageResource(Util.getResourceFromAttribute(getActivity(),
+ R.attr.ic_playlist_pressed));
else
- mPlaylistSwitch.setImageResource(R.drawable.ic_playlist_normal);
+ mPlaylistSwitch.setImageResource(Util.getResourceFromAttribute(getActivity(),
+ R.attr.ic_playlist_normal));
}
});
mSongsList.setOnItemClickListener(new OnItemClickListener() {
@@ -321,20 +323,25 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
mHeaderPlayPause.setContentDescription(getString(R.string.play));
}
if (mAudioController.isShuffling()) {
- mShuffle.setImageResource(R.drawable.ic_shuffle_pressed);
+ mShuffle.setImageResource(Util.getResourceFromAttribute(getActivity(),
+ R.attr.ic_shuffle_pressed));
} else {
- mShuffle.setImageResource(R.drawable.ic_shuffle_normal);
+ mShuffle.setImageResource(Util.getResourceFromAttribute(getActivity(),
+ R.attr.ic_shuffle_normal));
}
switch(mAudioController.getRepeatType()) {
case None:
- mRepeat.setImageResource(R.drawable.ic_repeat_normal);
+ mRepeat.setImageResource(Util.getResourceFromAttribute(getActivity(),
+ R.attr.ic_repeat_normal));
break;
case Once:
- mRepeat.setImageResource(R.drawable.ic_repeat_one);
+ mRepeat.setImageResource(Util.getResourceFromAttribute(getActivity(),
+ R.attr.ic_repeat_one));
break;
default:
case All:
- mRepeat.setImageResource(R.drawable.ic_repeat_pressed);
+ mRepeat.setImageResource(Util.getResourceFromAttribute(getActivity(),
+ R.attr.ic_repeat_pressed));
break;
}
if (mAudioController.hasNext())
More information about the Android
mailing list