mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 00:20:32 +00:00
Merge pull request #7222 from ktprograms/queue-menu-channel-details
Added the 'Show Channel Details' menu item to the Queue long press menu
This commit is contained in:
commit
7edef8d5a2
@ -18,6 +18,9 @@ import org.schabi.newpipe.util.NavigationHelper;
|
||||
import java.util.Collections;
|
||||
|
||||
public final class QueueItemMenuUtil {
|
||||
private QueueItemMenuUtil() {
|
||||
}
|
||||
|
||||
public static void openPopupMenu(final PlayQueue playQueue,
|
||||
final PlayQueueItem item,
|
||||
final View view,
|
||||
@ -57,6 +60,13 @@ public final class QueueItemMenuUtil {
|
||||
);
|
||||
|
||||
return true;
|
||||
case R.id.menu_item_channel_details:
|
||||
// An intent must be used here.
|
||||
// Opening with FragmentManager transactions is not working,
|
||||
// as PlayQueueActivity doesn't use fragments.
|
||||
NavigationHelper.openChannelFragmentUsingIntent(context, item.getServiceId(),
|
||||
item.getUploaderUrl(), item.getUploader());
|
||||
return true;
|
||||
case R.id.menu_item_share:
|
||||
shareText(context, item.getTitle(), item.getUrl(),
|
||||
item.getThumbnailUrl());
|
||||
@ -67,6 +77,4 @@ public final class QueueItemMenuUtil {
|
||||
|
||||
popupMenu.show();
|
||||
}
|
||||
|
||||
private QueueItemMenuUtil() { }
|
||||
}
|
||||
|
@ -495,6 +495,27 @@ public final class NavigationHelper {
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens {@link ChannelFragment}.
|
||||
* Use this instead of {@link #openChannelFragment(FragmentManager, int, String, String)}
|
||||
* when no fragments are used / no FragmentManager is available.
|
||||
* @param context
|
||||
* @param serviceId
|
||||
* @param url
|
||||
* @param title
|
||||
*/
|
||||
public static void openChannelFragmentUsingIntent(final Context context,
|
||||
final int serviceId,
|
||||
final String url,
|
||||
@NonNull final String title) {
|
||||
final Intent intent = getOpenIntent(context, url, serviceId,
|
||||
StreamingService.LinkType.CHANNEL);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Constants.KEY_TITLE, title);
|
||||
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void openMainActivity(final Context context) {
|
||||
final Intent mIntent = new Intent(context, MainActivity.class);
|
||||
mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
@ -10,6 +10,9 @@
|
||||
<item
|
||||
android:id="@+id/menu_item_append_playlist"
|
||||
android:title="@string/add_to_playlist" />
|
||||
<item
|
||||
android:id="@+id/menu_item_channel_details"
|
||||
android:title="@string/show_channel_details" />
|
||||
<item
|
||||
android:id="@+id/menu_item_share"
|
||||
android:title="@string/share" />
|
||||
|
Loading…
Reference in New Issue
Block a user