Search in sources :

Example 71 with DialogInterface

use of android.content.DialogInterface in project AntennaPod by AntennaPod.

the class QueueFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (!super.onOptionsItemSelected(item)) {
        switch(item.getItemId()) {
            case R.id.queue_lock:
                boolean newLockState = !UserPreferences.isQueueLocked();
                UserPreferences.setQueueLocked(newLockState);
                getActivity().supportInvalidateOptionsMenu();
                recyclerAdapter.setLocked(newLockState);
                if (newLockState) {
                    Snackbar.make(getActivity().findViewById(R.id.content), R.string.queue_locked, Snackbar.LENGTH_SHORT).show();
                } else {
                    Snackbar.make(getActivity().findViewById(R.id.content), R.string.queue_unlocked, Snackbar.LENGTH_SHORT).show();
                }
                return true;
            case R.id.refresh_item:
                List<Feed> feeds = ((MainActivity) getActivity()).getFeeds();
                if (feeds != null) {
                    DBTasks.refreshAllFeeds(getActivity(), feeds);
                }
                return true;
            case R.id.clear_queue:
                // make sure the user really wants to clear the queue
                ConfirmationDialog conDialog = new ConfirmationDialog(getActivity(), R.string.clear_queue_label, R.string.clear_queue_confirmation_msg) {

                    @Override
                    public void onConfirmButtonPressed(DialogInterface dialog) {
                        dialog.dismiss();
                        DBWriter.clearQueue();
                    }
                };
                conDialog.createNewDialog().show();
                return true;
            case R.id.queue_sort_episode_title_asc:
                QueueSorter.sort(getActivity(), QueueSorter.Rule.EPISODE_TITLE_ASC, true);
                return true;
            case R.id.queue_sort_episode_title_desc:
                QueueSorter.sort(getActivity(), QueueSorter.Rule.EPISODE_TITLE_DESC, true);
                return true;
            case R.id.queue_sort_date_asc:
                QueueSorter.sort(getActivity(), QueueSorter.Rule.DATE_ASC, true);
                return true;
            case R.id.queue_sort_date_desc:
                QueueSorter.sort(getActivity(), QueueSorter.Rule.DATE_DESC, true);
                return true;
            case R.id.queue_sort_duration_asc:
                QueueSorter.sort(getActivity(), QueueSorter.Rule.DURATION_ASC, true);
                return true;
            case R.id.queue_sort_duration_desc:
                QueueSorter.sort(getActivity(), QueueSorter.Rule.DURATION_DESC, true);
                return true;
            case R.id.queue_sort_feed_title_asc:
                QueueSorter.sort(getActivity(), QueueSorter.Rule.FEED_TITLE_ASC, true);
                return true;
            case R.id.queue_sort_feed_title_desc:
                QueueSorter.sort(getActivity(), QueueSorter.Rule.FEED_TITLE_DESC, true);
                return true;
            default:
                return false;
        }
    } else {
        return true;
    }
}
Also used : DialogInterface(android.content.DialogInterface) MainActivity(de.danoeh.antennapod.activity.MainActivity) Feed(de.danoeh.antennapod.core.feed.Feed) ConfirmationDialog(de.danoeh.antennapod.core.dialog.ConfirmationDialog)

Example 72 with DialogInterface

use of android.content.DialogInterface in project android-bootstrap by AndroidBootstrap.

the class BootstrapAuthenticatorActivity method onCreateDialog.

@Override
protected Dialog onCreateDialog(int id) {
    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setMessage(getText(string.message_signing_in));
    dialog.setIndeterminate(true);
    dialog.setCancelable(true);
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

        public void onCancel(final DialogInterface dialog) {
            if (authenticationTask != null) {
                authenticationTask.cancel(true);
            }
        }
    });
    return dialog;
}
Also used : DialogInterface(android.content.DialogInterface) ProgressDialog(android.app.ProgressDialog)

Example 73 with DialogInterface

use of android.content.DialogInterface in project AntennaPod by AntennaPod.

the class FlattrUtils method showNoTokenDialogOrRedirect.

/**
     * Opens a dialog that ask the user to either connect the app with flattr or to be redirected to
     * the thing's website.
     * If no API credentials are available, the user will immediately be redirected to the thing's website.
     */
