react-native-persona 1.2.4 → 1.2.8
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/CHANGELOG.md +33 -0
- package/RNPersonaInquiry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/ios/PersonaInquiry.swift +79 -33
- package/package.json +2 -2
- package/persona-tools/Theme.js +187 -166
- package/persona-tools/Theme.ts +36 -7
- package/persona-tools/lib/AndroidResourcePrinter.js +793 -538
- package/persona-tools/lib/AndroidResourcePrinter.spec.js +387 -154
- package/persona-tools/lib/AndroidResourcePrinter.spec.ts +285 -8
- package/persona-tools/lib/AndroidResourcePrinter.ts +280 -12
- package/persona-tools/tools/AndroidThemeGenerator.js +5 -1
- package/persona-tools/tools/AndroidThemeGenerator.ts +22 -3
|
@@ -2,576 +2,831 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const xmlbuilder2_1 = require("xmlbuilder2");
|
|
4
4
|
class AndroidResourcePrinter {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.root = this.root.up();
|
|
5
|
+
constructor(theme) {
|
|
6
|
+
this.preprintQueue = [];
|
|
7
|
+
this.printQueue = [];
|
|
8
|
+
this.postPrintQueue = [];
|
|
9
|
+
this.theme = theme;
|
|
10
|
+
this.root = xmlbuilder2_1.create({ version: "1.0" }).ele("resources");
|
|
11
|
+
this.buttonDrawable = xmlbuilder2_1.create({ version: "1.0" }).ele("selector", {
|
|
12
|
+
"xmlns:android": "http://schemas.android.com/apk/res/android",
|
|
13
|
+
});
|
|
14
|
+
this.buttonSecondaryDrawable = xmlbuilder2_1.create({ version: "1.0" }).ele("selector", {
|
|
15
|
+
"xmlns:android": "http://schemas.android.com/apk/res/android",
|
|
16
|
+
});
|
|
17
|
+
this.buttonColor = xmlbuilder2_1.create({ version: "1.0" }).ele("selector", {
|
|
18
|
+
"xmlns:android": "http://schemas.android.com/apk/res/android",
|
|
19
|
+
});
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
process() {
|
|
22
|
+
if (!this.hasTheme()) {
|
|
23
|
+
this.root = this.root.up();
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.print();
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
style: this.root,
|
|
30
|
+
buttonDrawable: this.buttonDrawable,
|
|
31
|
+
buttonSecondaryDrawable: this.buttonSecondaryDrawable,
|
|
32
|
+
buttonColor: this.buttonColor,
|
|
33
|
+
};
|
|
24
34
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.selfieAnimationAsset();
|
|
48
|
-
this.preprintQueue.forEach((fn) => fn());
|
|
49
|
-
// Precreate some style namespaces
|
|
50
|
-
this.root = this.root
|
|
51
|
-
.ele("style", {
|
|
52
|
-
name: "RN",
|
|
53
|
-
})
|
|
54
|
-
.up();
|
|
55
|
-
this.root = this.root
|
|
56
|
-
.ele("style", {
|
|
57
|
-
name: "RN.Persona",
|
|
58
|
-
})
|
|
59
|
-
.up();
|
|
60
|
-
this.root = this.root
|
|
61
|
-
.ele("style", {
|
|
62
|
-
name: "RN.Persona.Text",
|
|
63
|
-
})
|
|
64
|
-
.up();
|
|
65
|
-
this.root = this.root.ele("style", {
|
|
66
|
-
name: "Persona.Inquiry.Theme",
|
|
67
|
-
parent: "Base.Persona.Inquiry.Theme.Light",
|
|
68
|
-
});
|
|
69
|
-
this.printQueue.forEach((fn) => fn());
|
|
70
|
-
this.root = this.root.up();
|
|
71
|
-
this.postPrintQueue.forEach((fn) => fn());
|
|
72
|
-
}
|
|
73
|
-
hasTheme() {
|
|
74
|
-
return (Object.keys(this.theme).length > 0 &&
|
|
75
|
-
Object.values(this.theme).filter(Boolean).length > 0);
|
|
76
|
-
}
|
|
77
|
-
primaryColor() {
|
|
78
|
-
if (!this.theme.primaryColor)
|
|
79
|
-
return;
|
|
80
|
-
this.printQueue.push(() => {
|
|
81
|
-
this.root = this.root
|
|
82
|
-
.ele("item", { name: "colorPrimary" })
|
|
83
|
-
.txt(this.theme.primaryColor)
|
|
84
|
-
.up()
|
|
85
|
-
.txt(" ");
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
accentColor() {
|
|
89
|
-
if (!this.theme.accentColor)
|
|
90
|
-
return;
|
|
91
|
-
this.printQueue.push(() => {
|
|
92
|
-
this.root = this.root
|
|
93
|
-
.ele("item", { name: "colorAccent" })
|
|
94
|
-
.txt(this.theme.accentColor)
|
|
95
|
-
.up()
|
|
96
|
-
.txt(" ");
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
darkPrimaryColor() {
|
|
100
|
-
if (!this.theme.darkPrimaryColor)
|
|
101
|
-
return;
|
|
102
|
-
this.printQueue.push(() => {
|
|
103
|
-
this.root = this.root
|
|
104
|
-
.ele("item", { name: "colorPrimaryDark" })
|
|
105
|
-
.txt(this.theme.darkPrimaryColor)
|
|
106
|
-
.up()
|
|
107
|
-
.txt(" ");
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
backgroundColor() {
|
|
111
|
-
if (!this.theme.backgroundColor)
|
|
112
|
-
return;
|
|
113
|
-
this.preprintQueue.push(() => {
|
|
114
|
-
this.root = this.root
|
|
115
|
-
.ele("color", { name: "customPersonaBackgroundColor" })
|
|
116
|
-
.txt(this.theme.backgroundColor)
|
|
117
|
-
.up()
|
|
118
|
-
.txt(" ");
|
|
119
|
-
});
|
|
120
|
-
this.printQueue.push(() => {
|
|
121
|
-
this.root = this.root
|
|
122
|
-
.ele("item", { name: "android:colorBackground" })
|
|
123
|
-
.txt("@color/customPersonaBackgroundColor")
|
|
124
|
-
.up()
|
|
125
|
-
.txt(" ");
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
titleText() {
|
|
129
|
-
if (this.theme.titleTextColor || this.theme.titleTextFont) {
|
|
130
|
-
this.printQueue.push(() => {
|
|
35
|
+
print() {
|
|
36
|
+
this.primaryColor();
|
|
37
|
+
this.accentColor();
|
|
38
|
+
this.darkPrimaryColor();
|
|
39
|
+
this.backgroundColor();
|
|
40
|
+
this.titleText();
|
|
41
|
+
this.bodyText();
|
|
42
|
+
this.footnoteText();
|
|
43
|
+
this.cameraInstructionsText();
|
|
44
|
+
this.cameraHintText();
|
|
45
|
+
this.cameraGuideHintText();
|
|
46
|
+
// this.formLabelText();
|
|
47
|
+
this.textField();
|
|
48
|
+
this.pickerText();
|
|
49
|
+
this.button();
|
|
50
|
+
this.progressColor();
|
|
51
|
+
this.successAsset();
|
|
52
|
+
this.failAsset();
|
|
53
|
+
this.loadingAnimationAsset();
|
|
54
|
+
this.selfieAnimationAsset();
|
|
55
|
+
this.preprintQueue.forEach((fn) => fn());
|
|
56
|
+
// Precreate some style namespaces
|
|
131
57
|
this.root = this.root
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
// Create a text appearance
|
|
137
|
-
this.postPrintQueue.push(() => {
|
|
138
|
-
this.root = this.root.ele("style", {
|
|
139
|
-
name: "RN.Persona.Text.Title",
|
|
140
|
-
parent: "Persona.Text.Body",
|
|
141
|
-
});
|
|
142
|
-
if (this.theme.titleTextColor) {
|
|
143
|
-
this.root = this.root
|
|
144
|
-
.ele("item", { name: "android:textColor" })
|
|
145
|
-
.txt(this.theme.titleTextColor)
|
|
58
|
+
.ele("style", {
|
|
59
|
+
name: "RN",
|
|
60
|
+
})
|
|
146
61
|
.up();
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.root = this.root
|
|
152
|
-
.ele("item", { name: "android:fontFamily" })
|
|
153
|
-
.txt(this.theme.titleTextFont)
|
|
62
|
+
this.root = this.root
|
|
63
|
+
.ele("style", {
|
|
64
|
+
name: "RN.Persona",
|
|
65
|
+
})
|
|
154
66
|
.up();
|
|
155
|
-
}
|
|
156
|
-
// Default values taken from `Persona.Text.Title`
|
|
157
|
-
// in shared/src/main/res/values/styles.xml
|
|
158
67
|
this.root = this.root
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
68
|
+
.ele("style", {
|
|
69
|
+
name: "RN.Persona.Text",
|
|
70
|
+
})
|
|
71
|
+
.up();
|
|
72
|
+
this.root = this.root.ele("style", {
|
|
73
|
+
name: "Persona.Inquiry.Theme",
|
|
74
|
+
parent: "Base.Persona.Inquiry.Theme.Light",
|
|
75
|
+
});
|
|
76
|
+
this.printQueue.forEach((fn) => fn());
|
|
165
77
|
this.root = this.root.up();
|
|
166
|
-
|
|
78
|
+
this.postPrintQueue.forEach((fn) => fn());
|
|
167
79
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
.ele("item", { name: "personaTitleTextAppearance" })
|
|
172
|
-
.txt("@style/Persona.Text.Title")
|
|
173
|
-
.up();
|
|
174
|
-
});
|
|
80
|
+
hasTheme() {
|
|
81
|
+
return (Object.keys(this.theme).length > 0 &&
|
|
82
|
+
Object.values(this.theme).filter(Boolean).length > 0);
|
|
175
83
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
// Create a text appearance
|
|
186
|
-
this.postPrintQueue.push(() => {
|
|
187
|
-
this.root = this.root.ele("style", {
|
|
188
|
-
name: "RN.Persona.Text.Body",
|
|
189
|
-
parent: "Persona.Text.Body",
|
|
84
|
+
primaryColor() {
|
|
85
|
+
if (!this.theme.primaryColor)
|
|
86
|
+
return;
|
|
87
|
+
this.printQueue.push(() => {
|
|
88
|
+
this.root = this.root
|
|
89
|
+
.ele("item", { name: "colorPrimary" })
|
|
90
|
+
.txt(this.theme.primaryColor)
|
|
91
|
+
.up()
|
|
92
|
+
.txt(" ");
|
|
190
93
|
});
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
94
|
+
}
|
|
95
|
+
accentColor() {
|
|
96
|
+
if (!this.theme.accentColor)
|
|
97
|
+
return;
|
|
98
|
+
this.printQueue.push(() => {
|
|
99
|
+
this.root = this.root
|
|
100
|
+
.ele("item", { name: "colorAccent" })
|
|
101
|
+
.txt(this.theme.accentColor)
|
|
102
|
+
.up()
|
|
103
|
+
.txt(" ");
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
darkPrimaryColor() {
|
|
107
|
+
if (!this.theme.darkPrimaryColor)
|
|
108
|
+
return;
|
|
109
|
+
this.printQueue.push(() => {
|
|
110
|
+
this.root = this.root
|
|
111
|
+
.ele("item", { name: "colorPrimaryDark" })
|
|
112
|
+
.txt(this.theme.darkPrimaryColor)
|
|
113
|
+
.up()
|
|
114
|
+
.txt(" ");
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
backgroundColor() {
|
|
118
|
+
if (!this.theme.backgroundColor)
|
|
119
|
+
return;
|
|
120
|
+
this.preprintQueue.push(() => {
|
|
121
|
+
this.root = this.root
|
|
122
|
+
.ele("color", { name: "customPersonaBackgroundColor" })
|
|
123
|
+
.txt(this.theme.backgroundColor)
|
|
124
|
+
.up()
|
|
125
|
+
.txt(" ");
|
|
126
|
+
});
|
|
127
|
+
this.printQueue.push(() => {
|
|
128
|
+
this.root = this.root
|
|
129
|
+
.ele("item", { name: "android:colorBackground" })
|
|
130
|
+
.txt("@color/customPersonaBackgroundColor")
|
|
131
|
+
.up()
|
|
132
|
+
.txt(" ");
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
titleText() {
|
|
136
|
+
if (this.theme.titleTextColor || this.theme.titleTextSize || this.theme.titleTextFont) {
|
|
137
|
+
this.printQueue.push(() => {
|
|
138
|
+
this.root = this.root
|
|
139
|
+
.ele("item", { name: "personaTitleTextAppearance" })
|
|
140
|
+
.txt("@style/RN.Persona.Text.Title")
|
|
141
|
+
.up();
|
|
142
|
+
});
|
|
143
|
+
// Create a text appearance
|
|
144
|
+
this.postPrintQueue.push(() => {
|
|
145
|
+
this.root = this.root.ele("style", {
|
|
146
|
+
name: "RN.Persona.Text.Title",
|
|
147
|
+
parent: "Persona.Text.Body",
|
|
148
|
+
});
|
|
149
|
+
if (this.theme.titleTextColor) {
|
|
150
|
+
this.root = this.root
|
|
151
|
+
.ele("item", { name: "android:textColor" })
|
|
152
|
+
.txt(this.theme.titleTextColor)
|
|
153
|
+
.up();
|
|
154
|
+
}
|
|
155
|
+
if (this.theme.titleTextFont) {
|
|
156
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
157
|
+
// referenced here on Android
|
|
158
|
+
this.root = this.root
|
|
159
|
+
.ele("item", { name: "android:fontFamily" })
|
|
160
|
+
.txt(this.theme.titleTextFont)
|
|
161
|
+
.up();
|
|
162
|
+
}
|
|
163
|
+
// Default values taken from `Persona.Text.Title`
|
|
164
|
+
// in shared/src/main/res/values/styles.xml
|
|
165
|
+
const textSize = this.theme.titleTextSize ? `${this.theme.titleTextSize}sp` : "26sp";
|
|
166
|
+
this.root = this.root
|
|
167
|
+
.ele("item", { name: "android:textSize" })
|
|
168
|
+
.txt(textSize)
|
|
169
|
+
.up()
|
|
170
|
+
.ele("item", { name: "android:textStyle" })
|
|
171
|
+
.txt("bold")
|
|
172
|
+
.up();
|
|
173
|
+
this.root = this.root.up();
|
|
174
|
+
});
|
|
196
175
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
176
|
+
else {
|
|
177
|
+
this.printQueue.push(() => {
|
|
178
|
+
this.root = this.root
|
|
179
|
+
.ele("item", { name: "personaTitleTextAppearance" })
|
|
180
|
+
.txt("@style/Persona.Text.Title")
|
|
181
|
+
.up();
|
|
182
|
+
});
|
|
204
183
|
}
|
|
205
|
-
// Default values taken from `Persona.Text.Body`
|
|
206
|
-
// in shared/src/main/res/values/styles.xml
|
|
207
|
-
this.root = this.root
|
|
208
|
-
.ele("item", { name: "android:textSize" })
|
|
209
|
-
.txt("18sp")
|
|
210
|
-
.up();
|
|
211
|
-
this.root = this.root.up();
|
|
212
|
-
});
|
|
213
184
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
185
|
+
bodyText() {
|
|
186
|
+
if (this.theme.bodyTextColor || this.theme.bodyTextSize || this.theme.bodyTextFont) {
|
|
187
|
+
this.printQueue.push(() => {
|
|
188
|
+
this.root = this.root
|
|
189
|
+
.ele("item", { name: "personaBodyTextAppearance" })
|
|
190
|
+
.txt("@style/RN.Persona.Text.Body")
|
|
191
|
+
.up();
|
|
192
|
+
});
|
|
193
|
+
// Create a text appearance
|
|
194
|
+
this.postPrintQueue.push(() => {
|
|
195
|
+
this.root = this.root.ele("style", {
|
|
196
|
+
name: "RN.Persona.Text.Body",
|
|
197
|
+
parent: "Persona.Text.Body",
|
|
198
|
+
});
|
|
199
|
+
if (this.theme.bodyTextColor) {
|
|
200
|
+
this.root = this.root
|
|
201
|
+
.ele("item", { name: "android:textColor" })
|
|
202
|
+
.txt(this.theme.bodyTextColor)
|
|
203
|
+
.up();
|
|
204
|
+
}
|
|
205
|
+
if (this.theme.bodyTextFont) {
|
|
206
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
207
|
+
// referenced here on Android
|
|
208
|
+
this.root = this.root
|
|
209
|
+
.ele("item", { name: "android:fontFamily" })
|
|
210
|
+
.txt(this.theme.bodyTextFont)
|
|
211
|
+
.up();
|
|
212
|
+
}
|
|
213
|
+
// Default values taken from `Persona.Text.Body`
|
|
214
|
+
// in shared/src/main/res/values/styles.xml
|
|
215
|
+
const textSize = this.theme.bodyTextSize ? `${this.theme.bodyTextSize}sp` : "18sp";
|
|
216
|
+
this.root = this.root
|
|
217
|
+
.ele("item", { name: "android:textSize" })
|
|
218
|
+
.txt(textSize)
|
|
219
|
+
.up();
|
|
220
|
+
|
|
221
|
+
this.root = this.root.up();
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
this.printQueue.push(() => {
|
|
226
|
+
this.root = this.root
|
|
227
|
+
.ele("item", { name: "personaBodyTextAppearance" })
|
|
228
|
+
.txt("@style/Persona.Text.Body")
|
|
229
|
+
.up();
|
|
230
|
+
});
|
|
231
|
+
}
|
|
221
232
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
233
|
+
footnoteText() {
|
|
234
|
+
if (this.theme.footnoteTextColor || this.theme.footnoteTextFont) {
|
|
235
|
+
this.postPrintQueue.push(() => {
|
|
236
|
+
var _a, _b;
|
|
237
|
+
this.root = this.root
|
|
238
|
+
.ele("style", { name: "TextAppearance.AppCompat.Small" })
|
|
239
|
+
.ele("item", { name: "android:textColor" })
|
|
240
|
+
.txt((_a =
|
|
241
|
+
// Used default value found in the Android SDK
|
|
242
|
+
this.theme.footnoteTextColor) !== null && _a !== void 0 ? _a : "?android:attr/textColorTertiary")
|
|
243
|
+
.up();
|
|
244
|
+
if (this.theme.footnoteTextFont) {
|
|
245
|
+
this.root = this.root
|
|
246
|
+
.ele("item", { name: "android:fontFamily" })
|
|
247
|
+
.txt((_b =
|
|
248
|
+
// Used default value found in the Android SDK
|
|
249
|
+
this.theme.footnoteTextFont) !== null && _b !== void 0 ? _b : "?android:attr/textColorTertiary")
|
|
250
|
+
.up();
|
|
251
|
+
}
|
|
252
|
+
this.root = this.root
|
|
253
|
+
.ele("item", { name: "android:textSize" })
|
|
254
|
+
.txt((_b =
|
|
255
|
+
// Default value found in the Android SDK
|
|
256
|
+
this.theme.footnoteTextSize) !== null && _b !== void 0 ? `${_b}sp` : "@dimen/abc_text_size_small_material")
|
|
257
|
+
.up();
|
|
258
|
+
|
|
259
|
+
this.root = this.root.up();
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
cameraInstructionsText() {
|
|
264
|
+
if (this.theme.cameraInstructionsTextColor ||
|
|
265
|
+
this.theme.cameraInstructionsTextSize ||
|
|
266
|
+
this.theme.cameraInstructionsTextFont) {
|
|
267
|
+
this.printQueue.push(() => {
|
|
239
268
|
this.root = this.root
|
|
240
|
-
.ele("item", { name: "
|
|
241
|
-
.txt(
|
|
242
|
-
// Used default value found in the Android SDK
|
|
243
|
-
this.theme.footnoteTextFont) !== null && _b !== void 0 ? _b : "?android:attr/textColorTertiary")
|
|
269
|
+
.ele("item", { name: "personaCameraTitleTextAppearance" })
|
|
270
|
+
.txt("@style/RN.Persona.Text.CameraTitle")
|
|
244
271
|
.up();
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
// Create a text appearance
|
|
275
|
+
this.postPrintQueue.push(() => {
|
|
276
|
+
this.root = this.root.ele("style", {
|
|
277
|
+
name: "RN.Persona.Text.CameraTitle",
|
|
278
|
+
parent: "Persona.Text.CameraTitle",
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
if (this.theme.cameraInstructionsTextColor) {
|
|
282
|
+
this.root = this.root
|
|
283
|
+
.ele("item", { name: "android:textColor" })
|
|
284
|
+
.txt(this.theme.cameraInstructionsTextColor)
|
|
285
|
+
.up();
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (this.theme.cameraInstructionsTextFont) {
|
|
289
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
290
|
+
// referenced here on Android
|
|
291
|
+
this.root = this.root
|
|
292
|
+
.ele("item", { name: "android:fontFamily" })
|
|
293
|
+
.txt(this.theme.cameraInstructionsTextFont)
|
|
294
|
+
.up();
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const textSize = this.theme.cameraInstructionsTextSize ?
|
|
298
|
+
`${this.theme.cameraInstructionsTextSize}sp` : "20sp";
|
|
299
|
+
this.root = this.root
|
|
300
|
+
.ele("item", { name: "android:textSize" })
|
|
301
|
+
.txt(textSize)
|
|
302
|
+
.up();
|
|
303
|
+
|
|
304
|
+
this.root = this.root.up();
|
|
305
|
+
});
|
|
306
|
+
} else {
|
|
307
|
+
this.printQueue.push(() => {
|
|
308
|
+
this.root = this.root
|
|
309
|
+
.ele("item", { name: "personaCameraTitleTextAppearance" })
|
|
310
|
+
.txt("@style/Persona.Text.CameraTitle")
|
|
311
|
+
.up();
|
|
312
|
+
});
|
|
313
|
+
}
|
|
248
314
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
this.
|
|
254
|
-
.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
this.postPrintQueue.push(() => {
|
|
259
|
-
this.root = this.root
|
|
260
|
-
.ele("style", {
|
|
261
|
-
name: "RN.Persona.EditText",
|
|
262
|
-
parent: "Widget.AppCompat.EditText",
|
|
263
|
-
})
|
|
264
|
-
.ele("item", { name: "android:textAppearance" })
|
|
265
|
-
.txt("@style/RN.Persona.EditText.TextAppearance")
|
|
266
|
-
.up()
|
|
267
|
-
.ele("item", { name: "android:textColor" })
|
|
268
|
-
.txt(this.theme.textFieldTextColor)
|
|
269
|
-
.up()
|
|
270
|
-
.up();
|
|
271
|
-
this.root = this.root.ele("style", {
|
|
272
|
-
name: "RN.Persona.EditText.TextAppearance",
|
|
273
|
-
parent: "Base.TextAppearance.AppCompat.Medium",
|
|
315
|
+
cameraHintText() {
|
|
316
|
+
if (this.theme.cameraHintTextColor ||
|
|
317
|
+
this.theme.cameraHintTextSize ||
|
|
318
|
+
this.theme.cameraHintTextFont) {
|
|
319
|
+
this.printQueue.push(() => {
|
|
320
|
+
this.root = this.root
|
|
321
|
+
.ele("item", { name: "personaCameraBodyTextAppearance" })
|
|
322
|
+
.txt("@style/RN.Persona.Text.CameraBody")
|
|
323
|
+
.up();
|
|
274
324
|
});
|
|
275
|
-
|
|
325
|
+
|
|
326
|
+
// Create a text appearance
|
|
327
|
+
this.postPrintQueue.push(() => {
|
|
328
|
+
this.root = this.root.ele("style", {
|
|
329
|
+
name: "RN.Persona.Text.CameraBody",
|
|
330
|
+
parent: "Persona.Text.CameraBody",
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
if (this.theme.cameraHintTextColor) {
|
|
334
|
+
this.root = this.root
|
|
335
|
+
.ele("item", { name: "android:textColor" })
|
|
336
|
+
.txt(this.theme.cameraHintTextColor)
|
|
337
|
+
.up();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (this.theme.cameraHintTextFont) {
|
|
341
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
342
|
+
// referenced here on Android
|
|
343
|
+
this.root = this.root
|
|
344
|
+
.ele("item", { name: "android:fontFamily" })
|
|
345
|
+
.txt(this.theme.cameraHintTextFont)
|
|
346
|
+
.up();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const textSize = this.theme.cameraHintTextSize ?
|
|
350
|
+
`${this.theme.cameraHintTextSize}sp` : "16sp";
|
|
276
351
|
this.root = this.root
|
|
277
352
|
.ele("item", { name: "android:textSize" })
|
|
278
|
-
.txt(
|
|
353
|
+
.txt(textSize)
|
|
279
354
|
.up();
|
|
280
|
-
|
|
281
|
-
|
|
355
|
+
|
|
356
|
+
this.root = this.root.up();
|
|
357
|
+
});
|
|
358
|
+
} else {
|
|
359
|
+
this.printQueue.push(() => {
|
|
282
360
|
this.root = this.root
|
|
283
|
-
.ele("item", { name: "
|
|
284
|
-
.txt(
|
|
361
|
+
.ele("item", { name: "personaCameraBodyTextAppearance" })
|
|
362
|
+
.txt("@style/Persona.Text.CameraBody")
|
|
285
363
|
.up();
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
});
|
|
364
|
+
});
|
|
365
|
+
}
|
|
289
366
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
this.
|
|
295
|
-
.
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
.ele("item", { name: "spinnerDropDownItemStyle" })
|
|
300
|
-
.txt("@style/RN.Persona.DropDownItem.Spinner")
|
|
301
|
-
.up();
|
|
302
|
-
});
|
|
303
|
-
this.postPrintQueue.push(() => {
|
|
304
|
-
var _a, _b;
|
|
305
|
-
// Build Rn.Persona.Spinner
|
|
306
|
-
this.root = this.root
|
|
307
|
-
.ele("style", {
|
|
308
|
-
name: "RN.Persona.Spinner",
|
|
309
|
-
parent: "Widget.AppCompat.Spinner",
|
|
310
|
-
})
|
|
311
|
-
.ele("item", { name: "android:textColor" })
|
|
312
|
-
.txt((_a = this.theme.pickerTextColor) !== null && _a !== void 0 ? _a : "?android:attr/textColorPrimary")
|
|
313
|
-
.up()
|
|
314
|
-
.ele("item", { name: "android:textAppearance" })
|
|
315
|
-
.txt(this.theme.pickerTextFont
|
|
316
|
-
? "@style/RN.Persona.Text.Spinner"
|
|
317
|
-
: "@style/Persona.Text.Body")
|
|
318
|
-
.up()
|
|
319
|
-
.up();
|
|
320
|
-
// Build RN.Persona.DropDownItem.Spinner
|
|
321
|
-
this.root = this.root
|
|
322
|
-
.ele("style", {
|
|
323
|
-
name: "RN.Persona.DropDownItem.Spinner",
|
|
324
|
-
parent: "Widget.AppCompat.DropDownItem.Spinner",
|
|
325
|
-
})
|
|
326
|
-
.ele("item", { name: "android:textColor" })
|
|
327
|
-
.txt((_b = this.theme.pickerTextColor) !== null && _b !== void 0 ? _b : "?android:attr/textColorPrimary")
|
|
328
|
-
.up()
|
|
329
|
-
.ele("item", { name: "android:textAppearance" })
|
|
330
|
-
.txt(this.theme.pickerTextFont
|
|
331
|
-
? "@style/RN.Persona.Text.Spinner"
|
|
332
|
-
: "@style/Persona.Text.Body")
|
|
333
|
-
.up()
|
|
334
|
-
.up();
|
|
335
|
-
// Build RN.Persona.Text.Spinner
|
|
336
|
-
this.root = this.root.ele("style", {
|
|
337
|
-
name: "RN.Persona.Text.Spinner",
|
|
367
|
+
cameraGuideHintText() {
|
|
368
|
+
if (this.theme.cameraGuideHintTextColor ||
|
|
369
|
+
this.theme.cameraGuideHintTextSize ||
|
|
370
|
+
this.theme.cameraGuideHintTextFont) {
|
|
371
|
+
this.printQueue.push(() => {
|
|
372
|
+
this.root = this.root
|
|
373
|
+
.ele("item", { name: "personaCameraHintTextAppearance" })
|
|
374
|
+
.txt("@style/RN.Persona.Text.CameraHint")
|
|
375
|
+
.up();
|
|
338
376
|
});
|
|
339
|
-
|
|
377
|
+
|
|
378
|
+
// Create a text appearance
|
|
379
|
+
this.postPrintQueue.push(() => {
|
|
380
|
+
this.root = this.root.ele("style", {
|
|
381
|
+
name: "RN.Persona.Text.CameraHint",
|
|
382
|
+
parent: "Persona.Text.CameraHint",
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
if (this.theme.cameraGuideHintTextColor) {
|
|
386
|
+
this.root = this.root
|
|
387
|
+
.ele("item", { name: "android:textColor" })
|
|
388
|
+
.txt(this.theme.cameraGuideHintTextColor)
|
|
389
|
+
.up();
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (this.theme.cameraGuideHintTextFont) {
|
|
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.cameraGuideHintTextFont)
|
|
398
|
+
.up();
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const textSize = this.theme.cameraGuideHintTextSize ?
|
|
402
|
+
`${this.theme.cameraGuideHintTextSize}sp` : "20sp";
|
|
340
403
|
this.root = this.root
|
|
341
|
-
.ele("item", { name: "android:
|
|
342
|
-
.txt(
|
|
404
|
+
.ele("item", { name: "android:textSize" })
|
|
405
|
+
.txt(textSize)
|
|
343
406
|
.up();
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
407
|
+
|
|
408
|
+
this.root = this.root.up();
|
|
409
|
+
});
|
|
410
|
+
} else {
|
|
411
|
+
this.printQueue.push(() => {
|
|
348
412
|
this.root = this.root
|
|
349
|
-
.ele("item", { name: "
|
|
350
|
-
.txt(
|
|
413
|
+
.ele("item", { name: "personaCameraHintTextAppearance" })
|
|
414
|
+
.txt("@style/Persona.Text.CameraHint")
|
|
351
415
|
.up();
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
});
|
|
416
|
+
});
|
|
417
|
+
}
|
|
355
418
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
})
|
|
397
|
-
.txt("18sp")
|
|
398
|
-
.up()
|
|
399
|
-
.ele("item", {
|
|
400
|
-
name: "android:background",
|
|
401
|
-
})
|
|
402
|
-
.txt("@drawable/rn_persona_button")
|
|
403
|
-
.up()
|
|
404
|
-
.ele("item", {
|
|
405
|
-
name: "android:textColor",
|
|
406
|
-
})
|
|
407
|
-
.txt("@color/rn_persona_button")
|
|
408
|
-
.up()
|
|
409
|
-
.up();
|
|
410
|
-
// Disabled
|
|
411
|
-
this.buttonDrawable = this.buttonDrawable
|
|
412
|
-
.ele("item", {
|
|
413
|
-
"android:state_enabled": "false",
|
|
414
|
-
})
|
|
415
|
-
.ele("shape", { "android:shape": "rectangle" })
|
|
416
|
-
.ele("corners", {
|
|
417
|
-
"android:radius": this.theme.buttonCornerRadius
|
|
418
|
-
? `${this.theme.buttonCornerRadius}dp`
|
|
419
|
-
: "@dimen/abc_control_corner_material",
|
|
420
|
-
})
|
|
421
|
-
.up()
|
|
422
|
-
.ele("padding", {
|
|
423
|
-
"android:left": "@dimen/abc_button_padding_horizontal_material",
|
|
424
|
-
"android:top": "@dimen/abc_button_padding_vertical_material",
|
|
425
|
-
"android:right": "@dimen/abc_button_padding_horizontal_material",
|
|
426
|
-
"android:bottom": "@dimen/abc_button_padding_vertical_material",
|
|
427
|
-
})
|
|
428
|
-
.up()
|
|
429
|
-
.ele("solid", {
|
|
430
|
-
"android:color": this.theme.buttonDisabledBackgroundColor
|
|
431
|
-
? this.theme.buttonDisabledBackgroundColor
|
|
432
|
-
: "?attr/colorPrimaryDark",
|
|
433
|
-
})
|
|
434
|
-
.up()
|
|
435
|
-
.up()
|
|
436
|
-
.up();
|
|
437
|
-
// touched
|
|
438
|
-
this.buttonDrawable = this.buttonDrawable
|
|
439
|
-
.ele("item", {
|
|
440
|
-
"android:state_pressed": "true",
|
|
441
|
-
})
|
|
442
|
-
.ele("shape", { "android:shape": "rectangle" })
|
|
443
|
-
.ele("corners", {
|
|
444
|
-
"android:radius": this.theme.buttonCornerRadius
|
|
445
|
-
? `${this.theme.buttonCornerRadius}dp`
|
|
446
|
-
: "@dimen/abc_control_corner_material",
|
|
447
|
-
})
|
|
448
|
-
.up()
|
|
449
|
-
.ele("solid", {
|
|
450
|
-
"android:color": (_a = this.theme.buttonTouchedBackgroundColor) !== null && _a !== void 0 ? _a : "?attr/colorPrimaryDark",
|
|
451
|
-
})
|
|
452
|
-
.up()
|
|
453
|
-
.ele("padding", {
|
|
454
|
-
"android:left": "@dimen/abc_button_padding_horizontal_material",
|
|
455
|
-
"android:top": "@dimen/abc_button_padding_vertical_material",
|
|
456
|
-
"android:right": "@dimen/abc_button_padding_horizontal_material",
|
|
457
|
-
"android:bottom": "@dimen/abc_button_padding_vertical_material",
|
|
458
|
-
})
|
|
459
|
-
.up()
|
|
460
|
-
.up()
|
|
461
|
-
.up();
|
|
462
|
-
this.buttonDrawable = this.buttonDrawable
|
|
463
|
-
.ele("item")
|
|
464
|
-
.ele("shape", { "android:shape": "rectangle" })
|
|
465
|
-
.ele("corners", {
|
|
466
|
-
"android:radius": this.theme.buttonCornerRadius
|
|
467
|
-
? `${this.theme.buttonCornerRadius}dp`
|
|
468
|
-
: "@dimen/abc_control_corner_material",
|
|
469
|
-
})
|
|
470
|
-
.up()
|
|
471
|
-
.ele("solid", {
|
|
472
|
-
"android:color": (_b = this.theme.buttonBackgroundColor) !== null && _b !== void 0 ? _b : "?attr/colorPrimary",
|
|
473
|
-
})
|
|
474
|
-
.up()
|
|
475
|
-
.ele("padding", {
|
|
476
|
-
"android:left": "@dimen/abc_button_padding_horizontal_material",
|
|
477
|
-
"android:top": "@dimen/abc_button_padding_vertical_material",
|
|
478
|
-
"android:right": "@dimen/abc_button_padding_horizontal_material",
|
|
479
|
-
"android:bottom": "@dimen/abc_button_padding_vertical_material",
|
|
480
|
-
})
|
|
481
|
-
.up()
|
|
482
|
-
.up()
|
|
483
|
-
.up();
|
|
484
|
-
// Finish button drawable
|
|
485
|
-
this.buttonDrawable = this.buttonDrawable.up();
|
|
486
|
-
this.buttonColor = this.buttonColor
|
|
487
|
-
.ele("item", {
|
|
488
|
-
"android:state_enabled": "false",
|
|
489
|
-
"android:color": (_c = this.theme.buttonDisabledTextColor) !== null && _c !== void 0 ? _c : "@android:color/darker_gray",
|
|
490
|
-
})
|
|
491
|
-
.up()
|
|
492
|
-
.ele("item", {
|
|
493
|
-
"android:state_pressed": "true",
|
|
494
|
-
"android:color": (_d = this.theme.buttonTextColor) !== null && _d !== void 0 ? _d : "@android:color/white",
|
|
495
|
-
})
|
|
496
|
-
.up()
|
|
497
|
-
.ele("item", {
|
|
498
|
-
"android:color": (_e = this.theme.buttonTextColor) !== null && _e !== void 0 ? _e : "@android:color/white",
|
|
499
|
-
})
|
|
500
|
-
.up();
|
|
501
|
-
this.buttonColor = this.buttonColor.up();
|
|
502
|
-
this.root = this.root.up();
|
|
503
|
-
});
|
|
419
|
+
textField() {
|
|
420
|
+
if (this.theme.textFieldTextColor || this.theme.textFieldTextFont) {
|
|
421
|
+
this.printQueue.push(() => {
|
|
422
|
+
this.root = this.root
|
|
423
|
+
.ele("item", { name: "editTextStyle" })
|
|
424
|
+
.txt("@style/RN.Persona.EditText")
|
|
425
|
+
.up();
|
|
426
|
+
});
|
|
427
|
+
this.postPrintQueue.push(() => {
|
|
428
|
+
this.root = this.root
|
|
429
|
+
.ele("style", {
|
|
430
|
+
name: "RN.Persona.EditText",
|
|
431
|
+
parent: "Widget.AppCompat.EditText",
|
|
432
|
+
})
|
|
433
|
+
.ele("item", { name: "android:textAppearance" })
|
|
434
|
+
.txt("@style/RN.Persona.EditText.TextAppearance")
|
|
435
|
+
.up()
|
|
436
|
+
.ele("item", { name: "android:textColor" })
|
|
437
|
+
.txt(this.theme.textFieldTextColor)
|
|
438
|
+
.up()
|
|
439
|
+
.up();
|
|
440
|
+
this.root = this.root.ele("style", {
|
|
441
|
+
name: "RN.Persona.EditText.TextAppearance",
|
|
442
|
+
parent: "Base.TextAppearance.AppCompat.Medium",
|
|
443
|
+
});
|
|
444
|
+
if (this.theme.textFieldTextColor) {
|
|
445
|
+
this.root = this.root
|
|
446
|
+
.ele("item", { name: "android:textSize" })
|
|
447
|
+
.txt("18sp")
|
|
448
|
+
.up();
|
|
449
|
+
}
|
|
450
|
+
if (this.theme.textFieldTextFont) {
|
|
451
|
+
this.root = this.root
|
|
452
|
+
.ele("item", { name: "android:fontFamily" })
|
|
453
|
+
.txt(this.theme.textFieldTextFont)
|
|
454
|
+
.up();
|
|
455
|
+
}
|
|
456
|
+
this.root = this.root.up();
|
|
457
|
+
});
|
|
458
|
+
}
|
|
504
459
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
460
|
+
pickerText() {
|
|
461
|
+
if (this.theme.pickerTextColor || this.theme.pickerTextFont) {
|
|
462
|
+
this.printQueue.push(() => {
|
|
463
|
+
this.root = this.root
|
|
464
|
+
.ele("item", { name: "spinnerStyle" })
|
|
465
|
+
.txt("@style/RN.Persona.Spinner")
|
|
466
|
+
.up();
|
|
467
|
+
this.root = this.root
|
|
468
|
+
.ele("item", { name: "spinnerDropDownItemStyle" })
|
|
469
|
+
.txt("@style/RN.Persona.DropDownItem.Spinner")
|
|
470
|
+
.up();
|
|
471
|
+
});
|
|
472
|
+
this.postPrintQueue.push(() => {
|
|
473
|
+
var _a, _b;
|
|
474
|
+
// Build Rn.Persona.Spinner
|
|
475
|
+
this.root = this.root
|
|
476
|
+
.ele("style", {
|
|
477
|
+
name: "RN.Persona.Spinner",
|
|
478
|
+
parent: "Widget.AppCompat.Spinner",
|
|
479
|
+
})
|
|
480
|
+
.ele("item", { name: "android:textColor" })
|
|
481
|
+
.txt((_a = this.theme.pickerTextColor) !== null && _a !== void 0 ? _a : "?android:attr/textColorPrimary")
|
|
482
|
+
.up()
|
|
483
|
+
.ele("item", { name: "android:textAppearance" })
|
|
484
|
+
.txt(this.theme.pickerTextFont
|
|
485
|
+
? "@style/RN.Persona.Text.Spinner"
|
|
486
|
+
: "@style/Persona.Text.Body")
|
|
487
|
+
.up()
|
|
488
|
+
.up();
|
|
489
|
+
// Build RN.Persona.DropDownItem.Spinner
|
|
490
|
+
this.root = this.root
|
|
491
|
+
.ele("style", {
|
|
492
|
+
name: "RN.Persona.DropDownItem.Spinner",
|
|
493
|
+
parent: "Widget.AppCompat.DropDownItem.Spinner",
|
|
494
|
+
})
|
|
495
|
+
.ele("item", { name: "android:textColor" })
|
|
496
|
+
.txt((_b = this.theme.pickerTextColor) !== null && _b !== void 0 ? _b : "?android:attr/textColorPrimary")
|
|
497
|
+
.up()
|
|
498
|
+
.ele("item", { name: "android:textAppearance" })
|
|
499
|
+
.txt(this.theme.pickerTextFont
|
|
500
|
+
? "@style/RN.Persona.Text.Spinner"
|
|
501
|
+
: "@style/Persona.Text.Body")
|
|
502
|
+
.up()
|
|
503
|
+
.up();
|
|
504
|
+
// Build RN.Persona.Text.Spinner
|
|
505
|
+
this.root = this.root.ele("style", {
|
|
506
|
+
name: "RN.Persona.Text.Spinner",
|
|
507
|
+
});
|
|
508
|
+
if (this.theme.pickerTextColor) {
|
|
509
|
+
this.root = this.root
|
|
510
|
+
.ele("item", { name: "android:textColor" })
|
|
511
|
+
.txt(this.theme.pickerTextColor)
|
|
512
|
+
.up();
|
|
513
|
+
}
|
|
514
|
+
if (this.theme.pickerTextFont) {
|
|
515
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
516
|
+
// referenced here on Android
|
|
517
|
+
this.root = this.root
|
|
518
|
+
.ele("item", { name: "android:fontFamily" })
|
|
519
|
+
.txt(this.theme.pickerTextFont)
|
|
520
|
+
.up();
|
|
521
|
+
}
|
|
522
|
+
this.root = this.root.up();
|
|
523
|
+
});
|
|
524
|
+
}
|
|
514
525
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
if (!this.theme.failAsset) return;
|
|
531
|
-
|
|
532
|
-
this.printQueue.push(() => {
|
|
533
|
-
this.root = this.root
|
|
534
|
-
.ele("item", { name: "personaInquiryFailImage" })
|
|
535
|
-
.txt(this.theme.failAsset)
|
|
536
|
-
.up()
|
|
537
|
-
.txt(" ");
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
loadingAnimationAsset() {
|
|
542
|
-
if (!this.theme.loadingAnimationAsset || !this.theme.loadingAnimationWidthPercent) return;
|
|
543
|
-
|
|
544
|
-
this.printQueue.push(() => {
|
|
545
|
-
this.root = this.root
|
|
546
|
-
.ele("item", { name: "personaInquiryLoadingLottieRaw" })
|
|
547
|
-
.txt(this.theme.loadingAnimationAsset)
|
|
548
|
-
.up()
|
|
549
|
-
.txt(" ");
|
|
550
|
-
|
|
551
|
-
this.root = this.root
|
|
552
|
-
.ele("item", { name: "personaInquiryLoadingLottieWidthPercent" })
|
|
553
|
-
.txt(this.theme.loadingAnimationWidthPercent)
|
|
554
|
-
.up()
|
|
555
|
-
.txt(" ");
|
|
556
|
-
});
|
|
557
|
-
}
|
|
526
|
+
button() {
|
|
527
|
+
if (this.theme.buttonBackgroundColor ||
|
|
528
|
+
this.theme.buttonDisabledBackgroundColor ||
|
|
529
|
+
this.theme.buttonTouchedBackgroundColor ||
|
|
530
|
+
this.theme.buttonTextColor ||
|
|
531
|
+
this.theme.buttonDisabledTextColor ||
|
|
532
|
+
this.theme.buttonCornerRadius ||
|
|
533
|
+
this.theme.buttonFont ||
|
|
534
|
+
this.theme.buttonTextSize) {
|
|
535
|
+
const textSize = this.theme.buttonTextSize ? `${this.theme.buttonTextSize}sp` : "18sp";
|
|
536
|
+
this.printQueue.push(() => {
|
|
537
|
+
this.root = this.root
|
|
538
|
+
.ele("item", { name: "buttonStyle" })
|
|
539
|
+
.txt("@style/RN.Persona.Button")
|
|
540
|
+
.up();
|
|
558
541
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
542
|
+
this.root = this.root
|
|
543
|
+
.ele("item", { name: "buttonStyleSecondary" })
|
|
544
|
+
.txt("@style/RN.Persona.Button.Secondary")
|
|
545
|
+
.up();
|
|
546
|
+
});
|
|
547
|
+
this.postPrintQueue.push(() => {
|
|
548
|
+
var _a, _b, _c, _d, _e;
|
|
549
|
+
this.root = this.root
|
|
550
|
+
.ele("style", {
|
|
551
|
+
name: "RN.Persona.Button",
|
|
552
|
+
parent: "android:style/Widget.Button",
|
|
553
|
+
})
|
|
554
|
+
// Taken from
|
|
555
|
+
// appcompat's res/values/values.xml
|
|
556
|
+
.ele("item", {
|
|
557
|
+
name: "android:minHeight",
|
|
558
|
+
})
|
|
559
|
+
.txt("48dip")
|
|
560
|
+
.up()
|
|
561
|
+
// Taken from
|
|
562
|
+
// appcompat's res/values/values.xml
|
|
563
|
+
.ele("item", {
|
|
564
|
+
name: "android:minWidth",
|
|
565
|
+
})
|
|
566
|
+
.txt("88dip")
|
|
567
|
+
.up()
|
|
568
|
+
// Taken from
|
|
569
|
+
// persona-android's shared/src/main/res/values/styles.xml
|
|
570
|
+
.ele("item", {
|
|
571
|
+
name: "android:textSize",
|
|
572
|
+
})
|
|
573
|
+
.txt(textSize)
|
|
574
|
+
.up()
|
|
575
|
+
.ele("item", {
|
|
576
|
+
name: "android:background",
|
|
577
|
+
})
|
|
578
|
+
.txt("@drawable/rn_persona_button")
|
|
579
|
+
.up()
|
|
580
|
+
.ele("item", {
|
|
581
|
+
name: "android:textColor",
|
|
582
|
+
})
|
|
583
|
+
.txt("@color/rn_persona_button")
|
|
584
|
+
.up()
|
|
585
|
+
.up();
|
|
586
|
+
// Build RN.Persona.Button.Secondary
|
|
587
|
+
this.root = this.root
|
|
588
|
+
.ele("style", {
|
|
589
|
+
name: "RN.Persona.Button.Secondary",
|
|
590
|
+
parent: "RN.Persona.Button",
|
|
591
|
+
})
|
|
592
|
+
.ele("item", {
|
|
593
|
+
name: "android:background",
|
|
594
|
+
})
|
|
595
|
+
.txt("@drawable/rn_persona_button_secondary")
|
|
596
|
+
.up()
|
|
597
|
+
.up();
|
|
598
|
+
// Disabled
|
|
599
|
+
this.buttonDrawable = this.buttonDrawable
|
|
600
|
+
.ele("item", {
|
|
601
|
+
"android:state_enabled": "false",
|
|
602
|
+
})
|
|
603
|
+
.ele("shape", { "android:shape": "rectangle" })
|
|
604
|
+
.ele("corners", {
|
|
605
|
+
"android:radius": this.theme.buttonCornerRadius
|
|
606
|
+
? `${this.theme.buttonCornerRadius}dp`
|
|
607
|
+
: "@dimen/abc_control_corner_material",
|
|
608
|
+
})
|
|
609
|
+
.up()
|
|
610
|
+
.ele("padding", {
|
|
611
|
+
"android:left": "@dimen/abc_button_padding_horizontal_material",
|
|
612
|
+
"android:top": "@dimen/abc_button_padding_vertical_material",
|
|
613
|
+
"android:right": "@dimen/abc_button_padding_horizontal_material",
|
|
614
|
+
"android:bottom": "@dimen/abc_button_padding_vertical_material",
|
|
615
|
+
})
|
|
616
|
+
.up()
|
|
617
|
+
.ele("solid", {
|
|
618
|
+
"android:color": this.theme.buttonDisabledBackgroundColor
|
|
619
|
+
? this.theme.buttonDisabledBackgroundColor
|
|
620
|
+
: "?attr/colorPrimaryDark",
|
|
621
|
+
})
|
|
622
|
+
.up()
|
|
623
|
+
.up()
|
|
624
|
+
.up();
|
|
625
|
+
// touched
|
|
626
|
+
this.buttonDrawable = this.buttonDrawable
|
|
627
|
+
.ele("item", {
|
|
628
|
+
"android:state_pressed": "true",
|
|
629
|
+
})
|
|
630
|
+
.ele("shape", { "android:shape": "rectangle" })
|
|
631
|
+
.ele("corners", {
|
|
632
|
+
"android:radius": this.theme.buttonCornerRadius
|
|
633
|
+
? `${this.theme.buttonCornerRadius}dp`
|
|
634
|
+
: "@dimen/abc_control_corner_material",
|
|
635
|
+
})
|
|
636
|
+
.up()
|
|
637
|
+
.ele("solid", {
|
|
638
|
+
"android:color": (_a = this.theme.buttonTouchedBackgroundColor) !== null && _a !== void 0 ? _a : "?attr/colorPrimaryDark",
|
|
639
|
+
})
|
|
640
|
+
.up()
|
|
641
|
+
.ele("padding", {
|
|
642
|
+
"android:left": "@dimen/abc_button_padding_horizontal_material",
|
|
643
|
+
"android:top": "@dimen/abc_button_padding_vertical_material",
|
|
644
|
+
"android:right": "@dimen/abc_button_padding_horizontal_material",
|
|
645
|
+
"android:bottom": "@dimen/abc_button_padding_vertical_material",
|
|
646
|
+
})
|
|
647
|
+
.up()
|
|
648
|
+
.up()
|
|
649
|
+
.up();
|
|
650
|
+
this.buttonDrawable = this.buttonDrawable
|
|
651
|
+
.ele("item")
|
|
652
|
+
.ele("shape", { "android:shape": "rectangle" })
|
|
653
|
+
.ele("corners", {
|
|
654
|
+
"android:radius": this.theme.buttonCornerRadius
|
|
655
|
+
? `${this.theme.buttonCornerRadius}dp`
|
|
656
|
+
: "@dimen/abc_control_corner_material",
|
|
657
|
+
})
|
|
658
|
+
.up()
|
|
659
|
+
.ele("solid", {
|
|
660
|
+
"android:color": (_b = this.theme.buttonBackgroundColor) !== null && _b !== void 0 ? _b : "?attr/colorPrimary",
|
|
661
|
+
})
|
|
662
|
+
.up()
|
|
663
|
+
.ele("padding", {
|
|
664
|
+
"android:left": "@dimen/abc_button_padding_horizontal_material",
|
|
665
|
+
"android:top": "@dimen/abc_button_padding_vertical_material",
|
|
666
|
+
"android:right": "@dimen/abc_button_padding_horizontal_material",
|
|
667
|
+
"android:bottom": "@dimen/abc_button_padding_vertical_material",
|
|
668
|
+
})
|
|
669
|
+
.up()
|
|
670
|
+
.up()
|
|
671
|
+
.up();
|
|
672
|
+
// Disabled
|
|
673
|
+
this.buttonSecondaryDrawable = this.buttonSecondaryDrawable
|
|
674
|
+
.ele("item", {
|
|
675
|
+
"android:state_enabled": "false",
|
|
676
|
+
})
|
|
677
|
+
.ele("shape", { "android:shape": "rectangle" })
|
|
678
|
+
.ele("corners", {
|
|
679
|
+
"android:radius": this.theme.buttonCornerRadius
|
|
680
|
+
? `${this.theme.buttonCornerRadius}dp`
|
|
681
|
+
: "@dimen/abc_control_corner_material",
|
|
682
|
+
})
|
|
683
|
+
.up()
|
|
684
|
+
.ele("padding", {
|
|
685
|
+
"android:left": "@dimen/abc_button_padding_horizontal_material",
|
|
686
|
+
"android:top": "@dimen/abc_button_padding_vertical_material",
|
|
687
|
+
"android:right": "@dimen/abc_button_padding_horizontal_material",
|
|
688
|
+
"android:bottom": "@dimen/abc_button_padding_vertical_material",
|
|
689
|
+
})
|
|
690
|
+
.up()
|
|
691
|
+
.ele("solid", {
|
|
692
|
+
"android:color": "@android:color/darker_gray",
|
|
693
|
+
})
|
|
694
|
+
.up()
|
|
695
|
+
.up()
|
|
696
|
+
.up();
|
|
697
|
+
// touched
|
|
698
|
+
this.buttonSecondaryDrawable = this.buttonSecondaryDrawable
|
|
699
|
+
.ele("item", {
|
|
700
|
+
"android:state_pressed": "true",
|
|
701
|
+
})
|
|
702
|
+
.ele("shape", { "android:shape": "rectangle" })
|
|
703
|
+
.ele("corners", {
|
|
704
|
+
"android:radius": this.theme.buttonCornerRadius
|
|
705
|
+
? `${this.theme.buttonCornerRadius}dp`
|
|
706
|
+
: "@dimen/abc_control_corner_material",
|
|
707
|
+
})
|
|
708
|
+
.up()
|
|
709
|
+
.ele("solid", {
|
|
710
|
+
"android:color": "@color/grayButtonDark",
|
|
711
|
+
})
|
|
712
|
+
.up()
|
|
713
|
+
.ele("padding", {
|
|
714
|
+
"android:left": "@dimen/abc_button_padding_horizontal_material",
|
|
715
|
+
"android:top": "@dimen/abc_button_padding_vertical_material",
|
|
716
|
+
"android:right": "@dimen/abc_button_padding_horizontal_material",
|
|
717
|
+
"android:bottom": "@dimen/abc_button_padding_vertical_material",
|
|
718
|
+
})
|
|
719
|
+
.up()
|
|
720
|
+
.up()
|
|
721
|
+
.up();
|
|
722
|
+
this.buttonSecondaryDrawable = this.buttonSecondaryDrawable
|
|
723
|
+
.ele("item")
|
|
724
|
+
.ele("shape", { "android:shape": "rectangle" })
|
|
725
|
+
.ele("corners", {
|
|
726
|
+
"android:radius": this.theme.buttonCornerRadius
|
|
727
|
+
? `${this.theme.buttonCornerRadius}dp`
|
|
728
|
+
: "@dimen/abc_control_corner_material",
|
|
729
|
+
})
|
|
730
|
+
.up()
|
|
731
|
+
.ele("solid", {
|
|
732
|
+
"android:color": "@color/grayButton",
|
|
733
|
+
})
|
|
734
|
+
.up()
|
|
735
|
+
.ele("padding", {
|
|
736
|
+
"android:left": "@dimen/abc_button_padding_horizontal_material",
|
|
737
|
+
"android:top": "@dimen/abc_button_padding_vertical_material",
|
|
738
|
+
"android:right": "@dimen/abc_button_padding_horizontal_material",
|
|
739
|
+
"android:bottom": "@dimen/abc_button_padding_vertical_material",
|
|
740
|
+
})
|
|
741
|
+
.up()
|
|
742
|
+
.up()
|
|
743
|
+
.up();
|
|
744
|
+
// Finish button drawable
|
|
745
|
+
this.buttonDrawable = this.buttonDrawable.up();
|
|
746
|
+
this.buttonSecondaryDrawable = this.buttonSecondaryDrawable.up();
|
|
747
|
+
this.buttonColor = this.buttonColor
|
|
748
|
+
.ele("item", {
|
|
749
|
+
"android:state_enabled": "false",
|
|
750
|
+
"android:color": (_c = this.theme.buttonDisabledTextColor) !== null && _c !== void 0 ? _c : "@android:color/darker_gray",
|
|
751
|
+
})
|
|
752
|
+
.up()
|
|
753
|
+
.ele("item", {
|
|
754
|
+
"android:state_pressed": "true",
|
|
755
|
+
"android:color": (_d = this.theme.buttonTextColor) !== null && _d !== void 0 ? _d : "@android:color/white",
|
|
756
|
+
})
|
|
757
|
+
.up()
|
|
758
|
+
.ele("item", {
|
|
759
|
+
"android:color": (_e = this.theme.buttonTextColor) !== null && _e !== void 0 ? _e : "@android:color/white",
|
|
760
|
+
})
|
|
761
|
+
.up();
|
|
762
|
+
this.buttonColor = this.buttonColor.up();
|
|
763
|
+
this.root = this.root.up();
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
progressColor() {
|
|
768
|
+
if (this.theme.progressColor) {
|
|
769
|
+
this.printQueue.push(() => {
|
|
770
|
+
this.root = this.root
|
|
771
|
+
.ele("item", { name: "colorControlActivated" })
|
|
772
|
+
.txt(this.theme.progressColor)
|
|
773
|
+
.up();
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
successAsset() {
|
|
778
|
+
if (!this.theme.successAsset)
|
|
779
|
+
return;
|
|
780
|
+
this.printQueue.push(() => {
|
|
781
|
+
this.root = this.root
|
|
782
|
+
.ele("item", { name: "personaInquiryCompleteImage" })
|
|
783
|
+
.txt(this.theme.successAsset)
|
|
784
|
+
.up()
|
|
785
|
+
.txt(" ");
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
failAsset() {
|
|
789
|
+
if (!this.theme.failAsset)
|
|
790
|
+
return;
|
|
791
|
+
this.printQueue.push(() => {
|
|
792
|
+
this.root = this.root
|
|
793
|
+
.ele("item", { name: "personaInquiryFailImage" })
|
|
794
|
+
.txt(this.theme.failAsset)
|
|
795
|
+
.up()
|
|
796
|
+
.txt(" ");
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
loadingAnimationAsset() {
|
|
800
|
+
if (!this.theme.loadingAnimationAsset || !this.theme.loadingAnimationWidthPercent)
|
|
801
|
+
return;
|
|
802
|
+
this.printQueue.push(() => {
|
|
803
|
+
this.root = this.root
|
|
804
|
+
.ele("item", { name: "personaInquiryLoadingLottieRaw" })
|
|
805
|
+
.txt(this.theme.loadingAnimationAsset)
|
|
806
|
+
.up()
|
|
807
|
+
.txt(" ");
|
|
808
|
+
this.root = this.root
|
|
809
|
+
.ele("item", { name: "personaInquiryLoadingLottieWidthPercent" })
|
|
810
|
+
.txt(this.theme.loadingAnimationWidthPercent)
|
|
811
|
+
.up()
|
|
812
|
+
.txt(" ");
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
selfieAnimationAsset() {
|
|
816
|
+
if (!this.theme.selfieAnimationAsset || !this.theme.selfieAnimationWidthPercent)
|
|
817
|
+
return;
|
|
818
|
+
this.printQueue.push(() => {
|
|
819
|
+
this.root = this.root
|
|
820
|
+
.ele("item", { name: "personaInquirySelfieLottieRaw" })
|
|
821
|
+
.txt(this.theme.selfieAnimationAsset)
|
|
822
|
+
.up()
|
|
823
|
+
.txt(" ");
|
|
824
|
+
this.root = this.root
|
|
825
|
+
.ele("item", { name: "personaInquirySelfieLottieWidthPercent" })
|
|
826
|
+
.txt(this.theme.selfieAnimationWidthPercent)
|
|
827
|
+
.up()
|
|
828
|
+
.txt(" ");
|
|
829
|
+
});
|
|
830
|
+
}
|
|
576
831
|
}
|
|
577
832
|
exports.default = AndroidResourcePrinter;
|