When doing Auto Skip to End, do the right thing (#4594)
This commit is contained in:
parent
7e9363a0f7
commit
3a9829bd5e
@ -212,7 +212,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||||||
private Disposable positionEventTimer;
|
private Disposable positionEventTimer;
|
||||||
private PlaybackServiceNotificationBuilder notificationBuilder;
|
private PlaybackServiceNotificationBuilder notificationBuilder;
|
||||||
|
|
||||||
private long autoSkippedFeedMediaId = -1;
|
private String autoSkippedFeedMediaId = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for Lollipop notifications, Android Wear, and Android Auto.
|
* Used for Lollipop notifications, Android Wear, and Android Auto.
|
||||||
@ -1046,18 +1046,21 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||||||
Log.d(TAG, "smart mark as played");
|
Log.d(TAG, "smart mark as played");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean autoSkipped = false;
|
||||||
|
if (autoSkippedFeedMediaId != null && autoSkippedFeedMediaId.equals(item.getIdentifyingValue())) {
|
||||||
|
autoSkippedFeedMediaId = null;
|
||||||
|
autoSkipped = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (ended || smartMarkAsPlayed) {
|
if (ended || smartMarkAsPlayed) {
|
||||||
media.onPlaybackCompleted(getApplicationContext());
|
media.onPlaybackCompleted(getApplicationContext());
|
||||||
} else {
|
} else {
|
||||||
media.onPlaybackPause(getApplicationContext());
|
media.onPlaybackPause(getApplicationContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoSkippedFeedMediaId >= 0 && autoSkippedFeedMediaId == media.getId()) {
|
|
||||||
ended = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (ended || smartMarkAsPlayed
|
if (ended || smartMarkAsPlayed
|
||||||
|
|| autoSkipped
|
||||||
|| (skipped && !UserPreferences.shouldSkipKeepEpisode())) {
|
|| (skipped && !UserPreferences.shouldSkipKeepEpisode())) {
|
||||||
// only mark the item as played if we're not keeping it anyways
|
// only mark the item as played if we're not keeping it anyways
|
||||||
DBWriter.markItemPlayed(item, FeedItem.PLAYED, ended);
|
DBWriter.markItemPlayed(item, FeedItem.PLAYED, ended);
|
||||||
@ -1109,7 +1112,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||||||
FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences();
|
FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences();
|
||||||
int skipEnd = preferences.getFeedSkipEnding();
|
int skipEnd = preferences.getFeedSkipEnding();
|
||||||
if (skipEnd > 0
|
if (skipEnd > 0
|
||||||
&& skipEnd < getDuration()
|
&& skipEnd * 1000 < getDuration()
|
||||||
&& (remainingTime - (skipEnd * 1000) > 0)
|
&& (remainingTime - (skipEnd * 1000) > 0)
|
||||||
&& ((remainingTime - skipEnd * 1000) < (getCurrentPlaybackSpeed() * 1000))) {
|
&& ((remainingTime - skipEnd * 1000) < (getCurrentPlaybackSpeed() * 1000))) {
|
||||||
Log.d(TAG, "skipEndingIfNecessary: Skipping the remaining " + remainingTime + " " + skipEnd * 1000 + " speed " + getCurrentPlaybackSpeed());
|
Log.d(TAG, "skipEndingIfNecessary: Skipping the remaining " + remainingTime + " " + skipEnd * 1000 + " speed " + getCurrentPlaybackSpeed());
|
||||||
@ -1118,7 +1121,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||||||
Toast toast = Toast.makeText(context, skipMesg, Toast.LENGTH_LONG);
|
Toast toast = Toast.makeText(context, skipMesg, Toast.LENGTH_LONG);
|
||||||
toast.show();
|
toast.show();
|
||||||
|
|
||||||
this.autoSkippedFeedMediaId = feedMedia.getItem().getId();
|
this.autoSkippedFeedMediaId = feedMedia.getItem().getIdentifyingValue();
|
||||||
mediaPlayer.skip();
|
mediaPlayer.skip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user