-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

@ -767,15 +767,15 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
((HistoryListener) activity).onVideoPlayed(currentInfo, getSelectedVideoStream());
}
Toast.makeText(activity, R.string.popup_playing_toast, Toast.LENGTH_SHORT).show();
final PlayQueue playQueue = new SinglePlayQueue(currentInfo);
final VideoStream candidate = sortedStreamVideosList.get(actionBarHandler.getSelectedVideoStream());
final Intent intent;
if (append) {
Toast.makeText(activity, R.string.popup_playing_append, Toast.LENGTH_SHORT).show();
intent = NavigationHelper.getPlayerIntent(activity, PopupVideoPlayer.class, playQueue, true);
} else {
Toast.makeText(activity, R.string.popup_playing_toast, Toast.LENGTH_SHORT).show();
intent = NavigationHelper.getPlayerIntent(activity, PopupVideoPlayer.class, playQueue, Localization.resolutionOf(candidate.resolution));
}
activity.startService(intent);
@ -799,7 +799,11 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
private void openNormalBackgroundPlayer(final boolean append) {
final PlayQueue playQueue = new SinglePlayQueue(currentInfo);
activity.startService(NavigationHelper.getPlayerIntent(activity, BackgroundPlayer.class, playQueue, append));
Toast.makeText(activity, R.string.background_player_playing_toast, Toast.LENGTH_SHORT).show();
if (append) {
Toast.makeText(activity, R.string.background_player_append, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(activity, R.string.background_player_playing_toast, Toast.LENGTH_SHORT).show();
}
}
private void openExternalBackgroundPlayer(AudioStream audioStream) {

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