Commit fc9fa1c3 authored by Adrien Maglo's avatar Adrien Maglo

Styles: define style attributes for the icons of the repeat, shuffle and playlist image buttons

parent e3d82d96
......@@ -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
......@@ -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" />
......
......@@ -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">
......
......@@ -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())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment