use of com.google.android.material.dialog.MaterialAlertDialogBuilder in project collect by opendatakit.
the class MaterialProgressDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
super.onCreateDialog(savedInstanceState);
dialogView = requireActivity().getLayoutInflater().inflate(R.layout.progress_dialog, null, false);
AlertDialog dialog = new MaterialAlertDialogBuilder(requireContext()).setView(dialogView).create();
setupView(dialog);
return dialog;
}
use of com.google.android.material.dialog.MaterialAlertDialogBuilder in project collect by opendatakit.
the class SplashClickListener method onPreferenceClick.
@Override
public boolean onPreferenceClick(Preference preference) {
// if you have a value, you can clear it or select new.
CharSequence cs = splashPathPreference.getSummary();
if (cs != null && cs.toString().contains("/")) {
final CharSequence[] items = { preferencesFragment.getString(R.string.select_another_image), preferencesFragment.getString(R.string.use_odk_default) };
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(preferencesFragment.getActivity());
builder.setTitle(preferencesFragment.getString(R.string.change_splash_path));
builder.setNeutralButton(preferencesFragment.getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
if (items[item].equals(preferencesFragment.getString(R.string.select_another_image))) {
launchImageChooser();
} else {
preferencesFragment.setSplashPath(preferencesFragment.getString(R.string.default_splash_path));
}
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
launchImageChooser();
}
return true;
}
use of com.google.android.material.dialog.MaterialAlertDialogBuilder in project collect by opendatakit.
the class DrawActivity method setColor.
private void setColor(View view) {
if (view.getVisibility() == View.VISIBLE) {
fabActions.performClick();
final ColorPickerView picker = new ColorPickerView(this);
picker.setColor(drawView.getColor());
picker.showAlpha(false);
picker.showHex(false);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setView(picker).setPositiveButton(R.string.ok, (dialog, which) -> drawView.setColor(picker.getColor())).show();
}
}
use of com.google.android.material.dialog.MaterialAlertDialogBuilder in project collect by opendatakit.
the class FormHierarchyActivity method createErrorDialog.
/**
* Creates and displays dialog with the given errorMsg.
*/
protected void createErrorDialog(String errorMsg) {
AlertDialog alertDialog = new MaterialAlertDialogBuilder(this).create();
alertDialog.setTitle(getString(R.string.error_occured));
alertDialog.setMessage(errorMsg);
DialogInterface.OnClickListener errorListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
switch(i) {
case DialogInterface.BUTTON_POSITIVE:
FormController formController = Collect.getInstance().getFormController();
formController.jumpToIndex(currentIndex);
break;
}
}
};
alertDialog.setCancelable(false);
alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.ok), errorListener);
alertDialog.show();
}
use of com.google.android.material.dialog.MaterialAlertDialogBuilder in project collect by opendatakit.
the class BackgroundAudioHelpDialogFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
LayoutInflater inflater = LayoutInflater.from(requireContext());
View view = inflater.inflate(R.layout.background_audio_help_fragment_layout, null);
return new MaterialAlertDialogBuilder(requireContext()).setView(view).setPositiveButton(R.string.ok, null).create();
}
Aggregations