Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog ok button constraints #1720

Merged
merged 3 commits into from
May 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,8 @@ public static void showInsertSnippetDialog(final Activity activity, final Callba
dopt.data = data;
dopt.isSearchEnabled = true;
dopt.titleText = R.string.insert_snippet;
dopt.okButtonText = 0;
dopt.messageText = Html.fromHtml("<small><small>" + folder.getAbsolutePath() + "</small></small>");
dopt.callback = (key) -> callback.callback(FileUtils.readTextFileFast(texts.get(key)).first);
dopt.positionCallback = (ind) -> callback.callback(FileUtils.readTextFileFast(texts.get(data.get(ind.get(0)))).first);
SearchOrCustomTextDialog.showMultiChoiceDialogWithSearchFilterUI(activity, dopt);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ public static void showMultiChoiceDialogWithSearchFilterUI(final Activity activi

// =========================================================================================

// Ok button action
if (((dopt.callback != null) || (dopt.isMultiSelectEnabled)) && dopt.okButtonText != 0) {
// Ok button only present under these circumstances
if (((dopt.callback != null && dopt.isSearchEnabled) || (dopt.positionCallback != null && dopt.isMultiSelectEnabled))) {
dialogBuilder.setPositiveButton(dopt.okButtonText, (dialogInterface, i) -> {
final String searchText = dopt.isSearchEnabled ? searchEditText.getText().toString() : null;
if (dopt.positionCallback != null && !listAdapter._selectedItems.isEmpty()) {
Expand Down