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:
parent
ef070a4e0e
commit
bb5028364b
3 changed files with 20 additions and 20 deletions
|
@ -261,7 +261,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> implem
|
||||||
protected void showStreamDialog(final StreamInfoItem item) {
|
protected void showStreamDialog(final StreamInfoItem item) {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
final Activity activity = getActivity();
|
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[]{
|
final String[] commands = new String[]{
|
||||||
context.getResources().getString(R.string.enqueue_on_background),
|
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) -> {
|
final DialogInterface.OnClickListener actions = (dialogInterface, i) -> {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item));
|
NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item), false);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(item));
|
NavigationHelper.enqueueOnPopupPlayer(context, new SinglePlayQueue(item), false);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
NavigationHelper.playOnBackgroundPlayer(context, new SinglePlayQueue(item));
|
NavigationHelper.playOnBackgroundPlayer(context, new SinglePlayQueue(item), true);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
NavigationHelper.playOnPopupPlayer(activity, new SinglePlayQueue(item));
|
NavigationHelper.playOnPopupPlayer(context, new SinglePlayQueue(item), true);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (getFragmentManager() != null) {
|
if (getFragmentManager() != null) {
|
||||||
|
@ -293,14 +293,14 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> implem
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
ShareUtils.shareUrl(this.getContext(), item.getName(), item.getUrl());
|
ShareUtils.shareUrl(context, item.getName(), item.getUrl());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new InfoItemDialog(getActivity(), item, commands, actions).show();
|
new InfoItemDialog(activity, item, commands, actions).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -361,7 +361,7 @@ public class StatisticsPlaylistFragment
|
||||||
private void showStreamDialog(final StreamStatisticsEntry item) {
|
private void showStreamDialog(final StreamStatisticsEntry item) {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
final Activity activity = getActivity();
|
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 StreamInfoItem infoItem = item.toStreamInfoItem();
|
||||||
|
|
||||||
final String[] commands = new String[]{
|
final String[] commands = new String[]{
|
||||||
|
@ -381,13 +381,13 @@ public class StatisticsPlaylistFragment
|
||||||
NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem), false);
|
NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem), false);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(infoItem), false);
|
NavigationHelper.enqueueOnPopupPlayer(context, new SinglePlayQueue(infoItem), false);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index));
|
NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index), true);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(index));
|
NavigationHelper.playOnPopupPlayer(context, getPlayQueue(index), true);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
deleteEntry(index);
|
deleteEntry(index);
|
||||||
|
@ -399,14 +399,14 @@ public class StatisticsPlaylistFragment
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
ShareUtils.shareUrl(this.getContext(), infoItem.getName(), infoItem.getUrl());
|
ShareUtils.shareUrl(context, infoItem.getName(), infoItem.getUrl());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new InfoItemDialog(getActivity(), infoItem, commands, actions).show();
|
new InfoItemDialog(activity, infoItem, commands, actions).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteEntry(final int index) {
|
private void deleteEntry(final int index) {
|
||||||
|
|
|
@ -515,7 +515,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
||||||
protected void showStreamItemDialog(final PlaylistStreamEntry item) {
|
protected void showStreamItemDialog(final PlaylistStreamEntry item) {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
final Activity activity = getActivity();
|
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 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);
|
final int index = Math.max(itemListAdapter.getItemsList().indexOf(item), 0);
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem));
|
NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem), false);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(infoItem));
|
NavigationHelper.enqueueOnPopupPlayer(context, new SinglePlayQueue(infoItem), false);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index));
|
NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index), true);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(index));
|
NavigationHelper.playOnPopupPlayer(context, getPlayQueue(index), true);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
changeThumbnailUrl(item.thumbnailUrl);
|
changeThumbnailUrl(item.thumbnailUrl);
|
||||||
|
@ -558,14 +558,14 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
ShareUtils.shareUrl(this.getContext(), infoItem.getName(), infoItem.getUrl());
|
ShareUtils.shareUrl(context, infoItem.getName(), infoItem.getUrl());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new InfoItemDialog(getActivity(), infoItem, commands, actions).show();
|
new InfoItemDialog(activity, infoItem, commands, actions).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setInitialData(long playlistId, String name) {
|
private void setInitialData(long playlistId, String name) {
|
||||||
|
|
Loading…
Reference in a new issue