List of usage examples for android.app AlertDialog setTitle
@Override public void setTitle(CharSequence title)
From source file:org.quantumbadger.redreader.reddit.prepared.RedditPreparedPost.java
public static void showActionMenu(final Activity activity, final RedditPreparedPost post) { final EnumSet<Action> itemPref = PrefsUtility.pref_menus_post_context_items(activity, PreferenceManager.getDefaultSharedPreferences(activity)); if (itemPref.isEmpty()) return;//from www . j a v a 2 s . c o m final RedditAccount user = RedditAccountManager.getInstance(activity).getDefaultAccount(); final ArrayList<RPVMenuItem> menu = new ArrayList<RPVMenuItem>(); if (!RedditAccountManager.getInstance(activity).getDefaultAccount().isAnonymous()) { if (itemPref.contains(Action.UPVOTE)) { if (!post.isUpvoted()) { menu.add(new RPVMenuItem(activity, R.string.action_upvote, Action.UPVOTE)); } else { menu.add(new RPVMenuItem(activity, R.string.action_upvote_remove, Action.UNVOTE)); } } if (itemPref.contains(Action.DOWNVOTE)) { if (!post.isDownvoted()) { menu.add(new RPVMenuItem(activity, R.string.action_downvote, Action.DOWNVOTE)); } else { menu.add(new RPVMenuItem(activity, R.string.action_downvote_remove, Action.UNVOTE)); } } if (itemPref.contains(Action.SAVE)) { if (!post.isSaved()) { menu.add(new RPVMenuItem(activity, R.string.action_save, Action.SAVE)); } else { menu.add(new RPVMenuItem(activity, R.string.action_unsave, Action.UNSAVE)); } } if (itemPref.contains(Action.HIDE)) { if (!post.isHidden()) { menu.add(new RPVMenuItem(activity, R.string.action_hide, Action.HIDE)); } else { menu.add(new RPVMenuItem(activity, R.string.action_unhide, Action.UNHIDE)); } } if (itemPref.contains(Action.DELETE) && user.username.equalsIgnoreCase(post.src.author)) { menu.add(new RPVMenuItem(activity, R.string.action_delete, Action.DELETE)); } if (itemPref.contains(Action.REPORT)) menu.add(new RPVMenuItem(activity, R.string.action_report, Action.REPORT)); } if (itemPref.contains(Action.EXTERNAL)) menu.add(new RPVMenuItem(activity, R.string.action_external, Action.EXTERNAL)); if (itemPref.contains(Action.SELFTEXT_LINKS) && post.src.selftext != null && post.src.selftext.length() > 1) menu.add(new RPVMenuItem(activity, R.string.action_selftext_links, Action.SELFTEXT_LINKS)); if (itemPref.contains(Action.SAVE_IMAGE) && post.mIsProbablyAnImage) menu.add(new RPVMenuItem(activity, R.string.action_save_image, Action.SAVE_IMAGE)); if (itemPref.contains(Action.GOTO_SUBREDDIT)) menu.add(new RPVMenuItem(activity, R.string.action_gotosubreddit, Action.GOTO_SUBREDDIT)); if (itemPref.contains(Action.SHARE)) menu.add(new RPVMenuItem(activity, R.string.action_share, Action.SHARE)); if (itemPref.contains(Action.SHARE_COMMENTS)) menu.add(new RPVMenuItem(activity, R.string.action_share_comments, Action.SHARE_COMMENTS)); if (itemPref.contains(Action.COPY)) menu.add(new RPVMenuItem(activity, R.string.action_copy, Action.COPY)); if (itemPref.contains(Action.USER_PROFILE)) menu.add(new RPVMenuItem(activity, R.string.action_user_profile, Action.USER_PROFILE)); if (itemPref.contains(Action.PROPERTIES)) menu.add(new RPVMenuItem(activity, R.string.action_properties, Action.PROPERTIES)); final String[] menuText = new String[menu.size()]; for (int i = 0; i < menuText.length; i++) { menuText[i] = menu.get(i).title; } final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setItems(menuText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { onActionMenuItemSelected(post, activity, menu.get(which).action); } }); //builder.setNeutralButton(R.string.dialog_cancel, null); final AlertDialog alert = builder.create(); alert.setTitle(R.string.action_menu_post_title); alert.setCanceledOnTouchOutside(true); alert.show(); }
From source file:com.secbro.qark.customintent.ChooseIntentUseCaseActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Check which request we're responding to if (requestCode == START_ACTIVITY_FOR_RESULT) { // Make sure the request was successful if (resultCode == RESULT_OK) { AlertDialog result = new AlertDialog.Builder(this).create(); result.setTitle("Result from startActivityForResult()"); result.setMessage(data.getDataString()); result.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss();/*from w w w. j av a 2 s. c o m*/ } }); result.show(); } } }
From source file:com.github.mobile.ui.DialogFragmentHelper.java
/** * Create default dialog/* w ww .ja va 2 s. c o m*/ * * @return dialog */ protected AlertDialog createDialog() { final AlertDialog dialog = LightAlertDialog.create(getActivity()); dialog.setTitle(getTitle()); dialog.setMessage(getMessage()); dialog.setCancelable(true); dialog.setOnCancelListener(this); return dialog; }
From source file:com.danvelazco.fbwrapper.preferences.FacebookPreferences.java
/** * Show an alert dialog with the information about the application. *///from ww w . j a va 2s. com private void showAboutAlert() { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(getString(R.string.menu_about)); alertDialog.setMessage(getString(R.string.txt_about)); alertDialog.setIcon(R.drawable.ic_launcher); alertDialog.setButton(DialogInterface.BUTTON_NEUTRAL, getString(R.string.lbl_dialog_close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Don't do anything, simply close the dialog } }); alertDialog.show(); }
From source file:com.wellsandwhistles.android.redditsp.adapters.AccountListAdapter.java
@Override protected void onBindContentItemViewHolder(VH holder, final int position) { final VH1Text vh = (VH1Text) holder; final RedditAccount account = accounts.get(position); final BetterSSB username = new BetterSSB(); if (account.isAnonymous()) { username.append(context.getString(R.string.accounts_anon), 0); } else {// ww w.ja v a 2 s. c om username.append(account.username, 0); } if (account.equals(RedditAccountManager.getInstance(context).getDefaultAccount())) { final TypedArray attr = context.obtainStyledAttributes(new int[] { R.attr.srListSubtitleCol }); final int col = attr.getColor(0, 0); attr.recycle(); username.append(" (" + context.getString(R.string.accounts_active) + ")", BetterSSB.FOREGROUND_COLOR | BetterSSB.SIZE, col, 0, 0.8f); } vh.text.setText(username.get()); vh.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final RedditAccount account = accounts.get(position); final String[] items = account.isAnonymous() ? new String[] { context.getString(R.string.accounts_setactive) } : new String[] { context.getString(R.string.accounts_setactive), context.getString(R.string.accounts_delete) }; final AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final String selected = items[which]; if (selected.equals(context.getString(R.string.accounts_setactive))) { RedditAccountManager.getInstance(context).setDefaultAccount(account); } else if (selected.equals(context.getString(R.string.accounts_delete))) { new AlertDialog.Builder(context).setTitle(R.string.accounts_delete) .setMessage(R.string.accounts_delete_sure) .setPositiveButton(R.string.accounts_delete, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { RedditAccountManager.getInstance(context) .deleteAccount(account); } }) .setNegativeButton(R.string.dialog_cancel, null).show(); } } }); builder.setNeutralButton(R.string.dialog_cancel, null); final AlertDialog alert = builder.create(); alert.setTitle( account.isAnonymous() ? context.getString(R.string.accounts_anon) : account.username); alert.setCanceledOnTouchOutside(true); alert.show(); } }); }
From source file:pt.hive.cameo.activities.LoginActivity.java
public void handleException(JSONObject data) { try {/*from www .ja va 2 s.c o m*/ JSONObject exception = data.getJSONObject("exception"); String message = exception.getString("message"); AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Error in submission"); alertDialog.setMessage(message); alertDialog.show(); } catch (JSONException exception) { throw new RuntimeException(exception); } }
From source file:org.quantumbadger.redreader.adapters.AccountListAdapter.java
@Override protected void onBindContentItemViewHolder(VH holder, final int position) { final VH1Text vh = (VH1Text) holder; final RedditAccount account = accounts.get(position); final BetterSSB username = new BetterSSB(); if (account.isAnonymous()) { username.append(context.getString(R.string.accounts_anon), 0); } else {/* ww w . j a v a 2s . c o m*/ username.append(account.username, 0); } if (account.equals(RedditAccountManager.getInstance(context).getDefaultAccount())) { final TypedArray attr = context.obtainStyledAttributes(new int[] { R.attr.rrListSubtitleCol }); final int col = attr.getColor(0, 0); attr.recycle(); username.append(" (" + context.getString(R.string.accounts_active) + ")", BetterSSB.FOREGROUND_COLOR | BetterSSB.SIZE, col, 0, 0.8f); } vh.text.setText(username.get()); vh.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final RedditAccount account = accounts.get(position); final String[] items = account.isAnonymous() ? new String[] { context.getString(R.string.accounts_setactive) } : new String[] { context.getString(R.string.accounts_setactive), context.getString(R.string.accounts_delete) }; final AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final String selected = items[which]; if (selected.equals(context.getString(R.string.accounts_setactive))) { RedditAccountManager.getInstance(context).setDefaultAccount(account); } else if (selected.equals(context.getString(R.string.accounts_delete))) { new AlertDialog.Builder(context).setTitle(R.string.accounts_delete) .setMessage(R.string.accounts_delete_sure) .setPositiveButton(R.string.accounts_delete, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { RedditAccountManager.getInstance(context) .deleteAccount(account); } }) .setNegativeButton(R.string.dialog_cancel, null).show(); } } }); builder.setNeutralButton(R.string.dialog_cancel, null); final AlertDialog alert = builder.create(); alert.setTitle( account.isAnonymous() ? context.getString(R.string.accounts_anon) : account.username); alert.setCanceledOnTouchOutside(true); alert.show(); } }); }
From source file:com.toppatch.mv.ui.activities.MainActivity.java
private void checkConditions() { //sendToWelcomePage(); if (isConnectingToInternet()) { if (AdminHelper.isUserLoggedIn(this)) { if (AdminHelper.isAdminActive(this)) { if (AdminHelper.isSamsungESDKEnabled(this)) if (AdminHelper.isGCMRegistered(this)) { Log.i("see", "gcmif"); sendToWelcomePage(); } else { Log.i("see", "gcmelse"); sendToGCMPage(); }/*ww w . jav a 2 s. c om*/ else { Log.i("see", "register"); Boolean canRegiser = Registration.register(this); if (!canRegiser) sendToLoginPage(); } } else { sendToLoginPage(); } } else { sendToLoginPage(); } } else { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Ohh No!!"); alertDialog.setMessage("No Internet Connection...Exiting.."); alertDialog.show(); new Handler().postDelayed(new Runnable() { @Override public void run() { finish(); } }, 2000); } }
From source file:at.jclehner.androidutils.AlertDialogFragment.java
public void setTitle(CharSequence title) { mTitle = title;/*from w ww . ja va 2s .c o m*/ final AlertDialog dialog = getDialog(); if (dialog == null) return; dialog.setTitle(title); }
From source file:com.aikidonord.Intervenant.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_intervenant); View rlLoading = findViewById(R.id.loadingPanel); View listView = findViewById(R.id.list); ActionBar actionBar = this.getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(getResources().getString(R.string.actionbar_titre_intervenant)); if (VerifConnexion.isOnline(this)) { rlLoading.setVisibility(View.VISIBLE); listView.setVisibility(View.GONE); new QueryForAnimateurTask().execute(this, this.getApplicationContext()); } else {/*from w w w . j a v a 2 s. c o m*/ AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(getResources().getString(R.string.app_name)); alertDialog.setMessage(getResources().getString(R.string.no_network)); alertDialog.setIcon(R.drawable.ic_launcher); alertDialog.setCancelable(false); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // if this button is clicked, close // current activity Intervenant.this.finish(); } }); alertDialog.show(); } }