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.
This commit is contained in:
Stypox 2019-07-22 10:28:53 +02:00
parent ef070a4e0e
commit bb5028364b
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
3 changed files with 20 additions and 20 deletions

View file

@ -261,7 +261,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> 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<I, N> extends BaseStateFragment<I> 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<I, N> extends BaseStateFragment<I> 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();
}
/*//////////////////////////////////////////////////////////////////////////

View file

@ -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) {

View file

@ -515,7 +515,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
protected void showStreamItemDialog(final PlaylistStreamEntry 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();
@ -534,16 +534,16 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
final int index = Math.max(itemListAdapter.getItemsList().indexOf(item), 0);
switch (i) {
case 0:
NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem));
NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem), false);
break;
case 1:
NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(infoItem));
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:
changeThumbnailUrl(item.thumbnailUrl);
@ -558,14 +558,14 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
}
break;
case 7:
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 setInitialData(long playlistId, String name) {