Java Code Examples for com.afollestad.materialdialogs.MaterialDialog#findViewById()

The following examples show how to use com.afollestad.materialdialogs.MaterialDialog#findViewById() . 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: ReportBugsHelper.java    From candybar with Apache License 2.0 6 votes vote down vote up
public static void prepareReportBugs(@NonNull Context context) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
    builder.customView(R.layout.dialog_report_bugs, true);
    builder.typeface(
            TypefaceHelper.getMedium(context),
            TypefaceHelper.getRegular(context));
    builder.positiveText(R.string.report_bugs_send);
    builder.negativeText(R.string.close);

    MaterialDialog dialog = builder.build();

    EditText editText = (EditText) dialog.findViewById(R.id.input_desc);
    TextInputLayout inputLayout = (TextInputLayout) dialog.findViewById(R.id.input_layout);

    dialog.getActionButton(DialogAction.POSITIVE).setOnClickListener(view -> {
        if (editText.getText().length() > 0) {
            inputLayout.setErrorEnabled(false);
            ReportBugsTask.start(context, editText.getText().toString(), AsyncTask.THREAD_POOL_EXECUTOR);
            dialog.dismiss();
            return;
        }

        inputLayout.setError(context.getResources().getString(R.string.report_bugs_desc_empty));
    });
    dialog.show();
}
 
Example 2
Source File: OtherAppsFragment.java    From candybar-library with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_other_apps, false);
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.title(R.string.home_more_apps_header);
    builder.positiveText(R.string.close);

    MaterialDialog dialog = builder.build();
    dialog.show();

    mListView = (ListView) dialog.findViewById(R.id.listview);
    return dialog;
}
 
Example 3
Source File: CreditsFragment.java    From candybar with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_credits, false);
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.title(getTitle(mType));
    builder.positiveText(R.string.close);

    MaterialDialog dialog = builder.build();
    dialog.show();
    mListView = (ListView) dialog.findViewById(R.id.listview);
    return dialog;
}
 
Example 4
Source File: IconPreviewFragment.java    From candybar with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog dialog = new MaterialDialog.Builder(getActivity())
            .customView(R.layout.fragment_icon_preview, false)
            .typeface(
                    TypefaceHelper.getMedium(getActivity()),
                    TypefaceHelper.getRegular(getActivity()))
            .positiveText(R.string.close)
            .build();

    dialog.show();

    mName = (TextView) dialog.findViewById(R.id.name);
    mIcon = (ImageView) dialog.findViewById(R.id.icon);
    return dialog;
}
 
Example 5
Source File: ChangelogFragment.java    From candybar with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.customView(R.layout.fragment_changelog, false);
    builder.positiveText(R.string.close);
    MaterialDialog dialog = builder.build();
    dialog.show();

    mChangelogList = (ListView) dialog.findViewById(R.id.changelog_list);
    mChangelogDate = (TextView) dialog.findViewById(R.id.changelog_date);
    mChangelogVersion = (TextView) dialog.findViewById(R.id.changelog_version);
    return dialog;
}
 
Example 6
Source File: OtherAppsFragment.java    From candybar with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_other_apps, false);
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.title(R.string.home_more_apps_header);
    builder.positiveText(R.string.close);

    MaterialDialog dialog = builder.build();
    dialog.show();

    mListView = (ListView) dialog.findViewById(R.id.listview);
    return dialog;
}
 
Example 7
Source File: LicensesFragment.java    From candybar with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_licenses, false);
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.title(R.string.about_open_source_licenses);
    builder.negativeText(R.string.close);
    MaterialDialog dialog = builder.build();
    dialog.show();

    mWebView = (WebView) dialog.findViewById(R.id.webview);
    return dialog;
}
 
Example 8
Source File: BaseFragment.java    From EdXposedManager with GNU General Public License v3.0 6 votes vote down vote up
private void showAlert(final String result) {
    if (Looper.myLooper() != Looper.getMainLooper()) {
        requireActivity().runOnUiThread(() -> showAlert(result));
        return;
    }

    MaterialDialog dialog = new MaterialDialog.Builder(requireActivity()).content(result).positiveText(R.string.ok).build();
    dialog.show();

    TextView txtMessage = (TextView) dialog
            .findViewById(android.R.id.message);
    try {
        txtMessage.setTextSize(14);
    } catch (NullPointerException ignored) {
    }
}
 
Example 9
Source File: ReportBugsHelper.java    From candybar-library with Apache License 2.0 6 votes vote down vote up
public static void prepareReportBugs(@NonNull Context context) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
    builder.customView(R.layout.dialog_report_bugs, true);
    builder.typeface(
            TypefaceHelper.getMedium(context),
            TypefaceHelper.getRegular(context));
    builder.positiveText(R.string.report_bugs_send);
    builder.negativeText(R.string.close);

    MaterialDialog dialog = builder.build();

    EditText editText = (EditText) dialog.findViewById(R.id.input_desc);
    TextInputLayout inputLayout = (TextInputLayout) dialog.findViewById(R.id.input_layout);

    dialog.getActionButton(DialogAction.POSITIVE).setOnClickListener(view -> {
        if (editText.getText().length() > 0) {
            inputLayout.setErrorEnabled(false);
            ReportBugsTask.start(context, editText.getText().toString(), AsyncTask.THREAD_POOL_EXECUTOR);
            dialog.dismiss();
            return;
        }

        inputLayout.setError(context.getResources().getString(R.string.report_bugs_desc_empty));
    });
    dialog.show();
}
 
