use of org.schabi.newpipe.fragments.local.RemotePlaylistManager in project NewPipe by TeamNewPipe.
the class PlaylistFragment method onCreate.
/*//////////////////////////////////////////////////////////////////////////
// LifeCycle
//////////////////////////////////////////////////////////////////////////*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
disposables = new CompositeDisposable();
isBookmarkButtonReady = new AtomicBoolean(false);
remotePlaylistManager = new RemotePlaylistManager(NewPipeDatabase.getInstance(getContext()));
}
use of org.schabi.newpipe.fragments.local.RemotePlaylistManager in project NewPipe by TeamNewPipe.
the class BookmarkFragment method onCreate.
// /////////////////////////////////////////////////////////////////////////
// Fragment LifeCycle - Creation
// /////////////////////////////////////////////////////////////////////////
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final AppDatabase database = NewPipeDatabase.getInstance(getContext());
localPlaylistManager = new LocalPlaylistManager(database);
remotePlaylistManager = new RemotePlaylistManager(database);
disposables = new CompositeDisposable();
}
use of org.schabi.newpipe.fragments.local.RemotePlaylistManager in project NewPipe by TeamNewPipe.
the class PlaylistFragment method onBookmarkClicked.
private void onBookmarkClicked() {
if (isBookmarkButtonReady == null || !isBookmarkButtonReady.get() || remotePlaylistManager == null)
return;
final Disposable action;
if (currentInfo != null && playlistEntity == null) {
action = remotePlaylistManager.onBookmark(currentInfo).observeOn(AndroidSchedulers.mainThread()).subscribe(ignored -> {
/* Do nothing */
}, this::onError);
} else if (playlistEntity != null) {
action = remotePlaylistManager.deletePlaylist(playlistEntity.getUid()).observeOn(AndroidSchedulers.mainThread()).doFinally(() -> playlistEntity = null).subscribe(ignored -> {
/* Do nothing */
}, this::onError);
} else {
action = Disposables.empty();
}
disposables.add(action);
}
Aggregations