Java Code Examples for com.afollestad.materialdialogs.MaterialDialog#ListCallbackSingleChoice
The following examples show how to use
com.afollestad.materialdialogs.MaterialDialog#ListCallbackSingleChoice .
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: DialogService.java From Twire with GNU General Public License v3.0 | 6 votes |
public static MaterialDialog getChooseStartUpPageDialog(Activity activity, String currentlySelectedPageTitle, MaterialDialog.ListCallbackSingleChoice listCallbackSingleChoice) { final Settings settings = new Settings(activity); @ArrayRes int arrayRessource = settings.isLoggedIn() ? R.array.StartupPages : R.array.StartupPagesNoLogin; int indexOfPage = 0; String[] androidStrings = activity.getResources().getStringArray(arrayRessource); for (int i = 0; i < androidStrings.length; i++) { if (androidStrings[i].equals(currentlySelectedPageTitle)) { indexOfPage = i; break; } } return getBaseThemedDialog(activity) .title(R.string.gen_start_page) .items(arrayRessource) .itemsCallbackSingleChoice(indexOfPage, listCallbackSingleChoice) .positiveText(R.string.ok) .negativeText(R.string.cancel) .onNegative((dialog, which) -> dialog.dismiss()) .build(); }
Example 2
Source File: DialogService.java From Twire with GNU General Public License v3.0 | 6 votes |
public static MaterialDialog getChooseCardSizeDialog(Activity activity, @StringRes int dialogTitle, String currentlySelected, MaterialDialog.ListCallbackSingleChoice callbackSingleChoice) { int indexOfPage = 0; String[] sizeTitles = activity.getResources().getStringArray(R.array.CardSizes); for (int i = 0; i < sizeTitles.length; i++) { if (sizeTitles[i].equals(currentlySelected)) { indexOfPage = i; break; } } return getBaseThemedDialog(activity) .title(dialogTitle) .itemsCallbackSingleChoice(indexOfPage, callbackSingleChoice) .items(sizeTitles) .positiveText(R.string.done) .build(); }
Example 3
Source File: DialogService.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 6 votes |
public static MaterialDialog getChooseCardSizeDialog(Activity activity, @StringRes int dialogTitle, String currentlySelected, MaterialDialog.ListCallbackSingleChoice callbackSingleChoice) { int indexOfPage = 0; String[] sizeTitles = activity.getResources().getStringArray(R.array.CardSizes); for (int i = 0; i < sizeTitles.length; i++) { if (sizeTitles[i].equals(currentlySelected)) { indexOfPage = i; break; } } return getBaseThemedDialog(activity) .title(dialogTitle) .itemsCallbackSingleChoice(indexOfPage, callbackSingleChoice) .items(sizeTitles) .positiveText(R.string.done) .build(); }
Example 4
Source File: DialogService.java From Twire with GNU General Public License v3.0 | 5 votes |
public static MaterialDialog getChooseChatSizeDialog(Activity activity, @StringRes int dialogTitle, @ArrayRes int array, int currentSize, MaterialDialog.ListCallbackSingleChoice callbackSingleChoice) { int indexOfPage = currentSize - 1; String[] sizeTitles = activity.getResources().getStringArray(array); return getBaseThemedDialog(activity) .title(dialogTitle) .itemsCallbackSingleChoice(indexOfPage, callbackSingleChoice) .items(sizeTitles) .positiveText(R.string.done) .build(); }
Example 5
Source File: MaterialDialogSupport.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
/** * 单选dialog * @param context * @param title * @param items * @param selectIndex * @param callback */ public static void openChoiceDialog(Context context, String title, String[] items, int selectIndex, MaterialDialog.ListCallbackSingleChoice callback) { new MaterialDialog.Builder(context) .title(title) .items(items) .itemsCallbackSingleChoice(selectIndex, callback) .positiveText(R.string.positive) .negativeText(R.string.cancel) .negativeColor(Color.parseColor("#9B9B9B")) .show(); }
Example 6
Source File: MaterialDialogSupport.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
/** * 单选dialog 加取消操作 * @param context * @param title * @param items * @param selectIndex * @param callback * @param negativeCallback */ public static void openChoiceDialog(Context context, String title, String[] items, int selectIndex, MaterialDialog.ListCallbackSingleChoice callback, MaterialDialog.SingleButtonCallback negativeCallback) { new MaterialDialog.Builder(context) .title(title) .items(items) .itemsCallbackSingleChoice(selectIndex, callback) .positiveText(R.string.positive) .negativeText(R.string.cancel) .onNegative(negativeCallback) .negativeColor(Color.parseColor("#9B9B9B")) .show(); }
Example 7
Source File: DialogService.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 5 votes |
public static MaterialDialog getChooseStartUpPageDialog(Activity activity, String currentlySelectedPageTitle, MaterialDialog.ListCallbackSingleChoice listCallbackSingleChoice) { final Settings settings = new Settings(activity); @ArrayRes int arrayRessource = settings.isLoggedIn() ? R.array.StartupPages : R.array.StartupPagesNoLogin; int indexOfPage = 0; String[] androidStrings = activity.getResources().getStringArray(arrayRessource); for (int i = 0; i < androidStrings.length; i++) { if (androidStrings[i].equals(currentlySelectedPageTitle)) { indexOfPage = i; break; } } return getBaseThemedDialog(activity) .title(R.string.gen_start_page) .items(arrayRessource) .itemsCallbackSingleChoice(indexOfPage, listCallbackSingleChoice) .positiveText(R.string.ok) .negativeText(R.string.cancel) .onNegative(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { dialog.dismiss(); } }) .build(); }
Example 8
Source File: DialogService.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 5 votes |
public static MaterialDialog getChooseChatSizeDialog(Activity activity, @StringRes int dialogTitle, @ArrayRes int array, int currentSize, MaterialDialog.ListCallbackSingleChoice callbackSingleChoice) { int indexOfPage = currentSize - 1; String[] sizeTitles = activity.getResources().getStringArray(array); return getBaseThemedDialog(activity) .title(dialogTitle) .itemsCallbackSingleChoice(indexOfPage, callbackSingleChoice) .items(sizeTitles) .positiveText(R.string.done) .build(); }