Search in sources :

Example 16 with MaterialAlertDialogBuilder

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;
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder)

Example 17 with MaterialAlertDialogBuilder

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;
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) DialogInterface(android.content.DialogInterface) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder)

Example 18 with MaterialAlertDialogBuilder

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();
    }
}
Also used : StoragePathProvider(org.odk.collect.android.storage.StoragePathProvider) Bundle(android.os.Bundle) AlertDialog(androidx.appcompat.app.AlertDialog) KeyEvent(android.view.KeyEvent) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder) Uri(android.net.Uri) WindowManager(android.view.WindowManager) IconMenuListAdapter(org.odk.collect.android.adapters.IconMenuListAdapter) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DialogUtils(org.odk.collect.android.utilities.DialogUtils) ImmutableList(com.google.common.collect.ImmutableList) DrawView(org.odk.collect.android.views.DrawView) FloatingActionButton(com.google.android.material.floatingactionbutton.FloatingActionButton) ActivityInfo(android.content.pm.ActivityInfo) R(org.odk.collect.android.R) View(android.view.View) ImageFileUtils(org.odk.collect.android.utilities.ImageFileUtils) Canvas(android.graphics.Canvas) AnimationUtils(org.odk.collect.android.utilities.AnimationUtils) AdapterView(android.widget.AdapterView) IconMenuItem(org.odk.collect.android.adapters.model.IconMenuItem) CardView(androidx.cardview.widget.CardView) FileOutputStream(java.io.FileOutputStream) File(java.io.File) FileNotFoundException(java.io.FileNotFoundException) Timber(timber.log.Timber) List(java.util.List) Bitmap(android.graphics.Bitmap) OvershootInterpolator(android.view.animation.OvershootInterpolator) ListView(android.widget.ListView) Activity(android.app.Activity) ColorPickerView(com.rarepebble.colorpicker.ColorPickerView) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder) ColorPickerView(com.rarepebble.colorpicker.ColorPickerView)

Example 19 with MaterialAlertDialogBuilder

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();
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) FormController(org.odk.collect.android.javarosawrapper.FormController) DialogInterface(android.content.DialogInterface) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder)

Example 20 with MaterialAlertDialogBuilder

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();
}
Also used : LayoutInflater(android.view.LayoutInflater) View(android.view.View) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder) NonNull(androidx.annotation.NonNull)

Aggregations

MaterialAlertDialogBuilder (com.google.android.material.dialog.MaterialAlertDialogBuilder)69 NonNull (androidx.annotation.NonNull)36 View (android.view.View)32 AlertDialog (androidx.appcompat.app.AlertDialog)32 Bundle (android.os.Bundle)29 Nullable (androidx.annotation.Nullable)24 R (org.thoughtcrime.securesms.R)22 Context (android.content.Context)20 TextView (android.widget.TextView)18 Log (org.signal.core.util.logging.Log)16 LayoutInflater (android.view.LayoutInflater)15 Toast (android.widget.Toast)15 DialogInterface (android.content.DialogInterface)14 Intent (android.content.Intent)14 R (org.odk.collect.android.R)14 Dialog (android.app.Dialog)11 DialogFragment (androidx.fragment.app.DialogFragment)11 Resources (android.content.res.Resources)10 SignalStore (org.thoughtcrime.securesms.keyvalue.SignalStore)10 ViewUtil (org.thoughtcrime.securesms.util.ViewUtil)10