use of org.schabi.newpipe.fragments.local.LocalPlaylistManager 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.LocalPlaylistManager in project NewPipe by TeamNewPipe.
the class PlaylistCreationDialog method onCreateDialog.
/*//////////////////////////////////////////////////////////////////////////
// Dialog
//////////////////////////////////////////////////////////////////////////*/
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
if (getStreams() == null)
return super.onCreateDialog(savedInstanceState);
View dialogView = View.inflate(getContext(), R.layout.dialog_playlist_name, null);
EditText nameInput = dialogView.findViewById(R.id.playlist_name);
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getContext()).setTitle(R.string.create_playlist).setView(dialogView).setCancelable(true).setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.create, (dialogInterface, i) -> {
final String name = nameInput.getText().toString();
final LocalPlaylistManager playlistManager = new LocalPlaylistManager(NewPipeDatabase.getInstance(getContext()));
final Toast successToast = Toast.makeText(getActivity(), R.string.playlist_creation_success, Toast.LENGTH_SHORT);
playlistManager.createPlaylist(name, getStreams()).observeOn(AndroidSchedulers.mainThread()).subscribe(longs -> successToast.show());
});
return dialogBuilder.create();
}
use of org.schabi.newpipe.fragments.local.LocalPlaylistManager in project NewPipe by TeamNewPipe.
the class PlaylistAppendDialog method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final LocalPlaylistManager playlistManager = new LocalPlaylistManager(NewPipeDatabase.getInstance(getContext()));
playlistAdapter = new LocalItemListAdapter(getActivity());
playlistAdapter.setSelectedListener(new OnClickGesture<LocalItem>() {
@Override
public void selected(LocalItem selectedItem) {
if (!(selectedItem instanceof PlaylistMetadataEntry) || getStreams() == null)
return;
onPlaylistSelected(playlistManager, (PlaylistMetadataEntry) selectedItem, getStreams());
}
});
playlistRecyclerView = view.findViewById(R.id.playlist_list);
playlistRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
playlistRecyclerView.setAdapter(playlistAdapter);
final View newPlaylistButton = view.findViewById(R.id.newPlaylist);
newPlaylistButton.setOnClickListener(ignored -> openCreatePlaylistDialog());
playlistReactor = playlistManager.getPlaylists().observeOn(AndroidSchedulers.mainThread()).subscribe(this::onPlaylistsReceived);
}
use of org.schabi.newpipe.fragments.local.LocalPlaylistManager in project NewPipe by TeamNewPipe.
the class LocalPlaylistFragment method onCreate.
// /////////////////////////////////////////////////////////////////////////
// Fragment LifeCycle - Creation
// /////////////////////////////////////////////////////////////////////////
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
playlistManager = new LocalPlaylistManager(NewPipeDatabase.getInstance(getContext()));
debouncedSaveSignal = PublishSubject.create();
disposables = new CompositeDisposable();
isLoadingComplete = new AtomicBoolean();
isModified = new AtomicBoolean();
}
Aggregations