Commit 1059d970 authored by Alexandre Perraud's avatar Alexandre Perraud

Video : Add repeat mode advanced option

parent dd0ca244
......@@ -213,6 +213,7 @@
<item name="ic_equalizer_normal_style">@drawable/ic_equalizer_w</item>
<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="list_subtitle">@color/grey400</item>
<item name="list_title_last">@color/list_title_last</item>
......
......@@ -86,6 +86,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
private static final int ID_EQUALIZER = 7 ;
private static final int ID_SAVE_PLAYLIST = 8 ;
private static final int ID_POPUP_VIDEO = 9 ;
private static final int ID_REPEAT = 10 ;
private Activity mActivity;
private int mTheme;
......@@ -102,6 +103,8 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
private TextView mAudioDelay;
private TextView mSpuDelay;
private TextView mRepeat;
private TextView mChaptersTitle;
private int mTextColor;
private PlaybackService mService;
......@@ -318,6 +321,41 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
}
}
public void initRepeat() {
switch (mService.getRepeatType()) {
case PlaybackService.REPEAT_NONE:
mRepeat.setCompoundDrawablesWithIntrinsicBounds(0,
UiTools.getResourceFromAttribute(mActivity, R.attr.ic_repeat),
0, 0);
break;
case PlaybackService.REPEAT_ALL:
mRepeat.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_repeat_on, 0, 0);
break;
case PlaybackService.REPEAT_ONE:
mRepeat.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_repeat_one, 0, 0);
break;
}
}
public void setRepeatMode() {
switch (mService.getRepeatType()) {
case PlaybackService.REPEAT_NONE:
mRepeat.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_repeat_one, 0, 0);
mService.setRepeatType(PlaybackService.REPEAT_ONE);
break;
case PlaybackService.REPEAT_ONE:
mRepeat.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_repeat_on, 0, 0);
mService.setRepeatType(PlaybackService.REPEAT_ALL);
break;
case PlaybackService.REPEAT_ALL:
mRepeat.setCompoundDrawablesWithIntrinsicBounds(0,
UiTools.getResourceFromAttribute(mActivity, R.attr.ic_repeat),
0, 0);
mService.setRepeatType(PlaybackService.REPEAT_NONE);
break;
}
}
private void initChapters() {
final MediaPlayer.Chapter[] chapters = mService.getChapters(-1);
......@@ -363,6 +401,10 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
mSpuDelay = tv;
initSpuDelay();
break;
case ID_REPEAT:
mRepeat = tv;
initRepeat();
break;
}
}
......@@ -415,6 +457,9 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
case ID_SAVE_PLAYLIST:
showFragment(ID_SAVE_PLAYLIST);
break;
case ID_REPEAT:
setRepeatMode();
break;
}
}
......@@ -432,6 +477,10 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
mService.setAudioDelay(0l);
initAudioDelay();
return true;
case ID_REPEAT:
mService.setRepeatType(PlaybackService.REPEAT_NONE);
initRepeat();
return true;
}
return false;
}
......@@ -488,6 +537,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
mAdapter.addOption(new Option(ID_AUDIO_DELAY, R.attr.ic_audiodelay));
if (!tvUi)
mAdapter.addOption(new Option(ID_POPUP_VIDEO, R.attr.ic_popup_dim));
mAdapter.addOption(new Option(ID_REPEAT, R.attr.ic_repeat));
final MediaPlayer.Chapter[] chapters = mService.getChapters(-1);
final int chaptersCount = chapters != null ? chapters.length : 0;
......
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