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

fix(android): display title on Modals.showActions #2730

Merged
merged 1 commit into from
Apr 8, 2020
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 @@ -124,6 +124,7 @@ public void showActions(final PluginCall call) {
}

final ModalsBottomSheetDialogFragment fragment = new ModalsBottomSheetDialogFragment();
fragment.setTitle(title);
fragment.setOptions(options);
fragment.setCancelable(false);
fragment.setOnSelectedListener(new ModalsBottomSheetDialogFragment.OnSelectedListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ public interface OnSelectedListener {
void onSelected(int index);
}

private String title;
private JSArray options;

private OnSelectedListener listener;

public void setTitle(String title) {
this.title = title;
}
public void setOptions(JSArray options) {
this.options = options;
}
Expand Down Expand Up @@ -79,7 +83,11 @@ public void setupDialog(Dialog dialog, int style) {
LinearLayout layout = new LinearLayout(getContext());
layout.setOrientation(LinearLayout.VERTICAL);
layout.setPadding(layoutPaddingPx16, layoutPaddingPx16, layoutPaddingPx16, layoutPaddingPx16);

TextView ttv = new TextView(getContext());
ttv.setTextColor(Color.parseColor("#757575"));
ttv.setPadding(layoutPaddingPx8, layoutPaddingPx8, layoutPaddingPx8, layoutPaddingPx8);
ttv.setText(title);
layout.addView(ttv);
try {
List<Object> optionsList = options.toList();
for (int i = 0; i < optionsList.size(); i++) {
Expand Down
3 changes: 3 additions & 0 deletions core/src/core-plugin-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,9 @@ export interface ConfirmResult {

export interface ActionSheetOptions {
title: string;
/**
* iOS only
*/
message?: string;
options: ActionSheetOption[];
}
Expand Down