capacitor-extended-dialog 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorExtendedDialog.podspec +1 -1
- package/README.md +55 -55
- package/android/build.gradle +9 -9
- package/android/src/main/java/com/albermonte/extendeddialog/DialogStyleOptions.java +3 -1
- package/android/src/main/java/com/albermonte/extendeddialog/ExtendedDialog.java +4 -0
- package/android/src/main/java/com/albermonte/extendeddialog/ExtendedDialogPlugin.java +4 -0
- package/android/src/main/java/com/albermonte/extendeddialog/SheetBottomDialogFragment.java +69 -46
- package/dist/docs.json +85 -71
- package/dist/esm/definitions.d.ts +5 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js +27 -12
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +27 -12
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +27 -12
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/ExtendedDialogPlugin/ExtendedDialog.swift +9 -4
- package/ios/Sources/ExtendedDialogPlugin/ExtendedDialogPlugin.swift +4 -0
- package/ios/Sources/ExtendedDialogPlugin/FullScreenDialogViewController.swift +43 -2
- package/package.json +12 -12
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ npx cap sync
|
|
|
38
38
|
### alert(...)
|
|
39
39
|
|
|
40
40
|
```typescript
|
|
41
|
-
alert(options: AlertOptions) =>
|
|
41
|
+
alert(options: AlertOptions) => Promise<void>
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Show an alert dialog with a single dismiss button.
|
|
@@ -47,15 +47,13 @@ Show an alert dialog with a single dismiss button.
|
|
|
47
47
|
| ------------- | ----------------------------------------------------- | ------------------------------ |
|
|
48
48
|
| **`options`** | <code><a href="#alertoptions">AlertOptions</a></code> | - Alert configuration options. |
|
|
49
49
|
|
|
50
|
-
**Returns:** <code>any</code>
|
|
51
|
-
|
|
52
50
|
--------------------
|
|
53
51
|
|
|
54
52
|
|
|
55
53
|
### confirm(...)
|
|
56
54
|
|
|
57
55
|
```typescript
|
|
58
|
-
confirm(options: ConfirmOptions) =>
|
|
56
|
+
confirm(options: ConfirmOptions) => Promise<ConfirmResult>
|
|
59
57
|
```
|
|
60
58
|
|
|
61
59
|
Show a confirmation dialog with OK and Cancel buttons.
|
|
@@ -64,7 +62,7 @@ Show a confirmation dialog with OK and Cancel buttons.
|
|
|
64
62
|
| ------------- | --------------------------------------------------------- | -------------------------------- |
|
|
65
63
|
| **`options`** | <code><a href="#confirmoptions">ConfirmOptions</a></code> | - Confirm configuration options. |
|
|
66
64
|
|
|
67
|
-
**Returns:** <code>
|
|
65
|
+
**Returns:** <code>Promise<<a href="#confirmresult">ConfirmResult</a>></code>
|
|
68
66
|
|
|
69
67
|
--------------------
|
|
70
68
|
|
|
@@ -72,7 +70,7 @@ Show a confirmation dialog with OK and Cancel buttons.
|
|
|
72
70
|
### prompt(...)
|
|
73
71
|
|
|
74
72
|
```typescript
|
|
75
|
-
prompt(options: PromptOptions) =>
|
|
73
|
+
prompt(options: PromptOptions) => Promise<PromptResult>
|
|
76
74
|
```
|
|
77
75
|
|
|
78
76
|
Show a prompt dialog with a text input field.
|
|
@@ -81,7 +79,7 @@ Show a prompt dialog with a text input field.
|
|
|
81
79
|
| ------------- | ------------------------------------------------------- | ------------------------------- |
|
|
82
80
|
| **`options`** | <code><a href="#promptoptions">PromptOptions</a></code> | - Prompt configuration options. |
|
|
83
81
|
|
|
84
|
-
**Returns:** <code>
|
|
82
|
+
**Returns:** <code>Promise<<a href="#promptresult">PromptResult</a>></code>
|
|
85
83
|
|
|
86
84
|
--------------------
|
|
87
85
|
|
|
@@ -89,7 +87,7 @@ Show a prompt dialog with a text input field.
|
|
|
89
87
|
### singleSelect(...)
|
|
90
88
|
|
|
91
89
|
```typescript
|
|
92
|
-
singleSelect(options: SingleSelectOptions) =>
|
|
90
|
+
singleSelect(options: SingleSelectOptions) => Promise<SingleSelectResult>
|
|
93
91
|
```
|
|
94
92
|
|
|
95
93
|
Show a single-select dialog where the user picks one option.
|
|
@@ -98,7 +96,7 @@ Show a single-select dialog where the user picks one option.
|
|
|
98
96
|
| ------------- | ------------------------------------------------------------------- | -------------------------------------- |
|
|
99
97
|
| **`options`** | <code><a href="#singleselectoptions">SingleSelectOptions</a></code> | - Single select configuration options. |
|
|
100
98
|
|
|
101
|
-
**Returns:** <code>
|
|
99
|
+
**Returns:** <code>Promise<<a href="#singleselectresult">SingleSelectResult</a>></code>
|
|
102
100
|
|
|
103
101
|
--------------------
|
|
104
102
|
|
|
@@ -106,7 +104,7 @@ Show a single-select dialog where the user picks one option.
|
|
|
106
104
|
### multiSelect(...)
|
|
107
105
|
|
|
108
106
|
```typescript
|
|
109
|
-
multiSelect(options: MultiSelectOptions) =>
|
|
107
|
+
multiSelect(options: MultiSelectOptions) => Promise<MultiSelectResult>
|
|
110
108
|
```
|
|
111
109
|
|
|
112
110
|
Show a multi-select dialog where the user picks one or more options.
|
|
@@ -115,7 +113,7 @@ Show a multi-select dialog where the user picks one or more options.
|
|
|
115
113
|
| ------------- | ----------------------------------------------------------------- | ------------------------------------- |
|
|
116
114
|
| **`options`** | <code><a href="#multiselectoptions">MultiSelectOptions</a></code> | - Multi select configuration options. |
|
|
117
115
|
|
|
118
|
-
**Returns:** <code>
|
|
116
|
+
**Returns:** <code>Promise<<a href="#multiselectresult">MultiSelectResult</a>></code>
|
|
119
117
|
|
|
120
118
|
--------------------
|
|
121
119
|
|
|
@@ -123,7 +121,7 @@ Show a multi-select dialog where the user picks one or more options.
|
|
|
123
121
|
### sheet(...)
|
|
124
122
|
|
|
125
123
|
```typescript
|
|
126
|
-
sheet(options: SheetOptions) =>
|
|
124
|
+
sheet(options: SheetOptions) => Promise<SheetResult>
|
|
127
125
|
```
|
|
128
126
|
|
|
129
127
|
Show a sheet dialog with a header, title, and structured data rows.
|
|
@@ -132,7 +130,7 @@ Show a sheet dialog with a header, title, and structured data rows.
|
|
|
132
130
|
| ------------- | ----------------------------------------------------- | ------------------------------ |
|
|
133
131
|
| **`options`** | <code><a href="#sheetoptions">SheetOptions</a></code> | - Sheet configuration options. |
|
|
134
132
|
|
|
135
|
-
**Returns:** <code>
|
|
133
|
+
**Returns:** <code>Promise<<a href="#sheetresult">SheetResult</a>></code>
|
|
136
134
|
|
|
137
135
|
--------------------
|
|
138
136
|
|
|
@@ -140,7 +138,7 @@ Show a sheet dialog with a header, title, and structured data rows.
|
|
|
140
138
|
### messageSheet(...)
|
|
141
139
|
|
|
142
140
|
```typescript
|
|
143
|
-
messageSheet(options: MessageSheetOptions) =>
|
|
141
|
+
messageSheet(options: MessageSheetOptions) => Promise<MessageSheetResult>
|
|
144
142
|
```
|
|
145
143
|
|
|
146
144
|
Show a message sheet dialog with an optional header logo, title, and message.
|
|
@@ -149,7 +147,7 @@ Show a message sheet dialog with an optional header logo, title, and message.
|
|
|
149
147
|
| ------------- | ------------------------------------------------------------------- | -------------------------------------- |
|
|
150
148
|
| **`options`** | <code><a href="#messagesheetoptions">MessageSheetOptions</a></code> | - Message sheet configuration options. |
|
|
151
149
|
|
|
152
|
-
**Returns:** <code>
|
|
150
|
+
**Returns:** <code>Promise<<a href="#messagesheetresult">MessageSheetResult</a>></code>
|
|
153
151
|
|
|
154
152
|
--------------------
|
|
155
153
|
|
|
@@ -164,6 +162,13 @@ Show a message sheet dialog with an optional header logo, title, and message.
|
|
|
164
162
|
| **`buttonTitle`** | <code>string</code> | Title for the dismiss button. | <code>"OK"</code> |
|
|
165
163
|
|
|
166
164
|
|
|
165
|
+
#### ConfirmResult
|
|
166
|
+
|
|
167
|
+
| Prop | Type | Description |
|
|
168
|
+
| ----------- | -------------------- | ----------------------------------------------------------- |
|
|
169
|
+
| **`value`** | <code>boolean</code> | Whether the user confirmed (`true`) or cancelled (`false`). |
|
|
170
|
+
|
|
171
|
+
|
|
167
172
|
#### ConfirmOptions
|
|
168
173
|
|
|
169
174
|
| Prop | Type | Description | Default |
|
|
@@ -172,11 +177,12 @@ Show a message sheet dialog with an optional header logo, title, and message.
|
|
|
172
177
|
| **`cancelButtonTitle`** | <code>string</code> | Title for the cancel button. | <code>"Cancel"</code> |
|
|
173
178
|
|
|
174
179
|
|
|
175
|
-
####
|
|
180
|
+
#### PromptResult
|
|
176
181
|
|
|
177
|
-
| Prop
|
|
178
|
-
|
|
|
179
|
-
| **`value`**
|
|
182
|
+
| Prop | Type | Description |
|
|
183
|
+
| --------------- | -------------------- | -------------------------------------------------------- |
|
|
184
|
+
| **`value`** | <code>string</code> | The text entered by the user. Empty string if cancelled. |
|
|
185
|
+
| **`cancelled`** | <code>boolean</code> | Whether the user cancelled the dialog. |
|
|
180
186
|
|
|
181
187
|
|
|
182
188
|
#### PromptOptions
|
|
@@ -190,22 +196,22 @@ Show a message sheet dialog with an optional header logo, title, and message.
|
|
|
190
196
|
| **`focusInput`** | <code>boolean</code> | Whether to automatically focus the input field and open the keyboard when the dialog appears. Note: On iOS, basic (non-fullscreen) dialogs always auto-focus the input field due to UIAlertController's built-in behavior. This option only takes effect on iOS when using fullscreen mode (`mode: 'fullscreen'`). On Android and web, this works for all modes. | <code>false</code> |
|
|
191
197
|
|
|
192
198
|
|
|
193
|
-
####
|
|
199
|
+
#### SingleSelectResult
|
|
194
200
|
|
|
195
|
-
| Prop | Type
|
|
196
|
-
| --------------- |
|
|
197
|
-
| **`value`** | <code>string</code>
|
|
198
|
-
| **`cancelled`** | <code>boolean</code>
|
|
201
|
+
| Prop | Type | Description |
|
|
202
|
+
| --------------- | --------------------------- | --------------------------------------------------------- |
|
|
203
|
+
| **`value`** | <code>string \| null</code> | The value of the selected option, or `null` if cancelled. |
|
|
204
|
+
| **`cancelled`** | <code>boolean</code> | Whether the user cancelled the dialog. |
|
|
199
205
|
|
|
200
206
|
|
|
201
207
|
#### SingleSelectOptions
|
|
202
208
|
|
|
203
|
-
| Prop | Type
|
|
204
|
-
| ----------------------- |
|
|
205
|
-
| **`options`** | <code>
|
|
206
|
-
| **`selectedValue`** | <code>string</code>
|
|
207
|
-
| **`okButtonTitle`** | <code>string</code>
|
|
208
|
-
| **`cancelButtonTitle`** | <code>string</code>
|
|
209
|
+
| Prop | Type | Description | Default |
|
|
210
|
+
| ----------------------- | --------------------------- | ----------------------------------------- | --------------------- |
|
|
211
|
+
| **`options`** | <code>SelectOption[]</code> | List of options to display for selection. | |
|
|
212
|
+
| **`selectedValue`** | <code>string</code> | Value of the initially selected option. | |
|
|
213
|
+
| **`okButtonTitle`** | <code>string</code> | Title for the confirmation button. | <code>"OK"</code> |
|
|
214
|
+
| **`cancelButtonTitle`** | <code>string</code> | Title for the cancel button. | <code>"Cancel"</code> |
|
|
209
215
|
|
|
210
216
|
|
|
211
217
|
#### SelectOption
|
|
@@ -216,30 +222,29 @@ Show a message sheet dialog with an optional header logo, title, and message.
|
|
|
216
222
|
| **`value`** | <code>string</code> | Value returned when the option is selected. |
|
|
217
223
|
|
|
218
224
|
|
|
219
|
-
####
|
|
225
|
+
#### MultiSelectResult
|
|
220
226
|
|
|
221
|
-
| Prop | Type
|
|
222
|
-
| --------------- |
|
|
223
|
-
| **`
|
|
224
|
-
| **`cancelled`** | <code>boolean</code>
|
|
227
|
+
| Prop | Type | Description |
|
|
228
|
+
| --------------- | --------------------- | ------------------------------------------------------------- |
|
|
229
|
+
| **`values`** | <code>string[]</code> | The values of the selected options. Empty array if cancelled. |
|
|
230
|
+
| **`cancelled`** | <code>boolean</code> | Whether the user cancelled the dialog. |
|
|
225
231
|
|
|
226
232
|
|
|
227
233
|
#### MultiSelectOptions
|
|
228
234
|
|
|
229
|
-
| Prop | Type
|
|
230
|
-
| ----------------------- |
|
|
231
|
-
| **`options`** | <code>
|
|
232
|
-
| **`selectedValues`** | <code>
|
|
233
|
-
| **`okButtonTitle`** | <code>string</code>
|
|
234
|
-
| **`cancelButtonTitle`** | <code>string</code>
|
|
235
|
+
| Prop | Type | Description | Default |
|
|
236
|
+
| ----------------------- | --------------------------- | ----------------------------------------- | --------------------- |
|
|
237
|
+
| **`options`** | <code>SelectOption[]</code> | List of options to display for selection. | |
|
|
238
|
+
| **`selectedValues`** | <code>string[]</code> | Values of the initially selected options. | |
|
|
239
|
+
| **`okButtonTitle`** | <code>string</code> | Title for the confirmation button. | <code>"OK"</code> |
|
|
240
|
+
| **`cancelButtonTitle`** | <code>string</code> | Title for the cancel button. | <code>"Cancel"</code> |
|
|
235
241
|
|
|
236
242
|
|
|
237
|
-
####
|
|
243
|
+
#### SheetResult
|
|
238
244
|
|
|
239
|
-
| Prop | Type | Description
|
|
240
|
-
| --------------- | -------------------- |
|
|
241
|
-
| **`
|
|
242
|
-
| **`cancelled`** | <code>boolean</code> | Whether the user cancelled the dialog. |
|
|
245
|
+
| Prop | Type | Description |
|
|
246
|
+
| --------------- | -------------------- | ------------------------------------- |
|
|
247
|
+
| **`confirmed`** | <code>boolean</code> | True if confirmed, false if cancelled |
|
|
243
248
|
|
|
244
249
|
|
|
245
250
|
#### SheetOptions
|
|
@@ -248,7 +253,8 @@ Show a message sheet dialog with an optional header logo, title, and message.
|
|
|
248
253
|
| ------------------------ | ------------------------------------------------- | -------------------------------------------------------- |
|
|
249
254
|
| **`headerLogo`** | <code>string</code> | Header logo - supports base64 data URL or HTTP/HTTPS URL |
|
|
250
255
|
| **`title`** | <code>string</code> | Sheet title |
|
|
251
|
-
| **`
|
|
256
|
+
| **`subtitle`** | <code>string</code> | Optional subtitle displayed between title and rows |
|
|
257
|
+
| **`rows`** | <code>SheetRow[]</code> | Description rows |
|
|
252
258
|
| **`confirmButtonTitle`** | <code>string</code> | Confirm button title |
|
|
253
259
|
| **`cancelButtonTitle`** | <code>string</code> | Cancel button title |
|
|
254
260
|
| **`mode`** | <code><a href="#dialogmode">DialogMode</a></code> | Dialog mode |
|
|
@@ -263,7 +269,7 @@ Show a message sheet dialog with an optional header logo, title, and message.
|
|
|
263
269
|
| **`value`** | <code>string</code> | Optional value displayed on the right |
|
|
264
270
|
|
|
265
271
|
|
|
266
|
-
####
|
|
272
|
+
#### MessageSheetResult
|
|
267
273
|
|
|
268
274
|
| Prop | Type | Description |
|
|
269
275
|
| --------------- | -------------------- | ------------------------------------- |
|
|
@@ -276,19 +282,13 @@ Show a message sheet dialog with an optional header logo, title, and message.
|
|
|
276
282
|
| ------------------------ | ------------------------------------------------- | -------------------------------------------------------- |
|
|
277
283
|
| **`headerLogo`** | <code>string</code> | Header logo - supports base64 data URL or HTTP/HTTPS URL |
|
|
278
284
|
| **`title`** | <code>string</code> | Sheet title |
|
|
285
|
+
| **`subtitle`** | <code>string</code> | Optional subtitle displayed between title and message |
|
|
279
286
|
| **`message`** | <code>string</code> | Message body displayed in the sheet |
|
|
280
287
|
| **`confirmButtonTitle`** | <code>string</code> | Confirm button title |
|
|
281
288
|
| **`cancelButtonTitle`** | <code>string</code> | Cancel button title |
|
|
282
289
|
| **`mode`** | <code><a href="#dialogmode">DialogMode</a></code> | Dialog mode |
|
|
283
290
|
|
|
284
291
|
|
|
285
|
-
#### MessageSheetResult
|
|
286
|
-
|
|
287
|
-
| Prop | Type | Description |
|
|
288
|
-
| --------------- | -------------------- | ------------------------------------- |
|
|
289
|
-
| **`confirmed`** | <code>boolean</code> | True if confirmed, false if cancelled |
|
|
290
|
-
|
|
291
|
-
|
|
292
292
|
### Type Aliases
|
|
293
293
|
|
|
294
294
|
|
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
@@ -11,18 +11,18 @@ buildscript {
|
|
|
11
11
|
mavenCentral()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
apply plugin: 'com.android.library'
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
|
-
namespace "com.albermonte.extendeddialog"
|
|
22
|
-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
21
|
+
namespace = "com.albermonte.extendeddialog"
|
|
22
|
+
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
23
23
|
defaultConfig {
|
|
24
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
26
26
|
versionCode 1
|
|
27
27
|
versionName "1.0"
|
|
28
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -34,7 +34,7 @@ android {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
lintOptions {
|
|
37
|
-
abortOnError false
|
|
37
|
+
abortOnError = false
|
|
38
38
|
}
|
|
39
39
|
compileOptions {
|
|
40
40
|
sourceCompatibility JavaVersion.VERSION_21
|
|
@@ -171,7 +171,9 @@ public class DialogStyleOptions {
|
|
|
171
171
|
options.messageFontSize = bundle.containsKey(KEY_MESSAGE_FONT_SIZE) ? bundle.getFloat(KEY_MESSAGE_FONT_SIZE) : null;
|
|
172
172
|
options.buttonFontSize = bundle.containsKey(KEY_BUTTON_FONT_SIZE) ? bundle.getFloat(KEY_BUTTON_FONT_SIZE) : null;
|
|
173
173
|
options.contentButtonSpacing = bundle.containsKey(KEY_CONTENT_BUTTON_SPACING) ? bundle.getFloat(KEY_CONTENT_BUTTON_SPACING) : null;
|
|
174
|
-
options.headerLogoCornerRadius = bundle.containsKey(KEY_HEADER_LOGO_CORNER_RADIUS)
|
|
174
|
+
options.headerLogoCornerRadius = bundle.containsKey(KEY_HEADER_LOGO_CORNER_RADIUS)
|
|
175
|
+
? bundle.getFloat(KEY_HEADER_LOGO_CORNER_RADIUS)
|
|
176
|
+
: null;
|
|
175
177
|
return options;
|
|
176
178
|
}
|
|
177
179
|
}
|
|
@@ -744,6 +744,7 @@ public class ExtendedDialog {
|
|
|
744
744
|
public void showSheet(
|
|
745
745
|
Activity activity,
|
|
746
746
|
String title,
|
|
747
|
+
String subtitle,
|
|
747
748
|
String headerLogo,
|
|
748
749
|
JSONArray rows,
|
|
749
750
|
String confirmButtonTitle,
|
|
@@ -760,6 +761,7 @@ public class ExtendedDialog {
|
|
|
760
761
|
fragmentActivity.runOnUiThread(() -> {
|
|
761
762
|
SheetBottomDialogFragment fragment = SheetBottomDialogFragment.newInstance(
|
|
762
763
|
title,
|
|
764
|
+
subtitle,
|
|
763
765
|
headerLogo,
|
|
764
766
|
rows.toString(),
|
|
765
767
|
confirmButtonTitle != null ? confirmButtonTitle : "Confirm",
|
|
@@ -775,6 +777,7 @@ public class ExtendedDialog {
|
|
|
775
777
|
public void showMessageSheet(
|
|
776
778
|
Activity activity,
|
|
777
779
|
String title,
|
|
780
|
+
String subtitle,
|
|
778
781
|
String message,
|
|
779
782
|
String headerLogo,
|
|
780
783
|
String confirmButtonTitle,
|
|
@@ -791,6 +794,7 @@ public class ExtendedDialog {
|
|
|
791
794
|
fragmentActivity.runOnUiThread(() -> {
|
|
792
795
|
SheetBottomDialogFragment fragment = SheetBottomDialogFragment.newMessageInstance(
|
|
793
796
|
title,
|
|
797
|
+
subtitle,
|
|
794
798
|
headerLogo,
|
|
795
799
|
message,
|
|
796
800
|
confirmButtonTitle != null ? confirmButtonTitle : "Confirm",
|
|
@@ -211,6 +211,7 @@ public class ExtendedDialogPlugin extends Plugin {
|
|
|
211
211
|
@PluginMethod
|
|
212
212
|
public void sheet(PluginCall call) {
|
|
213
213
|
String title = call.getString("title");
|
|
214
|
+
String subtitle = call.getString("subtitle");
|
|
214
215
|
String headerLogo = call.getString("headerLogo");
|
|
215
216
|
JSArray rowsArray = call.getArray("rows");
|
|
216
217
|
String confirmButtonTitle = call.getString("confirmButtonTitle");
|
|
@@ -235,6 +236,7 @@ public class ExtendedDialogPlugin extends Plugin {
|
|
|
235
236
|
implementation.showSheet(
|
|
236
237
|
getActivity(),
|
|
237
238
|
title,
|
|
239
|
+
subtitle,
|
|
238
240
|
headerLogo,
|
|
239
241
|
rows,
|
|
240
242
|
confirmButtonTitle,
|
|
@@ -255,6 +257,7 @@ public class ExtendedDialogPlugin extends Plugin {
|
|
|
255
257
|
@PluginMethod
|
|
256
258
|
public void messageSheet(PluginCall call) {
|
|
257
259
|
String title = call.getString("title");
|
|
260
|
+
String subtitle = call.getString("subtitle");
|
|
258
261
|
String message = call.getString("message");
|
|
259
262
|
String headerLogo = call.getString("headerLogo");
|
|
260
263
|
String confirmButtonTitle = call.getString("confirmButtonTitle");
|
|
@@ -276,6 +279,7 @@ public class ExtendedDialogPlugin extends Plugin {
|
|
|
276
279
|
implementation.showMessageSheet(
|
|
277
280
|
getActivity(),
|
|
278
281
|
title,
|
|
282
|
+
subtitle,
|
|
279
283
|
message,
|
|
280
284
|
headerLogo,
|
|
281
285
|
confirmButtonTitle,
|
|
@@ -49,6 +49,7 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
49
49
|
private static final String ARG_CONFIRM_BUTTON = "confirmButton";
|
|
50
50
|
private static final String ARG_CANCEL_BUTTON = "cancelButton";
|
|
51
51
|
private static final String ARG_FULLSCREEN = "fullscreen";
|
|
52
|
+
private static final String ARG_SUBTITLE = "subtitle";
|
|
52
53
|
private static final String ARG_IS_MESSAGE_SHEET = "isMessageSheet";
|
|
53
54
|
|
|
54
55
|
private ExtendedDialog.SheetCallback sheetCallback;
|
|
@@ -68,6 +69,7 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
68
69
|
|
|
69
70
|
public static SheetBottomDialogFragment newInstance(
|
|
70
71
|
String title,
|
|
72
|
+
String subtitle,
|
|
71
73
|
String headerLogo,
|
|
72
74
|
String rowsJson,
|
|
73
75
|
String confirmButton,
|
|
@@ -78,6 +80,7 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
78
80
|
SheetBottomDialogFragment fragment = new SheetBottomDialogFragment();
|
|
79
81
|
Bundle args = new Bundle();
|
|
80
82
|
args.putString(ARG_TITLE, title);
|
|
83
|
+
args.putString(ARG_SUBTITLE, subtitle);
|
|
81
84
|
args.putString(ARG_HEADER_LOGO, headerLogo);
|
|
82
85
|
args.putString(ARG_ROWS, rowsJson);
|
|
83
86
|
args.putString(ARG_CONFIRM_BUTTON, confirmButton);
|
|
@@ -93,6 +96,7 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
93
96
|
|
|
94
97
|
public static SheetBottomDialogFragment newMessageInstance(
|
|
95
98
|
String title,
|
|
99
|
+
String subtitle,
|
|
96
100
|
String headerLogo,
|
|
97
101
|
String message,
|
|
98
102
|
String confirmButton,
|
|
@@ -103,6 +107,7 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
103
107
|
SheetBottomDialogFragment fragment = new SheetBottomDialogFragment();
|
|
104
108
|
Bundle args = new Bundle();
|
|
105
109
|
args.putString(ARG_TITLE, title);
|
|
110
|
+
args.putString(ARG_SUBTITLE, subtitle);
|
|
106
111
|
args.putString(ARG_HEADER_LOGO, headerLogo);
|
|
107
112
|
args.putString(ARG_MESSAGE, message);
|
|
108
113
|
args.putString(ARG_CONFIRM_BUTTON, confirmButton);
|
|
@@ -144,6 +149,7 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
String title = args.getString(ARG_TITLE, "");
|
|
152
|
+
String subtitle = args.getString(ARG_SUBTITLE);
|
|
147
153
|
String headerLogo = args.getString(ARG_HEADER_LOGO);
|
|
148
154
|
String rowsJson = args.getString(ARG_ROWS);
|
|
149
155
|
String message = args.getString(ARG_MESSAGE, "");
|
|
@@ -225,12 +231,14 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
225
231
|
}
|
|
226
232
|
if (radiusPx > 0) {
|
|
227
233
|
logoView.setClipToOutline(true);
|
|
228
|
-
logoView.setOutlineProvider(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
logoView.setOutlineProvider(
|
|
235
|
+
new android.view.ViewOutlineProvider() {
|
|
236
|
+
@Override
|
|
237
|
+
public void getOutline(android.view.View view, android.graphics.Outline outline) {
|
|
238
|
+
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), radiusPx);
|
|
239
|
+
}
|
|
232
240
|
}
|
|
233
|
-
|
|
241
|
+
);
|
|
234
242
|
}
|
|
235
243
|
|
|
236
244
|
headerLayout.addView(logoView);
|
|
@@ -256,17 +264,40 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
256
264
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
257
265
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
|
258
266
|
);
|
|
259
|
-
titleParams.bottomMargin = (int) (20 * density);
|
|
267
|
+
titleParams.bottomMargin = (subtitle != null && !subtitle.isEmpty()) ? (int) (4 * density) : (int) (20 * density);
|
|
260
268
|
titleView.setLayoutParams(titleParams);
|
|
261
269
|
headerLayout.addView(titleView);
|
|
262
270
|
}
|
|
271
|
+
|
|
272
|
+
// Subtitle
|
|
273
|
+
if (subtitle != null && !subtitle.isEmpty()) {
|
|
274
|
+
TextView subtitleView = new TextView(ctx);
|
|
275
|
+
subtitleView.setText(subtitle);
|
|
276
|
+
TextViewCompat.setTextAppearance(subtitleView, com.google.android.material.R.style.TextAppearance_Material3_BodyMedium);
|
|
277
|
+
if (styleOptions.getMessageColor() != null) {
|
|
278
|
+
subtitleView.setTextColor(styleOptions.getMessageColor());
|
|
279
|
+
} else {
|
|
280
|
+
int secondaryColor = MaterialColors.getColor(ctx, android.R.attr.textColorSecondary, 0xFF49454F);
|
|
281
|
+
subtitleView.setTextColor(secondaryColor);
|
|
282
|
+
}
|
|
283
|
+
if (styleOptions.getMessageFontSize() != null) {
|
|
284
|
+
subtitleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, styleOptions.getMessageFontSize());
|
|
285
|
+
}
|
|
286
|
+
subtitleView.setGravity(Gravity.CENTER);
|
|
287
|
+
LinearLayout.LayoutParams subtitleParams = new LinearLayout.LayoutParams(
|
|
288
|
+
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
289
|
+
LinearLayout.LayoutParams.WRAP_CONTENT
|
|
290
|
+
);
|
|
291
|
+
subtitleParams.bottomMargin = (int) (20 * density);
|
|
292
|
+
subtitleView.setLayoutParams(subtitleParams);
|
|
293
|
+
headerLayout.addView(subtitleView);
|
|
294
|
+
}
|
|
263
295
|
rootLayout.addView(headerLayout);
|
|
264
296
|
|
|
265
297
|
// ScrollView for body content (rows/message only)
|
|
266
298
|
scrollView = new ScrollView(ctx);
|
|
267
299
|
scrollView.setFillViewport(true);
|
|
268
|
-
scrollView.setLayoutParams(new LinearLayout.LayoutParams(
|
|
269
|
-
ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f));
|
|
300
|
+
scrollView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f));
|
|
270
301
|
|
|
271
302
|
bodyLayout = new LinearLayout(ctx);
|
|
272
303
|
bodyLayout.setOrientation(LinearLayout.VERTICAL);
|
|
@@ -279,9 +310,7 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
279
310
|
int messagePadding = (int) (16 * density);
|
|
280
311
|
messageContainer.setPadding(messagePadding, messagePadding, messagePadding, messagePadding);
|
|
281
312
|
|
|
282
|
-
ShapeAppearanceModel messageShape = ShapeAppearanceModel.builder()
|
|
283
|
-
.setAllCornerSizes(12 * density)
|
|
284
|
-
.build();
|
|
313
|
+
ShapeAppearanceModel messageShape = ShapeAppearanceModel.builder().setAllCornerSizes(12 * density).build();
|
|
285
314
|
MaterialShapeDrawable messageBackground = new MaterialShapeDrawable(messageShape);
|
|
286
315
|
int surfaceVariant = MaterialColors.getColor(ctx, com.google.android.material.R.attr.colorSurfaceVariant, 0xFFE7E0EC);
|
|
287
316
|
messageBackground.setFillColor(ColorStateList.valueOf(surfaceVariant));
|
|
@@ -449,21 +478,23 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
449
478
|
// Prevent dragging down in fullscreen mode
|
|
450
479
|
behavior.setDraggable(false);
|
|
451
480
|
setExpandedButtonOffset(true);
|
|
452
|
-
behavior.addBottomSheetCallback(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
481
|
+
behavior.addBottomSheetCallback(
|
|
482
|
+
new BottomSheetBehavior.BottomSheetCallback() {
|
|
483
|
+
@Override
|
|
484
|
+
public void onStateChanged(@NonNull View sheet, int newState) {
|
|
485
|
+
if (newState == BottomSheetBehavior.STATE_EXPANDED) {
|
|
486
|
+
setExpandedButtonOffset(true);
|
|
487
|
+
setRootHeight(getVisibleSheetHeight(sheet));
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
@Override
|
|
492
|
+
public void onSlide(@NonNull View sheet, float slideOffset) {
|
|
456
493
|
setExpandedButtonOffset(true);
|
|
457
494
|
setRootHeight(getVisibleSheetHeight(sheet));
|
|
458
495
|
}
|
|
459
496
|
}
|
|
460
|
-
|
|
461
|
-
@Override
|
|
462
|
-
public void onSlide(@NonNull View sheet, float slideOffset) {
|
|
463
|
-
setExpandedButtonOffset(true);
|
|
464
|
-
setRootHeight(getVisibleSheetHeight(sheet));
|
|
465
|
-
}
|
|
466
|
-
});
|
|
497
|
+
);
|
|
467
498
|
bottomSheet.post(() -> setRootHeight(getVisibleSheetHeight(bottomSheet)));
|
|
468
499
|
} else {
|
|
469
500
|
// Multi-stop bottom sheet: drag up to fullscreen, drag down to dismiss
|
|
@@ -476,30 +507,27 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
476
507
|
behavior.setHideable(true);
|
|
477
508
|
behavior.setDraggable(true);
|
|
478
509
|
|
|
479
|
-
behavior.addBottomSheetCallback(
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
newState == BottomSheetBehavior.STATE_HALF_EXPANDED ||
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
setRootHeight(getVisibleSheetHeight(sheet));
|
|
510
|
+
behavior.addBottomSheetCallback(
|
|
511
|
+
new BottomSheetBehavior.BottomSheetCallback() {
|
|
512
|
+
@Override
|
|
513
|
+
public void onStateChanged(@NonNull View sheet, int newState) {
|
|
514
|
+
if (newState == BottomSheetBehavior.STATE_HALF_EXPANDED || newState == BottomSheetBehavior.STATE_EXPANDED) {
|
|
515
|
+
setExpandedButtonOffset(newState == BottomSheetBehavior.STATE_EXPANDED);
|
|
516
|
+
setRootHeight(getVisibleSheetHeight(sheet));
|
|
517
|
+
}
|
|
488
518
|
}
|
|
489
|
-
}
|
|
490
519
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
520
|
+
@Override
|
|
521
|
+
public void onSlide(@NonNull View sheet, float slideOffset) {
|
|
522
|
+
setExpandedButtonOffset(slideOffset >= 0.9f);
|
|
523
|
+
setRootHeight(getVisibleSheetHeight(sheet));
|
|
524
|
+
}
|
|
495
525
|
}
|
|
496
|
-
|
|
526
|
+
);
|
|
497
527
|
|
|
498
528
|
bottomSheet.post(() -> {
|
|
499
529
|
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
|
500
|
-
int width = bottomSheet.getWidth() > 0
|
|
501
|
-
? bottomSheet.getWidth()
|
|
502
|
-
: getResources().getDisplayMetrics().widthPixels;
|
|
530
|
+
int width = bottomSheet.getWidth() > 0 ? bottomSheet.getWidth() : getResources().getDisplayMetrics().widthPixels;
|
|
503
531
|
|
|
504
532
|
int widthSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY);
|
|
505
533
|
int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
|
@@ -592,12 +620,7 @@ public class SheetBottomDialogFragment extends BottomSheetDialogFragment {
|
|
|
592
620
|
}
|
|
593
621
|
int expandedExtraBottomPadding = applyExpandedButtonOffset ? buttonExpandedExtraPaddingPx : 0;
|
|
594
622
|
int resolvedBottomPadding = buttonBottomBasePaddingPx + buttonBottomInsetsPx + expandedExtraBottomPadding;
|
|
595
|
-
buttonContainer.setPadding(
|
|
596
|
-
buttonHorizontalPaddingPx,
|
|
597
|
-
buttonTopPaddingPx,
|
|
598
|
-
buttonHorizontalPaddingPx,
|
|
599
|
-
resolvedBottomPadding
|
|
600
|
-
);
|
|
623
|
+
buttonContainer.setPadding(buttonHorizontalPaddingPx, buttonTopPaddingPx, buttonHorizontalPaddingPx, resolvedBottomPadding);
|
|
601
624
|
}
|
|
602
625
|
|
|
603
626
|
private LinearLayout createSheetRow(
|