Fix rebase

This commit is contained in:
TobiGr 2022-02-19 00:02:15 +01:00
parent 40103c07d2
commit a97ea9af70
2 changed files with 5 additions and 34 deletions

View file

@ -252,7 +252,7 @@ public final class InfoItemDialog {
* @return the current {@link Builder} instance * @return the current {@link Builder} instance
*/ */
public Builder addEnqueueEntriesIfNeeded() { public Builder addEnqueueEntriesIfNeeded() {
if (PlayerHolder.getInstance().isPlayerOpen()) { if (PlayerHolder.getInstance().isPlayQueueReady()) {
addEntry(StreamDialogDefaultEntry.ENQUEUE); addEntry(StreamDialogDefaultEntry.ENQUEUE);
if (PlayerHolder.getInstance().getQueueSize() > 1) { if (PlayerHolder.getInstance().getQueueSize() > 1) {

View file

@ -1,21 +1,15 @@
package org.schabi.newpipe.util; package org.schabi.newpipe.util;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.util.StreamDialogEntry.fetchItemInfoIfSparse; import static org.schabi.newpipe.util.StreamDialogEntry.fetchItemInfoIfSparse;
import static org.schabi.newpipe.util.StreamDialogEntry.openChannelFragment; import static org.schabi.newpipe.util.StreamDialogEntry.openChannelFragment;
import android.net.Uri; import android.net.Uri;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import org.schabi.newpipe.NewPipeDatabase;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.database.stream.model.StreamEntity; import org.schabi.newpipe.database.stream.model.StreamEntity;
import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.ErrorUtil;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog; import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
import org.schabi.newpipe.local.dialog.PlaylistDialog; import org.schabi.newpipe.local.dialog.PlaylistDialog;
import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.local.history.HistoryRecordManager;
@ -25,7 +19,6 @@ import org.schabi.newpipe.util.external_communication.ShareUtils;
import java.util.Collections; import java.util.Collections;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.schedulers.Schedulers;
/** /**
* <p> * <p>
@ -44,32 +37,10 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
* </p> * </p>
*/ */
public enum StreamDialogDefaultEntry { public enum StreamDialogDefaultEntry {
SHOW_CHANNEL_DETAILS(R.string.show_channel_details, (fragment, item) -> { SHOW_CHANNEL_DETAILS(R.string.show_channel_details, (fragment, item) ->
if (isNullOrEmpty(item.getUploaderUrl())) { SaveUploaderUrlHelper.saveUploaderUrlIfNeeded(fragment, item,
final int serviceId = item.getServiceId(); uploaderUrl -> openChannelFragment(fragment, item, uploaderUrl))
final String url = item.getUrl(); ),
Toast.makeText(fragment.getContext(), R.string.loading_channel_details,
Toast.LENGTH_SHORT).show();
ExtractorHelper.getStreamInfo(serviceId, url, false)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> {
NewPipeDatabase.getInstance(fragment.requireContext()).streamDAO()
.setUploaderUrl(serviceId, url, result.getUploaderUrl())
.subscribeOn(Schedulers.io()).subscribe();
openChannelFragment(fragment, item, result.getUploaderUrl());
}, throwable -> ErrorUtil.openActivity(
fragment.requireContext(),
new ErrorInfo(
throwable,
UserAction.REQUESTED_CHANNEL,
url,
serviceId
)));
} else {
openChannelFragment(fragment, item, item.getUploaderUrl());
}
}),
/** /**
* Enqueues the stream automatically to the current PlayerType. * Enqueues the stream automatically to the current PlayerType.