@maccesar/titools 2.2.4 → 2.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/README.md +23 -23
- package/lib/commands/update.js +4 -12
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +31 -31
- package/skills/alloy-guides/references/CONCEPTS.md +3 -3
- package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/MODELS.md +6 -6
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +27 -27
- package/skills/alloy-howtos/references/best_practices.md +9 -9
- package/skills/alloy-howtos/references/cli_reference.md +14 -14
- package/skills/alloy-howtos/references/config_files.md +16 -16
- package/skills/alloy-howtos/references/custom_tags.md +16 -16
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
- package/skills/alloy-howtos/references/samples.md +19 -19
- package/skills/purgetss/SKILL.md +11 -1
- package/skills/purgetss/references/animation-system.md +1 -1
- package/skills/purgetss/references/cli-commands.md +3 -3
- package/skills/purgetss/references/customization-deep-dive.md +1 -1
- package/skills/purgetss/references/dynamic-component-creation.md +1 -1
- package/skills/purgetss/references/icon-fonts.md +4 -0
- package/skills/purgetss/references/installation-setup.md +8 -1
- package/skills/purgetss/references/migration-guide.md +4 -0
- package/skills/purgetss/references/tikit-components.md +193 -204
- package/skills/purgetss/references/ui-ux-design.md +1 -1
- package/skills/ti-expert/SKILL.md +78 -118
- package/skills/ti-expert/references/alloy-builtins.md +18 -18
- package/skills/ti-expert/references/alloy-structure.md +21 -21
- package/skills/ti-expert/references/anti-patterns.md +15 -15
- package/skills/ti-expert/references/cli-expert.md +15 -15
- package/skills/ti-expert/references/code-conventions.md +38 -38
- package/skills/ti-expert/references/contracts.md +8 -8
- package/skills/ti-expert/references/controller-patterns.md +14 -14
- package/skills/ti-expert/references/error-handling.md +11 -11
- package/skills/ti-expert/references/examples.md +12 -12
- package/skills/ti-expert/references/migration-patterns.md +24 -24
- package/skills/ti-expert/references/patterns.md +10 -10
- package/skills/ti-expert/references/performance-listview.md +16 -16
- package/skills/ti-expert/references/performance-optimization.md +41 -41
- package/skills/ti-expert/references/security-device.md +22 -22
- package/skills/ti-expert/references/security-fundamentals.md +19 -19
- package/skills/ti-expert/references/state-management.md +33 -33
- package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
- package/skills/ti-expert/references/testing-unit.md +24 -24
- package/skills/ti-expert/references/theming.md +15 -15
- package/skills/ti-guides/SKILL.md +58 -60
- package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
- package/skills/ti-guides/references/android-manifest.md +15 -15
- package/skills/ti-guides/references/app-distribution.md +70 -166
- package/skills/ti-guides/references/application-frameworks.md +96 -114
- package/skills/ti-guides/references/cli-reference.md +294 -294
- package/skills/ti-guides/references/coding-best-practices.md +42 -33
- package/skills/ti-guides/references/commonjs-advanced.md +57 -51
- package/skills/ti-guides/references/hello-world.md +36 -36
- package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
- package/skills/ti-guides/references/javascript-primer.md +83 -101
- package/skills/ti-guides/references/reserved-words.md +9 -9
- package/skills/ti-guides/references/resources.md +75 -83
- package/skills/ti-guides/references/style-and-conventions.md +35 -28
- package/skills/ti-guides/references/tiapp-config.md +110 -74
- package/skills/ti-howtos/SKILL.md +88 -92
- package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
- package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
- package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
- package/skills/ti-howtos/references/cross-platform-development.md +115 -136
- package/skills/ti-howtos/references/debugging-profiling.md +167 -181
- package/skills/ti-howtos/references/extending-titanium.md +121 -121
- package/skills/ti-howtos/references/google-maps-v2.md +84 -82
- package/skills/ti-howtos/references/ios-map-kit.md +65 -60
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
- package/skills/ti-howtos/references/local-data-sources.md +79 -78
- package/skills/ti-howtos/references/location-and-maps.md +116 -120
- package/skills/ti-howtos/references/media-apis.md +87 -86
- package/skills/ti-howtos/references/notification-services.md +250 -260
- package/skills/ti-howtos/references/remote-data-sources.md +98 -93
- package/skills/ti-howtos/references/tutorials.md +226 -216
- package/skills/ti-howtos/references/using-modules.md +73 -102
- package/skills/ti-howtos/references/web-content-integration.md +101 -103
- package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
- package/skills/ti-ui/SKILL.md +85 -85
- package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
- package/skills/ti-ui/references/animation-and-matrices.md +79 -79
- package/skills/ti-ui/references/application-structures.md +96 -99
- package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
- package/skills/ti-ui/references/event-handling.md +58 -58
- package/skills/ti-ui/references/gestures.md +62 -64
- package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
- package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
- package/skills/ti-ui/references/listviews-and-performance.md +107 -107
- package/skills/ti-ui/references/orientation.md +87 -88
- package/skills/ti-ui/references/platform-ui-android.md +87 -81
- package/skills/ti-ui/references/platform-ui-ios.md +63 -61
- package/skills/ti-ui/references/scrolling-views.md +29 -29
- package/skills/ti-ui/references/tableviews.md +56 -56
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# Android UI
|
|
1
|
+
# Android UI components and conventions
|
|
2
2
|
|
|
3
|
-
## 1. Action
|
|
3
|
+
## 1. Action bar
|
|
4
4
|
|
|
5
5
|
### Overview
|
|
6
6
|
|
|
7
|
-
The
|
|
7
|
+
The action bar sits at the top of the screen. It shows actions, navigation, and app branding.
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### Enable the action bar
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
In `tiapp.xml`:
|
|
12
12
|
|
|
13
13
|
```xml
|
|
14
14
|
<android>
|
|
@@ -26,7 +26,7 @@ The Action Bar is a key Android UI component that appears at the top of the scre
|
|
|
26
26
|
</android>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
###
|
|
29
|
+
### Create the action bar (programmatic)
|
|
30
30
|
|
|
31
31
|
```javascript
|
|
32
32
|
const activity = Ti.Android.currentActivity;
|
|
@@ -87,7 +87,7 @@ activity.onPrepareOptionsMenu = (e) => {
|
|
|
87
87
|
activity.invalidateOptionsMenu();
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
### Action
|
|
90
|
+
### Action bar properties
|
|
91
91
|
|
|
92
92
|
```javascript
|
|
93
93
|
const activity = Ti.Android.currentActivity;
|
|
@@ -107,11 +107,11 @@ actionBar.onHomeIconItemSelected = () => {
|
|
|
107
107
|
};
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
###
|
|
110
|
+
### Refresh the options menu
|
|
111
111
|
|
|
112
|
-
Call `activity.invalidateOptionsMenu()` to force `onCreateOptionsMenu` to
|
|
112
|
+
Call `activity.invalidateOptionsMenu()` to force `onCreateOptionsMenu` to run again. This is useful when menu items need to change at runtime, for example after a tab switch or a state change.
|
|
113
113
|
|
|
114
|
-
### Action
|
|
114
|
+
### Action bar with app icon
|
|
115
115
|
|
|
116
116
|
```javascript
|
|
117
117
|
const activity = Ti.Android.currentActivity;
|
|
@@ -129,7 +129,7 @@ activity.onCreateOptionsMenu = (e) => {
|
|
|
129
129
|
};
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
### Action
|
|
132
|
+
### Action view (custom layout)
|
|
133
133
|
|
|
134
134
|
```javascript
|
|
135
135
|
activity.onCreateOptionsMenu = (e) => {
|
|
@@ -164,13 +164,13 @@ activity.onCreateOptionsMenu = (e) => {
|
|
|
164
164
|
};
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
## 2. Android
|
|
167
|
+
## 2. Android themes
|
|
168
168
|
|
|
169
169
|
### Overview
|
|
170
170
|
|
|
171
|
-
Themes control the visual style of Android apps. Titanium 10.0.0+
|
|
171
|
+
Themes control the visual style of Android apps. Titanium 10.0.0+ requires material-based themes.
|
|
172
172
|
|
|
173
|
-
### Titanium
|
|
173
|
+
### Titanium material themes (SDK 10.0.0+)
|
|
174
174
|
|
|
175
175
|
| Theme | Description |
|
|
176
176
|
| ------------------------------------ | ------------------------------------- |
|
|
@@ -184,7 +184,7 @@ Themes control the visual style of Android apps. Titanium 10.0.0+ **requires** m
|
|
|
184
184
|
| `Theme.AppDerived.Fullscreen` | Inherits app theme, fullscreen |
|
|
185
185
|
| `Theme.AppDerived.Translucent` | Transparent background |
|
|
186
186
|
|
|
187
|
-
### Material 3
|
|
187
|
+
### Material 3 themes (SDK 12.0.0+)
|
|
188
188
|
|
|
189
189
|
```xml
|
|
190
190
|
<!-- tiapp.xml -->
|
|
@@ -201,7 +201,8 @@ Themes control the visual style of Android apps. Titanium 10.0.0+ **requires** m
|
|
|
201
201
|
| `Theme.Titanium.Material3.DayNight.NoTitleBar` | No action bar |
|
|
202
202
|
| `Theme.Titanium.Material3.DayNight.Fullscreen` | No action/status bar |
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
Custom Material 3 theme:
|
|
205
|
+
|
|
205
206
|
```xml
|
|
206
207
|
<!-- platform/android/res/values/mytheme.xml -->
|
|
207
208
|
<resources>
|
|
@@ -209,9 +210,10 @@ Themes control the visual style of Android apps. Titanium 10.0.0+ **requires** m
|
|
|
209
210
|
</resources>
|
|
210
211
|
```
|
|
211
212
|
|
|
212
|
-
###
|
|
213
|
+
### Apply themes
|
|
214
|
+
|
|
215
|
+
Global (`tiapp.xml`):
|
|
213
216
|
|
|
214
|
-
**Global (tiapp.xml):**
|
|
215
217
|
```xml
|
|
216
218
|
<android xmlns:android="http://schemas.android.com/apk/res/android">
|
|
217
219
|
<manifest>
|
|
@@ -220,14 +222,15 @@ Themes control the visual style of Android apps. Titanium 10.0.0+ **requires** m
|
|
|
220
222
|
</android>
|
|
221
223
|
```
|
|
222
224
|
|
|
223
|
-
|
|
225
|
+
Per-window (JavaScript):
|
|
226
|
+
|
|
224
227
|
```javascript
|
|
225
228
|
const win = Ti.UI.createWindow({
|
|
226
229
|
theme: 'Theme.AppDerived.Fullscreen'
|
|
227
230
|
});
|
|
228
231
|
```
|
|
229
232
|
|
|
230
|
-
### Custom
|
|
233
|
+
### Custom theme
|
|
231
234
|
|
|
232
235
|
```xml
|
|
233
236
|
<!-- platform/android/res/values/mytheme.xml -->
|
|
@@ -245,7 +248,8 @@ const win = Ti.UI.createWindow({
|
|
|
245
248
|
</resources>
|
|
246
249
|
```
|
|
247
250
|
|
|
248
|
-
|
|
251
|
+
Dark theme variant (`values-night/`):
|
|
252
|
+
|
|
249
253
|
```xml
|
|
250
254
|
<!-- platform/android/res/values-night/mytheme.xml -->
|
|
251
255
|
<resources>
|
|
@@ -256,7 +260,7 @@ const win = Ti.UI.createWindow({
|
|
|
256
260
|
</resources>
|
|
257
261
|
```
|
|
258
262
|
|
|
259
|
-
### Color
|
|
263
|
+
### Color palette attributes
|
|
260
264
|
|
|
261
265
|
| Attribute | Description |
|
|
262
266
|
| ---------------------------- | -------------------------- |
|
|
@@ -269,14 +273,16 @@ const win = Ti.UI.createWindow({
|
|
|
269
273
|
| `android:navigationBarColor` | Bottom nav bar (API 21+) |
|
|
270
274
|
| `android:textColorPrimary` | Primary text color |
|
|
271
275
|
|
|
272
|
-
###
|
|
276
|
+
### Hide the action bar
|
|
277
|
+
|
|
278
|
+
Via theme (recommended):
|
|
273
279
|
|
|
274
|
-
**Via theme (recommended):**
|
|
275
280
|
```xml
|
|
276
281
|
<application android:theme="@style/Theme.AppDerived.NoTitleBar"/>
|
|
277
282
|
```
|
|
278
283
|
|
|
279
|
-
|
|
284
|
+
Via JavaScript:
|
|
285
|
+
|
|
280
286
|
```javascript
|
|
281
287
|
const win = Ti.UI.createWindow({
|
|
282
288
|
theme: 'Theme.AppDerived.NoTitleBar'
|
|
@@ -288,19 +294,19 @@ win.addEventListener('open', () => {
|
|
|
288
294
|
});
|
|
289
295
|
```
|
|
290
296
|
|
|
291
|
-
### Theme
|
|
297
|
+
### Theme requirements
|
|
292
298
|
|
|
293
|
-
|
|
299
|
+
Warning: SDK 10.0.0+ requires material-based themes. Using non-material themes will cause a runtime error. Do not name your custom theme file `theme.xml`. This will overwrite Titanium's built-in theme file. Use names like `mytheme.xml`.
|
|
294
300
|
|
|
295
301
|
- SDK 10.0.0+ requires material-based themes (runtime error otherwise)
|
|
296
302
|
- Place custom themes in `platform/android/res/values/`
|
|
297
|
-
- Do
|
|
303
|
+
- Do not name the file `theme.xml` (overwrites Titanium's)
|
|
298
304
|
- Use `values-v<api>` for version-specific themes
|
|
299
305
|
- Use `values-night` for dark mode variants
|
|
300
306
|
|
|
301
|
-
## 3. Options
|
|
307
|
+
## 3. Options menu
|
|
302
308
|
|
|
303
|
-
### Legacy
|
|
309
|
+
### Legacy options menu
|
|
304
310
|
|
|
305
311
|
```javascript
|
|
306
312
|
const activity = Ti.Android.currentActivity;
|
|
@@ -326,7 +332,7 @@ activity.onOptionsItemSelected = (e) => {
|
|
|
326
332
|
};
|
|
327
333
|
```
|
|
328
334
|
|
|
329
|
-
### Context
|
|
335
|
+
### Context menu (long press)
|
|
330
336
|
|
|
331
337
|
```javascript
|
|
332
338
|
const view = Ti.UI.createView({
|
|
@@ -344,7 +350,7 @@ function registerForContextMenu() {
|
|
|
344
350
|
}
|
|
345
351
|
```
|
|
346
352
|
|
|
347
|
-
## 4. Status
|
|
353
|
+
## 4. Status bar notifications
|
|
348
354
|
|
|
349
355
|
### Notifications
|
|
350
356
|
|
|
@@ -366,7 +372,7 @@ const notification = Ti.Android.createNotification({
|
|
|
366
372
|
Ti.Android.NotificationManager.notify(1, notification);
|
|
367
373
|
```
|
|
368
374
|
|
|
369
|
-
### Notification
|
|
375
|
+
### Notification channels (Android 8.0+)
|
|
370
376
|
|
|
371
377
|
```javascript
|
|
372
378
|
// Create notification channel for Android 8.0+
|
|
@@ -393,7 +399,7 @@ const notification = Ti.Android.createNotification({
|
|
|
393
399
|
Ti.Android.NotificationManager.notify(1, notification);
|
|
394
400
|
```
|
|
395
401
|
|
|
396
|
-
###
|
|
402
|
+
### Clear notifications
|
|
397
403
|
|
|
398
404
|
```javascript
|
|
399
405
|
// Cancel specific notification
|
|
@@ -403,9 +409,9 @@ Ti.Android.NotificationManager.cancel(1);
|
|
|
403
409
|
Ti.Android.NotificationManager.cancelAll();
|
|
404
410
|
```
|
|
405
411
|
|
|
406
|
-
## 5. Progress
|
|
412
|
+
## 5. Progress bars
|
|
407
413
|
|
|
408
|
-
### Horizontal
|
|
414
|
+
### Horizontal progress bar
|
|
409
415
|
|
|
410
416
|
```javascript
|
|
411
417
|
const progressBar = Ti.UI.createProgressBar({
|
|
@@ -426,7 +432,7 @@ progressBar.message = 'Loading...';
|
|
|
426
432
|
progressBar.show();
|
|
427
433
|
```
|
|
428
434
|
|
|
429
|
-
### Spinner (
|
|
435
|
+
### Spinner (indeterminate progress)
|
|
430
436
|
|
|
431
437
|
```javascript
|
|
432
438
|
const activityIndicator = Ti.UI.createActivityIndicator({
|
|
@@ -441,9 +447,9 @@ activityIndicator.show();
|
|
|
441
447
|
activityIndicator.hide();
|
|
442
448
|
```
|
|
443
449
|
|
|
444
|
-
## 6. Tab
|
|
450
|
+
## 6. Tab groups and tabs
|
|
445
451
|
|
|
446
|
-
### Native Android
|
|
452
|
+
### Native Android tabs
|
|
447
453
|
|
|
448
454
|
```javascript
|
|
449
455
|
const tabGroup = Ti.UI.createTabGroup({
|
|
@@ -455,7 +461,7 @@ tabGroup.addEventListener('open', (e) => {
|
|
|
455
461
|
});
|
|
456
462
|
```
|
|
457
463
|
|
|
458
|
-
### Tab
|
|
464
|
+
### Tab badges
|
|
459
465
|
|
|
460
466
|
```javascript
|
|
461
467
|
const tab = Titanium.UI.createTab({
|
|
@@ -471,9 +477,9 @@ tab.badge = 5;
|
|
|
471
477
|
tab.badge = null; // or tab.setBadge(null);
|
|
472
478
|
```
|
|
473
479
|
|
|
474
|
-
## 7. Hardware
|
|
480
|
+
## 7. Hardware back button handling
|
|
475
481
|
|
|
476
|
-
###
|
|
482
|
+
### Handle back button
|
|
477
483
|
|
|
478
484
|
```javascript
|
|
479
485
|
const win = Ti.UI.createWindow();
|
|
@@ -495,7 +501,7 @@ function canGoBack() {
|
|
|
495
501
|
}
|
|
496
502
|
```
|
|
497
503
|
|
|
498
|
-
### Exit
|
|
504
|
+
### Exit confirmation dialog
|
|
499
505
|
|
|
500
506
|
```javascript
|
|
501
507
|
function showExitConfirmation() {
|
|
@@ -517,9 +523,9 @@ function showExitConfirmation() {
|
|
|
517
523
|
}
|
|
518
524
|
```
|
|
519
525
|
|
|
520
|
-
## 8. Notification
|
|
526
|
+
## 8. Notification drawer
|
|
521
527
|
|
|
522
|
-
### Display
|
|
528
|
+
### Display notification
|
|
523
529
|
|
|
524
530
|
```javascript
|
|
525
531
|
const notification = Ti.Android.createNotification({
|
|
@@ -535,32 +541,32 @@ const notification = Ti.Android.createNotification({
|
|
|
535
541
|
Ti.Android.NotificationManager.notify(1, notification);
|
|
536
542
|
```
|
|
537
543
|
|
|
538
|
-
## 9. Android UI
|
|
544
|
+
## 9. Android UI conventions
|
|
539
545
|
|
|
540
|
-
### Back
|
|
546
|
+
### Back button behavior
|
|
541
547
|
|
|
542
548
|
Standard Android conventions:
|
|
543
|
-
-
|
|
544
|
-
-
|
|
549
|
+
- Back button = navigate back in hierarchy
|
|
550
|
+
- Long press back = show recent apps menu (system behavior)
|
|
545
551
|
- Apps should handle back button unless:
|
|
546
552
|
|
|
547
553
|
1. It's the root activity (app would exit)
|
|
548
554
|
2. User is in a task that shouldn't be interrupted
|
|
549
555
|
3. Confirmation needed (destructive action)
|
|
550
556
|
|
|
551
|
-
### Up
|
|
557
|
+
### Up and down navigation
|
|
552
558
|
|
|
553
559
|
Traditional Android navigation uses:
|
|
554
|
-
-
|
|
555
|
-
-
|
|
556
|
-
-
|
|
560
|
+
- Up button = navigate up in hierarchy
|
|
561
|
+
- Menu button = show options menu
|
|
562
|
+
- Home button = go to home (backgrounds app)
|
|
557
563
|
|
|
558
564
|
Modern apps may:
|
|
559
|
-
- Use Navigation Component (
|
|
560
|
-
- Use up button for
|
|
565
|
+
- Use Navigation Component (Jetpack)
|
|
566
|
+
- Use up button for a back-style pattern
|
|
561
567
|
- Implement custom up navigation
|
|
562
568
|
|
|
563
|
-
### App
|
|
569
|
+
### App shortcuts
|
|
564
570
|
|
|
565
571
|
Android 7.1+ app shortcuts:
|
|
566
572
|
|
|
@@ -577,7 +583,7 @@ Android 7.1+ app shortcuts:
|
|
|
577
583
|
</activity>
|
|
578
584
|
```
|
|
579
585
|
|
|
580
|
-
## 10. Material
|
|
586
|
+
## 10. Material design components
|
|
581
587
|
|
|
582
588
|
### Using AppCompat v7
|
|
583
589
|
|
|
@@ -593,9 +599,9 @@ Android 7.1+ app shortcuts:
|
|
|
593
599
|
</android>
|
|
594
600
|
```
|
|
595
601
|
|
|
596
|
-
### Material
|
|
602
|
+
### Material design components
|
|
597
603
|
|
|
598
|
-
- `Toolbar` - Replaces
|
|
604
|
+
- `Toolbar` - Replaces action bar (recommended)
|
|
599
605
|
- `CardView` - Cards with elevation
|
|
600
606
|
- `RecyclerView` - Advanced list component
|
|
601
607
|
- `CoordinatorLayout` - Complex layout coordination
|
|
@@ -604,7 +610,7 @@ Android 7.1+ app shortcuts:
|
|
|
604
610
|
|
|
605
611
|
These can be accessed via Hyperloop or custom modules.
|
|
606
612
|
|
|
607
|
-
## 11. Toast
|
|
613
|
+
## 11. Toast notifications
|
|
608
614
|
|
|
609
615
|
Toast notifications display brief messages at the bottom of the screen that automatically disappear.
|
|
610
616
|
|
|
@@ -630,15 +636,15 @@ const toast = Ti.UI.createNotification({
|
|
|
630
636
|
toast.show();
|
|
631
637
|
```
|
|
632
638
|
|
|
633
|
-
|
|
634
|
-
- `Ti.UI.NOTIFICATION_DURATION_SHORT`
|
|
635
|
-
- `Ti.UI.NOTIFICATION_DURATION_LONG`
|
|
639
|
+
Duration options:
|
|
640
|
+
- `Ti.UI.NOTIFICATION_DURATION_SHORT` - Short display time
|
|
641
|
+
- `Ti.UI.NOTIFICATION_DURATION_LONG` - Longer display time
|
|
636
642
|
|
|
637
|
-
## 12. HTML
|
|
643
|
+
## 12. HTML labels and linkification
|
|
638
644
|
|
|
639
|
-
### HTML
|
|
645
|
+
### HTML content in labels
|
|
640
646
|
|
|
641
|
-
Use the `html` property on
|
|
647
|
+
Use the `html` property on labels to render inline HTML content:
|
|
642
648
|
|
|
643
649
|
```javascript
|
|
644
650
|
const label = Ti.UI.createLabel({
|
|
@@ -647,9 +653,9 @@ const label = Ti.UI.createLabel({
|
|
|
647
653
|
});
|
|
648
654
|
```
|
|
649
655
|
|
|
650
|
-
### Auto-
|
|
656
|
+
### Auto-link constants
|
|
651
657
|
|
|
652
|
-
The `autoLink` property
|
|
658
|
+
The `autoLink` property detects and linkifies content:
|
|
653
659
|
|
|
654
660
|
| Constant | Description |
|
|
655
661
|
| -------------------------------- | ----------------------------- |
|
|
@@ -668,17 +674,17 @@ const label = Ti.UI.createLabel({
|
|
|
668
674
|
});
|
|
669
675
|
```
|
|
670
676
|
|
|
671
|
-
## 13. Nine-
|
|
677
|
+
## 13. Nine-patch images
|
|
672
678
|
|
|
673
679
|
Nine-patch images (`.9.png`) define stretchable regions that adapt to different screen sizes and content.
|
|
674
680
|
|
|
675
|
-
### Key
|
|
681
|
+
### Key points
|
|
676
682
|
|
|
677
683
|
- Files use the `.9.png` extension
|
|
678
684
|
- Only work as `backgroundImage` (not as regular images)
|
|
679
685
|
- Define stretchable regions so the image scales without distortion
|
|
680
|
-
- Reference
|
|
681
|
-
- Create with the Android SDK
|
|
686
|
+
- Reference without the `.9` in code. Android resolves it automatically
|
|
687
|
+
- Create with the Android SDK `draw9patch` tool
|
|
682
688
|
|
|
683
689
|
```javascript
|
|
684
690
|
const button = Ti.UI.createButton({
|
|
@@ -689,13 +695,13 @@ const button = Ti.UI.createButton({
|
|
|
689
695
|
});
|
|
690
696
|
```
|
|
691
697
|
|
|
692
|
-
## Best
|
|
698
|
+
## Best practices
|
|
693
699
|
|
|
694
|
-
1.
|
|
695
|
-
2.
|
|
696
|
-
3.
|
|
697
|
-
4.
|
|
698
|
-
5.
|
|
699
|
-
6.
|
|
700
|
-
7.
|
|
701
|
-
8.
|
|
700
|
+
1. Follow Material Design guidelines for modern Android apps
|
|
701
|
+
2. Use AppCompat v7 for consistent styling across Android versions
|
|
702
|
+
3. Handle back button to prevent unexpected app exits
|
|
703
|
+
4. Use themes that match your brand/design
|
|
704
|
+
5. Test on multiple Android versions because theme support varies
|
|
705
|
+
6. Consider accessibility and set content descriptions
|
|
706
|
+
7. Use notification channels for Android 8.0+ apps
|
|
707
|
+
8. Test on physical devices. Some features do not work in the emulator
|