Java Code Examples for com.google.android.material.dialog.MaterialAlertDialogBuilder#setTitle()
The following examples show how to use
com.google.android.material.dialog.MaterialAlertDialogBuilder#setTitle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterMapContributeActivity.java From intra42 with Apache License 2.0 | 6 votes |
/** * Callback method to be invoked when an item in this Recycler has * been clicked. */ @Override public void onItemClicked(final int position, Cluster item) { MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this); String[] str = new String[]{ getString(R.string.cluster_map_contribute_button_edit_metadata), getString(R.string.cluster_map_contribute_button_edit_layout) }; builder.setItems(str, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (which == 0) openEditMetadataDialog(clusters.get(position)); else if (which == 1) ClusterMapContributeEditActivity.openIt(ClusterMapContributeActivity.this, clusters.get(position)); } }); builder.setTitle(clusters.get(position).name); builder.show(); }
Example 2
Source File: ClusterMapContributeEditActivity.java From intra42 with Apache License 2.0 | 6 votes |
public void onClickControllerDeleteRowCol(final boolean finalIsRow, final LocationWrapper wrapper) { if (wrapper == null) return; final MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(this); alert.setTitle(R.string.cluster_map_contribute_dialog_delete_title); if (finalIsRow) alert.setMessage(app.getString(R.string.cluster_map_contribute_dialog_delete_message_row, wrapper.y)); else alert.setMessage(app.getString(R.string.cluster_map_contribute_dialog_delete_message_col, wrapper.x)); alert.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (finalIsRow) deleteRow(wrapper.y); else deleteColumn(wrapper.x); refreshMap(); } }); alert.setNegativeButton(R.string.cancel, null); alert.show(); }
Example 3
Source File: SearchActivity.java From NClientV2 with Apache License 2.0 | 5 votes |
private void addDialog(){ MaterialAlertDialogBuilder builder=new MaterialAlertDialogBuilder(this); builder.setView(autoComplete); autoComplete.setText(""); builder.setPositiveButton(R.string.ok, (dialog, which) -> createChip()); builder.setCancelable(true).setNegativeButton(R.string.cancel,null); builder.setTitle(R.string.insert_tag_name); try{ alertDialog=builder.show(); }catch (IllegalStateException e){//the autoComplete is still attached to another View ((ViewGroup)autoComplete.getParent()).removeView(autoComplete); alertDialog=builder.show(); } }
Example 4
Source File: VersionChecker.java From NClientV2 with Apache License 2.0 | 5 votes |
private void createDialog(String versionName, String latestVersion, String finalBody){ if(finalBody==null)return; finalBody=finalBody .replace("\r\n","\n")//Remove ugly newline .replace("NClientV2 "+latestVersion,"")//remove version header .replaceAll("(\\s*\n\\s*)+","\n")//remove multiple newline .replaceAll("\\(.*\\)","").trim();//remove things between () LogUtility.d("Evaluated: "+finalBody); LogUtility.d("Creating dialog"); MaterialAlertDialogBuilder builder=new MaterialAlertDialogBuilder(context); LogUtility.d(""+context); builder.setTitle(R.string.new_version_found); builder.setIcon(R.drawable.ic_file_download); builder.setMessage(context.getString(R.string.update_version_format,versionName,latestVersion,finalBody)); builder.setPositiveButton(R.string.install, (dialog, which) -> { if(Global.hasStoragePermission(context)) downloadVersion(latestVersion); else{ latest=latestVersion; context.runOnUiThread(()-> context.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.READ_EXTERNAL_STORAGE},2)); } }).setNegativeButton(R.string.cancel,null) .setNeutralButton(R.string.github, (dialog, which) -> { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(LATEST_RELEASE_URL)); context.startActivity(browserIntent); }); if(!context.isFinishing())builder.show(); }
Example 5
Source File: BoardItemListFragment.java From mimi-reader with Apache License 2.0 | 5 votes |
private void showAddBoardDialog() { if (getActivity() == null) { return; } final MaterialAlertDialogBuilder alertBuilder = new MaterialAlertDialogBuilder(getActivity()); final EditText input = new EditText(getActivity()); input.setHint(R.string.board_name_input_hint); input.setSingleLine(); input.setImeOptions(EditorInfo.IME_ACTION_DONE); alertBuilder.setView(input); alertBuilder.setPositiveButton(R.string.add, (dialog, which) -> addBoard(input.getText().toString())); alertBuilder.setNegativeButton(R.string.cancel, (dialog, which) -> Log.v(LOG_TAG, "Cancelled adding a board")); alertBuilder.setTitle(R.string.add_board); AlertDialog d = alertBuilder.create(); d.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); d.show(); input.setOnEditorActionListener((v, actionId, event) -> { if (actionId == EditorInfo.IME_ACTION_DONE) { addBoard(input.getText().toString()); d.dismiss(); } return true; }); }
Example 6
Source File: ClusterMapContributeEditActivity.java From intra42 with Apache License 2.0 | 5 votes |
public void onClickController(final LocationWrapper wrapper) { boolean isRow = false; if (wrapper.x == cluster.width && wrapper.y == cluster.height) return; else if (wrapper.x == cluster.width) isRow = true; else if (wrapper.y == cluster.height) isRow = false; MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this); String[] action; if (isRow) { builder.setTitle(R.string.cluster_map_contribute_dialog_controller_title_row); action = new String[]{getString(R.string.cluster_map_contribute_dialog_controller_action_scale_row), getString(R.string.cluster_map_contribute_dialog_controller_action_delete_row)}; } else { builder.setTitle(R.string.cluster_map_contribute_dialog_controller_action_column); action = new String[]{getString(R.string.cluster_map_contribute_dialog_controller_action_scale_column), getString(R.string.cluster_map_contribute_dialog_controller_action_delete_column)}; } final boolean finalIsRow = isRow; builder.setItems(action, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (which == 0) onClickControllerScaleRowCol(finalIsRow, wrapper); else if (which == 1) { onClickControllerDeleteRowCol(finalIsRow, wrapper); } } }); builder.show(); }