@nativescript/core 9.0.0-alpha.2 → 9.0.0-alpha.4
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/application/application.android.js +5 -26
- package/application/application.android.js.map +1 -1
- package/application/helpers-common.d.ts +12 -2
- package/application/helpers-common.js +37 -3
- package/application/helpers-common.js.map +1 -1
- package/application/helpers.android.js.map +1 -1
- package/application-settings/index.android.js.map +1 -1
- package/connectivity/index.android.js.map +1 -1
- package/debugger/webinspector-network.android.js.map +1 -1
- package/file-system/file-system-access.android.js +31 -31
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/index.d.ts +2 -2
- package/file-system/index.js.map +1 -1
- package/http/http-request/index.d.ts +4 -0
- package/http/index.d.ts +5 -104
- package/http/index.js +1 -1
- package/http/index.js.map +1 -1
- package/image-asset/index.android.js +3 -3
- package/image-asset/index.android.js.map +1 -1
- package/index.d.ts +6 -6
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/ui/action-bar/index.android.js +1 -1
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/core/properties/index.d.ts +1 -0
- package/ui/core/properties/index.js +2 -0
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/view/index.ios.js +2 -2
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/dialogs/index.android.js +8 -7
- package/ui/dialogs/index.android.js.map +1 -1
- package/ui/embedding/index.android.d.ts +1 -1
- package/ui/embedding/index.d.ts +1 -1
- package/ui/frame/frame-helper-for-android.js.map +1 -1
- package/ui/styling/background.android.js +1 -1
- package/ui/styling/background.android.js.map +1 -1
- package/ui/styling/font.android.js +2 -2
- package/ui/styling/font.android.js.map +1 -1
- package/ui/tab-view/index.android.js.map +1 -1
- package/ui/transition/page-transition.android.d.ts +1 -1
- package/ui/transition/page-transition.android.js +4 -4
- package/ui/transition/page-transition.android.js.map +1 -1
- package/utils/debug-source.js.map +1 -1
- package/utils/index.android.js +7 -7
- package/utils/layout-helper/index.android.js +3 -3
- package/utils/native-helper.android.d.ts +7 -3
- package/utils/native-helper.android.js +5 -2
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.d.ts +124 -201
package/utils/index.android.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Trace } from '../trace';
|
|
2
2
|
import { getFileExtension } from './utils-shared';
|
|
3
3
|
import { SDK_VERSION } from './constants';
|
|
4
|
-
import { android as
|
|
4
|
+
import { android as androidUtils } from './native-helper';
|
|
5
5
|
import { topmost } from '../ui/frame/frame-stack';
|
|
6
6
|
import { debounce, throttle } from './shared';
|
|
7
7
|
export { clearInterval, clearTimeout, setInterval, setTimeout } from '../timer';
|
|
@@ -49,7 +49,7 @@ export function releaseNativeObject(object) {
|
|
|
49
49
|
__releaseNativeCounterpart(object);
|
|
50
50
|
}
|
|
51
51
|
export function openUrl(location) {
|
|
52
|
-
const context =
|
|
52
|
+
const context = androidUtils.getApplicationContext();
|
|
53
53
|
try {
|
|
54
54
|
const intent = new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(location.trim()));
|
|
55
55
|
intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
@@ -65,7 +65,7 @@ export function openUrl(location) {
|
|
|
65
65
|
export function openUrlAsync(location) {
|
|
66
66
|
return new Promise((resolve, reject) => {
|
|
67
67
|
try {
|
|
68
|
-
const context =
|
|
68
|
+
const context = androidUtils.getApplicationContext();
|
|
69
69
|
const intent = new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(location.trim()));
|
|
70
70
|
intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
71
71
|
context.startActivity(intent);
|
|
@@ -120,7 +120,7 @@ function getMimeTypeNameFromExtension(filePath) {
|
|
|
120
120
|
* @returns {boolean} whether opening the file succeeded or not
|
|
121
121
|
*/
|
|
122
122
|
export function openFile(filePath, title = 'Open File...') {
|
|
123
|
-
const context =
|
|
123
|
+
const context = androidUtils.getApplicationContext();
|
|
124
124
|
try {
|
|
125
125
|
// Ensure external storage is available
|
|
126
126
|
if (!isExternalStorageAvailable()) {
|
|
@@ -179,12 +179,12 @@ Please ensure you have your manifest correctly configured with the FileProvider.
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
export function dismissSoftInput(nativeView) {
|
|
182
|
-
|
|
182
|
+
androidUtils.dismissSoftInput(nativeView);
|
|
183
183
|
}
|
|
184
184
|
export function dismissKeyboard() {
|
|
185
185
|
dismissSoftInput();
|
|
186
186
|
const modalDialog = (topmost()?._modalParent ?? topmost()?.modal)?._dialogFragment?.getDialog();
|
|
187
|
-
const view = modalDialog ??
|
|
187
|
+
const view = modalDialog ?? androidUtils.getCurrentActivity();
|
|
188
188
|
if (view) {
|
|
189
189
|
const focus = view.getCurrentFocus();
|
|
190
190
|
if (focus) {
|
|
@@ -194,7 +194,7 @@ export function dismissKeyboard() {
|
|
|
194
194
|
}
|
|
195
195
|
export function copyToClipboard(value) {
|
|
196
196
|
try {
|
|
197
|
-
const clipboard =
|
|
197
|
+
const clipboard = androidUtils.getApplicationContext().getSystemService(android.content.Context.CLIPBOARD_SERVICE);
|
|
198
198
|
const clip = android.content.ClipData.newPlainText('Clipboard value', value);
|
|
199
199
|
clipboard.setPrimaryClip(clip);
|
|
200
200
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as layoutCommon from './layout-helper-common';
|
|
2
|
-
import { android as
|
|
2
|
+
import { android as androidUtils } from '../native-helper';
|
|
3
3
|
// export * from './layout-helper-common';
|
|
4
4
|
let density;
|
|
5
5
|
let sdkVersion;
|
|
@@ -32,7 +32,7 @@ export var layout;
|
|
|
32
32
|
function makeMeasureSpec(size, mode) {
|
|
33
33
|
if (sdkVersion === undefined) {
|
|
34
34
|
// check whether the old layout is needed
|
|
35
|
-
sdkVersion =
|
|
35
|
+
sdkVersion = androidUtils.getApplicationContext().getApplicationInfo().targetSdkVersion;
|
|
36
36
|
useOldMeasureSpec = sdkVersion <= 17;
|
|
37
37
|
}
|
|
38
38
|
if (useOldMeasureSpec) {
|
|
@@ -43,7 +43,7 @@ export var layout;
|
|
|
43
43
|
layout.makeMeasureSpec = makeMeasureSpec;
|
|
44
44
|
function getDisplayDensity() {
|
|
45
45
|
if (density === undefined) {
|
|
46
|
-
density =
|
|
46
|
+
density = androidUtils.getResources().getDisplayMetrics().density;
|
|
47
47
|
}
|
|
48
48
|
return density;
|
|
49
49
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { resources, getApplication, getCurrentActivity, getApplicationContext,
|
|
1
|
+
import { resources, collections, getWindow, getApplication, getCurrentActivity, getApplicationContext, getResources, getPackageName, getInputMethodManager, showSoftInput, dismissSoftInput } from './native-helper-for-android';
|
|
2
|
+
export { dataSerialize, dataDeserialize } from './native-helper-for-android';
|
|
3
|
+
export { getWindow } from './native-helper-for-android';
|
|
2
4
|
export declare const android: {
|
|
3
5
|
resources: typeof resources;
|
|
6
|
+
collections: typeof collections;
|
|
7
|
+
getWindow: typeof getWindow;
|
|
4
8
|
getApplication: typeof getApplication;
|
|
5
9
|
getCurrentActivity: typeof getCurrentActivity;
|
|
6
10
|
getApplicationContext: typeof getApplicationContext;
|
|
7
|
-
getWindow: typeof getWindow;
|
|
8
11
|
getResources: typeof getResources;
|
|
9
12
|
getPackageName: typeof getPackageName;
|
|
10
13
|
getInputMethodManager: typeof getInputMethodManager;
|
|
@@ -16,10 +19,11 @@ export declare const android: {
|
|
|
16
19
|
*/
|
|
17
20
|
export declare const ad: {
|
|
18
21
|
resources: typeof resources;
|
|
22
|
+
collections: typeof collections;
|
|
23
|
+
getWindow: typeof getWindow;
|
|
19
24
|
getApplication: typeof getApplication;
|
|
20
25
|
getCurrentActivity: typeof getCurrentActivity;
|
|
21
26
|
getApplicationContext: typeof getApplicationContext;
|
|
22
|
-
getWindow: typeof getWindow;
|
|
23
27
|
getResources: typeof getResources;
|
|
24
28
|
getPackageName: typeof getPackageName;
|
|
25
29
|
getInputMethodManager: typeof getInputMethodManager;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { platformCheck } from './platform-check';
|
|
2
2
|
// importing this helper as a separate file avoids "android" symbol clash with the global android object
|
|
3
|
-
import { resources, getApplication, getCurrentActivity, getApplicationContext,
|
|
3
|
+
import { resources, collections, getWindow, getApplication, getCurrentActivity, getApplicationContext, getResources, getPackageName, getInputMethodManager, showSoftInput, dismissSoftInput } from './native-helper-for-android';
|
|
4
|
+
export { dataSerialize, dataDeserialize } from './native-helper-for-android';
|
|
5
|
+
export { getWindow } from './native-helper-for-android';
|
|
4
6
|
export const android = {
|
|
5
7
|
resources,
|
|
8
|
+
collections,
|
|
9
|
+
getWindow,
|
|
6
10
|
getApplication,
|
|
7
11
|
getCurrentActivity,
|
|
8
12
|
getApplicationContext,
|
|
9
|
-
getWindow,
|
|
10
13
|
getResources,
|
|
11
14
|
getPackageName,
|
|
12
15
|
getInputMethodManager,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-helper.android.js","sourceRoot":"","sources":["../../../../packages/core/utils/native-helper.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,wGAAwG;AACxG,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"native-helper.android.js","sourceRoot":"","sources":["../../../../packages/core/utils/native-helper.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,wGAAwG;AACxG,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACjO,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,MAAM,CAAC,MAAM,OAAO,GAAG;IACtB,SAAS;IACT,WAAW;IACX,SAAS;IACT,cAAc;IACd,kBAAkB;IAClB,qBAAqB;IACrB,YAAY;IACZ,cAAc;IACd,qBAAqB;IACrB,aAAa;IACb,gBAAgB;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC;AAE1B,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC,uBAAuB,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC"}
|
package/utils/native-helper.d.ts
CHANGED
|
@@ -14,211 +14,42 @@ export function dataDeserialize(nativeData?: any): any;
|
|
|
14
14
|
*/
|
|
15
15
|
export function isRealDevice(): boolean;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// declare namespace AndroidUtils {
|
|
23
|
-
// /**
|
|
24
|
-
// * Gets the native Android application instance.
|
|
25
|
-
// */
|
|
26
|
-
// export function getApplication(): any; /* android.app.Application */
|
|
27
|
-
|
|
28
|
-
// /**
|
|
29
|
-
// * Get the current native Android activity.
|
|
30
|
-
// */
|
|
31
|
-
// export function getCurrentActivity(): any; /* android.app.Activity */
|
|
32
|
-
// /**
|
|
33
|
-
// * Gets the native Android application resources.
|
|
34
|
-
// */
|
|
35
|
-
// export function getResources(): any; /* android.content.res.Resources */
|
|
36
|
-
|
|
37
|
-
// /**
|
|
38
|
-
// * Gets the Android application context.
|
|
39
|
-
// */
|
|
40
|
-
// export function getApplicationContext(): any; /* android.content.Context */
|
|
41
|
-
|
|
42
|
-
// /**
|
|
43
|
-
// * Gets the native Android input method manager.
|
|
44
|
-
// */
|
|
45
|
-
// export function getInputMethodManager(): any; /* android.view.inputmethod.InputMethodManager */
|
|
46
|
-
|
|
47
|
-
// /**
|
|
48
|
-
// * Hides the soft input method, usually a soft keyboard.
|
|
49
|
-
// */
|
|
50
|
-
// export function dismissSoftInput(nativeView?: any /* android.view.View */): void;
|
|
51
|
-
|
|
52
|
-
// /**
|
|
53
|
-
// * Shows the soft input method, usually a soft keyboard.
|
|
54
|
-
// */
|
|
55
|
-
// export function showSoftInput(nativeView: any /* android.view.View */): void;
|
|
56
|
-
|
|
57
|
-
// /**
|
|
58
|
-
// * Utility module dealing with some android collections.
|
|
59
|
-
// */
|
|
60
|
-
// namespace collections {
|
|
61
|
-
// /**
|
|
62
|
-
// * Converts string array into a String [hash set](http://developer.android.com/reference/java/util/HashSet.html).
|
|
63
|
-
// * @param str - An array of strings to convert.
|
|
64
|
-
// */
|
|
65
|
-
// export function stringArrayToStringSet(str: string[]): any;
|
|
66
|
-
|
|
67
|
-
// /**
|
|
68
|
-
// * Converts string hash set into array of strings.
|
|
69
|
-
// * @param stringSet - A string hash set to convert.
|
|
70
|
-
// */
|
|
71
|
-
// export function stringSetToStringArray(stringSet: any): string[];
|
|
72
|
-
// }
|
|
73
|
-
|
|
74
|
-
// /**
|
|
75
|
-
// * Utility module related to android resources.
|
|
76
|
-
// */
|
|
77
|
-
// export namespace resources {
|
|
78
|
-
// /**
|
|
79
|
-
// * Gets the drawable id from a given name.
|
|
80
|
-
// * @param name - Name of the resource.
|
|
81
|
-
// */
|
|
82
|
-
// export function getDrawableId(name);
|
|
83
|
-
|
|
84
|
-
// /**
|
|
85
|
-
// * Gets the string id from a given name.
|
|
86
|
-
// * @param name - Name of the resource.
|
|
87
|
-
// */
|
|
88
|
-
// export function getStringId(name);
|
|
89
|
-
|
|
90
|
-
// /**
|
|
91
|
-
// * Gets the id from a given name.
|
|
92
|
-
// * @param name - Name of the resource.
|
|
93
|
-
// */
|
|
94
|
-
// export function getId(name: string): number;
|
|
95
|
-
|
|
96
|
-
// /**
|
|
97
|
-
// * Gets the id from a given name with optional type.
|
|
98
|
-
// * This sets an explicit package name.
|
|
99
|
-
// * https://developer.android.com/reference/android/content/res/Resources#getIdentifier(java.lang.String,%20java.lang.String,%20java.lang.String)
|
|
100
|
-
// * @param name - Name of the resource.
|
|
101
|
-
// * @param type - (Optional) type
|
|
102
|
-
// */
|
|
103
|
-
// export function getResource(name: string, type?: string): number;
|
|
104
|
-
// }
|
|
105
|
-
|
|
106
|
-
// }
|
|
107
|
-
|
|
108
|
-
// /**
|
|
109
|
-
// * Module with ios specific utilities.
|
|
110
|
-
// */
|
|
111
|
-
// declare namespace iOSUtils {
|
|
112
|
-
// // Common properties between UILabel, UITextView and UITextField
|
|
113
|
-
// export interface TextUIView {
|
|
114
|
-
// font: any;
|
|
115
|
-
// textAlignment: number;
|
|
116
|
-
// textColor: any;
|
|
117
|
-
// text: string;
|
|
118
|
-
// attributedText: any;
|
|
119
|
-
// lineBreakMode: number;
|
|
120
|
-
// numberOfLines: number;
|
|
121
|
-
// }
|
|
122
|
-
|
|
123
|
-
// /**
|
|
124
|
-
// * Utility module dealing with some iOS collections.
|
|
125
|
-
// */
|
|
126
|
-
// export namespace collections {
|
|
127
|
-
// /**
|
|
128
|
-
// * Converts JavaScript array to [NSArray](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/).
|
|
129
|
-
// * @param str - JavaScript string array to convert.
|
|
130
|
-
// */
|
|
131
|
-
// export function jsArrayToNSArray<T>(str: T[]): NSArray<T>;
|
|
132
|
-
|
|
133
|
-
// /**
|
|
134
|
-
// * Converts NSArray to JavaScript array.
|
|
135
|
-
// * @param a - NSArray to convert.
|
|
136
|
-
// */
|
|
137
|
-
// export function nsArrayToJSArray<T>(a: NSArray<T>): T[];
|
|
138
|
-
// }
|
|
139
|
-
|
|
140
|
-
// /**
|
|
141
|
-
// * Get the root UIViewController of the app
|
|
142
|
-
// */
|
|
143
|
-
// export function getRootViewController(): any; /* UIViewController */
|
|
144
|
-
|
|
145
|
-
// /**
|
|
146
|
-
// * Get the UIWindow of the app
|
|
147
|
-
// */
|
|
148
|
-
// export function getWindow(): any; /* UIWindow */
|
|
149
|
-
|
|
150
|
-
// /**
|
|
151
|
-
// * Set the window background color of base view of the app.
|
|
152
|
-
// * Often this is shown when opening a modal as the view underneath scales down revealing the window color.
|
|
153
|
-
// * @param value color (hex, rgb, rgba, etc.)
|
|
154
|
-
// */
|
|
155
|
-
// export function setWindowBackgroundColor(value: string): void;
|
|
156
|
-
|
|
157
|
-
// /**
|
|
158
|
-
// * Data serialize and deserialize helpers
|
|
159
|
-
// */
|
|
160
|
-
// export function dataSerialize(data?: any): any;
|
|
161
|
-
// export function dataDeserialize(nativeData?: any): any;
|
|
162
|
-
|
|
163
|
-
// /**
|
|
164
|
-
// * @deprecated use application.orientation instead
|
|
165
|
-
// *
|
|
166
|
-
// * Gets an information about if current mode is Landscape.
|
|
167
|
-
// */
|
|
168
|
-
// export function isLandscape(): boolean;
|
|
169
|
-
|
|
170
|
-
// /**
|
|
171
|
-
// * Gets the iOS device major version (for 8.1 will return 8).
|
|
172
|
-
// */
|
|
173
|
-
// export const MajorVersion: number;
|
|
174
|
-
|
|
175
|
-
// /**
|
|
176
|
-
// * Opens file with associated application.
|
|
177
|
-
// * @param filePath The file path.
|
|
178
|
-
// */
|
|
179
|
-
// export function openFile(filePath: string): boolean;
|
|
180
|
-
|
|
181
|
-
// /**
|
|
182
|
-
// * Gets the currently visible(topmost) UIViewController.
|
|
183
|
-
// * @param rootViewController The root UIViewController instance to start searching from (normally window.rootViewController).
|
|
184
|
-
// * Returns the visible UIViewController.
|
|
185
|
-
// */
|
|
186
|
-
// export function getVisibleViewController(rootViewController: any /* UIViewController*/): any; /* UIViewController*/
|
|
187
|
-
|
|
188
|
-
// /**
|
|
189
|
-
// * Checks whether the application is running on real device and not on simulator.
|
|
190
|
-
// */
|
|
191
|
-
// export function isRealDevice(): boolean;
|
|
192
|
-
|
|
193
|
-
// /**
|
|
194
|
-
// * Debug utility to insert CGRect values into logging output.
|
|
195
|
-
// * Note: when printing a CGRect directly it will print blank so this helps show the values.
|
|
196
|
-
// * @param rect CGRect
|
|
197
|
-
// */
|
|
198
|
-
// export function printCGRect(rect: CGRect): void;
|
|
199
|
-
|
|
200
|
-
// /**
|
|
201
|
-
// * Take a snapshot of a View on screen.
|
|
202
|
-
// * @param view view to snapshot
|
|
203
|
-
// * @param scale screen scale
|
|
204
|
-
// */
|
|
205
|
-
// export function snapshotView(view: UIView, scale: number): UIImage;
|
|
206
|
-
|
|
207
|
-
// /**
|
|
208
|
-
// * Copy layer properties from one view to another.
|
|
209
|
-
// * @param view a view to copy layer properties to
|
|
210
|
-
// * @param toView a view to copy later properties from
|
|
211
|
-
// * @param (optional) custom properties to copy between both views
|
|
212
|
-
// */
|
|
213
|
-
// export function copyLayerProperties(view: UIView, toView: UIView, customProperties?: { view?: Array<string> /* Array<keyof UIView> */; layer?: Array<string> /* Array<keyof CALayer> */ }): void;
|
|
214
|
-
|
|
215
|
-
// }
|
|
17
|
+
type NativeWindow = android.view.Window | UIWindow;
|
|
18
|
+
/**
|
|
19
|
+
* Get the UIWindow or android.view.Window of the app
|
|
20
|
+
*/
|
|
21
|
+
export function getWindow<T extends NativeWindow>(): T;
|
|
216
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Utilities related to Android.
|
|
25
|
+
*/
|
|
217
26
|
export const android: {
|
|
27
|
+
/**
|
|
28
|
+
* Utilities related to Android resources.
|
|
29
|
+
*/
|
|
218
30
|
resources: {
|
|
31
|
+
/**
|
|
32
|
+
* Gets the drawable id from a given name.
|
|
33
|
+
* @param name - Name of the resource.
|
|
34
|
+
*/
|
|
219
35
|
getDrawableId: (name) => number;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the string id from a given name.
|
|
38
|
+
* @param name - Name of the resource.
|
|
39
|
+
*/
|
|
220
40
|
getStringId: (name) => number;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the id from a given name.
|
|
43
|
+
* @param name - Name of the resource.
|
|
44
|
+
*/
|
|
221
45
|
getId: (name: string) => number;
|
|
46
|
+
/**
|
|
47
|
+
* Gets the id from a given name with optional type.
|
|
48
|
+
* This sets an explicit package name.
|
|
49
|
+
* https://developer.android.com/reference/android/content/res/Resources#getIdentifier(java.lang.String,%20java.lang.String,%20java.lang.String)
|
|
50
|
+
* @param name - Name of the resource.
|
|
51
|
+
* @param type - (Optional) type
|
|
52
|
+
*/
|
|
222
53
|
getResource: (name: string, type?: string) => number;
|
|
223
54
|
/**
|
|
224
55
|
* Gets a color from the current theme.
|
|
@@ -227,14 +58,54 @@ export const android: {
|
|
|
227
58
|
*/
|
|
228
59
|
getPaletteColor: (name: string, context: android.content.Context) => number;
|
|
229
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Utilities related to Android collections.
|
|
63
|
+
*/
|
|
64
|
+
collections: {
|
|
65
|
+
/**
|
|
66
|
+
* Converts string array into a String [hash set](http://developer.android.com/reference/java/util/HashSet.html).
|
|
67
|
+
* @param str - An array of strings to convert.
|
|
68
|
+
*/
|
|
69
|
+
stringArrayToStringSet(str: string[]): java.util.HashSet<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Converts string hash set into array of strings.
|
|
72
|
+
* @param stringSet - A string hash set to convert.
|
|
73
|
+
*/
|
|
74
|
+
stringSetToStringArray(stringSet: any): string[];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use `Utils.getWindow<android.view.Window>()` instead.
|
|
78
|
+
* @returns application window.
|
|
79
|
+
*/
|
|
80
|
+
getWindow: () => android.view.Window;
|
|
81
|
+
/**
|
|
82
|
+
* Gets the native Android application instance.
|
|
83
|
+
*/
|
|
230
84
|
getApplication: () => android.app.Application;
|
|
85
|
+
/**
|
|
86
|
+
* Get the current native Android activity.
|
|
87
|
+
*/
|
|
231
88
|
getCurrentActivity: () => androidx.appcompat.app.AppCompatActivity | android.app.Activity | null;
|
|
89
|
+
/**
|
|
90
|
+
* Gets the Android application context.
|
|
91
|
+
*/
|
|
232
92
|
getApplicationContext: () => android.content.Context;
|
|
233
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Gets the native Android application resources.
|
|
95
|
+
*/
|
|
234
96
|
getResources: () => android.content.res.Resources;
|
|
235
97
|
getPackageName: () => string;
|
|
98
|
+
/**
|
|
99
|
+
* Gets the native Android input method manager.
|
|
100
|
+
*/
|
|
236
101
|
getInputMethodManager: () => android.view.inputmethod.InputMethodManager;
|
|
102
|
+
/**
|
|
103
|
+
* Shows the soft input method, usually a soft keyboard.
|
|
104
|
+
*/
|
|
237
105
|
showSoftInput: (nativeView: android.view.View) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Hides the soft input method, usually a soft keyboard.
|
|
108
|
+
*/
|
|
238
109
|
dismissSoftInput: (nativeView?: android.view.View) => void;
|
|
239
110
|
};
|
|
240
111
|
|
|
@@ -243,26 +114,67 @@ export const android: {
|
|
|
243
114
|
*/
|
|
244
115
|
export const ad = android;
|
|
245
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Utilities related to iOS.
|
|
119
|
+
*/
|
|
246
120
|
export const ios: {
|
|
121
|
+
/**
|
|
122
|
+
* Utilities related to iOS collections.
|
|
123
|
+
*/
|
|
247
124
|
collections: {
|
|
125
|
+
/**
|
|
126
|
+
* Converts JavaScript array to [NSArray](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/).
|
|
127
|
+
* @param str - JavaScript string array to convert.
|
|
128
|
+
*/
|
|
248
129
|
jsArrayToNSArray<T>(str: T[]): NSArray<T>;
|
|
130
|
+
/**
|
|
131
|
+
* Converts NSArray to JavaScript array.
|
|
132
|
+
* @param a - NSArray to convert.
|
|
133
|
+
*/
|
|
249
134
|
nsArrayToJSArray<T>(a: NSArray<T>): Array<T>;
|
|
250
135
|
};
|
|
251
136
|
/**
|
|
252
137
|
* Create a UIDocumentInteractionControllerDelegate implementation for use with UIDocumentInteractionController
|
|
253
138
|
*/
|
|
254
139
|
createUIDocumentInteractionControllerDelegate: () => NSObject;
|
|
140
|
+
/**
|
|
141
|
+
* @deprecated Use `Utils.getWindow<UIWindow>()` instead.
|
|
142
|
+
* @returns application window.
|
|
143
|
+
*/
|
|
144
|
+
getWindow: () => UIWindow;
|
|
255
145
|
/**
|
|
256
146
|
* Gets the root folder for the current application. This Folder is private for the application and not accessible from Users/External apps.
|
|
257
147
|
* iOS - this folder is read-only and contains the app and all its resources.
|
|
258
148
|
*/
|
|
259
149
|
getCurrentAppPath: () => string;
|
|
150
|
+
/**
|
|
151
|
+
* Get the root UIViewController of the app
|
|
152
|
+
*/
|
|
260
153
|
getRootViewController: () => UIViewController;
|
|
154
|
+
/**
|
|
155
|
+
* Gets the currently visible(topmost) UIViewController.
|
|
156
|
+
* @param rootViewController The root UIViewController instance to start searching from (normally window.rootViewController).
|
|
157
|
+
* Returns the visible UIViewController.
|
|
158
|
+
*/
|
|
261
159
|
getVisibleViewController: (rootViewController: UIViewController) => UIViewController;
|
|
262
|
-
getWindow: () => UIWindow;
|
|
263
160
|
getMainScreen: () => UIScreen;
|
|
161
|
+
/**
|
|
162
|
+
* Set the window background color of base view of the app.
|
|
163
|
+
* Often this is the view shown behind opening a modal, eg: a modal scales down revealing the window color.
|
|
164
|
+
* @param value color (hex, rgb, rgba, etc.)
|
|
165
|
+
*/
|
|
264
166
|
setWindowBackgroundColor: (value: string) => void;
|
|
167
|
+
/**
|
|
168
|
+
* @deprecated use Application.orientation instead
|
|
169
|
+
*
|
|
170
|
+
* Gets an information about if current mode is Landscape.
|
|
171
|
+
*/
|
|
265
172
|
isLandscape: () => boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Take a snapshot of a View on screen.
|
|
175
|
+
* @param view view to snapshot
|
|
176
|
+
* @param scale screen scale
|
|
177
|
+
*/
|
|
266
178
|
snapshotView: (view: UIView, scale: number) => UIImage;
|
|
267
179
|
/**
|
|
268
180
|
* Applies a rotation transform over X,Y and Z axis
|
|
@@ -272,7 +184,18 @@ export const ios: {
|
|
|
272
184
|
* @param z Rotation over Z axis in degrees
|
|
273
185
|
*/
|
|
274
186
|
applyRotateTransform: (transform: CATransform3D, x: number, y: number, z: number) => CATransform3D;
|
|
187
|
+
/**
|
|
188
|
+
* Debug utility to insert CGRect values into logging output.
|
|
189
|
+
* Note: when printing a CGRect directly it will print blank so this helps show the values.
|
|
190
|
+
* @param rect CGRect
|
|
191
|
+
*/
|
|
275
192
|
printCGRect: (rect: CGRect) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Copy layer properties from one view to another.
|
|
195
|
+
* @param view a view to copy layer properties to
|
|
196
|
+
* @param toView a view to copy later properties from
|
|
197
|
+
* @param (optional) custom properties to copy between both views
|
|
198
|
+
*/
|
|
276
199
|
copyLayerProperties: (view: UIView, toView: UIView, customProperties?: { view?: Array<keyof UIView>; layer?: Array<keyof CALayer> }) => void;
|
|
277
200
|
/**
|
|
278
201
|
* Animate views with a configurable spring effect
|