List of usage examples for android.app AlertDialog dismiss
@Override public void dismiss()
From source file:com.linkbubble.util.YouTubeEmbedHelper.java
AlertDialog getEmbedResultsDialog() { if (mEmbedInfo.size() > 0) { ListView listView = new ListView(mContext); listView.setAdapter(new EmbedItemAdapter()); AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setView(listView);//from w ww . ja v a2 s . co m builder.setIcon(mYouTubeResolveInfo.loadIcon(mContext.getPackageManager())); builder.setTitle(R.string.title_youtube_embed_to_load); final AlertDialog alertDialog = builder.create(); alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { EmbedInfo embedInfo = (EmbedInfo) view.getTag(); if (embedInfo != null) { loadYouTubeVideo(embedInfo.mId); } alertDialog.dismiss(); } }); return alertDialog; } else { final AlertDialog alertDialog = new AlertDialog.Builder(mContext).create(); alertDialog.setTitle(R.string.youtube_embed_error_title); alertDialog.setMessage(mContext.getString(R.string.youtube_embed_error_summary)); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, mContext.getResources().getString(R.string.action_ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { alertDialog.dismiss(); } }); alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); return alertDialog; } }
From source file:org.notfunnynerd.opencoinmap.MapActivity.java
private void showFilterDialog() { final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle(R.string.filter); LayoutInflater inflater = getLayoutInflater(); final View PopupLayout = inflater.inflate(R.layout.filters_dialog, null); dialogBuilder.setView(PopupLayout);/*from www. j a v a 2 s . com*/ final AlertDialog dialog = dialogBuilder.create(); dialog.show(); ListView listView = (ListView) PopupLayout.findViewById(R.id.listFilters); final FilterListAdapter filterListAdapter = new FilterListAdapter(getLayoutInflater(), filterList); listView.setAdapter(filterListAdapter); ((Button) PopupLayout.findViewById(R.id.okButton)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { updateMarkers(); dialog.dismiss(); } }); ((Button) PopupLayout.findViewById(R.id.selectAllButton)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { for (Filter filter : filterList) { filter.setSelected(true); } filterListAdapter.notifyDataSetChanged(); } }); ((Button) PopupLayout.findViewById(R.id.deselectAllButton)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { for (Filter filter : filterList) { filter.setSelected(false); } filterListAdapter.notifyDataSetChanged(); } }); }
From source file:org.mythdroid.activities.MDActivity.java
/** Create a dialog allowing user to choose default frontend */ private Dialog createFrontendDialog() { final AlertDialog d = new AlertDialog.Builder(ctx).setItems(new String[] {}, null) .setIcon(drawable.ic_menu_upload_you_tube).setTitle(R.string.chFe).create(); d.getListView().setOnItemClickListener(new OnItemClickListener() { @Override/*from w ww.ja va 2 s. co m*/ public void onItemClick(AdapterView<?> av, View v, int pos, long id) { onHere = false; String fe = (String) av.getAdapter().getItem(pos); Globals.curFe = fe; updateFrontendIndicator(); if (fe.equals(Messages.getString("MDActivity.0"))) // Here //$NON-NLS-1$ onHere = true; d.dismiss(); } }); return d; }
From source file:com.jwork.dhammapada.MainActivity.java
public void displayChangeLog() { AlertDialog dialog = new AlertDialog.Builder(this).create(); dialog.setTitle("Changelog"); WebView wv = new WebView(this); wv.loadData(getString(R.string.changelog_dialog_text), "text/html", "utf-8"); wv.setScrollContainer(true);//from ww w . ja v a 2s . co m dialog.setView(wv); dialog.setButton(AlertDialog.BUTTON_NEGATIVE, getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Configuration.getInstance(MainActivity.this) .setCurrentVersion(CrashHandler.getVersionCode(MainActivity.this)); dialog.dismiss(); } }); dialog.setButton(AlertDialog.BUTTON_POSITIVE, "Rate It", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Configuration.getInstance(MainActivity.this) .setCurrentVersion(CrashHandler.getVersionCode(MainActivity.this)); dialog.dismiss(); Uri uri = Uri.parse("market://details?id=" + MainActivity.this.getPackageName()); Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri); try { MainActivity.this.startActivity(myAppLinkToMarket); } catch (ActivityNotFoundException e) { Toast.makeText(MainActivity.this, "Failed to find Market application", Toast.LENGTH_LONG) .show(); } } }); dialog.setButton(AlertDialog.BUTTON_NEUTRAL, "Donate", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Configuration.getInstance(MainActivity.this) .setCurrentVersion(CrashHandler.getVersionCode(MainActivity.this)); dialog.dismiss(); openDonate(); } }); dialog.show(); }
From source file:com.cleanwiz.applock.ui.activity.SplashActivity.java
public void showUpdateDialog(String intro) { final AlertDialog updateDialogDlg = new AlertDialog.Builder(this).create(); updateDialogDlg.show();/* w w w.j av a2 s . c om*/ Window win = updateDialogDlg.getWindow(); win.setContentView(R.layout.dialog_update); TextView tvMsg = (TextView) win.findViewById(R.id.tvMsg); tvMsg.setText(intro); Button btOk = (Button) win.findViewById(R.id.btOk); ImageView closeImageView = (ImageView) win.findViewById(R.id.updateclose); closeImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub updateDialogDlg.dismiss(); SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_CANCEL; handler.sendMessage(msg); } }); btOk.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_DOWN; handler.sendMessage(msg); } }); updateDialogDlg.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { // TODO Auto-generated method stub List<UpdateVersionManafer> updateVersionManafers = updateVersionManagerService.getVersionManafers(); for (UpdateVersionManafer updateVersionManafer : updateVersionManafers) { updateVersionManafer.setLasttipdate(new Date().getTime()); updateVersionManagerService.modifyTipsDate(updateVersionManafer); break; } SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_CANCEL; handler.sendMessage(msg); } }); }
From source file:com.frostwire.android.gui.util.UIUtils.java
/** * @param context - containing Context. * @param showInstallationCompleteSection - true if you want to display "Your installation is now complete. Thank You" section * @param dismissListener - what happens when the dialog is dismissed. * @param referrerContextSuffix - string appended at the end of social pages click urls's ?ref=_android_ parameter. *//*from w ww. j a va2 s .c o m*/ public static void showSocialLinksDialog(final Context context, boolean showInstallationCompleteSection, DialogInterface.OnDismissListener dismissListener, String referrerContextSuffix) { AlertDialog.Builder builder = new AlertDialog.Builder(context); View customView = View.inflate(context, R.layout.view_social_buttons, null); builder.setView(customView); builder.setPositiveButton(context.getString(android.R.string.ok), (dialog, which) -> dialog.dismiss()); final AlertDialog socialLinksDialog = builder.create(); socialLinksDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); socialLinksDialog.setOnDismissListener(dismissListener); ImageButton fbButton = customView.findViewById(R.id.view_social_buttons_facebook_button); ImageButton twitterButton = customView.findViewById(R.id.view_social_buttons_twitter_button); ImageButton redditButton = customView.findViewById(R.id.view_social_buttons_reddit_button); final String referrerParam = "?ref=android_" + ((referrerContextSuffix != null) ? referrerContextSuffix.trim() : ""); fbButton.setOnClickListener( v -> UIUtils.openURL(v.getContext(), Constants.SOCIAL_URL_FACEBOOK_PAGE + referrerParam)); twitterButton.setOnClickListener( v -> UIUtils.openURL(v.getContext(), Constants.SOCIAL_URL_TWITTER_PAGE + referrerParam)); redditButton.setOnClickListener( v -> UIUtils.openURL(v.getContext(), Constants.SOCIAL_URL_REDDIT_PAGE + referrerParam)); if (showInstallationCompleteSection) { LinearLayout installationCompleteLayout = customView .findViewById(R.id.view_social_buttons_installation_complete_layout); installationCompleteLayout.setVisibility(View.VISIBLE); ImageButton dismissCheckButton = customView.findViewById(R.id.view_social_buttons_dismiss_check); dismissCheckButton.setOnClickListener(v -> socialLinksDialog.dismiss()); } socialLinksDialog.show(); }
From source file:org.mythdroid.activities.Main.java
private Dialog createMddDialog() { final AlertDialog d = new AlertDialog.Builder(ctx).setItems(new String[] {}, null) .setIcon(drawable.ic_menu_agenda).setTitle(R.string.mddCmd).create(); d.getListView().setOnItemClickListener(new OnItemClickListener() { @Override//ww w .j ava2 s . c o m public void onItemClick(AdapterView<?> av, View v, int pos, long id) { try { MDDManager.mddCommand(Globals.getFrontend(ctx).addr, (String) av.getItemAtPosition(pos)); } catch (IOException e) { ErrUtil.postErr(ctx, e); } d.dismiss(); } }); return d; }
From source file:com.gigathinking.simpleapplock.MainActivity.java
private void showRatingDialog() { mPrefs.edit().putBoolean("rating_dialog_showing", true).commit(); AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog dialog; builder.setTitle(getString(R.string.please_rate)); builder.setMessage(getString(R.string.please_rate_message)); builder.setPositiveButton(getString(R.string.rate_it), new DialogInterface.OnClickListener() { @Override//from w w w . j av a 2 s .c o m public void onClick(DialogInterface dialog, int which) { mPrefs.edit().putString("rating", "RATED").commit(); Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://market.android.com/details?id=" + getPackageName())); startActivity(marketIntent); mPrefs.edit().putBoolean("rating_dialog_showing", false).commit(); dialog.dismiss(); } }); builder.setNegativeButton(getString(R.string.not_interested), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mPrefs.edit().putString("rating", "Not Interested").commit(); mPrefs.edit().putBoolean("rating_dialog_showing", false).commit(); dialog.dismiss(); } }); builder.setNeutralButton(getString(R.string.may_be_later), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mPrefs.edit().putString("rating", "May be later").commit(); mPrefs.edit().putInt("launch_count", 0).commit(); mPrefs.edit().putBoolean("rating_dialog_showing", false).commit(); dialog.dismiss(); } }); builder.setCancelable(false); dialog = builder.create(); dialog.show(); }
From source file:cm.aptoide.pt.RemoteInTab.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == NEWREPO_FLAG) { if (data != null && data.hasExtra("update")) { final AlertDialog alrt = new AlertDialog.Builder(this).create(); alrt.setTitle("Update repositories"); alrt.setMessage("The list of repositories in use has been changed.\nDo you wish to update them?"); alrt.setButton("Yes", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { updateRepos();//from ww w . j av a 2s. c o m } }); alrt.setButton2("No", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { alrt.dismiss(); } }); alrt.show(); } } else if (requestCode == SETTINGS_FLAG) { if (data != null && data.hasExtra("align")) { order_lst = data.getExtras().getString("align"); prefEdit.putString("order_lst", order_lst); prefEdit.commit(); } } }
From source file:no.kreativo.badetemperaturer.MainActivity.java
private void showAboutPopup() { final AlertDialog dialog = new AlertDialog.Builder(this).setTitle(getResources().getString(R.string.about)) .setMessage(Html.fromHtml(/* w w w .ja va2 s. c o m*/ "<a href=\"http://www.yr.no/observasjonar/badetemperaturar.html\n\">Badetemperaturene blir " + "rapportert til yr.no og Reiseradioen av hver enkelt campingplass/badestrand. Mlingene flger ikke vanlig " + "meteorologisk standard, men gir en god indikasjon p vanntemperaturen. Badetemperaturene i Oslo er levert " + "av Oslo kommune, Akershus av badevann.no.</a>")) .setPositiveButton(R.string.close, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); dialog.show(); ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }