mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 02:53:09 +01: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;
|
import java.util.Collections;
|
||||||
|
|
||||||
public final class QueueItemMenuUtil {
|
public final class QueueItemMenuUtil {
|
||||||
|
private QueueItemMenuUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void openPopupMenu(final PlayQueue playQueue,
|
public static void openPopupMenu(final PlayQueue playQueue,
|
||||||
final PlayQueueItem item,
|
final PlayQueueItem item,
|
||||||
final View view,
|
final View view,
|
||||||
@ -57,6 +60,13 @@ public final class QueueItemMenuUtil {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
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:
|
case R.id.menu_item_share:
|
||||||
shareText(context, item.getTitle(), item.getUrl(),
|
shareText(context, item.getTitle(), item.getUrl(),
|
||||||
item.getThumbnailUrl());
|
item.getThumbnailUrl());
|
||||||
@ -67,6 +77,4 @@ public final class QueueItemMenuUtil {
|
|||||||
|
|
||||||
popupMenu.show();
|
popupMenu.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueueItemMenuUtil() { }
|
|
||||||
}
|
}
|
||||||
|
@ -495,6 +495,27 @@ public final class NavigationHelper {
|
|||||||
context.startActivity(intent);
|
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) {
|
public static void openMainActivity(final Context context) {
|
||||||
final Intent mIntent = new Intent(context, MainActivity.class);
|
final Intent mIntent = new Intent(context, MainActivity.class);
|
||||||
mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/menu_item_append_playlist"
|
android:id="@+id/menu_item_append_playlist"
|
||||||
android:title="@string/add_to_playlist" />
|
android:title="@string/add_to_playlist" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_item_channel_details"
|
||||||
|
android:title="@string/show_channel_details" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_item_share"
|
android:id="@+id/menu_item_share"
|
||||||
android:title="@string/share" />
|
android:title="@string/share" />
|
||||||
|
Loading…
Reference in New Issue
Block a user