From bb5028364bcc4ffffda561b342f5ceb3c2258466 Mon Sep 17 00:00:00 2001 From: Stypox Date: Mon, 22 Jul 2019 10:28:53 +0200 Subject: [PATCH] Complete merge after #2288: add resumePlayback to player calls. `resumePlayback`'s value is `false` when the video is enqueued, `true` otherwise. Also make the use of getContext() and getActivity() more consistant. --- .../newpipe/fragments/list/BaseListFragment.java | 14 +++++++------- .../local/history/StatisticsPlaylistFragment.java | 12 ++++++------ .../local/playlist/LocalPlaylistFragment.java | 14 +++++++------- 3 files changed, 20 insertions(+), 20 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 4e8fa49e6..6a304dc1f 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 @@ -261,7 +261,7 @@ public abstract class BaseListFragment extends BaseStateFragment implem protected void showStreamDialog(final StreamInfoItem item) { final Context context = getContext(); final Activity activity = getActivity(); - if (context == null || context.getResources() == null || getActivity() == null) return; + if (context == null || context.getResources() == null || activity == null) return; final String[] commands = new String[]{ context.getResources().getString(R.string.enqueue_on_background), @@ -275,16 +275,16 @@ public abstract class BaseListFragment extends BaseStateFragment implem final DialogInterface.OnClickListener actions = (dialogInterface, i) -> { switch (i) { case 0: - NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item)); + NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item), false); break; case 1: - NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(item)); + NavigationHelper.enqueueOnPopupPlayer(context, new SinglePlayQueue(item), false); break; case 2: - NavigationHelper.playOnBackgroundPlayer(context, new SinglePlayQueue(item)); + NavigationHelper.playOnBackgroundPlayer(context, new SinglePlayQueue(item), true); break; case 3: - NavigationHelper.playOnPopupPlayer(activity, new SinglePlayQueue(item)); + NavigationHelper.playOnPopupPlayer(context, new SinglePlayQueue(item), true); break; case 4: if (getFragmentManager() != null) { @@ -293,14 +293,14 @@ public abstract class BaseListFragment extends BaseStateFragment implem } break; case 5: - ShareUtils.shareUrl(this.getContext(), item.getName(), item.getUrl()); + ShareUtils.shareUrl(context, item.getName(), item.getUrl()); break; default: break; } }; - new InfoItemDialog(getActivity(), item, commands, actions).show(); + new InfoItemDialog(activity, item, commands, actions).show(); } /*////////////////////////////////////////////////////////////////////////// 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 9b655b376..9a815461d 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 @@ -361,7 +361,7 @@ public class StatisticsPlaylistFragment private void showStreamDialog(final StreamStatisticsEntry item) { final Context context = getContext(); final Activity activity = getActivity(); - if (context == null || context.getResources() == null || getActivity() == null) return; + if (context == null || context.getResources() == null || activity == null) return; final StreamInfoItem infoItem = item.toStreamInfoItem(); final String[] commands = new String[]{ @@ -381,13 +381,13 @@ public class StatisticsPlaylistFragment NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem), false); break; case 1: - NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(infoItem), false); + NavigationHelper.enqueueOnPopupPlayer(context, new SinglePlayQueue(infoItem), false); break; case 2: - NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index)); + NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index), true); break; case 3: - NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(index)); + NavigationHelper.playOnPopupPlayer(context, getPlayQueue(index), true); break; case 4: deleteEntry(index); @@ -399,14 +399,14 @@ public class StatisticsPlaylistFragment } break; case 6: - ShareUtils.shareUrl(this.getContext(), infoItem.getName(), infoItem.getUrl()); + ShareUtils.shareUrl(context, infoItem.getName(), infoItem.getUrl()); break; default: break; } }; - new InfoItemDialog(getActivity(), infoItem, commands, actions).show(); + new InfoItemDialog(activity, infoItem, commands, actions).show(); } private void deleteEntry(final int index) { 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 5aa506192..0de97033e 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 @@ -515,7 +515,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment