-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

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

View File

@ -32,7 +32,7 @@
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:scaleType="center"
android:src="?attr/reorder"
android:src="?attr/drag_handle"
tools:ignore="ContentDescription,RtlHardcoded"/>
<TextView

View File

@ -18,7 +18,7 @@
<attr name="palette" format="reference"/>
<attr name="language" format="reference"/>
<attr name="history" format="reference"/>
<attr name="reorder" format="reference"/>
<attr name="drag_handle" format="reference"/>
<!-- Can't refer to colors directly into drawable's xml-->
<attr name="toolbar_shadow_drawable" format="reference"/>

View File

@ -91,6 +91,8 @@
<string name="settings_category_other_title">Other</string>
<string name="background_player_playing_toast">Playing in background</string>
<string name="popup_playing_toast">Playing in popup mode</string>
<string name="background_player_append">Queued on background player</string>
<string name="popup_playing_append">Queued on popup player</string>
<string name="c3s_url" translatable="false">https://www.c3s.cc/</string>
<string name="play_btn_text">Play</string>
<string name="content">Content</string>

View File

@ -25,7 +25,7 @@
<item name="palette">@drawable/ic_palette_black_24dp</item>
<item name="language">@drawable/ic_language_black_24dp</item>
<item name="history">@drawable/ic_history_black_24dp</item>
<item name="reorder">@drawable/ic_reorder_black_24dp</item>
<item name="drag_handle">@drawable/ic_drag_handle_black_24dp</item>
<item name="selector_color">@color/light_selector</item>
<item name="separator_color">@color/light_separator_color</item>
@ -61,7 +61,7 @@
<item name="palette">@drawable/ic_palette_white_24dp</item>
<item name="language">@drawable/ic_language_white_24dp</item>
<item name="history">@drawable/ic_history_white_24dp</item>
<item name="reorder">@drawable/ic_reorder_white_24dp</item>
<item name="drag_handle">@drawable/ic_drag_handle_white_24dp</item>
<item name="selector_color">@color/dark_selector</item>
<item name="separator_color">@color/dark_separator_color</item>