Skip to content

Commit

Permalink
fix(android): display title on Modals.showActions (#2730)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Apr 8, 2020
1 parent 8e1abfe commit c2e0358
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
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

0 comments on commit c2e0358

Please sign in to comment.