List of usage examples for android.app AlertDialog.Builder setIcon
public void setIcon(Drawable icon)
From source file:com.gsma.rcs.ri.messaging.GroupTalkView.java
/** * Display notification to accept or reject invitation * * @param remote remote contact/*from w w w .j a v a 2 s .c o m*/ */ private void displayAcceptRejectDialog(ContactId remote) { /* Manual accept */ AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.title_group_chat); String from = RcsContactUtil.getInstance(this).getDisplayName(remote); String topic = (TextUtils.isEmpty(mSubject)) ? getString(R.string.label_no_subject) : mSubject; String msg = getString(R.string.label_gc_from_subject, from, topic); builder.setMessage(msg); builder.setCancelable(false); builder.setIcon(R.drawable.ri_notif_chat_icon); builder.setPositiveButton(R.string.label_accept, new android.content.DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { try { /* Accept the invitation */ mGroupChat.openChat(); } catch (RcsServiceException e) { showExceptionThenExit(e); } } }); builder.setNegativeButton(R.string.label_decline, new android.content.DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { /* * Let session die by timeout. Exit activity */ finish(); } }); registerDialog(builder.show()); }
From source file:csh.cryptonite.Cryptonite.java
private void showAlert(String alert, String msg, String btnLabel) { AlertDialog.Builder builder = new AlertDialog.Builder(Cryptonite.this); builder.setIcon(R.drawable.ic_launcher_cryptonite).setTitle(alert).setMessage(msg) .setPositiveButton(btnLabel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { }/*from ww w. ja va 2 s .c o m*/ }); AlertDialog dialog = builder.create(); dialog.show(); }
From source file:net.evecom.android.PublicOpinionLookActivity.java
/** * //from w w w. j ava 2s. c o m * * @param v */ public void opinionfh(View v) { final AlertDialog.Builder builder = new AlertDialog.Builder(PublicOpinionLookActivity.this); builder.setTitle(""); builder.setIcon(R.drawable.qq_dialog_default_icon);// builder.setMessage(""); builder.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { finish(); Intent intent = new Intent(getApplicationContext(), PublicOpinionlistActivity.class); startActivity(intent); } }); builder.setNegativeButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); }
From source file:net.evecom.android.PublicOpinionLookActivity.java
/** * // w w w.ja va2s.co m * * @param v */ public void opinion_more_delete(View v) { final AlertDialog.Builder builder = new AlertDialog.Builder(PublicOpinionLookActivity.this); builder.setTitle(""); builder.setIcon(R.drawable.qq_dialog_default_icon);// builder.setMessage(""); builder.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { progressDialog = ProgressDialog.show(PublicOpinionLookActivity.this, "", "..."); formSubmit(); } }); builder.setNegativeButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); }
From source file:com.sssemil.sonyirremote.ir.ir.java
public void update() { final GetLastVer getLastVer1 = new GetLastVer(ir.this); try {//w ww .j av a2 s . co m Log.i("Update", "last_ver : " + getLastVer1.execute().get() + " cur_ver : " + cur_ver); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } if (last_ver == "zirt") { AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle(getString(R.string.update)); adb.setMessage(getString(R.string.ser3)); adb.setIcon(android.R.drawable.ic_dialog_alert); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { update(); } }); adb.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //finish(); } }); adb.show(); } else { String result = compare(cur_ver, last_ver); boolean doUpdate = false; if (result == ">") { doUpdate = false; } else if (result == "<") { doUpdate = true; } else if (result == "==") { doUpdate = false; } if (doUpdate == true) { AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle(getString(R.string.update)); adb.setMessage(getString(R.string.new_version_available)); adb.setIcon(android.R.drawable.ic_dialog_alert); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mProgressDialog = new ProgressDialog(ir.this); mProgressDialog.setMessage(getString(R.string.downloading_new)); mProgressDialog.setIndeterminate(true); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); mProgressDialog.setCancelable(true); final DownloadApp downloadApp1 = new DownloadApp(ir.this); downloadApp1.execute(http_path_last_download1 + last_ver + http_path_last_download2); mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { downloadApp1.cancel(true); } }); } }); adb.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); adb.show(); } else if (doUpdate == false) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.update)); builder.setMessage(getString(R.string.already_new)); builder.setPositiveButton("OK", null); builder.show(); } } }
From source file:com.sssemil.sonyirremote.ir.ir.java
public void doOnDown() { spinner6 = ((Spinner) findViewById(R.id.spinner6)); try {/* w ww .ja va 2 s .c om*/ test = spinner6.getSelectedItem().toString(); lastWord = test.substring(test.lastIndexOf(" ") + 1); cont = true; } catch (NullPointerException ex) { cont = false; AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle(getString(R.string.error)); adb.setMessage(getString(R.string.you_need_to_select)); adb.setIcon(android.R.drawable.ic_dialog_alert); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); adb.show(); } if (cont) { // execute this when the downloader must be fired final DownloadTask downloadTask = new DownloadTask(ir.this); try { downloadTask.execute(lastWord).get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } if (!resp.equals("ok")) { AlertDialog.Builder adb1 = new AlertDialog.Builder(this); adb1.setTitle(getString(R.string.download)); adb1.setMessage(getString(R.string.ser3)); adb1.setIcon(android.R.drawable.ic_dialog_alert); adb1.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { doOnDown(); } }); adb1.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //finish(); } }); adb1.show(); } else { AlertDialog.Builder adb1 = new AlertDialog.Builder(this); adb1.setTitle(getString(R.string.downloadT)); adb1.setMessage(getString(R.string.done)); adb1.setIcon(android.R.drawable.ic_dialog_alert); adb1.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); adb1.show(); } resp = "ko"; } cont = false; }
From source file:org.secuso.privacyfriendlypasswordgenerator.dialogs.GeneratePasswordDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); rootView = inflater.inflate(R.layout.dialog_generate_password, null); Bundle bundle = getArguments();/*from w w w . j a v a 2 s . co m*/ position = bundle.getInt("position"); clipboard_enabled = bundle.getBoolean("clipboard_enabled"); bindToDevice_enabled = bundle.getBoolean("bindToDevice_enabled"); hashAlgorithm = bundle.getString("hash_algorithm"); number_iterations = bundle.getInt("number_iterations"); visibility = false; spinner = (ProgressBar) rootView.findViewById(R.id.progressBar); spinner.setVisibility(View.GONE); database = MetaDataSQLiteHelper.getInstance(getActivity()); metaData = database.getMetaData(position); TextView domain = (TextView) rootView.findViewById(R.id.domainHeadingTextView); domain.setText(metaData.getDOMAIN()); TextView username = (TextView) rootView.findViewById(R.id.domainUsernameTextView); username.setText(metaData.getUSERNAME()); TextView iteration = (TextView) rootView.findViewById(R.id.textViewIteration); iteration.setText(String.valueOf(metaData.getITERATION())); builder.setView(rootView); builder.setIcon(R.mipmap.ic_drawer); builder.setTitle(getActivity().getString(R.string.generate_heading)); builder.setPositiveButton(getActivity().getString(R.string.done), null); Button generateButton = (Button) rootView.findViewById(R.id.generatorButton); generateButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TextView textViewPassword = (TextView) rootView.findViewById(R.id.textViewPassword); textViewPassword.setText(""); InputMethodManager inputManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN); editTextMasterpassword = (EditText) rootView.findViewById(R.id.editTextMasterpassword); if (editTextMasterpassword.getText().toString().length() == 0) { Toast toast = Toast.makeText(getActivity().getBaseContext(), getString(R.string.enter_masterpassword), Toast.LENGTH_SHORT); toast.show(); } else if (editTextMasterpassword.getText().toString().length() < 8) { Toast toast = Toast.makeText(getActivity().getBaseContext(), getString(R.string.masterpassword_length), Toast.LENGTH_SHORT); toast.show(); } else { spinner.setVisibility(View.VISIBLE); generatePassword(); } } }); ImageButton copyButton = (ImageButton) rootView.findViewById(R.id.copyButton); copyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TextView password = (TextView) rootView.findViewById(R.id.textViewPassword); if (password.getText().toString().length() > 0) { ClipboardManager clipboard = (ClipboardManager) getActivity() .getSystemService(CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("", password.getText()); clipboard.setPrimaryClip(clip); Toast.makeText(getActivity(), getActivity().getString(R.string.password_copied), Toast.LENGTH_SHORT).show(); } } }); visibilityButton = (ImageButton) rootView.findViewById(R.id.visibilityButton); visibilityButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editTextMasterpassword = (EditText) rootView.findViewById(R.id.editTextMasterpassword); if (!visibility) { visibilityButton.setImageResource(R.drawable.ic_visibility_off); editTextMasterpassword.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); editTextMasterpassword.setSelection(editTextMasterpassword.getText().length()); visibility = true; } else { visibilityButton.setImageResource(R.drawable.ic_visibility); editTextMasterpassword .setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); editTextMasterpassword.setSelection(editTextMasterpassword.getText().length()); visibility = false; } } }); return builder.create(); }
From source file:csh.cryptonite.Cryptonite.java
public void buildSession() { // Has the user already decided whether to use an app folder? final SharedPreferences prefs = getBaseContext().getSharedPreferences(ACCOUNT_PREFS_NAME, 0); if (!prefs.getBoolean("dbDecided", false)) { AlertDialog.Builder builder = new AlertDialog.Builder(Cryptonite.this); builder.setIcon(R.drawable.ic_launcher_cryptonite).setTitle(R.string.dropbox_access_title) .setMessage(R.string.dropbox_access_msg) .setPositiveButton(R.string.dropbox_full, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { setSessionProgressDialog(false); }//w ww.j a v a 2 s .c om }).setNegativeButton(R.string.dropbox_folder, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { setSessionProgressDialog(true); } }); AlertDialog dialog = builder.create(); dialog.show(); } else { setSessionProgressDialog(prefs.getBoolean("cb_appfolder", false)); } }
From source file:csh.cryptonite.Cryptonite.java
private void jniFail() { AlertDialog.Builder builder = new AlertDialog.Builder(Cryptonite.this); builder.setIcon(R.drawable.ic_launcher_cryptonite).setTitle(R.string.error).setMessage(R.string.jni_fail) .setPositiveButton(R.string.send_email, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "christoph.schmidthieber@googlemail.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, Cryptonite.this.getString(R.string.crash_report)); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.crash_report_content)); Cryptonite.this.startActivity(Intent.createChooser(emailIntent, "Send mail...")); finish();// w w w. j a v a 2 s . c om } }).setNeutralButton(R.string.send_report, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent reportIntent = new Intent(android.content.Intent.ACTION_VIEW); String url = "https://code.google.com/p/cryptonite/issues/detail?id=9"; reportIntent.setData(Uri.parse(url)); Cryptonite.this.startActivity(reportIntent); finish(); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } }); AlertDialog dialog = builder.create(); dialog.show(); }
From source file:csh.cryptonite.Cryptonite.java
public void createEncFS(final boolean isDB) { SharedPreferences prefs = getBaseContext().getSharedPreferences(Cryptonite.ACCOUNT_PREFS_NAME, 0); if (!prefs.getBoolean("cb_norris", false)) { AlertDialog.Builder builder = new AlertDialog.Builder(Cryptonite.this); builder.setIcon(R.drawable.ic_launcher_cryptonite).setTitle(R.string.warning) .setMessage(R.string.create_warning) .setPositiveButton(R.string.create_short, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(getBaseContext(), CreateEncFS.class); int createMode = CreateEncFS.CREATE_LOCAL; if (isDB) { createMode = CreateEncFS.CREATE_DB; }/*w ww . j a v a2 s . c om*/ intent.putExtra(CreateEncFS.START_MODE, createMode); startActivityForResult(intent, createMode); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); AlertDialog dialog = builder.create(); dialog.show(); } else { Intent intent = new Intent(getBaseContext(), CreateEncFS.class); int createMode = CreateEncFS.CREATE_LOCAL; if (isDB) { createMode = CreateEncFS.CREATE_DB; } intent.putExtra(CreateEncFS.START_MODE, createMode); startActivityForResult(intent, createMode); } }