Search in sources :

Example 56 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project JamsMusicPlayer by psaravan.

the class WelcomeActivity method promptUserSetUpGooglePlayMusic.

/**
	 * Ask the user to set up GMusic.
	 */
private void promptUserSetUpGooglePlayMusic() {
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    AlertDialog dialog;
    builder.setTitle(R.string.tip);
    builder.setMessage(R.string.prompt_user_set_up_google_play_music);
    builder.setPositiveButton(R.string.let_me_check, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = getPackageManager().getLaunchIntentForPackage("com.google.android.music");
            startActivity(intent);
            dialog.dismiss();
        }
    });
    builder.setNeutralButton(R.string.sync_manually, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    builder.setNegativeButton(R.string.set_up_already, new OnClickListener() {

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

Example 57 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project JamsMusicPlayer by psaravan.

the class SmallWidgetConfigActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    setTheme(android.R.style.Theme_Holo_Dialog);
    super.onCreate(savedInstanceState);
    setResult(RESULT_CANCELED, new Intent());
    sharedPreferences = this.getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE);
    //Retrieve the id of the widget that called this activity.
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
    }
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.select_widget_color);
    builder.setCancelable(false);
    builder.setSingleChoiceItems(R.array.widget_color_options, -1, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == 0) {
                //Light theme.
                sharedPreferences.edit().putString("" + mAppWidgetId, "LIGHT").commit();
            } else if (which == 1) {
                //Dark theme.
                sharedPreferences.edit().putString("" + mAppWidgetId, "DARK").commit();
            }
            updateWidgetConfig();
        }
    });
    builder.create().show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Bundle(android.os.Bundle) OnClickListener(android.content.DialogInterface.OnClickListener) Intent(android.content.Intent)

Example 58 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project android by nextcloud.

the class StorageMigration method createMigrationProgressDialog.

private ProgressDialog createMigrationProgressDialog() {
    ProgressDialog progressDialog = new ProgressDialog(mContext);
    progressDialog.setCancelable(false);
    progressDialog.setTitle(R.string.file_migration_dialog_title);
    progressDialog.setMessage(mContext.getString(R.string.file_migration_preparing));
    progressDialog.setButton(ProgressDialog.BUTTON_POSITIVE, mContext.getString(R.string.drawer_close), new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            dialogInterface.dismiss();
        }
    });
    return progressDialog;
}
Also used : DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener) ProgressDialog(android.app.ProgressDialog)

Example 59 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project android by nextcloud.

the class StorageMigration method askToOverride.

private void askToOverride() {
    new AlertDialog.Builder(mContext).setMessage(R.string.file_migration_directory_already_exists).setCancelable(true).setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            if (mListener != null) {
                mListener.onCancelMigration();
            }
        }
    }).setNegativeButton(R.string.common_cancel, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            if (mListener != null) {
                mListener.onCancelMigration();
            }
        }
    }).setNeutralButton(R.string.file_migration_use_data_folder, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            ProgressDialog progressDialog = createMigrationProgressDialog();
            progressDialog.show();
            new StoragePathSwitchTask(mContext, mSourceStoragePath, mTargetStoragePath, progressDialog, mListener).execute();
            progressDialog.getButton(ProgressDialog.BUTTON_POSITIVE).setVisibility(View.GONE);
        }
    }).setPositiveButton(R.string.file_migration_override_data_folder, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            ProgressDialog progressDialog = createMigrationProgressDialog();
            progressDialog.show();
            new FileMigrationTask(mContext, mSourceStoragePath, mTargetStoragePath, progressDialog, mListener).execute();
            progressDialog.getButton(ProgressDialog.BUTTON_POSITIVE).setVisibility(View.GONE);
        }
    }).create().show();
}
Also used : DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener) ProgressDialog(android.app.ProgressDialog)

Example 60 with OnClickListener

use of android.content.DialogInterface.OnClickListener in project AndroidChromium by JackyAndroid.

the class DataUseTabUIManager method startDataUseDialog.

