react-native-persona 2.9.2 → 2.9.3
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/README.md +0 -42
- package/RNPersonaInquiry2.podspec +1 -1
- package/android/build.gradle +1 -1
- package/package.json +1 -12
- package/bin/persona-tool +0 -3
- package/lib/commonjs/persona-tool/AndroidResourcePrinter.js +0 -462
- package/lib/commonjs/persona-tool/AndroidResourcePrinter.js.map +0 -1
- package/lib/commonjs/persona-tool/Config.js +0 -78
- package/lib/commonjs/persona-tool/Config.js.map +0 -1
- package/lib/commonjs/persona-tool/Theme.js +0 -188
- package/lib/commonjs/persona-tool/Theme.js.map +0 -1
- package/lib/commonjs/persona-tool/index.js +0 -31
- package/lib/commonjs/persona-tool/index.js.map +0 -1
- package/lib/commonjs/persona-tool/prompts.js +0 -42
- package/lib/commonjs/persona-tool/prompts.js.map +0 -1
- package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js +0 -74
- package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js.map +0 -1
- package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js +0 -40
- package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js.map +0 -1
- package/lib/module/persona-tool/AndroidResourcePrinter.js +0 -455
- package/lib/module/persona-tool/AndroidResourcePrinter.js.map +0 -1
- package/lib/module/persona-tool/Config.js +0 -70
- package/lib/module/persona-tool/Config.js.map +0 -1
- package/lib/module/persona-tool/Theme.js +0 -178
- package/lib/module/persona-tool/Theme.js.map +0 -1
- package/lib/module/persona-tool/index.js +0 -28
- package/lib/module/persona-tool/index.js.map +0 -1
- package/lib/module/persona-tool/prompts.js +0 -31
- package/lib/module/persona-tool/prompts.js.map +0 -1
- package/lib/module/persona-tool/tools/AndroidThemeGenerator.js +0 -66
- package/lib/module/persona-tool/tools/AndroidThemeGenerator.js.map +0 -1
- package/lib/module/persona-tool/tools/IosThemeInstructions.js +0 -32
- package/lib/module/persona-tool/tools/IosThemeInstructions.js.map +0 -1
- package/lib/typescript/persona-tool/AndroidResourcePrinter.d.ts +0 -35
- package/lib/typescript/persona-tool/Config.d.ts +0 -15
- package/lib/typescript/persona-tool/Theme.d.ts +0 -108
- package/lib/typescript/persona-tool/index.d.ts +0 -1
- package/lib/typescript/persona-tool/prompts.d.ts +0 -8
- package/lib/typescript/persona-tool/tools/AndroidThemeGenerator.d.ts +0 -5
- package/lib/typescript/persona-tool/tools/IosThemeInstructions.d.ts +0 -5
- package/src/persona-tool/AndroidResourcePrinter.ts +0 -652
- package/src/persona-tool/Config.ts +0 -86
- package/src/persona-tool/Theme.ts +0 -243
- package/src/persona-tool/index.ts +0 -30
- package/src/persona-tool/prompts.ts +0 -36
- package/src/persona-tool/tools/AndroidThemeGenerator.ts +0 -100
- package/src/persona-tool/tools/IosThemeInstructions.ts +0 -41
|
@@ -1,652 +0,0 @@
|
|
|
1
|
-
import { create as createXml } from 'xmlbuilder2';
|
|
2
|
-
import type { AndroidThemeObject } from './Theme';
|
|
3
|
-
import type { XMLBuilder } from 'xmlbuilder2/lib/interfaces';
|
|
4
|
-
|
|
5
|
-
class AndroidResourcePrinter {
|
|
6
|
-
theme: AndroidThemeObject;
|
|
7
|
-
root: XMLBuilder;
|
|
8
|
-
buttonDrawable: XMLBuilder;
|
|
9
|
-
buttonColor: XMLBuilder;
|
|
10
|
-
preprintQueue: (() => void)[] = [];
|
|
11
|
-
printQueue: (() => void)[] = [];
|
|
12
|
-
postPrintQueue: (() => void)[] = [];
|
|
13
|
-
|
|
14
|
-
constructor(theme: AndroidThemeObject) {
|
|
15
|
-
this.theme = theme;
|
|
16
|
-
this.root = createXml({ version: '1.0' }).ele('resources');
|
|
17
|
-
this.buttonDrawable = createXml({ version: '1.0' }).ele('selector', {
|
|
18
|
-
'xmlns:android': 'http://schemas.android.com/apk/res/android',
|
|
19
|
-
});
|
|
20
|
-
this.buttonColor = createXml({ version: '1.0' }).ele('selector', {
|
|
21
|
-
'xmlns:android': 'http://schemas.android.com/apk/res/android',
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
process() {
|
|
26
|
-
if (!this.hasTheme()) {
|
|
27
|
-
this.root = this.root.up();
|
|
28
|
-
} else {
|
|
29
|
-
this.print();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
style: this.root,
|
|
34
|
-
buttonDrawable: this.buttonDrawable,
|
|
35
|
-
buttonColor: this.buttonColor,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
private print() {
|
|
40
|
-
this.primaryColor();
|
|
41
|
-
this.accentColor();
|
|
42
|
-
this.darkPrimaryColor();
|
|
43
|
-
this.backgroundColor();
|
|
44
|
-
this.titleText();
|
|
45
|
-
this.bodyText();
|
|
46
|
-
this.footnoteText();
|
|
47
|
-
// this.formLabelText();
|
|
48
|
-
this.textField();
|
|
49
|
-
this.pickerText();
|
|
50
|
-
this.button();
|
|
51
|
-
this.progressColor();
|
|
52
|
-
this.successAsset();
|
|
53
|
-
this.failAsset();
|
|
54
|
-
this.loadingAnimationAsset();
|
|
55
|
-
this.selfieAnimationAsset();
|
|
56
|
-
|
|
57
|
-
this.preprintQueue.forEach((fn) => fn());
|
|
58
|
-
|
|
59
|
-
// Precreate some style namespaces
|
|
60
|
-
this.root = this.root
|
|
61
|
-
.ele('style', {
|
|
62
|
-
name: 'RN',
|
|
63
|
-
})
|
|
64
|
-
.up();
|
|
65
|
-
this.root = this.root
|
|
66
|
-
.ele('style', {
|
|
67
|
-
name: 'RN.Persona',
|
|
68
|
-
})
|
|
69
|
-
.up();
|
|
70
|
-
this.root = this.root
|
|
71
|
-
.ele('style', {
|
|
72
|
-
name: 'RN.Persona.Text',
|
|
73
|
-
})
|
|
74
|
-
.up();
|
|
75
|
-
this.root = this.root.ele('style', {
|
|
76
|
-
name: 'Persona.Inquiry2.Theme',
|
|
77
|
-
parent: 'Base.Persona.Inquiry2.Theme',
|
|
78
|
-
});
|
|
79
|
-
this.printQueue.forEach((fn) => fn());
|
|
80
|
-
this.root = this.root.up();
|
|
81
|
-
this.postPrintQueue.forEach((fn) => fn());
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
private hasTheme(): boolean {
|
|
85
|
-
return (
|
|
86
|
-
Object.keys(this.theme).length > 0 &&
|
|
87
|
-
Object.values(this.theme).filter(Boolean).length > 0
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private primaryColor() {
|
|
92
|
-
if (!this.theme.primaryColor) return;
|
|
93
|
-
|
|
94
|
-
this.printQueue.push(() => {
|
|
95
|
-
this.root = this.root
|
|
96
|
-
.ele('item', { name: 'colorPrimary' })
|
|
97
|
-
.txt(this.theme.primaryColor as string)
|
|
98
|
-
.up()
|
|
99
|
-
.txt(' ');
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
private accentColor() {
|
|
104
|
-
if (!this.theme.accentColor) return;
|
|
105
|
-
|
|
106
|
-
this.printQueue.push(() => {
|
|
107
|
-
this.root = this.root
|
|
108
|
-
.ele('item', { name: 'colorSecondary' })
|
|
109
|
-
.txt(this.theme.accentColor as string)
|
|
110
|
-
.up()
|
|
111
|
-
.txt(' ');
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private darkPrimaryColor() {
|
|
116
|
-
if (!this.theme.darkPrimaryColor) return;
|
|
117
|
-
|
|
118
|
-
this.printQueue.push(() => {
|
|
119
|
-
this.root = this.root
|
|
120
|
-
.ele('item', { name: 'colorPrimaryVariant' })
|
|
121
|
-
.txt(this.theme.darkPrimaryColor as string)
|
|
122
|
-
.up()
|
|
123
|
-
.txt(' ');
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
private backgroundColor() {
|
|
128
|
-
if (!this.theme.backgroundColor) return;
|
|
129
|
-
|
|
130
|
-
this.preprintQueue.push(() => {
|
|
131
|
-
this.root = this.root
|
|
132
|
-
.ele('color', { name: 'customPersonaBackgroundColor' })
|
|
133
|
-
.txt(this.theme.backgroundColor as string)
|
|
134
|
-
.up()
|
|
135
|
-
.txt(' ');
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
this.printQueue.push(() => {
|
|
139
|
-
this.root = this.root
|
|
140
|
-
.ele('item', { name: 'android:colorBackground' })
|
|
141
|
-
.txt('@color/customPersonaBackgroundColor')
|
|
142
|
-
.up()
|
|
143
|
-
.txt(' ');
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
private titleText() {
|
|
148
|
-
if (this.theme.titleTextColor || this.theme.titleTextFont) {
|
|
149
|
-
this.printQueue.push(() => {
|
|
150
|
-
this.root = this.root
|
|
151
|
-
.ele('item', { name: 'textAppearanceHeadline6' })
|
|
152
|
-
.txt('@style/RN.Persona.Text.Title')
|
|
153
|
-
.up();
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// Create a text appearance
|
|
157
|
-
this.postPrintQueue.push(() => {
|
|
158
|
-
this.root = this.root.ele('style', {
|
|
159
|
-
name: 'RN.Persona.Text.Title',
|
|
160
|
-
parent: 'Persona.Inquiry2.Text.Body',
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
if (this.theme.titleTextColor) {
|
|
164
|
-
this.root = this.root
|
|
165
|
-
.ele('item', { name: 'android:textColor' })
|
|
166
|
-
.txt(this.theme.titleTextColor as string)
|
|
167
|
-
.up();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (this.theme.titleTextFont) {
|
|
171
|
-
// TODO: Add notice about how to add a custom font that can be
|
|
172
|
-
// referenced here on Android
|
|
173
|
-
this.root = this.root
|
|
174
|
-
.ele('item', { name: 'android:fontFamily' })
|
|
175
|
-
.txt(this.theme.titleTextFont as string)
|
|
176
|
-
.up();
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Default values taken from `Persona.Text.Title`
|
|
180
|
-
// in shared/src/main/res/values/styles.xml
|
|
181
|
-
this.root = this.root
|
|
182
|
-
.ele('item', { name: 'android:textSize' })
|
|
183
|
-
.txt('26sp')
|
|
184
|
-
.up()
|
|
185
|
-
.ele('item', { name: 'android:textStyle' })
|
|
186
|
-
.txt('bold')
|
|
187
|
-
.up();
|
|
188
|
-
|
|
189
|
-
this.root = this.root.up();
|
|
190
|
-
});
|
|
191
|
-
} else {
|
|
192
|
-
this.printQueue.push(() => {
|
|
193
|
-
this.root = this.root
|
|
194
|
-
.ele('item', { name: 'textAppearanceHeadline6' })
|
|
195
|
-
.txt('@style/Persona.Text.Title')
|
|
196
|
-
.up();
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
private bodyText() {
|
|
202
|
-
if (this.theme.bodyTextColor || this.theme.bodyTextFont) {
|
|
203
|
-
this.printQueue.push(() => {
|
|
204
|
-
this.root = this.root
|
|
205
|
-
.ele('item', { name: 'textAppearanceSubtitle1' })
|
|
206
|
-
.txt('@style/RN.Persona.Text.Body')
|
|
207
|
-
.up();
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
// Create a text appearance
|
|
211
|
-
this.postPrintQueue.push(() => {
|
|
212
|
-
this.root = this.root.ele('style', {
|
|
213
|
-
name: 'RN.Persona.Text.Body',
|
|
214
|
-
parent: 'Persona.Inquiry2.Text.Body',
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
if (this.theme.bodyTextColor) {
|
|
218
|
-
this.root = this.root
|
|
219
|
-
.ele('item', { name: 'android:textColor' })
|
|
220
|
-
.txt(this.theme.bodyTextColor as string)
|
|
221
|
-
.up();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (this.theme.bodyTextFont) {
|
|
225
|
-
// TODO: Add notice about how to add a custom font that can be
|
|
226
|
-
// referenced here on Android
|
|
227
|
-
this.root = this.root
|
|
228
|
-
.ele('item', { name: 'android:fontFamily' })
|
|
229
|
-
.txt(this.theme.bodyTextFont as string)
|
|
230
|
-
.up();
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Default values taken from `Persona.Text.Body`
|
|
234
|
-
// in shared/src/main/res/values/styles.xml
|
|
235
|
-
this.root = this.root
|
|
236
|
-
.ele('item', { name: 'android:textSize' })
|
|
237
|
-
.txt('18sp')
|
|
238
|
-
.up();
|
|
239
|
-
|
|
240
|
-
this.root = this.root.up();
|
|
241
|
-
});
|
|
242
|
-
} else {
|
|
243
|
-
this.printQueue.push(() => {
|
|
244
|
-
this.root = this.root
|
|
245
|
-
.ele('item', { name: 'textAppearanceSubtitle1' })
|
|
246
|
-
.txt('@style/Persona.Inquiry2.Text.Body')
|
|
247
|
-
.up();
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
private footnoteText() {
|
|
253
|
-
if (this.theme.footnoteTextColor || this.theme.footnoteTextFont) {
|
|
254
|
-
this.postPrintQueue.push(() => {
|
|
255
|
-
this.root = this.root
|
|
256
|
-
.ele('style', { name: 'TextAppearance.AppCompat.Small' })
|
|
257
|
-
.ele('item', { name: 'android:textSize' })
|
|
258
|
-
// Used default value found in the Android SDK
|
|
259
|
-
.txt('@dimen/abc_text_size_small_material')
|
|
260
|
-
.up()
|
|
261
|
-
.ele('item', { name: 'android:textColor' })
|
|
262
|
-
.txt(
|
|
263
|
-
// Used default value found in the Android SDK
|
|
264
|
-
this.theme.footnoteTextColor ?? '?android:attr/textColorTertiary'
|
|
265
|
-
)
|
|
266
|
-
.up();
|
|
267
|
-
|
|
268
|
-
if (this.theme.footnoteTextFont) {
|
|
269
|
-
this.root = this.root
|
|
270
|
-
.ele('item', { name: 'android:fontFamily' })
|
|
271
|
-
.txt(
|
|
272
|
-
// Used default value found in the Android SDK
|
|
273
|
-
this.theme.footnoteTextFont ?? '?android:attr/textColorTertiary'
|
|
274
|
-
)
|
|
275
|
-
.up();
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
this.root = this.root.up();
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
private textField() {
|
|
283
|
-
if (this.theme.textFieldTextColor || this.theme.textFieldTextFont) {
|
|
284
|
-
this.printQueue.push(() => {
|
|
285
|
-
this.root = this.root
|
|
286
|
-
.ele('item', { name: 'editTextStyle' })
|
|
287
|
-
.txt('@style/RN.Persona.EditText')
|
|
288
|
-
.up();
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
this.postPrintQueue.push(() => {
|
|
292
|
-
this.root = this.root
|
|
293
|
-
.ele('style', {
|
|
294
|
-
name: 'RN.Persona.EditText',
|
|
295
|
-
parent: 'Persona.Inquiry2.EditText',
|
|
296
|
-
})
|
|
297
|
-
.ele('item', { name: 'android:textAppearance' })
|
|
298
|
-
.txt('@style/RN.Persona.EditText.TextAppearance')
|
|
299
|
-
.up()
|
|
300
|
-
.ele('item', { name: 'android:textColor' })
|
|
301
|
-
.txt(this.theme.textFieldTextColor as string)
|
|
302
|
-
.up()
|
|
303
|
-
.up();
|
|
304
|
-
|
|
305
|
-
this.root = this.root.ele('style', {
|
|
306
|
-
name: 'RN.Persona.EditText.TextAppearance',
|
|
307
|
-
parent: 'Base.TextAppearance.TextAppearance.MaterialComponents.Body1',
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
if (this.theme.textFieldTextColor) {
|
|
311
|
-
this.root = this.root
|
|
312
|
-
.ele('item', { name: 'android:textSize' })
|
|
313
|
-
.txt('18sp')
|
|
314
|
-
.up();
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (this.theme.textFieldTextFont) {
|
|
318
|
-
this.root = this.root
|
|
319
|
-
.ele('item', { name: 'android:fontFamily' })
|
|
320
|
-
.txt(this.theme.textFieldTextFont as string)
|
|
321
|
-
.up();
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
this.root = this.root.up();
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
private pickerText() {
|
|
330
|
-
if (this.theme.pickerTextColor || this.theme.pickerTextFont) {
|
|
331
|
-
this.printQueue.push(() => {
|
|
332
|
-
this.root = this.root
|
|
333
|
-
.ele('item', { name: 'spinnerStyle' })
|
|
334
|
-
.txt('@style/RN.Persona.Spinner')
|
|
335
|
-
.up();
|
|
336
|
-
|
|
337
|
-
this.root = this.root
|
|
338
|
-
.ele('item', { name: 'spinnerDropDownItemStyle' })
|
|
339
|
-
.txt('@style/RN.Persona.DropDownItem.Spinner')
|
|
340
|
-
.up();
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
this.postPrintQueue.push(() => {
|
|
344
|
-
// Build Rn.Persona.Spinner
|
|
345
|
-
this.root = this.root
|
|
346
|
-
.ele('style', {
|
|
347
|
-
name: 'RN.Persona.Spinner',
|
|
348
|
-
parent: 'Persona.Inquiry2.Spinner',
|
|
349
|
-
})
|
|
350
|
-
.ele('item', { name: 'android:textColor' })
|
|
351
|
-
.txt(this.theme.pickerTextColor ?? '?android:attr/textColorPrimary')
|
|
352
|
-
.up()
|
|
353
|
-
.ele('item', { name: 'android:textAppearance' })
|
|
354
|
-
.txt(
|
|
355
|
-
this.theme.pickerTextFont
|
|
356
|
-
? '@style/RN.Persona.Text.Spinner'
|
|
357
|
-
: '@style/Persona.Inquiry2.Text.Body'
|
|
358
|
-
)
|
|
359
|
-
.up()
|
|
360
|
-
.up();
|
|
361
|
-
|
|
362
|
-
// Build RN.Persona.DropDownItem.Spinner
|
|
363
|
-
this.root = this.root
|
|
364
|
-
.ele('style', {
|
|
365
|
-
name: 'RN.Persona.DropDownItem.Spinner',
|
|
366
|
-
parent: 'Persona.Inquiry2.Spinner',
|
|
367
|
-
})
|
|
368
|
-
.ele('item', { name: 'android:textColor' })
|
|
369
|
-
.txt(this.theme.pickerTextColor ?? '?android:attr/textColorPrimary')
|
|
370
|
-
.up()
|
|
371
|
-
.ele('item', { name: 'android:textAppearance' })
|
|
372
|
-
.txt(
|
|
373
|
-
this.theme.pickerTextFont
|
|
374
|
-
? '@style/RN.Persona.Text.Spinner'
|
|
375
|
-
: '@style/Persona.Inquiry2.Text.Body'
|
|
376
|
-
)
|
|
377
|
-
.up()
|
|
378
|
-
.up();
|
|
379
|
-
|
|
380
|
-
// Build RN.Persona.Text.Spinner
|
|
381
|
-
this.root = this.root.ele('style', {
|
|
382
|
-
name: 'RN.Persona.Text.Spinner',
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
if (this.theme.pickerTextColor) {
|
|
386
|
-
this.root = this.root
|
|
387
|
-
.ele('item', { name: 'android:textColor' })
|
|
388
|
-
.txt(this.theme.pickerTextColor as string)
|
|
389
|
-
.up();
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
if (this.theme.pickerTextFont) {
|
|
393
|
-
// TODO: Add notice about how to add a custom font that can be
|
|
394
|
-
// referenced here on Android
|
|
395
|
-
this.root = this.root
|
|
396
|
-
.ele('item', { name: 'android:fontFamily' })
|
|
397
|
-
.txt(this.theme.pickerTextFont as string)
|
|
398
|
-
.up();
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
this.root = this.root.up();
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
private button() {
|
|
407
|
-
if (
|
|
408
|
-
this.theme.buttonBackgroundColor ||
|
|
409
|
-
this.theme.buttonDisabledBackgroundColor ||
|
|
410
|
-
this.theme.buttonTouchedBackgroundColor ||
|
|
411
|
-
this.theme.buttonTextColor ||
|
|
412
|
-
this.theme.buttonDisabledTextColor ||
|
|
413
|
-
this.theme.buttonCornerRadius ||
|
|
414
|
-
this.theme.buttonFont
|
|
415
|
-
) {
|
|
416
|
-
this.printQueue.push(() => {
|
|
417
|
-
this.root = this.root
|
|
418
|
-
.ele('item', { name: 'buttonStyle' })
|
|
419
|
-
.txt('@style/RN.Persona.Button')
|
|
420
|
-
.up();
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
this.postPrintQueue.push(() => {
|
|
424
|
-
this.root = this.root
|
|
425
|
-
.ele('style', {
|
|
426
|
-
name: 'RN.Persona.Button',
|
|
427
|
-
parent: 'Persona.Inquiry2.Button',
|
|
428
|
-
})
|
|
429
|
-
// Taken from
|
|
430
|
-
// appcompat's res/values/values.xml
|
|
431
|
-
.ele('item', {
|
|
432
|
-
name: 'android:minHeight',
|
|
433
|
-
})
|
|
434
|
-
.txt('48dip')
|
|
435
|
-
.up()
|
|
436
|
-
// Taken from
|
|
437
|
-
// appcompat's res/values/values.xml
|
|
438
|
-
.ele('item', {
|
|
439
|
-
name: 'android:minWidth',
|
|
440
|
-
})
|
|
441
|
-
.txt('88dip')
|
|
442
|
-
.up()
|
|
443
|
-
// Taken from
|
|
444
|
-
// persona-android's shared/src/main/res/values/styles.xml
|
|
445
|
-
.ele('item', {
|
|
446
|
-
name: 'android:textSize',
|
|
447
|
-
})
|
|
448
|
-
.txt('18sp')
|
|
449
|
-
.up()
|
|
450
|
-
.ele('item', {
|
|
451
|
-
name: 'android:background',
|
|
452
|
-
})
|
|
453
|
-
.txt('@drawable/rn_persona_button')
|
|
454
|
-
.up()
|
|
455
|
-
.ele('item', {
|
|
456
|
-
name: 'android:textColor',
|
|
457
|
-
})
|
|
458
|
-
.txt('@color/rn_persona_button')
|
|
459
|
-
.up()
|
|
460
|
-
.up();
|
|
461
|
-
|
|
462
|
-
// Disabled
|
|
463
|
-
this.buttonDrawable = this.buttonDrawable
|
|
464
|
-
.ele('item', {
|
|
465
|
-
'android:state_enabled': 'false',
|
|
466
|
-
})
|
|
467
|
-
.ele('shape', { 'android:shape': 'rectangle' })
|
|
468
|
-
.ele('corners', {
|
|
469
|
-
'android:radius': this.theme.buttonCornerRadius
|
|
470
|
-
? `${this.theme.buttonCornerRadius}dp`
|
|
471
|
-
: '@dimen/abc_control_corner_material',
|
|
472
|
-
})
|
|
473
|
-
.up()
|
|
474
|
-
.ele('padding', {
|
|
475
|
-
'android:left': '@dimen/abc_button_padding_horizontal_material',
|
|
476
|
-
'android:top': '@dimen/abc_button_padding_vertical_material',
|
|
477
|
-
'android:right': '@dimen/abc_button_padding_horizontal_material',
|
|
478
|
-
'android:bottom': '@dimen/abc_button_padding_vertical_material',
|
|
479
|
-
})
|
|
480
|
-
.up()
|
|
481
|
-
.ele('solid', {
|
|
482
|
-
'android:color': this.theme.buttonDisabledBackgroundColor
|
|
483
|
-
? this.theme.buttonDisabledBackgroundColor
|
|
484
|
-
: '?attr/colorPrimaryVariant',
|
|
485
|
-
})
|
|
486
|
-
.up()
|
|
487
|
-
.up()
|
|
488
|
-
.up();
|
|
489
|
-
|
|
490
|
-
// touched
|
|
491
|
-
this.buttonDrawable = this.buttonDrawable
|
|
492
|
-
.ele('item', {
|
|
493
|
-
'android:state_pressed': 'true',
|
|
494
|
-
})
|
|
495
|
-
.ele('shape', { 'android:shape': 'rectangle' })
|
|
496
|
-
.ele('corners', {
|
|
497
|
-
'android:radius': this.theme.buttonCornerRadius
|
|
498
|
-
? `${this.theme.buttonCornerRadius}dp`
|
|
499
|
-
: '@dimen/abc_control_corner_material',
|
|
500
|
-
})
|
|
501
|
-
.up()
|
|
502
|
-
.ele('solid', {
|
|
503
|
-
'android:color':
|
|
504
|
-
this.theme.buttonTouchedBackgroundColor ??
|
|
505
|
-
'?attr/colorPrimaryVariant',
|
|
506
|
-
})
|
|
507
|
-
.up()
|
|
508
|
-
.ele('padding', {
|
|
509
|
-
'android:left': '@dimen/abc_button_padding_horizontal_material',
|
|
510
|
-
'android:top': '@dimen/abc_button_padding_vertical_material',
|
|
511
|
-
'android:right': '@dimen/abc_button_padding_horizontal_material',
|
|
512
|
-
'android:bottom': '@dimen/abc_button_padding_vertical_material',
|
|
513
|
-
})
|
|
514
|
-
.up()
|
|
515
|
-
.up()
|
|
516
|
-
.up();
|
|
517
|
-
|
|
518
|
-
this.buttonDrawable = this.buttonDrawable
|
|
519
|
-
.ele('item')
|
|
520
|
-
.ele('shape', { 'android:shape': 'rectangle' })
|
|
521
|
-
.ele('corners', {
|
|
522
|
-
'android:radius': this.theme.buttonCornerRadius
|
|
523
|
-
? `${this.theme.buttonCornerRadius}dp`
|
|
524
|
-
: '@dimen/abc_control_corner_material',
|
|
525
|
-
})
|
|
526
|
-
.up()
|
|
527
|
-
.ele('solid', {
|
|
528
|
-
'android:color':
|
|
529
|
-
this.theme.buttonBackgroundColor ?? '?attr/colorPrimary',
|
|
530
|
-
})
|
|
531
|
-
.up()
|
|
532
|
-
.ele('padding', {
|
|
533
|
-
'android:left': '@dimen/abc_button_padding_horizontal_material',
|
|
534
|
-
'android:top': '@dimen/abc_button_padding_vertical_material',
|
|
535
|
-
'android:right': '@dimen/abc_button_padding_horizontal_material',
|
|
536
|
-
'android:bottom': '@dimen/abc_button_padding_vertical_material',
|
|
537
|
-
})
|
|
538
|
-
.up()
|
|
539
|
-
.up()
|
|
540
|
-
.up();
|
|
541
|
-
|
|
542
|
-
// Finish button drawable
|
|
543
|
-
this.buttonDrawable = this.buttonDrawable.up();
|
|
544
|
-
|
|
545
|
-
this.buttonColor = this.buttonColor
|
|
546
|
-
.ele('item', {
|
|
547
|
-
'android:state_enabled': 'false',
|
|
548
|
-
'android:color':
|
|
549
|
-
this.theme.buttonDisabledTextColor ??
|
|
550
|
-
'@android:color/darker_gray',
|
|
551
|
-
})
|
|
552
|
-
.up()
|
|
553
|
-
.ele('item', {
|
|
554
|
-
'android:state_pressed': 'true',
|
|
555
|
-
'android:color':
|
|
556
|
-
this.theme.buttonTextColor ?? '@android:color/white',
|
|
557
|
-
})
|
|
558
|
-
.up()
|
|
559
|
-
.ele('item', {
|
|
560
|
-
'android:color':
|
|
561
|
-
this.theme.buttonTextColor ?? '@android:color/white',
|
|
562
|
-
})
|
|
563
|
-
.up();
|
|
564
|
-
|
|
565
|
-
this.buttonColor = this.buttonColor.up();
|
|
566
|
-
|
|
567
|
-
this.root = this.root.up();
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
private progressColor() {
|
|
573
|
-
if (this.theme.progressColor) {
|
|
574
|
-
this.printQueue.push(() => {
|
|
575
|
-
this.root = this.root
|
|
576
|
-
.ele('item', { name: 'colorControlActivated' })
|
|
577
|
-
.txt(this.theme.progressColor as string)
|
|
578
|
-
.up();
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
private successAsset() {
|
|
584
|
-
if (!this.theme.successAsset) return;
|
|
585
|
-
|
|
586
|
-
this.printQueue.push(() => {
|
|
587
|
-
this.root = this.root
|
|
588
|
-
.ele('item', { name: 'personaInquiryCompleteImage' })
|
|
589
|
-
.txt(this.theme.successAsset as string)
|
|
590
|
-
.up()
|
|
591
|
-
.txt(' ');
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
private failAsset() {
|
|
596
|
-
if (!this.theme.failAsset) return;
|
|
597
|
-
|
|
598
|
-
this.printQueue.push(() => {
|
|
599
|
-
this.root = this.root
|
|
600
|
-
.ele('item', { name: 'personaInquiryFailImage' })
|
|
601
|
-
.txt(this.theme.failAsset as string)
|
|
602
|
-
.up()
|
|
603
|
-
.txt(' ');
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
private loadingAnimationAsset() {
|
|
608
|
-
if (
|
|
609
|
-
!this.theme.loadingAnimationAsset ||
|
|
610
|
-
!this.theme.loadingAnimationWidthPercent
|
|
611
|
-
)
|
|
612
|
-
return;
|
|
613
|
-
|
|
614
|
-
this.printQueue.push(() => {
|
|
615
|
-
this.root = this.root
|
|
616
|
-
.ele('item', { name: 'personaInquiryLoadingLottieRaw' })
|
|
617
|
-
.txt(this.theme.loadingAnimationAsset as string)
|
|
618
|
-
.up()
|
|
619
|
-
.txt(' ');
|
|
620
|
-
|
|
621
|
-
this.root = this.root
|
|
622
|
-
.ele('item', { name: 'personaInquiryLoadingLottieWidthPercent' })
|
|
623
|
-
.txt(this.theme.loadingAnimationWidthPercent as string)
|
|
624
|
-
.up()
|
|
625
|
-
.txt(' ');
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
private selfieAnimationAsset() {
|
|
630
|
-
if (
|
|
631
|
-
!this.theme.selfieAnimationAsset ||
|
|
632
|
-
!this.theme.selfieAnimationWidthPercent
|
|
633
|
-
)
|
|
634
|
-
return;
|
|
635
|
-
|
|
636
|
-
this.printQueue.push(() => {
|
|
637
|
-
this.root = this.root
|
|
638
|
-
.ele('item', { name: 'personaInquirySelfieLottieRaw' })
|
|
639
|
-
.txt(this.theme.selfieAnimationAsset as string)
|
|
640
|
-
.up()
|
|
641
|
-
.txt(' ');
|
|
642
|
-
|
|
643
|
-
this.root = this.root
|
|
644
|
-
.ele('item', { name: 'personaInquirySelfieLottieWidthPercent' })
|
|
645
|
-
.txt(this.theme.selfieAnimationWidthPercent as string)
|
|
646
|
-
.up()
|
|
647
|
-
.txt(' ');
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
export default AndroidResourcePrinter;
|