Search in sources :

Example 1 with InfoItemDialog

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

the class PlaylistFragment method showStreamDialog.

@Override
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.start_here_on_main), context.getResources().getString(R.string.start_here_on_background), context.getResources().getString(R.string.start_here_on_popup) };
    final DialogInterface.OnClickListener actions = (dialogInterface, i) -> {
        final int index = Math.max(infoListAdapter.getItemsList().indexOf(item), 0);
        switch(i) {
            case 0:
                NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item));
                break;
            case 1:
                NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(item));
                break;
            case 2:
                NavigationHelper.playOnMainPlayer(context, getPlayQueue(index));
                break;
            case 3:
                NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index));
                break;
            case 4:
                NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(index));
                break;
            default:
                break;
        }
    };
    new InfoItemDialog(getActivity(), item, commands, actions).show();
}
Also used : Context(android.content.Context) Context(android.content.Context) ImageDisplayConstants(org.schabi.newpipe.util.ImageDisplayConstants) Bundle(android.os.Bundle) ThemeHelper(org.schabi.newpipe.util.ThemeHelper) ImageView(android.widget.ImageView) PlaylistRemoteEntity(org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity) ListExtractor(org.schabi.newpipe.extractor.ListExtractor) NewPipe(org.schabi.newpipe.extractor.NewPipe) NavigationHelper(org.schabi.newpipe.util.NavigationHelper) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) NonNull(android.support.annotation.NonNull) Single(io.reactivex.Single) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) MenuItem(android.view.MenuItem) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue) ArrayList(java.util.ArrayList) StreamInfo(org.schabi.newpipe.extractor.stream.StreamInfo) InfoItem(org.schabi.newpipe.extractor.InfoItem) Disposables(io.reactivex.disposables.Disposables) MenuInflater(android.view.MenuInflater) ExtractorHelper(org.schabi.newpipe.util.ExtractorHelper) Menu(android.view.Menu) View(android.view.View) BaseListInfoFragment(org.schabi.newpipe.fragments.list.BaseListInfoFragment) AnimationUtils.animateView(org.schabi.newpipe.util.AnimationUtils.animateView) Subscriber(org.reactivestreams.Subscriber) R(org.schabi.newpipe.R) PlaylistInfo(org.schabi.newpipe.extractor.playlist.PlaylistInfo) Log(android.util.Log) ExtractionException(org.schabi.newpipe.extractor.exceptions.ExtractionException) DialogInterface(android.content.DialogInterface) RemotePlaylistManager(org.schabi.newpipe.fragments.local.RemotePlaylistManager) LayoutInflater(android.view.LayoutInflater) TextUtils(android.text.TextUtils) UserAction(org.schabi.newpipe.report.UserAction) NewPipeDatabase(org.schabi.newpipe.NewPipeDatabase) ViewGroup(android.view.ViewGroup) StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem) List(java.util.List) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) TextView(android.widget.TextView) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) Subscription(org.reactivestreams.Subscription) PlaylistPlayQueue(org.schabi.newpipe.playlist.PlaylistPlayQueue) PlayQueue(org.schabi.newpipe.playlist.PlayQueue) Nullable(android.support.annotation.Nullable) Activity(android.app.Activity) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue)

Example 2 with InfoItemDialog

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

the class LocalPlaylistFragment method showStreamDialog.

/*//////////////////////////////////////////////////////////////////////////
    // Utils
    //////////////////////////////////////////////////////////////////////////*/
protected void showStreamDialog(final PlaylistStreamEntry item) {
    final Context context = getContext();
    final Activity activity = getActivity();
    if (context == null || context.getResources() == null || getActivity() == null)
        return;
    final StreamInfoItem infoItem = item.toStreamInfoItem();
    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.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.set_as_playlist_thumbnail), context.getResources().getString(R.string.delete) };
    final DialogInterface.OnClickListener actions = (dialogInterface, i) -> {
        final int index = Math.max(itemListAdapter.getItemsList().indexOf(item), 0);
        switch(i) {
            case 0:
                NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem));
                break;
            case 1:
                NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(infoItem));
                break;
            case 2:
                NavigationHelper.playOnMainPlayer(context, getPlayQueue(index));
                break;
            case 3:
                NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index));
                break;
            case 4:
                NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(index));
                break;
            case 5:
                changeThumbnailUrl(item.thumbnailUrl);
                break;
            case 6:
                deleteItem(item);
                break;
            default:
                break;
        }
    };
    new InfoItemDialog(getActivity(), infoItem, commands, actions).show();
}
Also used : Context(android.content.Context) Context(android.content.Context) Bundle(android.os.Bundle) PlaylistStreamEntry(org.schabi.newpipe.database.playlist.PlaylistStreamEntry) NavigationHelper(org.schabi.newpipe.util.NavigationHelper) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) NonNull(android.support.annotation.NonNull) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue) ArrayList(java.util.ArrayList) Disposables(io.reactivex.disposables.Disposables) ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) Toast(android.widget.Toast) View(android.view.View) OnClickGesture(org.schabi.newpipe.util.OnClickGesture) State(icepick.State) AnimationUtils.animateView(org.schabi.newpipe.util.AnimationUtils.animateView) Subscriber(org.reactivestreams.Subscriber) R(org.schabi.newpipe.R) Log(android.util.Log) DialogInterface(android.content.DialogInterface) Parcelable(android.os.Parcelable) LayoutInflater(android.view.LayoutInflater) TextUtils(android.text.TextUtils) LocalItem(org.schabi.newpipe.database.LocalItem) UserAction(org.schabi.newpipe.report.UserAction) NewPipeDatabase(org.schabi.newpipe.NewPipeDatabase) ViewGroup(android.view.ViewGroup) LocalPlaylistManager(org.schabi.newpipe.fragments.local.LocalPlaylistManager) StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem) TimeUnit(java.util.concurrent.TimeUnit) RecyclerView(android.support.v7.widget.RecyclerView) List(java.util.List) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) AlertDialog(android.support.v7.app.AlertDialog) TextView(android.widget.TextView) PublishSubject(io.reactivex.subjects.PublishSubject) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) Subscription(org.reactivestreams.Subscription) PlayQueue(org.schabi.newpipe.playlist.PlayQueue) Nullable(android.support.annotation.Nullable) Activity(android.app.Activity) Localization(org.schabi.newpipe.util.Localization) Collections(java.util.Collections) EditText(android.widget.EditText) StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue)

