Skip to content

Commit a7d5d9a

Browse files
committed
Fix rebase
1 parent fd0d76e commit a7d5d9a

2 files changed

Lines changed: 5 additions & 34 deletions

File tree

app/src/main/java/org/schabi/newpipe/info_list/InfoItemDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public Builder setAction(@NonNull final StreamDialogDefaultEntry entry,
252252
* @return the current {@link Builder} instance
253253
*/
254254
public Builder addEnqueueEntriesIfNeeded() {
255-
if (PlayerHolder.getInstance().isPlayerOpen()) {
255+
if (PlayerHolder.getInstance().isPlayQueueReady()) {
256256
addEntry(StreamDialogDefaultEntry.ENQUEUE);
257257

258258
if (PlayerHolder.getInstance().getQueueSize() > 1) {

app/src/main/java/org/schabi/newpipe/util/StreamDialogDefaultEntry.java

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
package org.schabi.newpipe.util;
22

3-
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
43
import static org.schabi.newpipe.util.StreamDialogEntry.fetchItemInfoIfSparse;
54
import static org.schabi.newpipe.util.StreamDialogEntry.openChannelFragment;
65

76
import android.net.Uri;
8-
import android.widget.Toast;
97

108
import androidx.annotation.NonNull;
119
import androidx.annotation.StringRes;
1210

13-
import org.schabi.newpipe.NewPipeDatabase;
1411
import org.schabi.newpipe.R;
1512
import org.schabi.newpipe.database.stream.model.StreamEntity;
16-
import org.schabi.newpipe.error.ErrorInfo;
17-
import org.schabi.newpipe.error.ErrorUtil;
18-
import org.schabi.newpipe.error.UserAction;
1913
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
2014
import org.schabi.newpipe.local.dialog.PlaylistDialog;
2115
import org.schabi.newpipe.local.history.HistoryRecordManager;
@@ -25,7 +19,6 @@
2519
import java.util.Collections;
2620

2721
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
28-
import io.reactivex.rxjava3.schedulers.Schedulers;
2922

3023
/**
3124
* <p>
@@ -44,32 +37,10 @@
4437
* </p>
4538
*/
4639
public enum StreamDialogDefaultEntry {
47-
SHOW_CHANNEL_DETAILS(R.string.show_channel_details, (fragment, item) -> {
48-
if (isNullOrEmpty(item.getUploaderUrl())) {
49-
final int serviceId = item.getServiceId();
50-
final String url = item.getUrl();
51-
Toast.makeText(fragment.getContext(), R.string.loading_channel_details,
52-
Toast.LENGTH_SHORT).show();
53-
ExtractorHelper.getStreamInfo(serviceId, url, false)
54-
.subscribeOn(Schedulers.io())
55-
.observeOn(AndroidSchedulers.mainThread())
56-
.subscribe(result -> {
57-
NewPipeDatabase.getInstance(fragment.requireContext()).streamDAO()
58-
.setUploaderUrl(serviceId, url, result.getUploaderUrl())
59-
.subscribeOn(Schedulers.io()).subscribe();
60-
openChannelFragment(fragment, item, result.getUploaderUrl());
61-
}, throwable -> ErrorUtil.openActivity(
62-
fragment.requireContext(),
63-
new ErrorInfo(
64-
throwable,
65-
UserAction.REQUESTED_CHANNEL,
66-
url,
67-
serviceId
68-
)));
69-
} else {
70-
openChannelFragment(fragment, item, item.getUploaderUrl());
71-
}
72-
}),
40+
SHOW_CHANNEL_DETAILS(R.string.show_channel_details, (fragment, item) ->
41+
SaveUploaderUrlHelper.saveUploaderUrlIfNeeded(fragment, item,
42+
uploaderUrl -> openChannelFragment(fragment, item, uploaderUrl))
43+
),
7344

7445
/**
7546
* Enqueues the stream automatically to the current PlayerType.

0 commit comments

Comments
 (0)