-Added bulk playlist creation and append.

-Added UI to create playlist from service player activity.
-Added state saving to playlist dialogs.
-Removed access to history activity on service player activity.
-Made StreamEntity serializable.
This commit is contained in:
John Zhen Mo 2018-01-21 19:32:49 -08:00
parent 168ac91ab8
commit 776dbc34f7
12 changed files with 182 additions and 101 deletions

View file

@ -675,6 +675,7 @@ public abstract class BasePlayer implements Player.EventListener, PlaybackListen
simpleExoPlayer.seekTo(currentSourceIndex, startPos);
}
// TODO: update exoplayer to 2.6.x in order to register view count on repeated streams
databaseUpdateReactor.add(recordManager.onViewed(currentInfo).subscribe());
initThumbnail(info == null ? item.getThumbnailUrl() : info.thumbnail_url);
}

View file

@ -29,6 +29,7 @@ import com.google.android.exoplayer2.Player;
import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.fragments.OnScrollBelowItemsListener;
import org.schabi.newpipe.fragments.local.PlaylistAppendDialog;
import org.schabi.newpipe.player.event.PlayerEventListener;
import org.schabi.newpipe.playlist.PlayQueueItem;
import org.schabi.newpipe.playlist.PlayQueueItemBuilder;
@ -149,8 +150,8 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
case android.R.id.home:
finish();
return true;
case R.id.action_history:
NavigationHelper.openHistory(this);
case R.id.action_append_playlist:
appendToPlaylist();
return true;
case R.id.action_settings:
NavigationHelper.openSettings(this);
@ -185,6 +186,14 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
null
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
private void appendToPlaylist() {
if (this.player != null && this.player.getPlayQueue() != null) {
PlaylistAppendDialog.fromPlayQueueItems(this.player.getPlayQueue().getStreams())
.show(getSupportFragmentManager(), getTag());
}
}
////////////////////////////////////////////////////////////////////////////
// Service Connection
////////////////////////////////////////////////////////////////////////////