List of usage examples for android.app AlertDialog.Builder setTitle
@Override public void setTitle(CharSequence title)
From source file:net.internetTelephone.program.project.init.create.ProjectCreateFragment.java
@Click void projectIcon() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("").setCancelable(true).setItems(R.array.camera_gallery, (dialog, which) -> { if (which == 0) { camera();/*from w w w . j a v a 2s . co m*/ } else { photo(); } }).show(); }
From source file:com.microsoft.windowsazure.messaging.e2etestapp.MainActivity.java
/** * Creates a dialog and shows it/*from w w w . j av a 2s.co m*/ * * @param message * The dialog message * @param title * The dialog title */ private void createAndShowDialog(String message, String title) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(message); builder.setTitle(title); builder.create().show(); }
From source file:com.mendhak.gpslogger.common.PrefsIO.java
public Dialog ChooseFileDialog() { File myDir = new File(defPath); if (!myDir.exists()) return null; Utilities.LogDebug("Asking user the file to use for import of settings"); File[] enumeratedFiles = myDir.listFiles(new FilenameFilter() { @Override/*w w w. j a va 2s .c o m*/ public boolean accept(File dir, String name) { return name.endsWith("." + extension); } }); final int len = enumeratedFiles.length; List<String> fileList = new ArrayList<String>(len); for (File f : enumeratedFiles) { fileList.add(f.getName()); } fileList.add(context.getString(R.string.Browse)); final String[] files = fileList.toArray(new String[fileList.size()]); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(context.getString(R.string.SelectFile)); builder.setItems(files, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (item < len) { curFileName = defPath + File.separator + files[item]; ImportFile(); } else BrowseFile(); } }); builder.setCancelable(true); return builder.create(); }
From source file:com.coinblesk.client.backup.BackupDialogFragment.java
private void backup() { final File backupFile = newWalletBackupFile(); final String password = txtPassword.getText().toString(); Preconditions.checkState(password.equals(txtPasswordAgain.getText().toString()) && password.length() > 0); clearPasswordInput();// w w w .jav a2 s.co m Writer fileOut = null; try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ZipOutputStream zos = new ZipOutputStream(baos); Log.i(TAG, "Backup file: " + backupFile); // assemble all content to backup addFilesToZip(zos); // encrypt zip bytes and write to file zos.close(); byte[] plainBackup = baos.toByteArray(); String encryptedBackup = EncryptionUtils.encrypt(plainBackup, password.toCharArray()); fileOut = new OutputStreamWriter(new FileOutputStream(backupFile), Charsets.UTF_8); fileOut.write(encryptedBackup); fileOut.flush(); Log.i(TAG, "Wallet backup finished. File = [" + backupFile + "], size = " + backupFile.length() + "bytes, exists = " + backupFile.exists()); // ask user whether he wants backup file as mail attachment showBackupCompletedDialog(backupFile); } catch (Exception e) { Log.w(TAG, "Could not write to file", e); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.fragment_backup_failed_title) .setMessage(getString(R.string.fragment_backup_failed_message) + ": " + e.getMessage()) .setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }).create().show(); } finally { if (fileOut != null) { try { fileOut.close(); } catch (IOException e) { Log.i(TAG, "Could not close output stream"); } } } }
From source file:com.mendhak.gpslogger.common.PrefsIO.java
public void AskFileName() { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.AskFileName); final EditText input = new EditText(context); input.setInputType(InputType.TYPE_CLASS_TEXT); int pos = curFileName.lastIndexOf(File.separator) + 1; String filename = ""; if (pos > 0) filename = curFileName.substring(pos); pos = filename.lastIndexOf(extension); if (pos > 1) input.setText(filename.substring(0, pos - 1)); else/*from w w w . ja v a2 s.c om*/ input.setText(defFileName); Utilities.LogDebug("Asking user the filename to use for export of settings"); builder.setView(input); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String str = input.getText().toString(); String fname = ""; if (str.length() > 0) fname = str.replaceAll(filter, ""); if (fname.length() != 0) { curFileName = defPath + File.separator + fname + "." + extension; ExportFile(); } } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); }
From source file:com.sourcey.materiallogindemo.PostItemActivity.java
private void DialogMap() { View dialogBoxView = View.inflate(this, R.layout.activity_map, null); final WebView map = (WebView) dialogBoxView.findViewById(R.id.webView); String url = getString(R.string.url_map) + "index.php?poinFrom=" + strStart + "&poinTo=" + strEnd; map.getSettings().setLoadsImagesAutomatically(true); map.getSettings().setJavaScriptEnabled(true); map.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); map.loadUrl(url);//from w ww.j ava 2 s . c o m AlertDialog.Builder builderInOut = new AlertDialog.Builder(this); builderInOut.setTitle("?"); builderInOut.setMessage("").setView(dialogBoxView).setCancelable(false) .setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).show(); }
From source file:com.bt.heliniumstudentapp.UpdateClass.java
protected UpdateClass(final Activity context, boolean settings) { UpdateClass.context = context;//from ww w . j a v a2s. c o m this.settings = settings; final AlertDialog.Builder updateDialogBuilder = new AlertDialog.Builder( new ContextThemeWrapper(context, MainActivity.themeDialog)); updateDialogBuilder.setTitle(R.string.update_checking); updateDialogBuilder.setNegativeButton(R.string.cancel, null); updateDialogBuilder.setPositiveButton(R.string.update, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //FIXME Come on, don't do this up here ActivityCompat.requestPermissions(context, new String[] { Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE }, 1); //TODO See warning //FIXME Great, now everything is protected... } }); updateDialogBuilder.setView(R.layout.dialog_update); updateDialog = updateDialogBuilder.create(); updateDialog.setCanceledOnTouchOutside(true); if (settings) { updateDialog.show(); updateDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); updateDialog.getButton(AlertDialog.BUTTON_POSITIVE) .setTextColor(ContextCompat.getColor(context, MainActivity.accentPrimaryColor)); updateDialog.getButton(AlertDialog.BUTTON_NEGATIVE) .setTextColor(ContextCompat.getColor(context, MainActivity.accentSecondaryColor)); } }
From source file:net.coding.program.project.init.create.ProjectCreateFragment.java
@Click void projectIcon() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("").setCancelable(true).setItems(R.array.camera_gallery, new DialogInterface.OnClickListener() { @Override// w w w . j ava 2 s.c o m public void onClick(DialogInterface dialog, int which) { if (which == 0) { camera(); } else { photo(); } } }); AlertDialog dialog = builder.create(); dialog.show(); CustomDialog.dialogTitleLineColor(getActivity(), dialog); }
From source file:com.intel.xdk.notification.Notification.java
public void confirm(String message, final String iden, String title, String ok, String cancel) { if (bConfirmBusy) { final String js = "javascript:var e = document.createEvent('Events');e.initEvent('intel.xdk.notification.confirm.busy',true,true);e.success=false;e.message='busy';e.id='" + iden + "';document.dispatchEvent(e);"; activity.runOnUiThread(new Runnable() { public void run() { webView.loadUrl(js);//from www . j ava2 s . c o m } }); return; } bConfirmBusy = true; if (title == null || title.length() == 0) title = "Please confirm"; if (ok == null || ok.length() == 0) ok = "OK"; if (cancel == null || cancel.length() == 0) cancel = "Cancel"; AlertDialog.Builder alertBldr = new AlertDialog.Builder(activity); alertBldr.setCancelable(false); alertBldr.setMessage(message); alertBldr.setTitle(title); alertBldr.setPositiveButton(ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { processConfirm(true, iden); } }); alertBldr.setNegativeButton(cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { processConfirm(false, iden); } }); alertBldr.show(); }
From source file:com.linkedin.android.eventsapp.EventFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final String eventNameArg = getArguments().getString(EXTRA_EVENT_NAME); final long eventDateArg = getArguments().getLong(EXTRA_EVENT_DATE); final String eventLocationArg = getArguments().getString(EXTRA_EVENT_LOCATION); int pictureIdArg = getArguments().getInt(EXTRA_PICTURE_ID); boolean isAttendingArg = getArguments().getBoolean(EXTRA_EVENT_ATTENDING); Person[] attendeesArg = (Person[]) getArguments().getParcelableArray(EXTRA_EVENT_ATTENDEES); SimpleDateFormat dateFormat = new SimpleDateFormat("E dd MMM yyyy 'at' hh:00 a"); final String dateString = dateFormat.format(new Date(eventDateArg)); View v = inflater.inflate(R.layout.layout_event_fragment, container, false); boolean accessTokenValid = LISessionManager.getInstance(getActivity()).getSession().isValid(); if (!accessTokenValid) { ViewStub linkedinLogin = (ViewStub) v.findViewById(R.id.connectWithLinkedInStub); linkedinLogin.inflate();/* ww w. ja va 2s . c o m*/ Button loginButton = (Button) v.findViewById(R.id.connectWithLinkedInButton); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i(TAG, "clicked login button"); LISessionManager.getInstance(getActivity()).init(getActivity(), Constants.scope, new AuthListener() { @Override public void onAuthSuccess() { Intent intent = new Intent(getActivity(), MainActivity.class); startActivity(intent); getActivity().finish(); } @Override public void onAuthError(LIAuthError error) { } }, false); } }); } TextView eventNameView = (TextView) v.findViewById(R.id.eventName); eventNameView.setText(eventNameArg); TextView eventLocationAndDateView = (TextView) v.findViewById(R.id.eventLocationAndDate); eventLocationAndDateView.setText(eventLocationArg + " " + dateString); TextView eventAttendeeCount = (TextView) v.findViewById(R.id.attendeeCount); eventAttendeeCount.setText("Other Attendees (" + attendeesArg.length + ")"); ImageView eventImageView = (ImageView) v.findViewById(R.id.eventImage); eventImageView.setImageResource(pictureIdArg); final Button attendButton = (Button) v.findViewById(R.id.attendButton); final Button declineButton = (Button) v.findViewById(R.id.declineButton); if (isAttendingArg) { attendButton.setText("Attending"); attendButton.setEnabled(false); declineButton.setText("Decline"); declineButton.setEnabled(true); } attendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((Button) v).setText("Attending"); v.setEnabled(false); declineButton.setText("Decline"); declineButton.setEnabled(true); if (LISessionManager.getInstance(getActivity()).getSession().isValid()) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); alertDialogBuilder.setTitle("Share on LinkedIn?"); alertDialogBuilder.setCancelable(true) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { JSONObject shareObject = new JSONObject(); try { JSONObject visibilityCode = new JSONObject(); visibilityCode.put("code", "anyone"); shareObject.put("visibility", visibilityCode); shareObject.put("comment", "I am attending " + eventNameArg + " in " + eventLocationArg + " on " + dateString); } catch (JSONException e) { } APIHelper.getInstance(getActivity()).postRequest(getActivity(), Constants.shareBaseUrl, shareObject, new ApiListener() { @Override public void onApiSuccess(ApiResponse apiResponse) { Toast.makeText(getActivity(), "Your share was successful!", Toast.LENGTH_LONG); } @Override public void onApiError(LIApiError apiError) { Log.e(TAG, apiError.toString()); Toast.makeText(getActivity(), "Your share was unsuccessful. Try again later!", Toast.LENGTH_LONG); } }); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } } }); declineButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((Button) v).setText("Declined"); v.setEnabled(false); attendButton.setText("Attend"); attendButton.setEnabled(true); } }); ListView attendeesListView = (ListView) v.findViewById(R.id.attendeesList); AttendeeAdapter adapter = new AttendeeAdapter(getActivity(), R.layout.attendee_list_item, attendeesArg, accessTokenValid); attendeesListView.setAdapter(adapter); attendeesListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ArrayAdapter adapter = (ArrayAdapter) parent.getAdapter(); Person person = (Person) adapter.getItem(position); Intent intent = new Intent(getActivity(), ProfileActivity.class); Bundle extras = new Bundle(); extras.putParcelable("person", person); intent.putExtras(extras); startActivity(intent); } }); return v; }