From baa63249d1d4e8cca96eadaa0c86dd962ec275a8 Mon Sep 17 00:00:00 2001 From: Somethingweirdhere Date: Tue, 5 Jun 2018 19:48:31 +0200 Subject: [PATCH] Added share option to long tap menu --- .../newpipe/fragments/detail/VideoDetailFragment.java | 6 +++++- .../org/schabi/newpipe/fragments/list/BaseListFragment.java | 6 +++++- .../newpipe/fragments/list/channel/ChannelFragment.java | 6 +++++- .../newpipe/fragments/list/playlist/PlaylistFragment.java | 4 ++++ .../newpipe/local/history/StatisticsPlaylistFragment.java | 4 ++++ .../newpipe/local/playlist/LocalPlaylistFragment.java | 6 +++++- 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 68c0a11ff..640c1d087 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -540,7 +540,8 @@ public class VideoDetailFragment final String[] commands = new String[]{ context.getResources().getString(R.string.enqueue_on_background), context.getResources().getString(R.string.enqueue_on_popup), - context.getResources().getString(R.string.append_playlist) + context.getResources().getString(R.string.append_playlist), + context.getResources().getString(R.string.share) }; final DialogInterface.OnClickListener actions = (DialogInterface dialogInterface, int i) -> { @@ -557,6 +558,9 @@ public class VideoDetailFragment .show(getFragmentManager(), TAG); } break; + case 3: + shareUrl(item.getName(), item.getUrl()); + break; default: break; } 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 14ec50775..c4b341aae 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 @@ -196,7 +196,8 @@ public abstract class BaseListFragment extends BaseStateFragment implem final String[] commands = new String[]{ context.getResources().getString(R.string.enqueue_on_background), context.getResources().getString(R.string.enqueue_on_popup), - context.getResources().getString(R.string.append_playlist) + context.getResources().getString(R.string.append_playlist), + context.getResources().getString(R.string.share) }; final DialogInterface.OnClickListener actions = (dialogInterface, i) -> { @@ -213,6 +214,9 @@ public abstract class BaseListFragment extends BaseStateFragment implem .show(getFragmentManager(), TAG); } break; + case 3: + shareUrl(item.getName(), item.getUrl()); + break; default: break; } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java index dc8d764f3..b56692877 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java @@ -161,7 +161,8 @@ public class ChannelFragment extends BaseListInfoFragment { context.getResources().getString(R.string.start_here_on_main), context.getResources().getString(R.string.start_here_on_background), context.getResources().getString(R.string.start_here_on_popup), - context.getResources().getString(R.string.append_playlist) + context.getResources().getString(R.string.append_playlist), + context.getResources().getString(R.string.share) }; final DialogInterface.OnClickListener actions = new DialogInterface.OnClickListener() { @@ -190,6 +191,9 @@ public class ChannelFragment extends BaseListInfoFragment { .show(getFragmentManager(), TAG); } break; + case 6: + shareUrl(item.getName(), item.getUrl()); + break; default: break; } 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 0498c95c5..bba7a470e 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 @@ -142,6 +142,7 @@ public class PlaylistFragment extends BaseListInfoFragment { context.getResources().getString(R.string.start_here_on_main), context.getResources().getString(R.string.start_here_on_background), context.getResources().getString(R.string.start_here_on_popup), + context.getResources().getString(R.string.share) }; final DialogInterface.OnClickListener actions = (dialogInterface, i) -> { @@ -162,6 +163,9 @@ public class PlaylistFragment extends BaseListInfoFragment { case 4: NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(index)); break; + case 5: + shareUrl(item.getName(), item.getUrl()); + break; default: break; } 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 eac1873a4..c2c813a4d 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 @@ -298,6 +298,7 @@ public class StatisticsPlaylistFragment context.getResources().getString(R.string.start_here_on_background), context.getResources().getString(R.string.start_here_on_popup), context.getResources().getString(R.string.delete), + context.getResources().getString(R.string.share) }; final DialogInterface.OnClickListener actions = (dialogInterface, i) -> { @@ -321,6 +322,9 @@ public class StatisticsPlaylistFragment case 5: deleteEntry(index); break; + case 6: + shareUrl(item.toStreamInfoItem().getName(), item.toStreamInfoItem().getUrl()); + break; default: break; } 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 e51fa50a4..35a1530c9 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 @@ -520,7 +520,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment { @@ -549,6 +550,9 @@ public class LocalPlaylistFragment extends BaseLocalListFragment