Search in sources :

Example 6 with InfoItemDialog

use of org.schabi.newpipe.info_list.InfoItemDialog in project NewPipe by TeamNewPipe.

the class BaseListFragment method showStreamDialog.

protected void showStreamDialog(final StreamInfoItem item) {
    final Context context = getContext();
    final Activity activity = getActivity();
    if (context == null || context.getResources() == null || getActivity() == null)
        return;
    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) };
    final DialogInterface.OnClickListener actions = (dialogInterface, i) -> {
        switch(i) {
            case 0:
                NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item));
                break;
            case 1:
                NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(item));
                break;
            case 2:
                if (getFragmentManager() != null) {
                    PlaylistAppendDialog.fromStreamInfoItems(Collections.singletonList(item)).show(getFragmentManager(), TAG);
                }
                break;
            default:
                break;
        }
    };
    new InfoItemDialog(getActivity(), item, commands, actions).show();
}
Also used : Context(android.content.Context) InfoListAdapter(org.schabi.newpipe.info_list.InfoListAdapter) Context(android.content.Context) ChannelInfoItem(org.schabi.newpipe.extractor.channel.ChannelInfoItem) Bundle(android.os.Bundle) NavigationHelper(org.schabi.newpipe.util.NavigationHelper) NonNull(android.support.annotation.NonNull) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue) InfoItem(org.schabi.newpipe.extractor.InfoItem) MenuInflater(android.view.MenuInflater) Menu(android.view.Menu) View(android.view.View) OnClickGesture(org.schabi.newpipe.util.OnClickGesture) AnimationUtils.animateView(org.schabi.newpipe.util.AnimationUtils.animateView) ActionBar(android.support.v7.app.ActionBar) R(org.schabi.newpipe.R) Log(android.util.Log) DialogInterface(android.content.DialogInterface) BaseStateFragment(org.schabi.newpipe.fragments.BaseStateFragment) StateSaver(org.schabi.newpipe.util.StateSaver) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem) RecyclerView(android.support.v7.widget.RecyclerView) List(java.util.List) PlaylistInfoItem(org.schabi.newpipe.extractor.playlist.PlaylistInfoItem) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) Queue(java.util.Queue) Activity(android.app.Activity) PlaylistAppendDialog(org.schabi.newpipe.fragments.local.dialog.PlaylistAppendDialog) Collections(java.util.Collections) OnScrollBelowItemsListener(org.schabi.newpipe.fragments.OnScrollBelowItemsListener) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue)

Aggregations

Context (android.content.Context)6 DialogInterface (android.content.DialogInterface)6 InfoItemDialog (org.schabi.newpipe.info_list.InfoItemDialog)6 SinglePlayQueue (org.schabi.newpipe.playlist.SinglePlayQueue)6 Activity (android.app.Activity)5 Bundle (android.os.Bundle)4 NonNull (android.support.annotation.NonNull)4 View (android.view.View)4 List (java.util.List)4 R (org.schabi.newpipe.R)4 StreamInfoItem (org.schabi.newpipe.extractor.stream.StreamInfoItem)4 NavigationHelper (org.schabi.newpipe.util.NavigationHelper)4 Nullable (android.support.annotation.Nullable)3 Log (android.util.Log)3 LayoutInflater (android.view.LayoutInflater)3 ViewGroup (android.view.ViewGroup)3 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)3 ArrayList (java.util.ArrayList)3 Collections (java.util.Collections)3 Subscriber (org.reactivestreams.Subscriber)3