/**
 * Shows a dialog with the option to cancel the navigation or continue. Also allows the user to
 * opt out of seeing this dialog again.
 *
 * @param activity Current activity.
 * @param tab The tab loading the url.
 * @param url URL that is pending.
 * @param pageTransitionType The type of transition. see
 *            {@link org.chromium.content.browser.PageTransition} for valid values.
 * @param referrerUrl URL for the referrer.
 */
private static void startDataUseDialog(final Activity activity, final Tab tab, final String url, final int pageTransitionType, final String referrerUrl) {
    View dataUseDialogView = View.inflate(activity, R.layout.data_use_dialog, null);
    final TextView textView = (TextView) dataUseDialogView.findViewById(R.id.data_use_message);
    textView.setText(getDataUseUIString(DataUseUIMessage.DATA_USE_TRACKING_ENDED_MESSAGE));
    final CheckBox checkBox = (CheckBox) dataUseDialogView.findViewById(R.id.data_use_checkbox);
    checkBox.setText(getDataUseUIString(DataUseUIMessage.DATA_USE_TRACKING_ENDED_CHECKBOX_MESSAGE));
    View learnMore = dataUseDialogView.findViewById(R.id.learn_more);
    learnMore.setOnClickListener(new android.view.View.OnClickListener() {

        @Override
        public void onClick(View v) {
            EmbedContentViewActivity.show(activity, getDataUseUIString(DataUseUIMessage.DATA_USE_LEARN_MORE_TITLE), getDataUseUIString(DataUseUIMessage.DATA_USE_LEARN_MORE_LINK_URL));
            recordDataUseUIAction(DataUsageUIAction.DIALOG_LEARN_MORE_CLICKED);
        }
    });
    new AlertDialog.Builder(activity, R.style.AlertDialogTheme).setTitle(getDataUseUIString(DataUseUIMessage.DATA_USE_TRACKING_ENDED_TITLE)).setView(dataUseDialogView).setPositiveButton(getDataUseUIString(DataUseUIMessage.DATA_USE_TRACKING_ENDED_CONTINUE), new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            setOptedOutOfDataUseDialog(activity, checkBox.isChecked());
            LoadUrlParams loadUrlParams = new LoadUrlParams(url, pageTransitionType);
            if (!TextUtils.isEmpty(referrerUrl)) {
                Referrer referrer = new Referrer(referrerUrl, Referrer.REFERRER_POLICY_ALWAYS);
                loadUrlParams.setReferrer(referrer);
            }
            tab.loadUrl(loadUrlParams);
            recordDataUseUIAction(DataUsageUIAction.DIALOG_CONTINUE_CLICKED);
            userClickedContinueOnDialogBox(tab);
        }
    }).setNegativeButton(R.string.cancel, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            setOptedOutOfDataUseDialog(activity, checkBox.isChecked());
            recordDataUseUIAction(DataUsageUIAction.DIALOG_CANCEL_CLICKED);
        }
    }).show();
    recordDataUseUIAction(DataUsageUIAction.DIALOG_SHOWN);
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) TextView(android.widget.TextView) View(android.view.View) CheckBox(android.widget.CheckBox) Referrer(org.chromium.content_public.common.Referrer) OnClickListener(android.content.DialogInterface.OnClickListener) TextView(android.widget.TextView) LoadUrlParams(org.chromium.content_public.browser.LoadUrlParams)

Aggregations

OnClickListener (android.content.DialogInterface.OnClickListener)264 DialogInterface (android.content.DialogInterface)259 AlertDialog (android.app.AlertDialog)161 View (android.view.View)75 TextView (android.widget.TextView)52 Intent (android.content.Intent)44 SuppressLint (android.annotation.SuppressLint)41 Context (android.content.Context)35 AlertDialog (android.support.v7.app.AlertDialog)32 LayoutInflater (android.view.LayoutInflater)30 EditText (android.widget.EditText)30 Activity (android.app.Activity)27 Bundle (android.os.Bundle)25 OnCancelListener (android.content.DialogInterface.OnCancelListener)21 ImageView (android.widget.ImageView)17 Builder (android.app.AlertDialog.Builder)16 Dialog (android.app.Dialog)16 ProgressDialog (android.app.ProgressDialog)15 Paint (android.graphics.Paint)15 AdapterView (android.widget.AdapterView)15