From b9aaafdb30324b7460e73170eedfbd20ebf4a167 Mon Sep 17 00:00:00 2001 From: TiA4f8R <74829229+TiA4f8R@users.noreply.github.com> Date: Thu, 13 May 2021 12:49:34 +0200 Subject: [PATCH 1/2] Add Open in browser option to long-press menu Add Open in browser option to long-press menu when long pressing a stream and a subscription --- .../org/schabi/newpipe/fragments/list/BaseListFragment.java | 2 +- .../newpipe/local/subscription/SubscriptionFragment.kt | 6 ++++-- .../java/org/schabi/newpipe/util/StreamDialogEntry.java | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java index 38fdbccab..728558685 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java @@ -370,10 +370,10 @@ public abstract class BaseListFragment extends BaseStateFragment StreamDialogEntry.share )); } + entries.add(StreamDialogEntry.open_in_browser); if (KoreUtil.shouldShowPlayWithKodi(context, item.getServiceId())) { entries.add(StreamDialogEntry.play_with_kodi); } - if (!isNullOrEmpty(item.getUploaderUrl())) { entries.add(StreamDialogEntry.show_channel_details); } diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index d3f80e214..13643af15 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -294,12 +294,14 @@ class SubscriptionFragment : BaseStateFragment() { } private fun showLongTapDialog(selectedItem: ChannelInfoItem) { - val commands = arrayOf(getString(R.string.share), getString(R.string.unsubscribe)) + val commands = arrayOf(getString(R.string.share), getString(R.string.open_in_browser), + getString(R.string.unsubscribe)) val actions = DialogInterface.OnClickListener { _, i -> when (i) { 0 -> ShareUtils.shareText(requireContext(), selectedItem.name, selectedItem.url) - 1 -> deleteChannel(selectedItem) + 1 -> ShareUtils.openUrlInBrowser(requireContext(), selectedItem.url) + 2 -> deleteChannel(selectedItem) } } diff --git a/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java b/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java index 2d59febc2..b7629fac3 100644 --- a/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java +++ b/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java @@ -87,7 +87,10 @@ public enum StreamDialogEntry { }), share(R.string.share, (fragment, item) -> - ShareUtils.shareText(fragment.getContext(), item.getName(), item.getUrl())); + ShareUtils.shareText(fragment.getContext(), item.getName(), item.getUrl())), + + open_in_browser(R.string.open_in_browser, (fragment, item) -> + ShareUtils.openUrlInBrowser(fragment.getContext(), item.getUrl())); /////////////// From b4d60154646eb06df1d1219a46685ee5ae1105d3 Mon Sep 17 00:00:00 2001 From: TiA4f8R <74829229+TiA4f8R@users.noreply.github.com> Date: Thu, 13 May 2021 17:45:51 +0200 Subject: [PATCH 2/2] Add the Open in browser option when long-pressing a stream for local and online playlists and for history --- .../schabi/newpipe/fragments/list/playlist/PlaylistFragment.java | 1 + .../schabi/newpipe/local/history/StatisticsPlaylistFragment.java | 1 + .../org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java | 1 + 3 files changed, 3 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java index 1ede515ba..0e36d18c7 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java @@ -161,6 +161,7 @@ public class PlaylistFragment extends BaseListInfoFragment { StreamDialogEntry.share )); } + entries.add(StreamDialogEntry.open_in_browser); if (KoreUtil.shouldShowPlayWithKodi(context, item.getServiceId())) { entries.add(StreamDialogEntry.play_with_kodi); } diff --git a/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java index a6877a9a0..10aa8aa68 100644 --- a/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java @@ -358,6 +358,7 @@ public class StatisticsPlaylistFragment StreamDialogEntry.share )); } + entries.add(StreamDialogEntry.open_in_browser); if (KoreUtil.shouldShowPlayWithKodi(context, infoItem.getServiceId())) { entries.add(StreamDialogEntry.play_with_kodi); } diff --git a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java index 4c2f80edc..f79282641 100644 --- a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java @@ -769,6 +769,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment