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

The following examples show how to use com.afollestad.materialdialogs.MaterialDialog#show() . 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: GeneralDialogCreation.java    From PowerFileExplorer with GNU General Public License v3.0 6 votes vote down vote up
public static void showHiddenDialog(DataUtils dataUtils, Futils utils, final ContentFragment m, AppTheme appTheme) {
    int accentColor = m.activity.getColorPreference().getColor(ColorUsage.ACCENT);
    final MaterialDialog.Builder a = new MaterialDialog.Builder(m.activity);
    a.positiveText(R.string.cancel);
    a.positiveColor(accentColor);
    a.title(R.string.hiddenfiles);
    a.theme(appTheme.getMaterialDialogTheme());
    a.autoDismiss(true);
    HiddenAdapter adapter = new HiddenAdapter(m.activity, m, utils, R.layout.bookmarkrow,
								  toHFileArray(dataUtils.getHiddenfiles()), null, false);
    a.adapter(adapter, null);
    a.dividerColor(Color.GRAY);
    MaterialDialog x= a.build();
    adapter.updateDialog(x);
    x.show();

}
 
Example 2
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 3
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 4
Source File: MainActivityHelper.java    From PowerFileExplorer with GNU General Public License v3.0 6 votes vote down vote up
private void mk(@StringRes int newText, final OnClickMaterialListener l) {
     final MaterialDialog materialDialog = GeneralDialogCreation.showNameDialog(mainActivity,
																	   new String[]{mainActivity.getResources().getString(R.string.entername),
																		   "",
																		   mainActivity.getResources().getString(newText),
																		   mainActivity.getResources().getString(R.string.create),
																		   mainActivity.getResources().getString(R.string.cancel),
																		   null});

     materialDialog.getActionButton(DialogAction.POSITIVE).setOnClickListener(new View.OnClickListener() {
	@Override
	public void onClick(View v) {
		l.onClick(materialDialog);
	}
});
     materialDialog.show();
 }
 
Example 5
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 6
Source File: ShareTask.java    From PowerFileExplorer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onPostExecute(Void v) {
    if (!targetShareIntents.isEmpty()) {
        MaterialDialog.Builder builder = new MaterialDialog.Builder(contextc);
        builder.title(R.string.share);
        builder.theme(appTheme.getMaterialDialogTheme());
        ShareAdapter shareAdapter = new ShareAdapter(contextc, targetShareIntents, arrayList1, arrayList2);
        builder.adapter(shareAdapter, null);
        builder.negativeText(R.string.cancel);
        builder.negativeColor(fab_skin);
        MaterialDialog b = builder.build();
        shareAdapter.updateMatDialog(b);
        b.show();
    } else {
        Toast.makeText(contextc, R.string.noappfound, Toast.LENGTH_SHORT).show();
    }
}
 
Example 7
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 8
Source File: DialogHelper.java    From matlog with GNU General Public License v3.0 5 votes vote down vote up
public static void startRecordingWithProgressDialog(final String filename,
                                                    final String filterQuery, final String logLevel, final Runnable onPostExecute, final Context context) {

    final MaterialDialog progressDialog = new MaterialDialog.Builder(context)
            .title(R.string.dialog_please_wait)
            .content(R.string.dialog_initializing_recorder)
            .progress(true, -1)
            .build();

    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);

    final Handler handler = new Handler(Looper.getMainLooper());
    progressDialog.show();
    new Thread(() -> {
        ServiceHelper.startBackgroundServiceIfNotAlreadyRunning(context, filename, filterQuery, logLevel);
        handler.post(() -> {
            if (progressDialog.isShowing()) {
                progressDialog.dismiss();
            }
            if (onPostExecute != null) {
                onPostExecute.run();
            }
        });
    }).start();

}
 
Example 9
Source File: FoldersPref.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
private void loadDeleteDialog(final PathSwitchPreference p) {
    int fab_skin = activity.getColorPreference().getColor(ColorUsage.ACCENT);

    final MaterialDialog dialog = new MaterialDialog.Builder(getActivity())
            .title(R.string.questiondelete_shortcut)
            .theme(activity.getAppTheme().getMaterialDialogTheme())
            .positiveColor(fab_skin)
            .positiveText(getString(R.string.delete).toUpperCase())// TODO: 29/4/2017 don't use toUpperCase()
            .negativeColor(fab_skin)
            .negativeText(android.R.string.cancel)
            .build();

    dialog.getActionButton(DialogAction.POSITIVE)
            .setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    getPreferenceScreen().removePreference(p);
                    currentValue.remove((int) position.get(p).intValue());

                    dataUtils.removeBook(position.get(p).intValue());

                    AppConfig.runInBackground(new Runnable() {
                        @Override
                        public void run() {
                            utilsHandler.removeBookmarksPath(p.getTitle().toString(),
                                    p.getSummary().toString());
                        }
                    });
                    dialog.dismiss();
                }
            });

    dialog.show();
}
 
Example 10
Source File: DialogHelper.java    From 4pdaClient-plus with Apache License 2.0 5 votes vote down vote up
public static void showCommentDialog(Context context, String comment, String name) {
    MaterialDialog dialog = new MaterialDialog.Builder(context)
            .cancelable(true)
            .title(name)
            .content(comment)
            .negativeText(R.string.close)
            .build();

    dialog.show();
}
 
Example 11
Source File: CreditsFragment.java    From wallpaperboard 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_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();
    ButterKnife.bind(this, dialog);
    return dialog;
}
 
Example 12
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 13
Source File: DialogHelper.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public static void startRecordingWithProgressDialog(final String filename,
                                                    final String filterQuery, final String logLevel, final Runnable onPostExecute, final Context context) {

    final MaterialDialog progressDialog = new MaterialDialog.Builder(context)
            .title(R.string.dialog_please_wait)
            .content(R.string.dialog_initializing_recorder)
            .progress(true, -1)
            .build();

    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);

    final Handler handler = new Handler(Looper.getMainLooper());
    progressDialog.show();
    new Thread(new Runnable() {
        @Override
        public void run() {
            ServiceHelper.startBackgroundServiceIfNotAlreadyRunning(context, filename, filterQuery, logLevel);
            handler.post(new Runnable() {
                @Override
                public void run() {
                    if (progressDialog.isShowing()) {
                        progressDialog.dismiss();
                    }
                    if (onPostExecute != null) {
                        onPostExecute.run();
                    }
                }
            });
        }
    }).start();

}
 
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: FilterFragment.java    From wallpaperboard 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.typeface(TypefaceHelper.getMedium(getActivity()), TypefaceHelper.getRegular(getActivity()));
    builder.customView(R.layout.fragment_filter, false);
    MaterialDialog dialog = builder.build();
    dialog.show();

    ButterKnife.bind(this, dialog);
    mTitle.setText(mIsMuzei ? R.string.muzei_category : R.string.wallpaper_filter);
    mMenuSelect.setOnClickListener(this);
    return dialog;
}
 
Example 16
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 17
Source File: DialogHelper.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public static void startRecordingWithProgressDialog(final String filename,
                                                    final String filterQuery, final String logLevel, final Runnable onPostExecute, final Context context) {

    final MaterialDialog progressDialog = new MaterialDialog.Builder(context)
            .title(R.string.dialog_please_wait)
            .content(R.string.dialog_initializing_recorder)
            .progress(true, -1)
            .build();

    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);

    final Handler handler = new Handler(Looper.getMainLooper());
    progressDialog.show();
    new Thread(new Runnable() {
        @Override
        public void run() {
            ServiceHelper.startBackgroundServiceIfNotAlreadyRunning(context, filename, filterQuery, logLevel);
            handler.post(new Runnable() {
                @Override
                public void run() {
                    if (progressDialog.isShowing()) {
                        progressDialog.dismiss();
                    }
                    if (onPostExecute != null) {
                        onPostExecute.run();
                    }
                }
            });
        }
    }).start();

}
 
Example 18
Source File: LogcatActivity.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
private void showAddFilterDialog(final FilterAdapter filterAdapter) {

        // show a popup to add a new filter text
        LayoutInflater inflater = getLayoutInflater();
        @SuppressLint("InflateParams")
        final AutoCompleteTextView editText =
                (AutoCompleteTextView) inflater.inflate(R.layout.dialog_new_filter, null, false);

        // show suggestions as the user types
        List<String> suggestions = new ArrayList<>(mSearchSuggestionsSet);
        SortedFilterArrayAdapter<String> suggestionAdapter = new SortedFilterArrayAdapter<>(
                this, R.layout.list_item_dropdown, suggestions);
        editText.setAdapter(suggestionAdapter);

        final MaterialDialog alertDialog = new MaterialDialog.Builder(this)
                .title(R.string.add_filter)
                .positiveText(android.R.string.ok)
                .onPositive(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                        handleNewFilterText(editText.getText().toString(), filterAdapter);
                        dialog.dismiss();
                    }
                })
                .negativeText(android.R.string.cancel)
                .customView(editText, true)
                .build();

        // when 'Done' is clicked (i.e. enter button), do the same as when "OK" is clicked
        editText.setOnEditorActionListener(new OnEditorActionListener() {

            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    // dismiss soft keyboard

                    handleNewFilterText(editText.getText().toString(), filterAdapter);

                    alertDialog.dismiss();
                    return true;
                }
                return false;
            }
        });

        alertDialog.show();

        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(editText, 0);

    }
 
Example 19
Source File: UI.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
public static MaterialDialog popupWait(final Activity a, final int title) {
    final int id = INVALID_RESOURCE_ID;
    final MaterialDialog dialog = popup(a, title, id).progress(true, 0).build();
    dialog.show();
    return dialog;
}
 
Example 20
Source File: AppearanceSettingsFragment.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 4 votes vote down vote up
public void onClickThemeColor(View view) {
	MaterialDialog themeChooserDialog = DialogService.getThemeDialog(getActivity());
	themeChooserDialog.show();
}