mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 11:02:35 +01:00
Update stream state in database after loading
This commit is contained in:
parent
62d36126ea
commit
bc2f0f9f3e
@ -159,6 +159,11 @@ class FeedFragment : BaseStateFragment<FeedState>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Move
|
||||||
|
fun redrawContent() {
|
||||||
|
groupAdapter.notifyItemRangeChanged(0, Int.MAX_VALUE)
|
||||||
|
}
|
||||||
|
|
||||||
fun setupListViewMode() {
|
fun setupListViewMode() {
|
||||||
// does everything needed to setup the layouts for grid or list modes
|
// does everything needed to setup the layouts for grid or list modes
|
||||||
groupAdapter.spanCount = if (shouldUseGridLayout(context)) getGridSpanCountStreams(context) else 1
|
groupAdapter.spanCount = if (shouldUseGridLayout(context)) getGridSpanCountStreams(context) else 1
|
||||||
|
@ -62,13 +62,13 @@ public enum StreamDialogEntry {
|
|||||||
* Info: Add this entry within showStreamDialog.
|
* Info: Add this entry within showStreamDialog.
|
||||||
*/
|
*/
|
||||||
enqueue(R.string.enqueue_stream, (fragment, item) -> {
|
enqueue(R.string.enqueue_stream, (fragment, item) -> {
|
||||||
fetchItemInfoIfSparse(item,
|
fetchItemInfoIfSparse(fragment, item,
|
||||||
fullItem -> NavigationHelper.enqueueOnPlayer(fragment.getContext(), fullItem)
|
fullItem -> NavigationHelper.enqueueOnPlayer(fragment.getContext(), fullItem)
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
enqueue_next(R.string.enqueue_next_stream, (fragment, item) -> {
|
enqueue_next(R.string.enqueue_next_stream, (fragment, item) -> {
|
||||||
fetchItemInfoIfSparse(item,
|
fetchItemInfoIfSparse(fragment, item,
|
||||||
fullItem -> NavigationHelper.enqueueNextOnPlayer(fragment.getContext(), fullItem)
|
fullItem -> NavigationHelper.enqueueNextOnPlayer(fragment.getContext(), fullItem)
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@ -218,7 +218,8 @@ public enum StreamDialogEntry {
|
|||||||
void onInfo(SinglePlayQueue item);
|
void onInfo(SinglePlayQueue item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fetchItemInfoIfSparse(final StreamInfoItem item,
|
private static void fetchItemInfoIfSparse(final Fragment fragment,
|
||||||
|
final StreamInfoItem item,
|
||||||
final InfoCallback callback) {
|
final InfoCallback callback) {
|
||||||
if (item.getDuration() < 0) {
|
if (item.getDuration() < 0) {
|
||||||
// Sparse item: fetched by fast fetch
|
// Sparse item: fetched by fast fetch
|
||||||
@ -227,9 +228,19 @@ public enum StreamDialogEntry {
|
|||||||
item.getUrl(),
|
item.getUrl(),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(result -> {
|
.subscribe(result -> {
|
||||||
|
final HistoryRecordManager recordManager =
|
||||||
|
new HistoryRecordManager(fragment.getContext());
|
||||||
|
recordManager.saveStreamState(result, 0)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.doOnError(throwable -> Log.e("StreamDialogEntry",
|
||||||
|
throwable.toString()))
|
||||||
|
.subscribe();
|
||||||
|
|
||||||
callback.onInfo(new SinglePlayQueue(result));
|
callback.onInfo(new SinglePlayQueue(result));
|
||||||
}, throwable -> Log.e("StreamDialogEntry", throwable.toString()));
|
}, throwable -> Log.e("StreamDialogEntry", throwable.toString()));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user