@maccesar/titools 5.3.0 → 5.4.0

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.
Files changed (98) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +31 -60
  3. package/agents/ti-pro.md +3 -1
  4. package/commands/ti-audit.md +6 -4
  5. package/docs/examples.md +9 -0
  6. package/docs/knowledge-index.md +2 -1
  7. package/lib/config.js +1 -0
  8. package/package.json +1 -1
  9. package/skills/alloy-guides/SKILL.md +18 -179
  10. package/skills/alloy-guides/references/CLI_TASKS.md +17 -216
  11. package/skills/alloy-guides/references/CONCEPTS.md +27 -162
  12. package/skills/alloy-guides/references/CONTROLLERS.md +38 -236
  13. package/skills/alloy-guides/references/MODELS.md +47 -723
  14. package/skills/alloy-guides/references/MODELS_ADVANCED.md +21 -482
  15. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +12 -222
  16. package/skills/alloy-guides/references/VIEWS_STYLES.md +39 -358
  17. package/skills/alloy-guides/references/VIEWS_XML.md +36 -552
  18. package/skills/alloy-guides/references/WIDGETS.md +49 -127
  19. package/skills/alloy-howtos/SKILL.md +14 -169
  20. package/skills/alloy-howtos/references/best_practices.md +9 -113
  21. package/skills/alloy-howtos/references/cli_reference.md +18 -223
  22. package/skills/alloy-howtos/references/config_files.md +50 -133
  23. package/skills/alloy-howtos/references/debugging_troubleshooting.md +19 -63
  24. package/skills/alloy-howtos/references/samples.md +21 -138
  25. package/skills/ti-api/SKILL.md +10 -2
  26. package/skills/ti-api/references/api-android.md +36 -2
  27. package/skills/ti-api/references/api-app-platform.md +39 -3
  28. package/skills/ti-api/references/api-core.md +50 -18
  29. package/skills/ti-api/references/api-data-network.md +49 -35
  30. package/skills/ti-api/references/api-media.md +45 -27
  31. package/skills/ti-api/references/api-services.md +39 -9
  32. package/skills/ti-api/references/api-ui-android.md +33 -13
  33. package/skills/ti-api/references/api-ui-extras.md +41 -15
  34. package/skills/ti-api/references/api-ui-ios-animator.md +42 -26
  35. package/skills/ti-api/references/api-ui-ios.md +74 -2
  36. package/skills/ti-api/references/api-ui-lists.md +32 -16
  37. package/skills/ti-api/references/api-ui-text-input.md +34 -17
  38. package/skills/ti-api/references/api-ui-views.md +27 -1
  39. package/skills/ti-api/references/api-ui-windows-navigation.md +32 -18
  40. package/skills/ti-api/references/api-xml-global.md +66 -16
  41. package/skills/ti-create-release/SKILL.md +98 -0
  42. package/skills/ti-create-release/references/module-discovery.md +69 -0
  43. package/skills/ti-expert/references/adaptive-layouts.md +1 -1
  44. package/skills/ti-guides/SKILL.md +37 -76
  45. package/skills/ti-guides/references/advanced-data-and-images.md +122 -126
  46. package/skills/ti-guides/references/android-manifest.md +24 -83
  47. package/skills/ti-guides/references/app-distribution.md +31 -377
  48. package/skills/ti-guides/references/application-frameworks.md +127 -335
  49. package/skills/ti-guides/references/cli-reference.md +184 -633
  50. package/skills/ti-guides/references/commonjs-advanced.md +81 -231
  51. package/skills/ti-guides/references/compatibility-matrix.md +36 -75
  52. package/skills/ti-guides/references/hello-world.md +95 -70
  53. package/skills/ti-guides/references/hyperloop-native-access.md +52 -448
  54. package/skills/ti-guides/references/resources.md +174 -142
  55. package/skills/ti-guides/references/sdk-release-notes.md +28 -71
  56. package/skills/ti-guides/references/tiapp-config.md +222 -598
  57. package/skills/ti-howtos/SKILL.md +23 -123
  58. package/skills/ti-howtos/references/cross-platform-development.md +119 -324
  59. package/skills/ti-howtos/references/debugging-profiling.md +77 -445
  60. package/skills/ti-howtos/references/extending-titanium.md +199 -673
  61. package/skills/ti-howtos/references/local-data-sources.md +87 -300
  62. package/skills/ti-howtos/references/location-and-maps.md +86 -213
  63. package/skills/ti-howtos/references/media-apis.md +103 -223
  64. package/skills/ti-howtos/references/notification-services.md +86 -506
  65. package/skills/ti-howtos/references/remote-data-sources.md +97 -316
  66. package/skills/ti-howtos/references/using-modules.md +77 -133
  67. package/skills/ti-ui/SKILL.md +28 -143
  68. package/skills/ti-ui/references/icons-and-splash-screens.md +74 -403
  69. package/skills/ti-ui/references/layouts-and-positioning.md +175 -402
  70. package/skills/ti-ui/references/listviews-and-performance.md +100 -703
  71. package/skills/ti-ui/references/platform-conventions.md +180 -0
  72. package/skills/ti-ui/references/user-interface.md +43 -0
  73. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +0 -102
  74. package/skills/alloy-howtos/references/custom_tags.md +0 -148
  75. package/skills/ti-guides/references/coding-best-practices.md +0 -149
  76. package/skills/ti-guides/references/javascript-primer.md +0 -414
  77. package/skills/ti-guides/references/reserved-words.md +0 -36
  78. package/skills/ti-guides/references/style-and-conventions.md +0 -103
  79. package/skills/ti-howtos/references/android-platform-deep-dives.md +0 -624
  80. package/skills/ti-howtos/references/automation-fastlane-appium.md +0 -96
  81. package/skills/ti-howtos/references/buffer-codec-streams.md +0 -162
  82. package/skills/ti-howtos/references/google-maps-v2.md +0 -172
  83. package/skills/ti-howtos/references/ios-map-kit.md +0 -149
  84. package/skills/ti-howtos/references/ios-platform-deep-dives.md +0 -611
  85. package/skills/ti-howtos/references/tutorials.md +0 -565
  86. package/skills/ti-howtos/references/web-content-integration.md +0 -287
  87. package/skills/ti-howtos/references/webpack-build-pipeline.md +0 -124
  88. package/skills/ti-ui/references/accessibility-deep-dive.md +0 -288
  89. package/skills/ti-ui/references/animation-and-matrices.md +0 -569
  90. package/skills/ti-ui/references/application-structures.md +0 -626
  91. package/skills/ti-ui/references/custom-fonts-styling.md +0 -549
  92. package/skills/ti-ui/references/event-handling.md +0 -401
  93. package/skills/ti-ui/references/gestures.md +0 -448
  94. package/skills/ti-ui/references/orientation.md +0 -374
  95. package/skills/ti-ui/references/platform-ui-android.md +0 -727
  96. package/skills/ti-ui/references/platform-ui-ios.md +0 -576
  97. package/skills/ti-ui/references/scrolling-views.md +0 -288
  98. package/skills/ti-ui/references/tableviews.md +0 -542
