-Added different toast for append long click on detail fragment.

-Corrected drag handle icon.
-Removed reorder icon.
-Refactored play queue item selection.
This commit is contained in:
John Zhen M 2017-10-13 21:07:19 -07:00 committed by John Zhen Mo
parent 0d3e0c201e
commit a8f5cfa640
28 changed files with 34 additions and 30 deletions

View file

@ -809,9 +809,13 @@ public abstract class BasePlayer implements Player.EventListener,
else audioManager.abandonAudioFocus(this);
if (getCurrentState() == STATE_COMPLETED) {
if (playQueue.getIndex() == 0) simpleExoPlayer.seekToDefaultPosition();
else playQueue.setIndex(0);
if (playQueue.getIndex() == 0) {
simpleExoPlayer.seekToDefaultPosition();
} else {
playQueue.setIndex(0);
}
}
simpleExoPlayer.setPlayWhenReady(!isPlaying());
}
@ -846,11 +850,19 @@ public abstract class BasePlayer implements Player.EventListener,
playQueue.offsetIndex(+1);
}
public void onRestart() {
if (playQueue == null) return;
if (DEBUG) Log.d(TAG, "onRestart() called");
public void onSelected(final PlayQueueItem item) {
final int index = playQueue.indexOf(item);
if (index == -1) return;
simpleExoPlayer.seekToDefaultPosition();
if (playQueue.getIndex() == index) {
simpleExoPlayer.seekToDefaultPosition();
} else {
playQueue.setIndex(index);
}
if (!isPlaying()) {
onVideoPlayPause();
}
}
public void seekBy(int milliSeconds) {
@ -873,7 +885,7 @@ public abstract class BasePlayer implements Player.EventListener,
private final StringBuilder stringBuilder = new StringBuilder();
private final Formatter formatter = new Formatter(stringBuilder, Locale.getDefault());
private final NumberFormat speedFormatter = new DecimalFormat("0.##x");
private final NumberFormat pitchFormatter = new DecimalFormat("##.##%");
private final NumberFormat pitchFormatter = new DecimalFormat("##%");
// todo: merge this into Localization
public String getTimeString(int milliSeconds) {

View file

@ -572,14 +572,7 @@ public final class MainVideoPlayer extends Activity {
return new PlayQueueItemBuilder.OnSelectedListener() {
@Override
public void selected(PlayQueueItem item, View view) {
final int index = playQueue.indexOf(item);
if (index == -1) return;
if (playQueue.getIndex() == index) {
onRestart();
} else {
playQueue.setIndex(index);
}
onSelected(item);
}
@Override

View file

@ -347,14 +347,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
return new PlayQueueItemBuilder.OnSelectedListener() {
@Override
public void selected(PlayQueueItem item, View view) {
final int index = player.playQueue.indexOf(item);
if (index == -1) return;
if (player.playQueue.getIndex() == index) {
player.onRestart();
} else {
player.playQueue.setIndex(index);
}
player.onSelected(item);
}
@Override