Example 10
Source File: ChangelogFragment.java    From candybar-library with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.customView(R.layout.fragment_changelog, false);
    builder.positiveText(R.string.close);
    MaterialDialog dialog = builder.build();
    dialog.show();

    mChangelogList = (ListView) dialog.findViewById(R.id.changelog_list);
    mChangelogDate = (TextView) dialog.findViewById(R.id.changelog_date);
    mChangelogVersion = (TextView) dialog.findViewById(R.id.changelog_version);
    return dialog;
}
 
Example 11
Source File: CreditsFragment.java    From candybar-library with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_credits, false);
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.title(getTitle(mType));
    builder.positiveText(R.string.close);

    MaterialDialog dialog = builder.build();
    dialog.show();
    mListView = (ListView) dialog.findViewById(R.id.listview);
    return dialog;
}
 
Example 12
Source File: IconPreviewFragment.java    From candybar-library with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_icon_preview, false);
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.positiveText(R.string.close);
    MaterialDialog dialog = builder.build();
    dialog.show();

    mName = (TextView) dialog.findViewById(R.id.name);
    mIcon = (ImageView) dialog.findViewById(R.id.icon);
    return dialog;
}
 
Example 13
Source File: LicensesFragment.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_licenses, false);
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.title(R.string.about_open_source_licenses);
    MaterialDialog dialog = builder.build();
    dialog.show();

    mWebView = (WebView) dialog.findViewById(R.id.webview);
    return dialog;
}
 
Example 14
Source File: LanguagesFragment.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_languages, false);
    builder.typeface(TypefaceHelper.getMedium(getActivity()), TypefaceHelper.getRegular(getActivity()));
    builder.title(R.string.pref_language_header);
    MaterialDialog dialog = builder.build();
    dialog.show();

    mListView = (ListView) dialog.findViewById(R.id.listview);
    return dialog;
}
 
Example 15
Source File: IntentChooserFragment.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_intent_chooser, false);
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.positiveText(android.R.string.cancel);

    MaterialDialog dialog = builder.build();
    dialog.getActionButton(DialogAction.POSITIVE).setOnClickListener(view -> {
        if (mAdapter == null || mAdapter.isAsyncTaskRunning()) return;

        if (CandyBarApplication.sZipPath != null) {
            File file = new File(CandyBarApplication.sZipPath);
            if (file.exists()) {
                if (file.delete()) {
                    LogUtil.e(String.format("Intent chooser cancel: %s deleted", file.getName()));
                }
            }
        }

        RequestFragment.sSelectedRequests = null;
        CandyBarApplication.sRequestProperty = null;
        CandyBarApplication.sZipPath = null;
        dialog.dismiss();
    });
    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
    setCancelable(false);

    mIntentList = (ListView) dialog.findViewById(R.id.intent_list);
    mNoApp = (TextView) dialog.findViewById(R.id.intent_noapp);
    return dialog;
}
 
Example 16
Source File: LanguagesFragment.java    From candybar with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_languages, false);
    builder.typeface(TypefaceHelper.getMedium(getActivity()), TypefaceHelper.getRegular(getActivity()));
    builder.title(R.string.pref_language_header);
    builder.negativeText(R.string.close);
    MaterialDialog dialog = builder.build();
    dialog.show();

    mListView = (ListView) dialog.findViewById(R.id.listview);
    return dialog;
}
 
Example 17
Source File: IntentChooserFragment.java    From candybar with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_intent_chooser, false);
    builder.typeface(
            TypefaceHelper.getMedium(getActivity()),
            TypefaceHelper.getRegular(getActivity()));
    builder.positiveText(android.R.string.cancel);

    MaterialDialog dialog = builder.build();
    dialog.getActionButton(DialogAction.POSITIVE).setOnClickListener(view -> {
        if (mAdapter == null || mAdapter.isAsyncTaskRunning()) return;

        if (CandyBarApplication.sZipPath != null) {
            File file = new File(CandyBarApplication.sZipPath);
            if (file.exists()) {
                if (file.delete()) {
                    LogUtil.e(String.format("Intent chooser cancel: %s deleted", file.getName()));
                }
            }
        }

        RequestFragment.sSelectedRequests = null;
        CandyBarApplication.sRequestProperty = null;
        CandyBarApplication.sZipPath = null;
        dialog.dismiss();
    });
    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
    setCancelable(false);

    mIntentList = (ListView) dialog.findViewById(R.id.intent_list);
    mNoApp = (TextView) dialog.findViewById(R.id.intent_noapp);
    return dialog;
}
 
Example 18
Source File: IconShapeFragment.java    From candybar with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    builder.customView(R.layout.fragment_languages, false);
    builder.typeface(TypefaceHelper.getMedium(getActivity()), TypefaceHelper.getRegular(getActivity()));
    builder.title(R.string.icon_shape);
    builder.negativeText(R.string.close);
    MaterialDialog dialog = builder.build();
    dialog.show();

    mListView = (ListView) dialog.findViewById(R.id.listview);
    return dialog;
}