@@ -1,374 +0,0 @@
1
- # Orientation
2
-
3
- <!-- TOC-START -->
4
- ## Contents
5
-
6
- - [1. Overview](#1-overview)
7
- - [2. Design principles](#2-design-principles)
8
- - [3. Orientation modes](#3-orientation-modes)
9
- - [4. Locking orientation](#4-locking-orientation)
10
- - [5. Handling orientation changes](#5-handling-orientation-changes)
11
- - [6. Adapting UI to orientation](#6-adapting-ui-to-orientation)
12
- - [7. Platform differences](#7-platform-differences)
13
- - [8. Checking current orientation](#8-checking-current-orientation)
14
- - [9. Disabling orientation change](#9-disabling-orientation-change)
15
- - [10. Orientation lock limitations](#10-orientation-lock-limitations)
16
- - [11. Modal window constraints (iOS)](#11-modal-window-constraints-ios)
17
- - [12. Splash screen configuration](#12-splash-screen-configuration)
18
- - [13. Best practices](#13-best-practices)
19
- - [14. Common issues](#14-common-issues)
20
-
21
- <!-- TOC-END -->
22
-
23
- ## 1. Overview
24
-
25
- Orientation is whether the app displays in portrait or landscape, and how it reacts when the device rotates.
26
-
27
- ## 2. Design principles
28
-
29
- - Do not mix orientations on iPhone or iPod. Pick portrait or landscape for the whole app. Switching mid-flow feels jarring.
30
- - Do not support portrait upside-down on iPhone. A phone call can appear upside-down, which is confusing and risky.
31
- - iPad should support all orientations. Apple’s HIG expects it and users rotate their iPads often.
32
- - These principles apply to Android as well. Android is more permissive, but consistency still matters.
33
-
34
- ## 3. Orientation modes
35
-
36
- ### Supported orientations
37
-
38
- | Mode | Description |
39
- | ----------------------- | -------------------------------- |
40
- | `Ti.UI.PORTRAIT` | Upright, home button at bottom |
41
- | `Ti.UI.UPSIDE_PORTRAIT` | Upright, home button at top |
42
- | `Ti.UI.LANDSCAPE_LEFT` | Landscape, home button on right |
43
- | `Ti.UI.LANDSCAPE_RIGHT` | Landscape, home button on left |
44
- | `Ti.UI.FACE_UP` | Device face up (flat on table) |
45
- | `Ti.UI.FACE_DOWN` | Device face down (flat on table) |
46
- | `Ti.UI.AUTO` | Let system decide |
47
-
48
- ## 4. Locking orientation
49
-
50
- ### Lock to a specific orientation
51
-
52
- In `tiapp.xml` (preferred):
53
-
54
- ```xml
55
- <ios>
56
- <plist>
57
- <dict>
58
- <key>UISupportedInterfaceOrientations</key>
59
- <array>
60
- <string>UIInterfaceOrientationPortrait</string>
61
- <string>UIInterfaceOrientationPortraitUpsideDown</string>
62
- </array>
63
- </dict>
64
- </plist>
65
- </ios>
66
- ```
67
-
68
- iOS plist iPhone vs iPad keys: You can define separate orientations for iPhone and iPad:
69
- - `UISupportedInterfaceOrientations~iphone` for iPhone (default: portrait only)
70
- - `UISupportedInterfaceOrientations~ipad` for iPad (default: all four)
71
- - `UISupportedInterfaceOrientations` applies to both if device-specific keys are absent
72
-
73
- The `<activity>` element must include `android:name` and be nested inside `<application>`. Titanium generates the main activity name as `<app-id>.<Appname>Activity`.
74
-
75
- ```xml
76
- <android xmlns:android="http://schemas.android.com/apk/res/android">
77
- <manifest>
78
- <application>
79
- <activity
80
- android:name="com.example.myapp.MyappActivity"
81
- android:screenOrientation="portrait"/>
82
- </application>
83
- </manifest>
84
- </android>
85
- ```
86
-
87
- ### Android orientation values
88
-
89
- ```xml
90
- <activity android:screenOrientation="portrait"/>
91
- <activity android:screenOrientation="landscape"/>
92
- <activity android:screenOrientation="reversePortrait"/>
93
- <activity android:screenOrientation="reverseLandscape"/>
94
- <activity android:screenOrientation="sensorPortrait"/>
95
- <activity android:screenOrientation="sensorLandscape"/>
96
- <activity android:screenOrientation="fullSensor"/>
97
- <activity android:screenOrientation="nosensor"/>
98
- <activity android:screenOrientation="userPortrait"/>
99
- <activity android:screenOrientation="userLandscape"/>
100
- <activity android:screenOrientation="sensor"/>
101
- ```
102
-
103
- Common values:
104
- - `portrait` for portrait mode
105
- - `landscape` for landscape mode
106
- - `sensor` uses the accelerometer
107
- - `fullSensor` allows all four orientations
108
- - `nosensor` ignores the accelerometer
109
- - `user` follows the user preference
110
-
111
- 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.
112
-
113
- ### Runtime orientation lock (iOS)
114
-
115
- ```javascript
116
- // Set orientation at runtime
117
- Ti.UI.iPhone.setStatusBarStyle(Ti.UI.iPhone.StatusBar.DEFAULT);
118
-
119
- // Note: In iOS, orientation is primarily controlled by Info.plist
120
- // Use tiapp.xml configuration for consistent behavior
121
- ```
122
-
123
- ## 5. Handling orientation changes
124
-
125
- ### Detect orientation change
126
-
127
- ```javascript
128
- Ti.Gesture.addEventListener('orientationchange', (e) => {
129
- Ti.API.info(`Orientation changed to: ${e.orientation}`);
130
-
131
- if (e.orientation === Ti.UI.PORTRAIT) {
132
- adjustForPortrait();
133
- } else if (e.orientation === Ti.UI.LANDSCAPE_LEFT ||
134
- e.orientation === Ti.UI.LANDSCAPE_RIGHT) {
135
- adjustForLandscape();
136
- }
137
-
138
- // Ti.Gesture convenience boolean properties
139
- Ti.API.info(`Is portrait: ${e.source.portrait}`);
140
- Ti.API.info(`Is landscape: ${e.source.landscape}`);
141
- });
142
- ```
143
-
144
- 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`. ...
145
- ### Window orientation events
146
-
147
- ```javascript
148
- const win = Ti.UI.createWindow();
149
-
150
- win.addEventListener('focus', () => {
151
- Ti.API.info(`Current orientation: ${Ti.Gesture.orientation}`);
152
- });
153
-
154
- win.addEventListener('orientationchange', (e) => {
155
- Ti.API.info('Window orientation changed');
156
- });
157
- ```
158
-
159
- ## 6. Adapting UI to orientation
160
-
161
- ### Responsive layout example
162
-
163
- ```javascript
164
- const container = Ti.UI.createView({
165
- width: Ti.UI.FILL,
166
- height: Ti.UI.FILL,
167
- layout: 'vertical'
168
- });
169
-
170
- function updateLayout() {
171
- const orientation = Ti.Gesture.orientation;
172
-
173
- if (orientation === Ti.UI.PORTRAIT ||
174
- orientation === Ti.UI.UPSIDE_PORTRAIT) {
175
- // Portrait layout
176
- container.width = Ti.UI.FILL;
177
- container.height = Ti.UI.FILL;
178
- container.layout = 'vertical';
179
- } else {
180
- // Landscape layout
181
- container.width = Ti.UI.FILL;
182
- container.height = Ti.UI.FILL;
183
- container.layout = 'horizontal';
184
- }
185
- }
186
-
187
- Ti.Gesture.addEventListener('orientationchange', updateLayout);
188
- ```
189
-
190
- ### Orientation-specific components
191
-
192
- ```javascript
193
- function createPortraitLayout() {
194
- return Ti.UI.createView({
195
- layout: 'vertical'
196
- });
197
- }
198
-
199
- function createLandscapeLayout() {
200
- return Ti.UI.createView({
201
- layout: 'horizontal'
202
- });
203
- }
204
-
205
- let currentLayout;
206
-
207
- function switchLayout() {
208
- const orientation = Ti.Gesture.orientation;
209
- const isPortrait = (orientation === Ti.UI.PORTRAIT ||
210
- orientation === Ti.UI.UPSIDE_PORTRAIT);
211
-
212
- const newLayout = isPortrait ? createPortraitLayout() : createLandscapeLayout();
213
-
214
- if (currentLayout) {
215
- win.remove(currentLayout);
216
- }
217
-
218
- currentLayout = newLayout;
219
- win.add(currentLayout);
220
- }
221
-
222
- Ti.Gesture.addEventListener('orientationchange', switchLayout);
223
- ```
224
-
225
- ## 7. Platform differences
226
-
227
- ### iOS orientation
228
-
229
- - Controlled by `UISupportedInterfaceOrientations` in Info.plist
230
- - Shake to rotate can be disabled
231
- - Status bar orientation matches window orientation
232
- - Supports all orientations, including upside-down
233
-
234
- ### Android orientation
235
-
236
- - Controlled by `screenOrientation` in AndroidManifest.xml
237
- - Can be set per activity
238
- - More granular control (sensor, user, nosensor)
239
- - May ignore upside-down depending on device
240
-
241
- ## 8. Checking current orientation
242
-
243
- ```javascript
244
- // Get current orientation
245
- const currentOrientation = Ti.Gesture.orientation;
246
-
247
- Ti.API.info(`Current: ${currentOrientation}`);
248
-
249
- // Check if portrait
250
- const isPortrait = (currentOrientation === Ti.UI.PORTRAIT ||
251
- currentOrientation === Ti.UI.UPSIDE_PORTRAIT);
252
-
253
- // Check if landscape
254
- const isLandscape = (currentOrientation === Ti.UI.LANDSCAPE_LEFT ||
255
- currentOrientation === Ti.UI.LANDSCAPE_RIGHT);
256
- ```
257
-
258
- ## 9. Disabling orientation change
259
-
260
- ### Disable all rotation
261
-
262
- iOS (tiapp.xml):
263
- ```xml
264
- <ios>
265
- <plist>
266
- <dict>
267
- <key>UISupportedInterfaceOrientations</key>
268
- <array>
269
- <string>UIInterfaceOrientationPortrait</string>
270
- </array>
271
- </dict>
272
- </plist>
273
- </ios>
274
- ```
275
-
276
- Android (tiapp.xml):
277
- ```xml
278
- <android xmlns:android="http://schemas.android.com/apk/res/android">
279
- <manifest>
280
- <application>
281
- <activity
282
- android:name="com.example.myapp.MyappActivity"
283
- android:screenOrientation="portrait"/>
284
- </application>
285
- </manifest>
286
- </android>
287
- ```
288
-
289
- ### Disable rotation for a specific window (iOS)
290
-
291
- ```javascript
292
- const win = Ti.UI.createWindow({
293
- orientationModes: [Ti.UI.PORTRAIT]
294
- });
295
- ```
296
-
297
- Note: Window-level control is limited. App-level configuration is more reliable.
298
-
299
- ## 10. Orientation lock limitations
300
-
301
- Runtime orientation locking is not reliable across platforms.
302
-
303
- - iOS: Orientation is controlled by `tiapp.xml` plist keys and window-level `orientationModes`. There is no API to lock or unlock at runtime.
304
- - Android: Use `android:screenOrientation` in `tiapp.xml`. Changing orientation programmatically at runtime is not supported through Titanium APIs.
305
-
306
- If you need a specific orientation for one screen (for example, landscape video playback), create a dedicated window with `orientationModes` set at creation time:
307
-
308
- ```javascript
309
- // Landscape-only video window
310
- const videoWin = Ti.UI.createWindow({
311
- orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]
312
- });
313
-
314
- const videoPlayer = Ti.Media.createVideoPlayer({
315
- url: 'video.mp4'
316
- });
317
-
318
- videoWin.add(videoPlayer);
319
- videoWin.open();
320
- ```
321
-
322
- ## 11. Modal window constraints (iOS)
323
-
324
- 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.
325
-
326
- ## 12. Splash screen configuration
327
-
328
- Splash screens need orientation-specific images:
329
- - Android uses `default.png` (lowercase d) in `Resources/android/images/`.
330
- - iOS uses `Default.png` (uppercase D) and orientation variants like `Default-Landscape.png` and `Default-Portrait.png` for iPad and Universal apps.
331
-
332
- See `icons-and-splash-screens.md` for full naming and size details.
333
-
334
- ## 13. Best practices
335
-
336
- 1. Test on multiple devices. Orientation behavior varies.
337
- 2. Test rotation scenarios. See how your UI adapts.
338
- 3. Consider user preference. Allow rotation when it makes sense.
339
- 4. Lock when needed, like video, games, or camera capture.
340
- 5. Use responsive layouts.
341
- 6. Test upside-down. Some devices support it, some do not.
342
- 7. Handle edge cases like phone calls.
343
- 8. Consider tablets. Default orientation can differ.
344
-
345
- ## 14. Common issues
346
-
347
- ### Orientation not changing
348
-
349
- Problem: App does not rotate when the device rotates.
350
-
351
- Solutions:
352
- 1. Check `tiapp.xml` orientation settings.
353
- 2. Ensure all orientations are enabled.
354
- 3. Test on physical device (simulator may not reflect real behavior).
355
- 4. Check for custom orientation locking code.
356
-
357
- ### UI does not adapt
358
-
359
- Problem: App rotates but layout does not adjust.
360
-
361
- Solutions:
362
- 1. Implement `orientationchange` listeners.
363
- 2. Use responsive layout techniques.
364
- 3. Test portrait and landscape layouts.
365
- 4. Consider different layouts per orientation.
366
-
367
- ### Upside-down orientation
368
-
369
- Problem: App appears upside-down.
370
-
371
- Solutions:
372
- 1. Add `UIInterfaceOrientationPortraitUpsideDown` on iOS.
373
- 2. Use `reversePortrait` or `fullSensor` on Android.
374
- 3. Decide if upside-down is needed for your use case.