@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
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## 1. Overview
|
|
4
4
|
|
|
5
|
-
Orientation
|
|
5
|
+
Orientation is whether the app displays in portrait or landscape, and how it reacts when the device rotates.
|
|
6
6
|
|
|
7
|
-
## 2. Design
|
|
7
|
+
## 2. Design principles
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
- Do not mix orientations on iPhone or iPod. Pick portrait or landscape for the whole app. Switching mid-flow feels jarring.
|
|
10
|
+
- Do not support portrait upside-down on iPhone. A phone call can appear upside-down, which is confusing and risky.
|
|
11
|
+
- iPad should support all orientations. Apple’s HIG expects it and users rotate their iPads often.
|
|
12
|
+
- These principles apply to Android as well. Android is more permissive, but consistency still matters.
|
|
13
13
|
|
|
14
|
-
## 3. Orientation
|
|
14
|
+
## 3. Orientation modes
|
|
15
15
|
|
|
16
|
-
### Supported
|
|
16
|
+
### Supported orientations
|
|
17
17
|
|
|
18
18
|
| Mode | Description |
|
|
19
19
|
| ----------------------- | -------------------------------- |
|
|
@@ -25,11 +25,11 @@ Orientation refers to whether the app displays in portrait or landscape mode, an
|
|
|
25
25
|
| `Ti.UI.FACE_DOWN` | Device face down (flat on table) |
|
|
26
26
|
| `Ti.UI.AUTO` | Let system decide |
|
|
27
27
|
|
|
28
|
-
## 4. Locking
|
|
28
|
+
## 4. Locking orientation
|
|
29
29
|
|
|
30
|
-
### Lock to
|
|
30
|
+
### Lock to a specific orientation
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
In `tiapp.xml` (preferred):
|
|
33
33
|
|
|
34
34
|
```xml
|
|
35
35
|
<ios>
|
|
@@ -45,10 +45,10 @@ Orientation refers to whether the app displays in portrait or landscape mode, an
|
|
|
45
45
|
</ios>
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
- `UISupportedInterfaceOrientations~iphone`
|
|
50
|
-
- `UISupportedInterfaceOrientations~ipad`
|
|
51
|
-
- `UISupportedInterfaceOrientations`
|
|
48
|
+
iOS plist iPhone vs iPad keys: You can define separate orientations for iPhone and iPad:
|
|
49
|
+
- `UISupportedInterfaceOrientations~iphone` for iPhone (default: portrait only)
|
|
50
|
+
- `UISupportedInterfaceOrientations~ipad` for iPad (default: all four)
|
|
51
|
+
- `UISupportedInterfaceOrientations` applies to both if device-specific keys are absent
|
|
52
52
|
|
|
53
53
|
```xml
|
|
54
54
|
<android>
|
|
@@ -60,7 +60,7 @@ Orientation refers to whether the app displays in portrait or landscape mode, an
|
|
|
60
60
|
</android>
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
### Android
|
|
63
|
+
### Android orientation values
|
|
64
64
|
|
|
65
65
|
```xml
|
|
66
66
|
<activity android:screenOrientation="portrait"/>
|
|
@@ -76,17 +76,17 @@ Orientation refers to whether the app displays in portrait or landscape mode, an
|
|
|
76
76
|
<activity android:screenOrientation="sensor"/>
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
- `portrait`
|
|
81
|
-
- `landscape`
|
|
82
|
-
- `sensor`
|
|
83
|
-
- `fullSensor`
|
|
84
|
-
- `nosensor`
|
|
85
|
-
- `user`
|
|
79
|
+
Common values:
|
|
80
|
+
- `portrait` for portrait mode
|
|
81
|
+
- `landscape` for landscape mode
|
|
82
|
+
- `sensor` uses the accelerometer
|
|
83
|
+
- `fullSensor` allows all four orientations
|
|
84
|
+
- `nosensor` ignores the accelerometer
|
|
85
|
+
- `user` follows the user preference
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
Warning: Android set vs get mismatch. You can set four specific orientations, but you only get two values back (portrait or landscape). Meaning also varies between phones and tablets based on sensor orientation.
|
|
88
88
|
|
|
89
|
-
### Runtime
|
|
89
|
+
### Runtime orientation lock (iOS)
|
|
90
90
|
|
|
91
91
|
```javascript
|
|
92
92
|
// Set orientation at runtime
|
|
@@ -96,9 +96,9 @@ Ti.UI.iPhone.setStatusBarStyle(Ti.UI.iPhone.StatusBar.DEFAULT);
|
|
|
96
96
|
// Use tiapp.xml configuration for consistent behavior
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
## 5. Handling
|
|
99
|
+
## 5. Handling orientation changes
|
|
100
100
|
|
|
101
|
-
### Detect
|
|
101
|
+
### Detect orientation change
|
|
102
102
|
|
|
103
103
|
```javascript
|
|
104
104
|
Ti.Gesture.addEventListener('orientationchange', (e) => {
|
|
@@ -111,15 +111,15 @@ Ti.Gesture.addEventListener('orientationchange', (e) => {
|
|
|
111
111
|
adjustForLandscape();
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
// Ti.Gesture helper methods
|
|
114
|
+
// Ti.Gesture helper methods - convenience booleans
|
|
115
115
|
Ti.API.info(`Is portrait: ${e.source.isPortrait()}`);
|
|
116
116
|
Ti.API.info(`Is landscape: ${e.source.isLandscape()}`);
|
|
117
117
|
});
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
Anti-pattern warning: Do not use `orientationchange` listeners to force an orientation. It causes the wrong orientation to flash, repeated firing, and bad behavior. Use `tiapp.xml` or window `orientationModes`.
|
|
121
121
|
...
|
|
122
|
-
### Window
|
|
122
|
+
### Window orientation events
|
|
123
123
|
|
|
124
124
|
```javascript
|
|
125
125
|
const win = Ti.UI.createWindow();
|
|
@@ -133,9 +133,9 @@ win.addEventListener('orientationchange', (e) => {
|
|
|
133
133
|
});
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
## 6. Adapting UI to
|
|
136
|
+
## 6. Adapting UI to orientation
|
|
137
137
|
|
|
138
|
-
### Responsive
|
|
138
|
+
### Responsive layout example
|
|
139
139
|
|
|
140
140
|
```javascript
|
|
141
141
|
const container = Ti.UI.createView({
|
|
@@ -164,7 +164,7 @@ function updateLayout() {
|
|
|
164
164
|
Ti.Gesture.addEventListener('orientationchange', updateLayout);
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
### Orientation-
|
|
167
|
+
### Orientation-specific components
|
|
168
168
|
|
|
169
169
|
```javascript
|
|
170
170
|
function createPortraitLayout() {
|
|
@@ -199,23 +199,23 @@ function switchLayout() {
|
|
|
199
199
|
Ti.Gesture.addEventListener('orientationchange', switchLayout);
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
## 7. Platform
|
|
202
|
+
## 7. Platform differences
|
|
203
203
|
|
|
204
|
-
### iOS
|
|
204
|
+
### iOS orientation
|
|
205
205
|
|
|
206
206
|
- Controlled by `UISupportedInterfaceOrientations` in Info.plist
|
|
207
207
|
- Shake to rotate can be disabled
|
|
208
208
|
- Status bar orientation matches window orientation
|
|
209
|
-
- Supports all orientations including upside-down
|
|
209
|
+
- Supports all orientations, including upside-down
|
|
210
210
|
|
|
211
|
-
### Android
|
|
211
|
+
### Android orientation
|
|
212
212
|
|
|
213
213
|
- Controlled by `screenOrientation` in AndroidManifest.xml
|
|
214
|
-
- Can be set per
|
|
214
|
+
- Can be set per activity
|
|
215
215
|
- More granular control (sensor, user, nosensor)
|
|
216
216
|
- May ignore upside-down depending on device
|
|
217
217
|
|
|
218
|
-
## 8. Checking
|
|
218
|
+
## 8. Checking current orientation
|
|
219
219
|
|
|
220
220
|
```javascript
|
|
221
221
|
// Get current orientation
|
|
@@ -232,11 +232,11 @@ const isLandscape = (currentOrientation === Ti.UI.LANDSCAPE_LEFT ||
|
|
|
232
232
|
currentOrientation === Ti.UI.LANDSCAPE_RIGHT);
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
## 9. Disabling
|
|
235
|
+
## 9. Disabling orientation change
|
|
236
236
|
|
|
237
|
-
### Disable
|
|
237
|
+
### Disable all rotation
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
iOS (tiapp.xml):
|
|
240
240
|
```xml
|
|
241
241
|
<ios>
|
|
242
242
|
<plist>
|
|
@@ -250,7 +250,7 @@ const isLandscape = (currentOrientation === Ti.UI.LANDSCAPE_LEFT ||
|
|
|
250
250
|
</ios>
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
Android (tiapp.xml):
|
|
254
254
|
```xml
|
|
255
255
|
<android>
|
|
256
256
|
<manifest>
|
|
@@ -259,7 +259,7 @@ const isLandscape = (currentOrientation === Ti.UI.LANDSCAPE_LEFT ||
|
|
|
259
259
|
</android>
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
### Disable
|
|
262
|
+
### Disable rotation for a specific window (iOS)
|
|
263
263
|
|
|
264
264
|
```javascript
|
|
265
265
|
const win = Ti.UI.createWindow({
|
|
@@ -267,16 +267,16 @@ const win = Ti.UI.createWindow({
|
|
|
267
267
|
});
|
|
268
268
|
```
|
|
269
269
|
|
|
270
|
-
|
|
270
|
+
Note: Window-level control is limited. App-level configuration is more reliable.
|
|
271
271
|
|
|
272
|
-
## 10. Orientation
|
|
272
|
+
## 10. Orientation lock limitations
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
Runtime orientation locking is not reliable across platforms.
|
|
275
275
|
|
|
276
|
-
-
|
|
277
|
-
-
|
|
276
|
+
- iOS: Orientation is controlled by `tiapp.xml` plist keys and window-level `orientationModes`. There is no API to lock or unlock at runtime.
|
|
277
|
+
- Android: Use `android:screenOrientation` in `tiapp.xml`. Changing orientation programmatically at runtime is not supported through Titanium APIs.
|
|
278
278
|
|
|
279
|
-
If you need a specific orientation for
|
|
279
|
+
If you need a specific orientation for one screen (for example, landscape video playback), create a dedicated window with `orientationModes` set at creation time:
|
|
280
280
|
|
|
281
281
|
```javascript
|
|
282
282
|
// Landscape-only video window
|
|
@@ -292,57 +292,56 @@ videoWin.add(videoPlayer);
|
|
|
292
292
|
videoWin.open();
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
-
## 11. Modal
|
|
295
|
+
## 11. Modal window constraints (iOS)
|
|
296
296
|
|
|
297
|
-
|
|
297
|
+
Note: Modal windows should not support orientations unsupported by the parent window. It can cause redraw glitches after dismissal. Also, setting `orientationModes` on non-modal windows inside a `NavigationWindow` or `TabGroup` is bad practice. Only the root window’s orientation settings are respected.
|
|
298
298
|
|
|
299
|
-
## 12. Splash
|
|
299
|
+
## 12. Splash screen configuration
|
|
300
300
|
|
|
301
|
-
Splash screens need orientation-specific
|
|
301
|
+
Splash screens need orientation-specific images:
|
|
302
|
+
- Android uses `default.png` (lowercase d) in `Resources/android/images/`.
|
|
303
|
+
- iOS uses `Default.png` (uppercase D) and orientation variants like `Default-Landscape.png` and `Default-Portrait.png` for iPad and Universal apps.
|
|
302
304
|
|
|
303
|
-
|
|
304
|
-
- **iOS**: Uses `Default.png` (uppercase `D`) with orientation variants like `Default-Landscape.png` and `Default-Portrait.png` for iPad and Universal apps.
|
|
305
|
+
See `icons-and-splash-screens.md` for full naming and size details.
|
|
305
306
|
|
|
306
|
-
|
|
307
|
+
## 13. Best practices
|
|
307
308
|
|
|
308
|
-
|
|
309
|
+
1. Test on multiple devices. Orientation behavior varies.
|
|
310
|
+
2. Test rotation scenarios. See how your UI adapts.
|
|
311
|
+
3. Consider user preference. Allow rotation when it makes sense.
|
|
312
|
+
4. Lock when needed, like video, games, or camera capture.
|
|
313
|
+
5. Use responsive layouts.
|
|
314
|
+
6. Test upside-down. Some devices support it, some do not.
|
|
315
|
+
7. Handle edge cases like phone calls.
|
|
316
|
+
8. Consider tablets. Default orientation can differ.
|
|
309
317
|
|
|
310
|
-
|
|
311
|
-
2. **Test rotation scenarios** - How does your UI adapt?
|
|
312
|
-
3. **Consider user preference** - Allow rotation when appropriate
|
|
313
|
-
4. **Lock when needed** - Video, games, camera capture
|
|
314
|
-
5. **Use responsive layouts** - Adapt UI to orientation
|
|
315
|
-
6. **Test upside-down** - Some devices support it, some don't
|
|
316
|
-
7. **Handle edge cases** - What happens during phone calls?
|
|
317
|
-
8. **Consider tablets** - Default orientation may differ
|
|
318
|
+
## 14. Common issues
|
|
318
319
|
|
|
319
|
-
|
|
320
|
+
### Orientation not changing
|
|
320
321
|
|
|
321
|
-
|
|
322
|
+
Problem: App does not rotate when the device rotates.
|
|
322
323
|
|
|
323
|
-
|
|
324
|
+
Solutions:
|
|
325
|
+
1. Check `tiapp.xml` orientation settings.
|
|
326
|
+
2. Ensure all orientations are enabled.
|
|
327
|
+
3. Test on physical device (simulator may not reflect real behavior).
|
|
328
|
+
4. Check for custom orientation locking code.
|
|
324
329
|
|
|
325
|
-
|
|
326
|
-
1. Check `tiapp.xml` orientation settings
|
|
327
|
-
2. Ensure all orientations are enabled
|
|
328
|
-
3. Test on physical device (simulator may not reflect real behavior)
|
|
329
|
-
4. Check for custom orientation locking code
|
|
330
|
+
### UI does not adapt
|
|
330
331
|
|
|
331
|
-
|
|
332
|
+
Problem: App rotates but layout does not adjust.
|
|
332
333
|
|
|
333
|
-
|
|
334
|
+
Solutions:
|
|
335
|
+
1. Implement `orientationchange` listeners.
|
|
336
|
+
2. Use responsive layout techniques.
|
|
337
|
+
3. Test portrait and landscape layouts.
|
|
338
|
+
4. Consider different layouts per orientation.
|
|
334
339
|
|
|
335
|
-
|
|
336
|
-
1. Implement `orientationchange` event listener
|
|
337
|
-
2. Use responsive layout techniques
|
|
338
|
-
3. Test both portrait and landscape layouts
|
|
339
|
-
4. Consider using different layouts for each orientation
|
|
340
|
+
### Upside-down orientation
|
|
340
341
|
|
|
341
|
-
|
|
342
|
+
Problem: App appears upside-down.
|
|
342
343
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
2. Use `reversePortrait` or `fullSensor` (Android)
|
|
348
|
-
3. Consider whether upside-down is needed for your use case
|
|
344
|
+
Solutions:
|
|
345
|
+
1. Add `UIInterfaceOrientationPortraitUpsideDown` on iOS.
|
|
346
|
+
2. Use `reversePortrait` or `fullSensor` on Android.
|
|
347
|
+
3. Decide if upside-down is needed for your use case.
|