public static void showNoTokenDialogOrRedirect(final Context context, final String url) {
    if (hasAPICredentials()) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setTitle(R.string.no_flattr_token_title);
        builder.setMessage(R.string.no_flattr_token_msg);
        builder.setPositiveButton(R.string.authenticate_now_label, new OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                context.startActivity(ClientConfig.flattrCallbacks.getFlattrAuthenticationActivityIntent(context));
            }
        });
        builder.setNegativeButton(R.string.visit_website_label, new OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                Uri uri = Uri.parse(url);
                context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
            }
        });
        builder.create().show();
    } else {
        Uri uri = Uri.parse(url);
        context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener) Intent(android.content.Intent) Uri(android.net.Uri)

Example 74 with DialogInterface

use of android.content.DialogInterface in project AntennaPod by AntennaPod.

the class FlattrUtils method showRevokeDialog.

// ------------------------------------------------ DIALOGS
public static void showRevokeDialog(final Context context) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(R.string.access_revoked_title);
    builder.setMessage(R.string.access_revoked_info);
    builder.setNeutralButton(android.R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    builder.create().show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 75 with DialogInterface

use of android.content.DialogInterface in project AntennaPod by AntennaPod.

the class MediaplayerInfoActivity method onContextItemSelected.

@Override
public boolean onContextItemSelected(MenuItem item) {
    final int position = mPosition;
    // reset
    mPosition = -1;
    if (position < 0) {
        return false;
    }
    Feed feed = navDrawerData.feeds.get(position - navAdapter.getSubscriptionOffset());
    switch(item.getItemId()) {
        case R.id.mark_all_seen_item:
            DBWriter.markFeedSeen(feed.getId());
            return true;
        case R.id.mark_all_read_item:
            DBWriter.markFeedRead(feed.getId());
            return true;
        case R.id.rename_item:
            new RenameFeedDialog(this, feed).show();
            return true;
        case R.id.remove_item:
            final FeedRemover remover = new FeedRemover(this, feed) {

                @Override
                protected void onPostExecute(Void result) {
                    super.onPostExecute(result);
                }
            };
            ConfirmationDialog conDialog = new ConfirmationDialog(this, R.string.remove_feed_label, R.string.feed_delete_confirmation_msg) {

                @Override
                public void onConfirmButtonPressed(DialogInterface dialog) {
                    dialog.dismiss();
                    if (controller != null) {
                        Playable playable = controller.getMedia();
                        if (playable != null && playable instanceof FeedMedia) {
                            FeedMedia media = (FeedMedia) playable;
                            if (media.getItem().getFeed().getId() == feed.getId()) {
                                Log.d(TAG, "Currently playing episode is about to be deleted, skipping");
                                remover.skipOnCompletion = true;
                                if (controller.getStatus() == PlayerStatus.PLAYING) {
                                    sendBroadcast(new Intent(PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE));
                                }
                            }
                        }
                    }
                    remover.executeAsync();
                }
            };
            conDialog.createNewDialog().show();
            return true;
        default:
            return super.onContextItemSelected(item);
    }
}
Also used : FeedRemover(de.danoeh.antennapod.core.asynctask.FeedRemover) DialogInterface(android.content.DialogInterface) Playable(de.danoeh.antennapod.core.util.playback.Playable) FeedMedia(de.danoeh.antennapod.core.feed.FeedMedia) RenameFeedDialog(de.danoeh.antennapod.dialog.RenameFeedDialog) Intent(android.content.Intent) Feed(de.danoeh.antennapod.core.feed.Feed) ConfirmationDialog(de.danoeh.antennapod.core.dialog.ConfirmationDialog)

Aggregations

DialogInterface (android.content.DialogInterface)2727 AlertDialog (android.app.AlertDialog)1227 View (android.view.View)877 Intent (android.content.Intent)708 TextView (android.widget.TextView)653 AlertDialog (android.support.v7.app.AlertDialog)644 EditText (android.widget.EditText)426 ImageView (android.widget.ImageView)308 OnClickListener (android.content.DialogInterface.OnClickListener)285 LayoutInflater (android.view.LayoutInflater)242 SuppressLint (android.annotation.SuppressLint)225 AdapterView (android.widget.AdapterView)220 ListView (android.widget.ListView)220 ArrayList (java.util.ArrayList)213 Dialog (android.app.Dialog)179 Context (android.content.Context)179 File (java.io.File)160 OnClickListener (android.view.View.OnClickListener)157 Bundle (android.os.Bundle)146 Activity (android.app.Activity)143