List of usage examples for android.app AlertDialog setTitle
@Override public void setTitle(CharSequence title)
From source file:com.github.pockethub.ui.repo.RepositoryListFragment.java
@Override public boolean onListItemLongClick(ListView list, View v, int position, long itemId) { if (!isUsable()) return false; final Repo repo = (Repo) list.getItemAtPosition(position); if (repo == null) return false; final AlertDialog dialog = LightAlertDialog.create(getActivity()); dialog.setCanceledOnTouchOutside(true); dialog.setTitle(InfoUtils.createRepoId(repo)); View view = getActivity().getLayoutInflater().inflate(R.layout.repo_dialog, null); ViewFinder finder = new ViewFinder(view); final User owner = repo.owner; avatars.bind(finder.imageView(R.id.iv_owner_avatar), owner); finder.setText(R.id.tv_owner_name, getString(R.string.navigate_to_user, owner.login)); finder.onClick(R.id.ll_owner_area, new OnClickListener() { public void onClick(View v) { dialog.dismiss();/*from www . j a va2 s.c o m*/ viewUser(owner); } }); if ((recentRepos != null) && (recentRepos.contains(repo))) { finder.find(R.id.divider).setVisibility(View.VISIBLE); finder.find(R.id.ll_recent_repo_area).setVisibility(View.VISIBLE); finder.onClick(R.id.ll_recent_repo_area, new OnClickListener() { public void onClick(View v) { dialog.dismiss(); recentRepos.remove(repo); refresh(); } }); } dialog.setView(view); dialog.show(); return true; }
From source file:org.restcomm.android.olympus.MainFragment.java
private void showOkAlert(final String title, final String detail) { AlertDialog alertDialog = new AlertDialog.Builder(getActivity(), R.style.SimpleAlertStyle).create(); alertDialog.setTitle(title); alertDialog.setMessage(detail);//from w ww. ja v a 2 s .c o m alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); }
From source file:com.repay.android.adddebt.AddDebtActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (data != null && requestCode == 1) { try {/* www. ja va 2s . com*/ Log.i(TAG, "Closing contact picker"); Uri contactUri = data.getData(); String[] cols = { ContactsContract.Contacts.DISPLAY_NAME }; Cursor cursor = getContentResolver().query(contactUri, cols, null, null, null); cursor.moveToFirst(); String result = cursor.getString(0).replaceAll("[-+.^:,']", ""); Friend pickerResult = new Friend(DatabaseHandler.generateRepayID(), contactUri, result, new BigDecimal("0")); mDB.addFriend(pickerResult); ((ChoosePersonFragment) mChoosePerson).dataSetChanged(); } catch (IndexOutOfBoundsException e) { Toast.makeText(this, "Problem in getting result from your contacts", Toast.LENGTH_SHORT).show(); } catch (SQLException e) { e.printStackTrace(); AlertDialog alert = new AlertDialog.Builder(this).create(); alert.setMessage("This person already exists in Repay"); alert.setTitle("Person Already Exists"); Log.i(TAG, "Person already exists within app database"); alert.show(); } } }
From source file:dev.ronlemire.contactclientcloud.MainActivity.java
@SuppressWarnings("deprecation") @Override/* w ww . j a va 2s .co m*/ public void onBackPressed() { //super.onBackPressed(); AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Exiting Application"); alertDialog.setMessage("Are you sure?"); alertDialog.setIcon(android.R.attr.alertDialogIcon); alertDialog.setButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { finish(); } }); alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { return; } }); alertDialog.show(); // new AlertDialog.Builder(this, AlertDialog.THEME_HOLO_DARK) // .setIconAttribute(android.R.attr.alertDialogIcon) // .setTitle(R.string.exitingApplication) // .setMessage(R.string.shortMessage) // .setPositiveButton(R.string.alert_dialog_ok, // new DialogInterface.OnClickListener() { // public void onClick(DialogInterface dialog, // int whichButton) { // finish(); // } // }) // .setNegativeButton(R.string.alert_dialog_cancel, // new DialogInterface.OnClickListener() { // public void onClick(DialogInterface dialog, // int whichButton) { // return; // } // }).create().show(); }
From source file:com.yeldi.yeldibazaar.ManageRepo.java
@Override public boolean onMenuItemSelected(int featureId, MenuItem item) { super.onMenuItemSelected(featureId, item); LayoutInflater li = LayoutInflater.from(this); switch (item.getItemId()) { case ADD_REPO: View view = li.inflate(R.layout.addrepo, null); Builder p = new AlertDialog.Builder(this).setView(view); final AlertDialog alrt = p.create(); alrt.setIcon(android.R.drawable.ic_menu_add); alrt.setTitle(getString(R.string.repo_add_title)); alrt.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.repo_add_add), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { EditText uri = (EditText) alrt.findViewById(R.id.edit_uri); String uri_str = uri.getText().toString(); try { DB db = DB.getDB(); db.addRepo(uri_str, null, null, 10, null, true); } finally { DB.releaseDB(); }//from w w w.ja va 2 s . co m changed = true; redraw(); } }); alrt.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alrt.show(); return true; case REM_REPO: final List<String> rem_lst = new ArrayList<String>(); CharSequence[] b = new CharSequence[repos.size()]; for (int i = 0; i < repos.size(); i++) { b[i] = repos.get(i).address; } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.repo_delete_title)); builder.setIcon(android.R.drawable.ic_menu_close_clear_cancel); builder.setMultiChoiceItems(b, null, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) { if (isChecked) { rem_lst.add(repos.get(whichButton).address); } else { rem_lst.remove(repos.get(whichButton).address); } } }); builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { try { DB db = DB.getDB(); removeRepos(rem_lst); } finally { DB.releaseDB(); } changed = true; redraw(); } }); builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { return; } }); AlertDialog alert = builder.create(); alert.show(); return true; } return true; }
From source file:net.networksaremadeofstring.cyllell.ViewCookbooks_Fragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { settings = this.getActivity().getSharedPreferences("Cyllell", 0); try {/*from ww w .j a va 2 s . c o m*/ Cut = new Cuts(getActivity()); } catch (Exception e) { e.printStackTrace(); } dialog = new ProgressDialog(getActivity()); dialog.setTitle("Contacting Chef"); dialog.setMessage("Please wait: Prepping Authentication protocols"); dialog.setIndeterminate(true); if (listOfCookbooks.size() < 1) { dialog.show(); } updateListNotify = new Handler() { public void handleMessage(Message msg) { int tag = msg.getData().getInt("tag", 999999); if (msg.what == 0) { if (tag != 999999) { listOfCookbooks.get(tag).SetSpinnerVisible(); } } else if (msg.what == 1) { //Get rid of the lock CutInProgress = false; //the notifyDataSetChanged() will handle the rest } else if (msg.what == 99) { if (tag != 999999) { Toast.makeText(ViewCookbooks_Fragment.this.getActivity(), "An error occured during that operation.", Toast.LENGTH_LONG).show(); listOfCookbooks.get(tag).SetErrorState(); } } CookbookAdapter.notifyDataSetChanged(); } }; handler = new Handler() { public void handleMessage(Message msg) { //Once we've checked the data is good to use start processing it if (msg.what == 0) { OnClickListener listener = new OnClickListener() { public void onClick(View v) { GetMoreDetails((Integer) v.getTag()); } }; OnLongClickListener listenerLong = new OnLongClickListener() { public boolean onLongClick(View v) { //selectForCAB((Integer)v.getTag()); Toast.makeText(getActivity(), "This version doesn't support Cookbook editing yet", Toast.LENGTH_SHORT).show(); return true; } }; CookbookAdapter = new CookbookListAdaptor(getActivity(), listOfCookbooks, listener, listenerLong); try { list = (ListView) getView().findViewById(R.id.cookbooksListView); } catch (Exception e) { e.printStackTrace(); } if (list != null) { if (CookbookAdapter != null) { list.setAdapter(CookbookAdapter); } else { //Log.e("CookbookAdapter","CookbookAdapter is null"); } } else { //Log.e("List","List is null"); } dialog.dismiss(); } else if (msg.what == 200) { dialog.setMessage("Sending request to Chef..."); } else if (msg.what == 201) { dialog.setMessage("Parsing JSON....."); } else if (msg.what == 202) { dialog.setMessage("Populating UI!"); } else { //Close the Progress dialog dialog.dismiss(); //Alert the user that something went terribly wrong AlertDialog alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setTitle("API Error"); alertDialog.setMessage("There was an error communicating with the API:\n" + msg.getData().getString("exception")); alertDialog.setButton2("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //getActivity().finish(); } }); alertDialog.setIcon(R.drawable.icon); alertDialog.show(); } } }; Thread dataPreload = new Thread() { public void run() { if (listOfCookbooks.size() > 0) { handler.sendEmptyMessage(0); } else { try { handler.sendEmptyMessage(200); Cookbooks = Cut.GetCookbooks(); handler.sendEmptyMessage(201); JSONArray Keys = Cookbooks.names(); String URI = ""; String Version = "0.0.0"; JSONObject cookbook; for (int i = 0; i < Cookbooks.length(); i++) { cookbook = new JSONObject(Cookbooks.getString(Keys.get(i).toString())); //URI = Cookbooks.getString(Keys.get(i).toString()).replaceFirst("^(https://|http://).*/cookbooks/", ""); //Version = Cookbooks.getString(Keys.get(i).toString()) //Log.i("Cookbook Name", Keys.get(i).toString()); URI = cookbook.getString("url").replaceFirst("^(https://|http://).*/cookbooks/", ""); //Log.i("Cookbook URL", URI); JSONArray versions = cookbook.getJSONArray("versions"); Version = versions.getJSONObject(versions.length() - 1).getString("version"); //Log.i("Cookbook version", Version); listOfCookbooks.add(new Cookbook(Keys.get(i).toString(), URI, Version)); } handler.sendEmptyMessage(202); handler.sendEmptyMessage(0); } catch (Exception e) { BugSenseHandler.log("ViewCookbooksFragment", e); e.printStackTrace(); Message msg = new Message(); Bundle data = new Bundle(); data.putString("exception", e.getMessage()); msg.setData(data); msg.what = 1; handler.sendMessage(msg); } } return; } }; dataPreload.start(); return inflater.inflate(R.layout.cookbooks_landing, container, false); }
From source file:com.jwork.spycamera.MainFragment.java
private void showHelp() { AlertDialog dialog = new AlertDialog.Builder(activity).create(); dialog.setTitle(this.getString(R.string.help)); WebView wv = new WebView(activity); wv.loadData(this.getString(R.string.help_html), "text/html", "utf-8"); wv.setScrollContainer(true);//from ww w . j a va2 s . c om dialog.setView(wv); dialog.setButton(AlertDialog.BUTTON_NEGATIVE, this.getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.setButton(AlertDialog.BUTTON_POSITIVE, "Rate It", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Uri uri = Uri.parse("market://details?id=" + activity.getPackageName()); Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri); try { activity.startActivity(myAppLinkToMarket); } catch (ActivityNotFoundException e) { Toast.makeText(activity, "Failed to find Market application", Toast.LENGTH_LONG).show(); } } }); dialog.setButton(AlertDialog.BUTTON_NEUTRAL, "Share It", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Utility.shareIt(activity); } }); dialog.show(); }
From source file:org.sigimera.app.android.MainActivity.java
/** * Shows the about dialog./*from w w w . j a v a 2s . c o m*/ */ public final void showAboutDialog() { AlertDialog dialog = new AlertDialog.Builder(MainActivity.this).create(); dialog.setTitle("About"); dialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.cancel(); } }); WebView wv = new WebView(this); wv.setBackgroundColor(Color.BLACK); StringBuffer strbuffer = new StringBuffer(); strbuffer.append("<small><font color='white'>"); strbuffer.append("<h3 style='text-align: center'>" + this.getString(R.string.app_name) + "</h3>"); strbuffer.append("<p>This is the official App of the Crises " + "Information Platform Sigimera. It provides " + "the following functionality:</p>"); strbuffer.append("<ul>"); strbuffer.append("<li>Get crises (natural disaster) information." + "Currently floods, earthquakes, cyclones " + "and volcanic erruptions.</li>"); strbuffer.append("<li>Get crises alerts via push notifications.</li>"); strbuffer.append("<li>Get new crises via push notifications.</li>"); strbuffer.append("<li>Manage your App via " + "<a href='http://www.sigimera.org/mobile_devices'>" + "<span style='color: #00FFFF'>mobile device management" + "website </span></a>."); strbuffer.append("</ul>"); strbuffer.append("<p>© 2013 <a href='http://www.sigimera.com'>" + "<span style='color: #00FFFF'>Sigimera Ltd.</span></a>. " + "All rights reserved.</p>"); wv.loadData(strbuffer.toString(), "text/html", "utf-8"); dialog.setView(wv); dialog.show(); }
From source file:com.njlabs.amrita.aid.landing.Landing.java
public void checkForUpdates() { OkHttpClient client = new OkHttpClient.Builder().followRedirects(true).followSslRedirects(true).build(); Request.Builder request = new Request.Builder().url("https://api.codezero.xyz/aid/latest"); client.newCall(request.build()).enqueue(new Callback() { @Override//from www. jav a 2 s.c o m public void onFailure(Call call, IOException e) { Ln.e(e); } @Override public void onResponse(Call call, final Response rawResponse) throws IOException { final String responseString = rawResponse.body().string(); ((Activity) baseContext).runOnUiThread(new Runnable() { @Override public void run() { JSONObject response; try { response = new JSONObject(responseString); String status = ""; status = response.getString("status"); if (status.equals("ok")) { Double Latest = 0.0; String Description = null; try { Latest = response.getDouble("version"); Description = response.getString("description"); } catch (JSONException e) { FirebaseCrash.report(e); } if (Latest > BuildConfig.VERSION_CODE) { AlertDialog.Builder updateDialogBuilder = new AlertDialog.Builder(Landing.this); LayoutInflater factory = LayoutInflater.from(Landing.this); final View changelogView = factory.inflate(R.layout.webview_dialog, null); LinearLayout WebViewDialogLayout = (LinearLayout) changelogView .findViewById(R.id.WebViewDialogLayout); WebViewDialogLayout.setPadding(5, 5, 5, 5); WebView changelogWebView = (WebView) changelogView .findViewById(R.id.LicensesView); changelogWebView.loadData(String.format("%s", Description), "text/html", "utf-8"); changelogWebView.setPadding(5, 5, 5, 5); changelogWebView.setBackgroundColor(0); changelogWebView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { return true; } }); changelogWebView.setLongClickable(false); updateDialogBuilder.setView(changelogView).setCancelable(true) .setCancelable(false) .setNegativeButton("Dismiss", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }) .setPositiveButton("Update Now", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Uri uri = Uri .parse("market://details?id=com.njlabs.amrita.aid"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); } }); AlertDialog alert = updateDialogBuilder.create(); alert.setTitle("Update Available"); alert.setIcon(R.mipmap.ic_launcher); alert.show(); } } } catch (Exception e) { Ln.e(e); } } }); } }); }
From source file:com.yeldi.yeldibazaar.FDroid.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case UPDATE_REPO: updateRepos();//from w w w .j a v a 2 s.co m return true; case MANAGE_REPO: Intent i = new Intent(this, ManageRepo.class); startActivityForResult(i, REQUEST_MANAGEREPOS); return true; case PREFERENCES: Intent prefs = new Intent(getBaseContext(), PreferencesActivity.class); startActivityForResult(prefs, REQUEST_PREFS); return true; case SEARCH: onSearchRequested(); return true; case ABOUT: LayoutInflater li = LayoutInflater.from(this); View view = li.inflate(R.layout.about, null); // Fill in the version... TextView tv = (TextView) view.findViewById(R.id.version); PackageManager pm = getPackageManager(); try { PackageInfo pi = pm.getPackageInfo(getApplicationContext().getPackageName(), 0); tv.setText(pi.versionName); } catch (Exception e) { } Builder p = new AlertDialog.Builder(this).setView(view); final AlertDialog alrt = p.create(); alrt.setIcon(R.drawable.icon); alrt.setTitle(getString(R.string.about_title)); alrt.setButton(AlertDialog.BUTTON_NEUTRAL, getString(R.string.about_website), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Uri uri = Uri.parse("https://f-droid.org"); startActivity(new Intent(Intent.ACTION_VIEW, uri)); } }); alrt.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alrt.show(); return true; } return super.onOptionsItemSelected(item); }