Skip to content

Commit

Permalink
Move StreamDialogEntry.openChannelFragment to NavigationHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiGr committed Feb 20, 2022
1 parent 277f21d commit ee477b2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
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;

Expand Down Expand Up @@ -42,15 +41,6 @@ public interface StreamDialogEntryAction {
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 />
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand Down Expand Up @@ -402,6 +403,15 @@ public static void openChannelFragment(final FragmentManager fragmentManager,
.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) {
Expand Down

0 comments on commit ee477b2

Please sign in to comment.