[Android] Video : Add shuffle mode advanced option
Alexandre Perraud
git at videolan.org
Fri Apr 8 17:56:21 CEST 2016
vlc-android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Fri Apr 8 15:03:28 2016 +0200| [77110fb972127476079cbe7de3f848b0cdd3b43a] | committer: Alexandre Perraud
Video : Add shuffle mode advanced option
> https://code.videolan.org/videolan/vlc-android/commit/77110fb972127476079cbe7de3f848b0cdd3b43a
---
vlc-android/res/values/styles.xml | 1 +
.../videolan/vlc/gui/dialogs/AdvOptionsDialog.java | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index 31fcf19..e58a5c4 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -214,6 +214,7 @@
<item name="ic_audiodelay">@drawable/ic_audiodelay_w</item>
<item name="ic_subtitledelay">@drawable/ic_subtitledelay_w</item>
<item name="ic_repeat">@drawable/ic_repeat_w</item>
+ <item name="ic_shuffle">@drawable/ic_shuffle_w</item>
<item name="list_subtitle">@color/grey400</item>
<item name="list_title_last">@color/list_title_last</item>
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
index 2528845..d6f0b89 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -87,6 +87,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
private static final int ID_SAVE_PLAYLIST = 8 ;
private static final int ID_POPUP_VIDEO = 9 ;
private static final int ID_REPEAT = 10 ;
+ private static final int ID_SHUFFLE = 11 ;
private Activity mActivity;
private int mTheme;
@@ -104,6 +105,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
private TextView mSpuDelay;
private TextView mRepeat;
+ private TextView mShuffle;
private TextView mChaptersTitle;
private int mTextColor;
@@ -356,6 +358,15 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
}
}
+ public void initShuffle(){
+ mShuffle.setCompoundDrawablesWithIntrinsicBounds(0,
+ mService.isShuffling()
+ ? R.drawable.ic_shuffle_on
+ : UiTools.getResourceFromAttribute(mActivity, R.attr.ic_shuffle),
+ 0, 0);
+
+ }
+
private void initChapters() {
final MediaPlayer.Chapter[] chapters = mService.getChapters(-1);
@@ -405,6 +416,10 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
mRepeat = tv;
initRepeat();
break;
+ case ID_SHUFFLE:
+ mShuffle = tv;
+ initShuffle();
+ break;
}
}
@@ -460,6 +475,10 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
case ID_REPEAT:
setRepeatMode();
break;
+ case ID_SHUFFLE:
+ mService.shuffle();
+ initShuffle();
+ break;
}
}
@@ -538,6 +557,8 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
if (!tvUi)
mAdapter.addOption(new Option(ID_POPUP_VIDEO, R.attr.ic_popup_dim));
mAdapter.addOption(new Option(ID_REPEAT, R.attr.ic_repeat));
+ if (mService.getMediaListSize() > 2)
+ mAdapter.addOption(new Option(ID_SHUFFLE, R.attr.ic_shuffle));
final MediaPlayer.Chapter[] chapters = mService.getChapters(-1);
final int chaptersCount = chapters != null ? chapters.length : 0;
More information about the Android
mailing list