1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-06-26 07:03:20 +00:00

Move StreamDialogEntry.openChannelFragment to NavigationHelper

This commit is contained in:
TobiGr 2022-02-20 20:26:23 +01:00
parent 277f21d5b2
commit ee477b25e5
3 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
package org.schabi.newpipe.info_list.dialog;
import static org.schabi.newpipe.info_list.dialog.StreamDialogEntry.fetchItemInfoIfSparse;
import static org.schabi.newpipe.info_list.dialog.StreamDialogEntry.openChannelFragment;
import static org.schabi.newpipe.util.NavigationHelper.openChannelFragment;
import android.net.Uri;

View File

@ -14,7 +14,6 @@ import org.schabi.newpipe.extractor.stream.StreamType;
import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.NavigationHelper;
import java.util.function.Consumer;
@ -42,15 +41,6 @@ public class StreamDialogEntry {
void onClick(Fragment fragment, StreamInfoItem infoItem);
}
public static void openChannelFragment(@NonNull final Fragment fragment,
@NonNull final StreamInfoItem item,
final String uploaderUrl) {
// For some reason `getParentFragmentManager()` doesn't work, but this does.
NavigationHelper.openChannelFragment(
fragment.requireActivity().getSupportFragmentManager(),
item.getServiceId(), uploaderUrl, item.getUploaderName());
}
/**
* Fetches a {@link StreamInfoItem} if it is incomplete and executes the callback.
* <br />

View File

@ -31,6 +31,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.stream.AudioStream;
import org.schabi.newpipe.extractor.stream.Stream;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.stream.VideoStream;
import org.schabi.newpipe.fragments.MainFragment;
import org.schabi.newpipe.fragments.detail.VideoDetailFragment;
@ -402,6 +403,15 @@ public final class NavigationHelper {
.commit();
}
public static void openChannelFragment(@NonNull final Fragment fragment,
@NonNull final StreamInfoItem item,
final String uploaderUrl) {
// For some reason `getParentFragmentManager()` doesn't work, but this does.
openChannelFragment(
fragment.requireActivity().getSupportFragmentManager(),
item.getServiceId(), uploaderUrl, item.getUploaderName());
}
public static void openPlaylistFragment(final FragmentManager fragmentManager,
final int serviceId, final String url,
@NonNull final String name) {