Commit c70cd37c by tonihei Committed by Oliver Woodman

Repeat mode UI

Added repeat mode toggle buttons to UI. Current mode gets forwarded to
Exoplayer instance, but without playback behaviour changes yet.
Translations for button descriptions are also missing - this will be another CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155386549
parent df0d1b0f
Showing with 102 additions and 1 deletions
...@@ -470,6 +470,10 @@ import java.util.Locale; ...@@ -470,6 +470,10 @@ import java.util.Locale;
switch (repeatMode) { switch (repeatMode) {
case ExoPlayer.REPEAT_MODE_OFF: case ExoPlayer.REPEAT_MODE_OFF:
return "OFF"; return "OFF";
case ExoPlayer.REPEAT_MODE_ONE:
return "ONE";
case ExoPlayer.REPEAT_MODE_ALL:
return "ALL";
default: default:
return "?"; return "?";
} }
......
...@@ -268,12 +268,20 @@ public interface ExoPlayer { ...@@ -268,12 +268,20 @@ public interface ExoPlayer {
* Repeat modes for playback. * Repeat modes for playback.
*/ */
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({REPEAT_MODE_OFF}) @IntDef({REPEAT_MODE_OFF, REPEAT_MODE_ONE, REPEAT_MODE_ALL})
public @interface RepeatMode {} public @interface RepeatMode {}
/** /**
* Normal playback without repetition. * Normal playback without repetition.
*/ */
int REPEAT_MODE_OFF = 0; int REPEAT_MODE_OFF = 0;
/**
* "Repeat One" mode to repeat the currently playing window infinitely.
*/
int REPEAT_MODE_ONE = 1;
/**
* "Repeat All" mode to repeat the entire timeline infinitely.
*/
int REPEAT_MODE_ALL = 2;
/** /**
* Register a listener to receive events from the player. The listener's methods will be called on * Register a listener to receive events from the player. The listener's methods will be called on
......
...@@ -592,6 +592,16 @@ public final class SimpleExoPlayerView extends FrameLayout { ...@@ -592,6 +592,16 @@ public final class SimpleExoPlayerView extends FrameLayout {
} }
/** /**
* Sets which repeat toggle modes are enabled.
*
* @param repeatToggleModes A set of {@link PlaybackControlView.RepeatToggleModes}.
*/
public void setRepeatToggleModes(@PlaybackControlView.RepeatToggleModes int repeatToggleModes) {
Assertions.checkState(controller != null);
controller.setRepeatToggleModes(repeatToggleModes);
}
/**
* Sets whether the time bar should show all windows, as opposed to just the current one. * Sets whether the time bar should show all windows, as opposed to just the current one.
* *
* @param showMultiWindowTimeBar Whether to show all windows. * @param showMultiWindowTimeBar Whether to show all windows.
......
<!-- Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4z"/>
</vector>
<!-- Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#4EFFFFFF"
android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4z"/>
</vector>
<!-- Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="32dp"
android:width="32dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4zM13,15L13,9h-1l-2,1v1h1.5v4L13,15z"/>
</vector>
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
<ImageButton android:id="@id/exo_rew" <ImageButton android:id="@id/exo_rew"
style="@style/ExoMediaButton.Rewind"/> style="@style/ExoMediaButton.Rewind"/>
<ImageButton android:id="@id/exo_repeat_toggle"
style="@style/ExoMediaButton"/>
<ImageButton android:id="@id/exo_play" <ImageButton android:id="@id/exo_play"
style="@style/ExoMediaButton.Play"/> style="@style/ExoMediaButton.Play"/>
......
...@@ -34,6 +34,11 @@ ...@@ -34,6 +34,11 @@
<attr name="fastforward_increment" format="integer"/> <attr name="fastforward_increment" format="integer"/>
<attr name="player_layout_id" format="reference"/> <attr name="player_layout_id" format="reference"/>
<attr name="controller_layout_id" format="reference"/> <attr name="controller_layout_id" format="reference"/>
<attr name="repeat_toggle_modes">
<flag name="none" value="0"/>
<flag name="one" value="1"/>
<flag name="all" value="2"/>
</attr>
<declare-styleable name="SimpleExoPlayerView"> <declare-styleable name="SimpleExoPlayerView">
<attr name="use_artwork" format="boolean"/> <attr name="use_artwork" format="boolean"/>
...@@ -57,6 +62,7 @@ ...@@ -57,6 +62,7 @@
<attr name="show_timeout"/> <attr name="show_timeout"/>
<attr name="rewind_increment"/> <attr name="rewind_increment"/>
<attr name="fastforward_increment"/> <attr name="fastforward_increment"/>
<attr name="repeat_toggle_modes"/>
<attr name="controller_layout_id"/> <attr name="controller_layout_id"/>
</declare-styleable> </declare-styleable>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<item name="exo_ffwd" type="id"/> <item name="exo_ffwd" type="id"/>
<item name="exo_prev" type="id"/> <item name="exo_prev" type="id"/>
<item name="exo_next" type="id"/> <item name="exo_next" type="id"/>
<item name="exo_repeat_toggle" type="id"/>
<item name="exo_duration" type="id"/> <item name="exo_duration" type="id"/>
<item name="exo_position" type="id"/> <item name="exo_position" type="id"/>
<item name="exo_progress" type="id"/> <item name="exo_progress" type="id"/>
......
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 sign in to comment