Example 3 with InfoItemDialog

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

the class ChannelFragment method showStreamDialog.

@Override
protected void showStreamDialog(final StreamInfoItem item) {
    final Activity activity = getActivity();
    final Context context = getContext();
    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.start_here_on_main), context.getResources().getString(R.string.start_here_on_background), context.getResources().getString(R.string.start_here_on_popup) };
    final DialogInterface.OnClickListener actions = new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            final int index = Math.max(infoListAdapter.getItemsList().indexOf(item), 0);
            switch(i) {
                case 0:
                    NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item));
                    break;
                case 1:
                    NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(item));
                    break;
                case 2:
                    NavigationHelper.playOnMainPlayer(context, getPlayQueue(index));
                    break;
                case 3:
                    NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index));
                    break;
                case 4:
                    NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(index));
                    break;
                default:
                    break;
            }
        }
    };
    new InfoItemDialog(getActivity(), item, commands, actions).show();
}
Also used : Context(android.content.Context) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue)

Example 4 with InfoItemDialog

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

the class StatisticsPlaylistFragment method showStreamDialog.

/*//////////////////////////////////////////////////////////////////////////
    // Utils
    //////////////////////////////////////////////////////////////////////////*/
private void showStreamDialog(final StreamStatisticsEntry item) {
    final Context context = getContext();
    final Activity activity = getActivity();
    if (context == null || context.getResources() == null || getActivity() == null)
        return;
    final StreamInfoItem infoItem = item.toStreamInfoItem();
    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.start_here_on_main), context.getResources().getString(R.string.start_here_on_background), context.getResources().getString(R.string.start_here_on_popup) };
    final DialogInterface.OnClickListener actions = (dialogInterface, i) -> {
        final int index = Math.max(itemListAdapter.getItemsList().indexOf(item), 0);
        switch(i) {
            case 0:
                NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(infoItem));
                break;
            case 1:
                NavigationHelper.enqueueOnPopupPlayer(activity, new SinglePlayQueue(infoItem));
                break;
            case 2:
                NavigationHelper.playOnMainPlayer(context, getPlayQueue(index));
                break;
            case 3:
                NavigationHelper.playOnBackgroundPlayer(context, getPlayQueue(index));
                break;
            case 4:
                NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(index));
                break;
            default:
                break;
        }
    };
    new InfoItemDialog(getActivity(), infoItem, commands, actions).show();
}
Also used : Context(android.content.Context) Context(android.content.Context) StreamStatisticsEntry(org.schabi.newpipe.database.stream.StreamStatisticsEntry) Bundle(android.os.Bundle) NavigationHelper(org.schabi.newpipe.util.NavigationHelper) NonNull(android.support.annotation.NonNull) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue) ArrayList(java.util.ArrayList) HistoryRecordManager(org.schabi.newpipe.history.HistoryRecordManager) View(android.view.View) OnClickGesture(org.schabi.newpipe.util.OnClickGesture) State(icepick.State) Subscriber(org.reactivestreams.Subscriber) R(org.schabi.newpipe.R) DialogInterface(android.content.DialogInterface) Parcelable(android.os.Parcelable) LayoutInflater(android.view.LayoutInflater) LocalItem(org.schabi.newpipe.database.LocalItem) UserAction(org.schabi.newpipe.report.UserAction) ViewGroup(android.view.ViewGroup) StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem) List(java.util.List) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) Subscription(org.reactivestreams.Subscription) PlayQueue(org.schabi.newpipe.playlist.PlayQueue) Nullable(android.support.annotation.Nullable) Activity(android.app.Activity) Collections(java.util.Collections) StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue)

Example 5 with InfoItemDialog

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

the class VideoDetailFragment method showStreamDialog.

private void showStreamDialog(final StreamInfoItem item) {
    final Context context = getContext();
    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) };
    final DialogInterface.OnClickListener actions = (DialogInterface dialogInterface, int i) -> {
        switch(i) {
            case 0:
                NavigationHelper.enqueueOnBackgroundPlayer(context, new SinglePlayQueue(item));
                break;
            case 1:
                NavigationHelper.enqueueOnPopupPlayer(getActivity(), new SinglePlayQueue(item));
                break;
            default:
                break;
        }
    };
    new InfoItemDialog(getActivity(), item, commands, actions).show();
}
Also used : Context(android.content.Context) InfoItemDialog(org.schabi.newpipe.info_list.InfoItemDialog) DialogInterface(android.content.DialogInterface) 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