@nativescript/core 9.0.0-alpha.24 → 9.0.0-alpha.26
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-common.d.ts +29 -10
- package/application/application-common.js +58 -5
- package/application/application-common.js.map +1 -1
- package/application/application-interfaces.d.ts +10 -0
- package/application/application-shims.d.ts +27 -0
- package/application/application-shims.js +27 -0
- package/application/application-shims.js.map +1 -1
- package/application/application.android.d.ts +12 -2
- package/application/application.android.js +418 -342
- package/application/application.android.js.map +1 -1
- package/application/application.d.ts +8 -1
- package/application/application.ios.d.ts +16 -1
- package/application/application.ios.js +59 -21
- package/application/application.ios.js.map +1 -1
- package/application/helpers.android.d.ts +0 -9
- package/application/helpers.android.js +0 -54
- package/application/helpers.android.js.map +1 -1
- package/application/helpers.d.ts +0 -10
- package/application/helpers.ios.d.ts +0 -19
- package/application/helpers.ios.js +0 -38
- package/application/helpers.ios.js.map +1 -1
- package/config/config.interface.d.ts +21 -0
- package/connectivity/index.android.js +25 -25
- package/connectivity/index.android.js.map +1 -1
- package/core-types/index.d.ts +77 -63
- package/core-types/index.js +10 -1
- package/core-types/index.js.map +1 -1
- package/core-types/validators.js +12 -6
- package/core-types/validators.js.map +1 -1
- package/data/observable/index.d.ts +2 -1
- package/data/observable/index.js +31 -19
- package/data/observable/index.js.map +1 -1
- package/fps-meter/fps-native.ios.js +1 -1
- package/fps-meter/fps-native.ios.js.map +1 -1
- package/http/http-request/index.ios.js +1 -1
- package/http/http-request/index.ios.js.map +1 -1
- package/image-source/index.d.ts +2 -2
- package/index.js +0 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/platform/screen/index.d.ts +5 -0
- package/platforms/android/widgets-release.aar +0 -0
- package/references.d.ts +1 -1
- package/timer/index.ios.js +1 -1
- package/timer/index.ios.js.map +1 -1
- package/ui/action-bar/index.android.js +18 -18
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/action-bar/index.ios.js +2 -4
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/animation/index.ios.js +2 -3
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/button/index.android.js +20 -20
- package/ui/button/index.android.js.map +1 -1
- package/ui/button/index.ios.d.ts +2 -1
- package/ui/button/index.ios.js +28 -10
- package/ui/button/index.ios.js.map +1 -1
- package/ui/core/control-state-change/index.ios.js +1 -1
- package/ui/core/control-state-change/index.ios.js.map +1 -1
- package/ui/core/view/index.android.d.ts +6 -6
- package/ui/core/view/index.android.js +337 -455
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.d.ts +18 -5
- package/ui/core/view/index.ios.d.ts +10 -2
- package/ui/core/view/index.ios.js +99 -46
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +46 -12
- package/ui/core/view/view-common.js +28 -0
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +5 -0
- package/ui/core/view/view-helper/index.ios.d.ts +5 -4
- package/ui/core/view/view-helper/index.ios.js +20 -23
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-common.js +7 -0
- package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
- package/ui/core/view/view-interfaces.d.ts +3 -0
- package/ui/core/view-base/index.d.ts +4 -0
- package/ui/core/view-base/index.js +4 -0
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/date-picker/index.android.js +38 -38
- package/ui/date-picker/index.android.js.map +1 -1
- package/ui/date-picker/index.ios.js +1 -1
- package/ui/date-picker/index.ios.js.map +1 -1
- package/ui/editable-text-base/index.android.js +34 -34
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/frame/fragment.transitions.android.d.ts +2 -1
- package/ui/frame/fragment.transitions.android.js +106 -104
- package/ui/frame/fragment.transitions.android.js.map +1 -1
- package/ui/frame/fragment.transitions.d.ts +3 -2
- package/ui/frame/index.android.js +57 -4
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.ios.d.ts +2 -1
- package/ui/frame/index.ios.js +83 -43
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/gestures/index.android.js +129 -130
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/index.ios.js +3 -5
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.js +32 -32
- package/ui/gestures/touch-manager.js.map +1 -1
- package/ui/image/index.android.js +19 -19
- package/ui/image/index.android.js.map +1 -1
- package/ui/image-cache/index.android.js +12 -14
- package/ui/image-cache/index.android.js.map +1 -1
- package/ui/image-cache/index.ios.js +6 -6
- package/ui/image-cache/index.ios.js.map +1 -1
- package/ui/index.d.ts +2 -1
- package/ui/index.js +1 -0
- package/ui/index.js.map +1 -1
- package/ui/label/index.android.js +4 -1
- package/ui/label/index.android.js.map +1 -1
- package/ui/label/index.ios.d.ts +2 -1
- package/ui/label/index.ios.js +12 -2
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.ios.js +3 -6
- package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
- package/ui/layouts/index.d.ts +2 -0
- package/ui/layouts/index.js +2 -0
- package/ui/layouts/index.js.map +1 -1
- package/ui/layouts/liquid-glass/index.android.d.ts +5 -0
- package/ui/layouts/liquid-glass/index.android.js +8 -0
- package/ui/layouts/liquid-glass/index.android.js.map +1 -0
- package/ui/layouts/liquid-glass/index.d.ts +10 -0
- package/ui/layouts/liquid-glass/index.ios.d.ts +10 -0
- package/ui/layouts/liquid-glass/index.ios.js +59 -0
- package/ui/layouts/liquid-glass/index.ios.js.map +1 -0
- package/ui/layouts/liquid-glass/liquid-glass-common.d.ts +3 -0
- package/ui/layouts/liquid-glass/liquid-glass-common.js +4 -0
- package/ui/layouts/liquid-glass/liquid-glass-common.js.map +1 -0
- package/ui/layouts/liquid-glass-container/index.android.d.ts +3 -0
- package/ui/layouts/liquid-glass-container/index.android.js +4 -0
- package/ui/layouts/liquid-glass-container/index.android.js.map +1 -0
- package/ui/layouts/liquid-glass-container/index.d.ts +3 -0
- package/ui/layouts/liquid-glass-container/index.ios.d.ts +14 -0
- package/ui/layouts/liquid-glass-container/index.ios.js +121 -0
- package/ui/layouts/liquid-glass-container/index.ios.js.map +1 -0
- package/ui/layouts/liquid-glass-container/liquid-glass-container-common.d.ts +4 -0
- package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js +5 -0
- package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js.map +1 -0
- package/ui/layouts/stack-layout/index.ios.js +6 -0
- package/ui/layouts/stack-layout/index.ios.js.map +1 -1
- package/ui/list-picker/index.android.js +35 -35
- package/ui/list-picker/index.android.js.map +1 -1
- package/ui/list-picker/index.ios.js +2 -2
- package/ui/list-picker/index.ios.js.map +1 -1
- package/ui/list-view/index.android.d.ts +26 -1
- package/ui/list-view/index.android.js +765 -129
- package/ui/list-view/index.android.js.map +1 -1
- package/ui/list-view/index.d.ts +127 -0
- package/ui/list-view/index.ios.d.ts +34 -2
- package/ui/list-view/index.ios.js +557 -21
- package/ui/list-view/index.ios.js.map +1 -1
- package/ui/list-view/list-view-common.d.ts +22 -1
- package/ui/list-view/list-view-common.js +85 -0
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/index.ios.js +25 -64
- package/ui/page/index.ios.js.map +1 -1
- package/ui/scroll-view/index.d.ts +1 -1
- package/ui/scroll-view/index.ios.d.ts +2 -0
- package/ui/scroll-view/index.ios.js +31 -12
- package/ui/scroll-view/index.ios.js.map +1 -1
- package/ui/scroll-view/scroll-view-common.d.ts +3 -8
- package/ui/scroll-view/scroll-view-common.js +4 -4
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.android.js +48 -52
- package/ui/search-bar/index.android.js.map +1 -1
- package/ui/search-bar/index.ios.js +3 -6
- package/ui/search-bar/index.ios.js.map +1 -1
- package/ui/segmented-bar/index.android.js +56 -58
- package/ui/segmented-bar/index.android.js.map +1 -1
- package/ui/segmented-bar/index.ios.js +1 -1
- package/ui/segmented-bar/index.ios.js.map +1 -1
- package/ui/slider/index.android.js +23 -25
- package/ui/slider/index.android.js.map +1 -1
- package/ui/slider/index.ios.js +2 -2
- package/ui/slider/index.ios.js.map +1 -1
- package/ui/split-view/index.android.d.ts +4 -0
- package/ui/split-view/index.android.js +4 -0
- package/ui/split-view/index.android.js.map +1 -0
- package/ui/split-view/index.d.ts +11 -0
- package/ui/split-view/index.ios.d.ts +39 -0
- package/ui/split-view/index.ios.js +368 -0
- package/ui/split-view/index.ios.js.map +1 -0
- package/ui/split-view/split-view-common.d.ts +51 -0
- package/ui/split-view/split-view-common.js +111 -0
- package/ui/split-view/split-view-common.js.map +1 -0
- package/ui/styling/background-common.d.ts +4 -4
- package/ui/styling/background-common.js +8 -8
- package/ui/styling/background-common.js.map +1 -1
- package/ui/styling/background.d.ts +0 -3
- package/ui/styling/background.ios.d.ts +2 -1
- package/ui/styling/background.ios.js +47 -38
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/css-utils.d.ts +1 -0
- package/ui/styling/css-utils.js +15 -4
- package/ui/styling/css-utils.js.map +1 -1
- package/ui/styling/style/index.d.ts +3 -1
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.d.ts +1 -0
- package/ui/styling/style-properties.js +30 -11
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/switch/index.android.js +18 -18
- package/ui/switch/index.android.js.map +1 -1
- package/ui/switch/index.ios.d.ts +1 -0
- package/ui/switch/index.ios.js +62 -12
- package/ui/switch/index.ios.js.map +1 -1
- package/ui/tab-view/index.android.js +185 -187
- package/ui/tab-view/index.android.js.map +1 -1
- package/ui/tab-view/index.d.ts +17 -1
- package/ui/tab-view/index.ios.d.ts +13 -5
- package/ui/tab-view/index.ios.js +253 -49
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.d.ts +14 -0
- package/ui/tab-view/tab-view-common.js +15 -0
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/index.android.d.ts +2 -1
- package/ui/text-base/index.android.js +133 -101
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.d.ts +5 -0
- package/ui/text-base/index.ios.js +12 -18
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/text-base-common.d.ts +2 -1
- package/ui/text-base/text-base-common.js +1 -0
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/text-field/index.ios.d.ts +2 -1
- package/ui/text-field/index.ios.js +9 -5
- package/ui/text-field/index.ios.js.map +1 -1
- package/ui/text-view/index.ios.d.ts +2 -1
- package/ui/text-view/index.ios.js +12 -7
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/time-picker/index.android.js +21 -21
- package/ui/time-picker/index.android.js.map +1 -1
- package/ui/time-picker/index.ios.js +1 -1
- package/ui/time-picker/index.ios.js.map +1 -1
- package/ui/transition/fade-transition.ios.js +5 -6
- package/ui/transition/fade-transition.ios.js.map +1 -1
- package/ui/transition/modal-transition.ios.js +19 -26
- package/ui/transition/modal-transition.ios.js.map +1 -1
- package/ui/transition/page-transition.android.js +3 -12
- package/ui/transition/page-transition.android.js.map +1 -1
- package/ui/transition/page-transition.ios.js +19 -25
- package/ui/transition/page-transition.ios.js.map +1 -1
- package/ui/transition/slide-transition.ios.js +5 -6
- package/ui/transition/slide-transition.ios.js.map +1 -1
- package/ui/web-view/index.android.js +58 -62
- package/ui/web-view/index.android.js.map +1 -1
- package/ui/web-view/index.ios.js +18 -18
- package/ui/web-view/index.ios.js.map +1 -1
- package/utils/common.d.ts +3 -1
- package/utils/common.js +9 -3
- package/utils/common.js.map +1 -1
- package/utils/index.d.ts +6 -0
- package/utils/layout-helper/index.android.d.ts +1 -0
- package/utils/layout-helper/index.android.js +9 -0
- package/utils/layout-helper/index.android.js.map +1 -1
- package/utils/layout-helper/index.d.ts +5 -0
- package/utils/layout-helper/index.ios.d.ts +1 -0
- package/utils/layout-helper/index.ios.js +4 -0
- package/utils/layout-helper/index.ios.js.map +1 -1
- package/utils/native-helper-for-android.d.ts +14 -3
- package/utils/native-helper-for-android.js +57 -54
- package/utils/native-helper-for-android.js.map +1 -1
- package/utils/native-helper.android.d.ts +3 -3
- package/utils/native-helper.android.js +2 -2
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.d.ts +22 -5
- package/utils/native-helper.ios.js +20 -20
- package/utils/native-helper.ios.js.map +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getNativeScriptGlobals } from '../../../globals/global-utils';
|
|
2
|
-
import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty, testIDProperty, AndroidHelper, statusBarStyleProperty } from './view-common';
|
|
3
|
-
import { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty } from '../../styling/style-properties';
|
|
4
|
-
import { Length } from '../../styling/length-shared';
|
|
2
|
+
import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty, testIDProperty, AndroidHelper, androidOverflowEdgeProperty, statusBarStyleProperty } from './view-common';
|
|
3
|
+
import { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, directionProperty } from '../../styling/style-properties';
|
|
5
4
|
import { layout } from '../../../utils';
|
|
6
5
|
import { Trace } from '../../../trace';
|
|
7
6
|
import { hiddenProperty } from '../view-base';
|
|
8
7
|
import { isCssWideKeyword } from '../properties/property-shared';
|
|
9
8
|
import { perspectiveProperty, visibilityProperty, opacityProperty, horizontalAlignmentProperty, verticalAlignmentProperty, minWidthProperty, minHeightProperty, widthProperty, heightProperty, marginLeftProperty, marginTopProperty, marginRightProperty, marginBottomProperty, rotateProperty, rotateXProperty, rotateYProperty, scaleXProperty, scaleYProperty, translateXProperty, translateYProperty, zIndexProperty, backgroundInternalProperty, androidElevationProperty, androidDynamicElevationOffsetProperty } from '../../styling/style-properties';
|
|
9
|
+
import { CoreTypes } from '../../../core-types';
|
|
10
10
|
import { Background, refreshBorderDrawable } from '../../styling/background';
|
|
11
11
|
import { profile } from '../../../profiling';
|
|
12
12
|
import { topmost } from '../../frame/frame-stack';
|
|
@@ -44,196 +44,220 @@ const STATUS_BAR_DARK_BCKG = 1711276032;
|
|
|
44
44
|
const modalMap = new Map();
|
|
45
45
|
let TouchListener;
|
|
46
46
|
let DialogFragment;
|
|
47
|
+
let OnBackPressedCallback;
|
|
48
|
+
if (SDK_VERSION >= 33) {
|
|
49
|
+
OnBackPressedCallback = androidx.activity.OnBackPressedCallback.extend({
|
|
50
|
+
handleOnBackPressed() {
|
|
51
|
+
console.log('OnBackPressedCallback handleOnBackPressed called');
|
|
52
|
+
const dialog = this['_dialog']?.get();
|
|
53
|
+
if (!dialog) {
|
|
54
|
+
// disable the callback and call super to avoid infinite loop
|
|
55
|
+
this.setEnabled(false);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const view = dialog.fragment.owner;
|
|
59
|
+
const args = {
|
|
60
|
+
eventName: 'activityBackPressed',
|
|
61
|
+
object: view,
|
|
62
|
+
activity: view._context,
|
|
63
|
+
cancel: false,
|
|
64
|
+
};
|
|
65
|
+
// Fist fire application.android global event
|
|
66
|
+
getNativeScriptGlobals().events.notify(args);
|
|
67
|
+
if (args.cancel) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
view.notify(args);
|
|
71
|
+
if (!args.cancel) {
|
|
72
|
+
this.setEnabled(false);
|
|
73
|
+
dialog.getOnBackPressedDispatcher().onBackPressed();
|
|
74
|
+
this.setEnabled(true);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
47
79
|
function initializeTouchListener() {
|
|
48
80
|
if (TouchListener) {
|
|
49
81
|
return;
|
|
50
82
|
}
|
|
51
|
-
var TouchListenerImpl =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
TouchListenerImpl.prototype.onTouch = function (view, event) {
|
|
59
|
-
var owner = this.owner.get();
|
|
60
|
-
if (!owner) {
|
|
61
|
-
return;
|
|
83
|
+
var TouchListenerImpl = (function (_super) {
|
|
84
|
+
__extends(TouchListenerImpl, _super);
|
|
85
|
+
function TouchListenerImpl(owner) {
|
|
86
|
+
var _this = _super.call(this) || this;
|
|
87
|
+
_this.owner = new WeakRef(owner);
|
|
88
|
+
return global.__native(_this);
|
|
62
89
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
TouchListenerImpl.prototype.onTouch = function (view, event) {
|
|
91
|
+
var owner = this.owner.get();
|
|
92
|
+
if (!owner) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
owner.handleGestureTouch(event);
|
|
96
|
+
var nativeView = owner.nativeViewProtected;
|
|
97
|
+
if (!nativeView || !nativeView.onTouchEvent) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return nativeView.onTouchEvent(event);
|
|
101
|
+
};
|
|
102
|
+
var _a;
|
|
103
|
+
TouchListenerImpl = __decorate([
|
|
104
|
+
Interfaces([android.view.View.OnTouchListener]),
|
|
105
|
+
__metadata("design:paramtypes", [typeof (_a = typeof View !== "undefined" && View) === "function" ? _a : Object])
|
|
106
|
+
], TouchListenerImpl);
|
|
107
|
+
return TouchListenerImpl;
|
|
108
|
+
}(java.lang.Object));
|
|
77
109
|
TouchListener = TouchListenerImpl;
|
|
78
110
|
}
|
|
79
111
|
function initializeDialogFragment() {
|
|
80
112
|
if (DialogFragment) {
|
|
81
113
|
return;
|
|
82
114
|
}
|
|
83
|
-
var DialogImpl =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
DialogImpl.prototype.onBackPressed = function () {
|
|
95
|
-
var view = this.fragment.owner;
|
|
96
|
-
var args = {
|
|
97
|
-
eventName: 'activityBackPressed',
|
|
98
|
-
object: view,
|
|
99
|
-
activity: view._context,
|
|
100
|
-
cancel: false,
|
|
101
|
-
};
|
|
102
|
-
// Fist fire application.android global event
|
|
103
|
-
getNativeScriptGlobals().events.notify(args);
|
|
104
|
-
if (args.cancel) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
view.notify(args);
|
|
108
|
-
if (!args.cancel && !view.onBackPressed()) {
|
|
109
|
-
_super.prototype.onBackPressed.call(this);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
return DialogImpl;
|
|
113
|
-
}(android.app.Dialog));
|
|
114
|
-
var DialogFragmentImpl = /** @class */ (function (_super) {
|
|
115
|
-
__extends(DialogFragmentImpl, _super);
|
|
116
|
-
function DialogFragmentImpl() {
|
|
117
|
-
var _this = _super.call(this) || this;
|
|
118
|
-
return global.__native(_this);
|
|
119
|
-
}
|
|
120
|
-
DialogFragmentImpl.prototype.onCreate = function (savedInstanceState) {
|
|
121
|
-
var _a;
|
|
122
|
-
_super.prototype.onCreate.call(this, savedInstanceState);
|
|
123
|
-
var ownerId = (_a = this.getArguments()) === null || _a === void 0 ? void 0 : _a.getInt(DOMID);
|
|
124
|
-
var options = getModalOptions(ownerId);
|
|
125
|
-
// The teardown when the activity is destroyed happens after the state is saved, but is not recoverable,
|
|
126
|
-
// Cancel the native dialog in this case or the app will crash with subsequent errors.
|
|
127
|
-
if (savedInstanceState != null && options === undefined) {
|
|
128
|
-
this.dismissAllowingStateLoss();
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
DialogFragmentImpl.prototype.onCreateDialog = function (savedInstanceState) {
|
|
132
|
-
var ownerId = this.getArguments().getInt(DOMID);
|
|
133
|
-
var options = getModalOptions(ownerId);
|
|
134
|
-
this.owner = options.owner;
|
|
135
|
-
// Set owner._dialogFragment to this in case the DialogFragment was recreated after app suspend
|
|
136
|
-
this.owner._dialogFragment = this;
|
|
137
|
-
this._fullscreen = options.fullscreen;
|
|
138
|
-
this._animated = options.animated;
|
|
139
|
-
this._cancelable = options.cancelable;
|
|
140
|
-
this._stretched = options.stretched;
|
|
141
|
-
this._dismissCallback = options.dismissCallback;
|
|
142
|
-
this._shownCallback = options.shownCallback;
|
|
143
|
-
this._windowSoftInputMode = options.windowSoftInputMode;
|
|
144
|
-
this.setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_TITLE, 0);
|
|
145
|
-
var theme = this.getTheme();
|
|
146
|
-
if (this._fullscreen) {
|
|
147
|
-
// In fullscreen mode, get the application's theme.
|
|
148
|
-
theme = this.getActivity().getApplicationInfo().theme;
|
|
149
|
-
}
|
|
150
|
-
var dialog = new DialogImpl(this, this.getActivity(), theme);
|
|
151
|
-
// do not override alignment unless fullscreen modal will be shown;
|
|
152
|
-
// otherwise we might break component-level layout:
|
|
153
|
-
// https://github.com/NativeScript/NativeScript/issues/5392
|
|
154
|
-
if (!this._fullscreen && !this._stretched) {
|
|
155
|
-
this.owner.horizontalAlignment = 'center';
|
|
156
|
-
this.owner.verticalAlignment = 'middle';
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
this.owner.horizontalAlignment = 'stretch';
|
|
160
|
-
this.owner.verticalAlignment = 'stretch';
|
|
161
|
-
}
|
|
162
|
-
// set the modal window animation
|
|
163
|
-
// https://github.com/NativeScript/NativeScript/issues/5989
|
|
164
|
-
if (this._animated) {
|
|
165
|
-
dialog.getWindow().setWindowAnimations(styleAnimationDialog);
|
|
166
|
-
}
|
|
167
|
-
dialog.setCanceledOnTouchOutside(this._cancelable);
|
|
168
|
-
return dialog;
|
|
169
|
-
};
|
|
170
|
-
DialogFragmentImpl.prototype.onCreateView = function (inflater, container, savedInstanceState) {
|
|
171
|
-
var owner = this.owner;
|
|
172
|
-
this.activity = new WeakRef(this.getActivity());
|
|
173
|
-
owner._setupAsRootView(this.getActivity());
|
|
174
|
-
owner._isAddedToNativeVisualTree = true;
|
|
175
|
-
// we need to set the window SoftInputMode here.
|
|
176
|
-
// it wont work is set in onStart
|
|
177
|
-
var window = this.getDialog().getWindow();
|
|
178
|
-
if (this._windowSoftInputMode !== undefined) {
|
|
179
|
-
window.setSoftInputMode(this._windowSoftInputMode);
|
|
115
|
+
var DialogImpl = (function (_super) {
|
|
116
|
+
__extends(DialogImpl, _super);
|
|
117
|
+
function DialogImpl(fragment, context, themeResId) {
|
|
118
|
+
var _this = _super.call(this, context, themeResId) || this;
|
|
119
|
+
_this.fragment = fragment;
|
|
120
|
+
if (SDK_VERSION >= 33 && OnBackPressedCallback) {
|
|
121
|
+
var callback = new OnBackPressedCallback(true);
|
|
122
|
+
callback["_dialog"] = new WeakRef(_this);
|
|
123
|
+
_this.getOnBackPressedDispatcher().addCallback(_this, callback);
|
|
124
|
+
}
|
|
125
|
+
return global.__native(_this);
|
|
180
126
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
127
|
+
DialogImpl.prototype.onDetachedFromWindow = function () {
|
|
128
|
+
_super.prototype.onDetachedFromWindow.call(this);
|
|
129
|
+
this.fragment = null;
|
|
130
|
+
};
|
|
131
|
+
DialogImpl.prototype.onBackPressed = function () {
|
|
132
|
+
if (SDK_VERSION >= 33) {
|
|
133
|
+
_super.prototype.onBackPressed.call(this);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
var view = this.fragment.owner;
|
|
137
|
+
var args = {
|
|
138
|
+
eventName: "activityBackPressed",
|
|
139
|
+
object: view,
|
|
140
|
+
activity: view._context,
|
|
141
|
+
cancel: false,
|
|
142
|
+
};
|
|
143
|
+
getNativeScriptGlobals().events.notify(args);
|
|
144
|
+
if (args.cancel) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
view.notify(args);
|
|
148
|
+
if (!args.cancel && !view.onBackPressed()) {
|
|
149
|
+
_super.prototype.onBackPressed.call(this);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
return DialogImpl;
|
|
153
|
+
}(androidx.appcompat.app.AppCompatDialog));
|
|
154
|
+
var DialogFragmentImpl = (function (_super) {
|
|
155
|
+
__extends(DialogFragmentImpl, _super);
|
|
156
|
+
function DialogFragmentImpl() {
|
|
157
|
+
var _this = _super.call(this) || this;
|
|
158
|
+
return global.__native(_this);
|
|
159
|
+
}
|
|
160
|
+
DialogFragmentImpl.prototype.onCreate = function (savedInstanceState) {
|
|
161
|
+
var _a;
|
|
162
|
+
_super.prototype.onCreate.call(this, savedInstanceState);
|
|
163
|
+
var ownerId = (_a = this.getArguments()) === null || _a === void 0 ? void 0 : _a.getInt(DOMID);
|
|
164
|
+
var options = getModalOptions(ownerId);
|
|
165
|
+
if (savedInstanceState != null && options === undefined) {
|
|
166
|
+
this.dismissAllowingStateLoss();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
DialogFragmentImpl.prototype.onCreateDialog = function (savedInstanceState) {
|
|
170
|
+
var ownerId = this.getArguments().getInt(DOMID);
|
|
171
|
+
var options = getModalOptions(ownerId);
|
|
172
|
+
this.owner = options.owner;
|
|
173
|
+
this.owner._dialogFragment = this;
|
|
174
|
+
this._fullscreen = options.fullscreen;
|
|
175
|
+
this._animated = options.animated;
|
|
176
|
+
this._cancelable = options.cancelable;
|
|
177
|
+
this._stretched = options.stretched;
|
|
178
|
+
this._dismissCallback = options.dismissCallback;
|
|
179
|
+
this._shownCallback = options.shownCallback;
|
|
180
|
+
this._windowSoftInputMode = options.windowSoftInputMode;
|
|
181
|
+
this.setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_TITLE, 0);
|
|
182
|
+
var theme = this.getTheme();
|
|
183
|
+
if (this._fullscreen) {
|
|
184
|
+
theme = this.getActivity().getApplicationInfo().theme;
|
|
185
|
+
}
|
|
186
|
+
var dialog = new DialogImpl(this, this.getActivity(), theme);
|
|
187
|
+
if (!this._fullscreen && !this._stretched) {
|
|
188
|
+
this.owner.horizontalAlignment = "center";
|
|
189
|
+
this.owner.verticalAlignment = "middle";
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
this.owner.horizontalAlignment = "stretch";
|
|
193
|
+
this.owner.verticalAlignment = "stretch";
|
|
194
|
+
}
|
|
195
|
+
if (this._animated) {
|
|
196
|
+
dialog.getWindow().setWindowAnimations(styleAnimationDialog);
|
|
197
|
+
}
|
|
198
|
+
dialog.setCanceledOnTouchOutside(this._cancelable);
|
|
199
|
+
return dialog;
|
|
200
|
+
};
|
|
201
|
+
DialogFragmentImpl.prototype.onCreateView = function (inflater, container, savedInstanceState) {
|
|
202
|
+
var owner = this.owner;
|
|
203
|
+
this.activity = new WeakRef(this.getActivity());
|
|
204
|
+
owner._setupAsRootView(this.getActivity());
|
|
205
|
+
owner._isAddedToNativeVisualTree = true;
|
|
191
206
|
var window = this.getDialog().getWindow();
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (owner) {
|
|
226
|
-
// Android calls onDestroy before onDismiss.
|
|
227
|
-
// Make sure we unload first and then call _tearDownUI.
|
|
228
|
-
if (owner.isLoaded) {
|
|
207
|
+
if (this._windowSoftInputMode !== undefined) {
|
|
208
|
+
window.setSoftInputMode(this._windowSoftInputMode);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
window.setSoftInputMode(owner._context.getWindow().getAttributes().softInputMode);
|
|
212
|
+
}
|
|
213
|
+
return owner.nativeViewProtected;
|
|
214
|
+
};
|
|
215
|
+
DialogFragmentImpl.prototype.onStart = function () {
|
|
216
|
+
_super.prototype.onStart.call(this);
|
|
217
|
+
if (this._fullscreen) {
|
|
218
|
+
var window = this.getDialog().getWindow();
|
|
219
|
+
var length = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
220
|
+
window.setLayout(length, length);
|
|
221
|
+
window.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.WHITE));
|
|
222
|
+
}
|
|
223
|
+
var owner = this.owner;
|
|
224
|
+
if (owner && !owner.isLoaded) {
|
|
225
|
+
owner.callLoaded();
|
|
226
|
+
}
|
|
227
|
+
this._shownCallback();
|
|
228
|
+
};
|
|
229
|
+
DialogFragmentImpl.prototype.onDismiss = function (dialog) {
|
|
230
|
+
var _a;
|
|
231
|
+
_super.prototype.onDismiss.call(this, dialog);
|
|
232
|
+
var manager = this.getFragmentManager();
|
|
233
|
+
var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
|
|
234
|
+
if (manager && !(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
|
|
235
|
+
removeModal(this.owner._domId);
|
|
236
|
+
this._dismissCallback();
|
|
237
|
+
}
|
|
238
|
+
var owner = this.owner;
|
|
239
|
+
if (owner && owner.isLoaded) {
|
|
229
240
|
owner.callUnloaded();
|
|
230
241
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
242
|
+
};
|
|
243
|
+
DialogFragmentImpl.prototype.onDestroy = function () {
|
|
244
|
+
var _a;
|
|
245
|
+
_super.prototype.onDestroy.call(this);
|
|
246
|
+
var owner = this.owner;
|
|
247
|
+
var activity = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.get();
|
|
248
|
+
if (!(activity === null || activity === void 0 ? void 0 : activity.isChangingConfigurations())) {
|
|
249
|
+
this.activity = null;
|
|
250
|
+
}
|
|
251
|
+
if (owner) {
|
|
252
|
+
if (owner.isLoaded) {
|
|
253
|
+
owner.callUnloaded();
|
|
254
|
+
}
|
|
255
|
+
owner._isAddedToNativeVisualTree = false;
|
|
256
|
+
owner._tearDownUI(true);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
return DialogFragmentImpl;
|
|
260
|
+
}(androidx.fragment.app.DialogFragment));
|
|
237
261
|
DialogFragment = DialogFragmentImpl;
|
|
238
262
|
}
|
|
239
263
|
function saveModal(options) {
|
|
@@ -253,20 +277,21 @@ const INSET_LEFT_CONSUMED = 16;
|
|
|
253
277
|
const INSET_TOP_CONSUMED = 20;
|
|
254
278
|
const INSET_RIGHT_CONSUMED = 24;
|
|
255
279
|
const INSET_BOTTOM_CONSUMED = 28;
|
|
280
|
+
const OverflowEdgeIgnore = -1;
|
|
256
281
|
const OverflowEdgeNone = 0;
|
|
257
|
-
const OverflowEdgeLeft = 1;
|
|
258
|
-
const OverflowEdgeTop = 1 <<
|
|
259
|
-
const OverflowEdgeRight = 1 <<
|
|
260
|
-
const OverflowEdgeBottom = 1 <<
|
|
261
|
-
const OverflowEdgeDontApply = 1 <<
|
|
262
|
-
const OverflowEdgeLeftDontConsume = 1 <<
|
|
263
|
-
const OverflowEdgeTopDontConsume = 1 <<
|
|
264
|
-
const OverflowEdgeRightDontConsume = 1 <<
|
|
265
|
-
const OverflowEdgeBottomDontConsume = 1 <<
|
|
266
|
-
const OverflowEdgeAllButLeft = 1 <<
|
|
267
|
-
const OverflowEdgeAllButTop = 1 <<
|
|
268
|
-
const OverflowEdgeAllButRight = 1 <<
|
|
269
|
-
const OverflowEdgeAllButBottom = 1 <<
|
|
282
|
+
const OverflowEdgeLeft = 1 << 1;
|
|
283
|
+
const OverflowEdgeTop = 1 << 2;
|
|
284
|
+
const OverflowEdgeRight = 1 << 3;
|
|
285
|
+
const OverflowEdgeBottom = 1 << 4;
|
|
286
|
+
const OverflowEdgeDontApply = 1 << 5;
|
|
287
|
+
const OverflowEdgeLeftDontConsume = 1 << 6;
|
|
288
|
+
const OverflowEdgeTopDontConsume = 1 << 7;
|
|
289
|
+
const OverflowEdgeRightDontConsume = 1 << 8;
|
|
290
|
+
const OverflowEdgeBottomDontConsume = 1 << 9;
|
|
291
|
+
const OverflowEdgeAllButLeft = 1 << 10;
|
|
292
|
+
const OverflowEdgeAllButTop = 1 << 11;
|
|
293
|
+
const OverflowEdgeAllButRight = 1 << 12;
|
|
294
|
+
const OverflowEdgeAllButBottom = 1 << 13;
|
|
270
295
|
class Inset {
|
|
271
296
|
constructor(data) {
|
|
272
297
|
this.data = ArrayBuffer.from(data);
|
|
@@ -337,11 +362,6 @@ class Inset {
|
|
|
337
362
|
}
|
|
338
363
|
}
|
|
339
364
|
export class View extends ViewCommon {
|
|
340
|
-
constructor() {
|
|
341
|
-
super(...arguments);
|
|
342
|
-
this._defaultOverflowEdge = OverflowEdgeNone;
|
|
343
|
-
this._defaultOverflowEdgeValue = 'none';
|
|
344
|
-
}
|
|
345
365
|
// TODO: Implement unobserve that detach the touchListener.
|
|
346
366
|
_observe(type, callback, thisArg) {
|
|
347
367
|
super._observe(type, callback, thisArg);
|
|
@@ -449,128 +469,30 @@ export class View extends ViewCommon {
|
|
|
449
469
|
}
|
|
450
470
|
return manager;
|
|
451
471
|
}
|
|
452
|
-
|
|
453
|
-
set androidOverflowEdge(value) {
|
|
454
|
-
if (typeof value !== 'string') {
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
472
|
+
[androidOverflowEdgeProperty.setNative](value) {
|
|
457
473
|
const nativeView = this.nativeViewProtected;
|
|
458
|
-
if (nativeView
|
|
459
|
-
|
|
460
|
-
nativeView.setOverflowEdge(OverflowEdgeNone);
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
463
|
-
const newValue = parseEdges(value);
|
|
464
|
-
if (newValue !== null) {
|
|
465
|
-
nativeView.setOverflowEdge(newValue);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
474
|
+
if (typeof value !== 'string' || nativeView === null || nativeView == undefined) {
|
|
475
|
+
return;
|
|
468
476
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
if (edge === null) {
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
this._defaultOverflowEdgeValue = value;
|
|
475
|
-
this._defaultOverflowEdge = edge;
|
|
477
|
+
if (!('setOverflowEdge' in nativeView)) {
|
|
478
|
+
return;
|
|
476
479
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
case OverflowEdgeRight:
|
|
490
|
-
return 'right';
|
|
491
|
-
case OverflowEdgeBottom:
|
|
492
|
-
return 'bottom';
|
|
493
|
-
case OverflowEdgeDontApply:
|
|
494
|
-
return 'dont-apply';
|
|
495
|
-
case OverflowEdgeLeftDontConsume:
|
|
496
|
-
return 'left-dont-consume';
|
|
497
|
-
case OverflowEdgeTopDontConsume:
|
|
498
|
-
return 'top-dont-consume';
|
|
499
|
-
case OverflowEdgeRightDontConsume:
|
|
500
|
-
return 'right-dont-consume';
|
|
501
|
-
case OverflowEdgeBottomDontConsume:
|
|
502
|
-
return 'bottom-dont-consume';
|
|
503
|
-
case OverflowEdgeAllButLeft:
|
|
504
|
-
return 'all-but-left';
|
|
505
|
-
case OverflowEdgeAllButTop:
|
|
506
|
-
return 'all-but-top';
|
|
507
|
-
case OverflowEdgeAllButRight:
|
|
508
|
-
return 'all-but-right';
|
|
509
|
-
case OverflowEdgeAllButBottom:
|
|
510
|
-
return 'all-but-bottom';
|
|
511
|
-
default:
|
|
512
|
-
{
|
|
513
|
-
let value = '';
|
|
514
|
-
const overflowLeftConsume = (overflowEdge & OverflowEdgeLeft) == OverflowEdgeLeft;
|
|
515
|
-
const overflowTopConsume = (overflowEdge & OverflowEdgeTop) == OverflowEdgeTop;
|
|
516
|
-
const overflowRightConsume = (overflowEdge & OverflowEdgeRight) == OverflowEdgeRight;
|
|
517
|
-
const overflowBottomConsume = (overflowEdge & OverflowEdgeBottom) == OverflowEdgeBottom;
|
|
518
|
-
const overflowLeft = (overflowEdge & OverflowEdgeLeftDontConsume) == OverflowEdgeLeftDontConsume;
|
|
519
|
-
const overflowTop = (overflowEdge & OverflowEdgeTopDontConsume) == OverflowEdgeTopDontConsume;
|
|
520
|
-
const overflowRight = (overflowEdge & OverflowEdgeRightDontConsume) == OverflowEdgeRightDontConsume;
|
|
521
|
-
const overflowBottom = (overflowEdge & OverflowEdgeBottomDontConsume) == OverflowEdgeBottomDontConsume;
|
|
522
|
-
if (overflowLeftConsume) {
|
|
523
|
-
value += 'left';
|
|
524
|
-
}
|
|
525
|
-
if (overflowTopConsume) {
|
|
526
|
-
if (value.length > 0) {
|
|
527
|
-
value += ',';
|
|
528
|
-
}
|
|
529
|
-
value += 'top';
|
|
530
|
-
}
|
|
531
|
-
if (overflowRightConsume) {
|
|
532
|
-
if (value.length > 0) {
|
|
533
|
-
value += ',';
|
|
534
|
-
}
|
|
535
|
-
value += 'right';
|
|
536
|
-
}
|
|
537
|
-
if (overflowBottomConsume) {
|
|
538
|
-
if (value.length > 0) {
|
|
539
|
-
value += ',';
|
|
540
|
-
}
|
|
541
|
-
value += 'bottom';
|
|
542
|
-
}
|
|
543
|
-
if (overflowLeft) {
|
|
544
|
-
value += 'left-dont-consume';
|
|
545
|
-
}
|
|
546
|
-
if (overflowTop) {
|
|
547
|
-
if (value.length > 0) {
|
|
548
|
-
value += ',';
|
|
549
|
-
}
|
|
550
|
-
value += 'top-dont-consume';
|
|
551
|
-
}
|
|
552
|
-
if (overflowRight) {
|
|
553
|
-
if (value.length > 0) {
|
|
554
|
-
value += ',';
|
|
555
|
-
}
|
|
556
|
-
value += 'right-dont-consume';
|
|
557
|
-
}
|
|
558
|
-
if (overflowBottom) {
|
|
559
|
-
if (value.length > 0) {
|
|
560
|
-
value += ',';
|
|
561
|
-
}
|
|
562
|
-
value += 'bottom-dont-consume';
|
|
563
|
-
}
|
|
480
|
+
switch (value) {
|
|
481
|
+
case 'none':
|
|
482
|
+
nativeView.setOverflowEdge(OverflowEdgeNone);
|
|
483
|
+
break;
|
|
484
|
+
case 'ignore':
|
|
485
|
+
nativeView.setOverflowEdge(OverflowEdgeIgnore);
|
|
486
|
+
break;
|
|
487
|
+
default:
|
|
488
|
+
{
|
|
489
|
+
const edge = parseEdges(value);
|
|
490
|
+
if (edge != null) {
|
|
491
|
+
nativeView.setOverflowEdge(edge);
|
|
564
492
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}
|
|
568
|
-
else {
|
|
569
|
-
if (this._defaultOverflowEdgeValue) {
|
|
570
|
-
return this._defaultOverflowEdgeValue;
|
|
571
|
-
}
|
|
493
|
+
}
|
|
494
|
+
break;
|
|
572
495
|
}
|
|
573
|
-
return 'none';
|
|
574
496
|
}
|
|
575
497
|
onLoaded() {
|
|
576
498
|
this._manager = null;
|
|
@@ -593,11 +515,29 @@ export class View extends ViewCommon {
|
|
|
593
515
|
return false;
|
|
594
516
|
}
|
|
595
517
|
handleGestureTouch(event) {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
518
|
+
// This keeps a copy of gesture observers from the map to ensure concurrency
|
|
519
|
+
const allObservers = Object.values(this._gestureObservers);
|
|
520
|
+
for (const observers of allObservers) {
|
|
521
|
+
const length = observers.length;
|
|
522
|
+
if (!length) {
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
if (length === 1) {
|
|
526
|
+
const entry = observers[0];
|
|
527
|
+
if (entry) {
|
|
528
|
+
entry.androidOnTouchEvent(event);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
// This keeps a copy of gesture observers list to ensure concurrency
|
|
533
|
+
const observersCp = observers.slice();
|
|
534
|
+
for (let i = 0; i < length; i++) {
|
|
535
|
+
const entry = observersCp[i];
|
|
536
|
+
if (entry) {
|
|
537
|
+
entry.androidOnTouchEvent(event);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
601
541
|
}
|
|
602
542
|
if (this.parent instanceof View) {
|
|
603
543
|
this.parent.handleGestureTouch(event);
|
|
@@ -614,12 +554,6 @@ export class View extends ViewCommon {
|
|
|
614
554
|
if (!this.insetListenerIsSet && this.needsInsetListener) {
|
|
615
555
|
this.setInsetListener();
|
|
616
556
|
}
|
|
617
|
-
const nativeView = this.nativeViewProtected;
|
|
618
|
-
if (typeof this._defaultOverflowEdge === 'number') {
|
|
619
|
-
if (nativeView && nativeView.setOverflowEdge) {
|
|
620
|
-
nativeView.setOverflowEdge(this._defaultOverflowEdge);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
557
|
}
|
|
624
558
|
needsOnLayoutChangeListener() {
|
|
625
559
|
return this.hasListeners(ViewCommon.layoutChangedEvent);
|
|
@@ -945,8 +879,14 @@ export class View extends ViewCommon {
|
|
|
945
879
|
const gravity = lp.gravity;
|
|
946
880
|
const weight = lp.weight;
|
|
947
881
|
// Set only if params gravity exists.
|
|
948
|
-
if (gravity
|
|
882
|
+
if (gravity != null) {
|
|
949
883
|
switch (value) {
|
|
884
|
+
case 'start':
|
|
885
|
+
lp.gravity = (this.direction === CoreTypes.LayoutDirection.rtl ? GRAVITY_RIGHT : GRAVITY_LEFT) | (gravity & VERTICAL_GRAVITY_MASK);
|
|
886
|
+
if (weight < 0) {
|
|
887
|
+
lp.weight = -2;
|
|
888
|
+
}
|
|
889
|
+
break;
|
|
950
890
|
case 'left':
|
|
951
891
|
lp.gravity = GRAVITY_LEFT | (gravity & VERTICAL_GRAVITY_MASK);
|
|
952
892
|
if (weight < 0) {
|
|
@@ -965,6 +905,12 @@ export class View extends ViewCommon {
|
|
|
965
905
|
lp.weight = -2;
|
|
966
906
|
}
|
|
967
907
|
break;
|
|
908
|
+
case 'end':
|
|
909
|
+
lp.gravity = (this.direction === CoreTypes.LayoutDirection.rtl ? GRAVITY_LEFT : GRAVITY_RIGHT) | (gravity & VERTICAL_GRAVITY_MASK);
|
|
910
|
+
if (weight < 0) {
|
|
911
|
+
lp.weight = -2;
|
|
912
|
+
}
|
|
913
|
+
break;
|
|
968
914
|
case 'stretch':
|
|
969
915
|
lp.gravity = GRAVITY_FILL_HORIZONTAL | (gravity & VERTICAL_GRAVITY_MASK);
|
|
970
916
|
if (weight < 0) {
|
|
@@ -1094,9 +1040,6 @@ export class View extends ViewCommon {
|
|
|
1094
1040
|
}
|
|
1095
1041
|
return this._context.getWindow();
|
|
1096
1042
|
}
|
|
1097
|
-
[testIDProperty.setNative](value) {
|
|
1098
|
-
this.setAccessibilityIdentifier(this.nativeViewProtected, value);
|
|
1099
|
-
}
|
|
1100
1043
|
setAccessibilityIdentifier(view, value) {
|
|
1101
1044
|
const id = Utils.android.resources.getId(':id/nativescript_accessibility_id');
|
|
1102
1045
|
if (id) {
|
|
@@ -1108,6 +1051,23 @@ export class View extends ViewCommon {
|
|
|
1108
1051
|
if (this.accessibilityIdentifier !== value)
|
|
1109
1052
|
this.accessibilityIdentifier = value;
|
|
1110
1053
|
}
|
|
1054
|
+
[directionProperty.setNative](value) {
|
|
1055
|
+
const nativeView = this.nativeViewProtected;
|
|
1056
|
+
switch (value) {
|
|
1057
|
+
case CoreTypes.LayoutDirection.ltr:
|
|
1058
|
+
nativeView.setLayoutDirection(android.view.View.LAYOUT_DIRECTION_LTR);
|
|
1059
|
+
break;
|
|
1060
|
+
case CoreTypes.LayoutDirection.rtl:
|
|
1061
|
+
nativeView.setLayoutDirection(android.view.View.LAYOUT_DIRECTION_RTL);
|
|
1062
|
+
break;
|
|
1063
|
+
default:
|
|
1064
|
+
nativeView.setLayoutDirection(android.view.View.LAYOUT_DIRECTION_LOCALE);
|
|
1065
|
+
break;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
[testIDProperty.setNative](value) {
|
|
1069
|
+
this.setAccessibilityIdentifier(this.nativeViewProtected, value);
|
|
1070
|
+
}
|
|
1111
1071
|
[accessibilityEnabledProperty.setNative](value) {
|
|
1112
1072
|
this.nativeViewProtected.setFocusable(!!value);
|
|
1113
1073
|
updateA11yPropertiesCallback(this);
|
|
@@ -1303,17 +1263,21 @@ export class View extends ViewCommon {
|
|
|
1303
1263
|
}
|
|
1304
1264
|
}
|
|
1305
1265
|
}
|
|
1306
|
-
_drawBoxShadow(
|
|
1266
|
+
_drawBoxShadow(boxShadows) {
|
|
1307
1267
|
const nativeView = this.nativeViewProtected;
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1268
|
+
const valueCount = 6;
|
|
1269
|
+
const nativeArray = Array.create('int', boxShadows.length * valueCount);
|
|
1270
|
+
for (let i = 0, length = boxShadows.length; i < length; i++) {
|
|
1271
|
+
const boxShadow = boxShadows[i];
|
|
1272
|
+
const nativeIndex = i * valueCount;
|
|
1273
|
+
nativeArray[nativeIndex + 0] = boxShadow.color.android;
|
|
1274
|
+
nativeArray[nativeIndex + 1] = boxShadow.spreadRadius;
|
|
1275
|
+
nativeArray[nativeIndex + 2] = boxShadow.blurRadius;
|
|
1276
|
+
nativeArray[nativeIndex + 3] = boxShadow.offsetX;
|
|
1277
|
+
nativeArray[nativeIndex + 4] = boxShadow.offsetY;
|
|
1278
|
+
nativeArray[nativeIndex + 5] = boxShadow.inset ? 1 : 0;
|
|
1279
|
+
}
|
|
1280
|
+
org.nativescript.widgets.Utils.drawBoxShadow(nativeView, nativeArray);
|
|
1317
1281
|
}
|
|
1318
1282
|
_redrawNativeBackground(value) {
|
|
1319
1283
|
if (value instanceof Background) {
|
|
@@ -1356,13 +1320,13 @@ export class View extends ViewCommon {
|
|
|
1356
1320
|
// prettier-ignore
|
|
1357
1321
|
const onlyColor = !background.hasBorderWidth()
|
|
1358
1322
|
&& !background.hasBorderRadius()
|
|
1359
|
-
&& !background.
|
|
1323
|
+
&& !background.hasBoxShadows()
|
|
1360
1324
|
&& !background.clipPath
|
|
1361
1325
|
&& !background.image
|
|
1362
1326
|
&& !!background.color;
|
|
1363
1327
|
this._applyBackground(background, isBorderDrawable, onlyColor, drawable);
|
|
1364
|
-
if (background.
|
|
1365
|
-
this._drawBoxShadow(background.
|
|
1328
|
+
if (background.hasBoxShadows()) {
|
|
1329
|
+
this._drawBoxShadow(background.getBoxShadows());
|
|
1366
1330
|
}
|
|
1367
1331
|
// TODO: Can we move BorderWidths as separate native setter?
|
|
1368
1332
|
// This way we could skip setPadding if borderWidth is not changed.
|
|
@@ -1410,123 +1374,41 @@ __decorate([
|
|
|
1410
1374
|
__metadata("design:paramtypes", []),
|
|
1411
1375
|
__metadata("design:returntype", void 0)
|
|
1412
1376
|
], View.prototype, "requestLayout", null);
|
|
1377
|
+
const edgeMap = {
|
|
1378
|
+
none: OverflowEdgeNone,
|
|
1379
|
+
left: OverflowEdgeLeft,
|
|
1380
|
+
top: OverflowEdgeTop,
|
|
1381
|
+
right: OverflowEdgeRight,
|
|
1382
|
+
bottom: OverflowEdgeBottom,
|
|
1383
|
+
'dont-apply': OverflowEdgeDontApply,
|
|
1384
|
+
'left-dont-consume': OverflowEdgeLeftDontConsume,
|
|
1385
|
+
'top-dont-consume': OverflowEdgeTopDontConsume,
|
|
1386
|
+
'right-dont-consume': OverflowEdgeRightDontConsume,
|
|
1387
|
+
'bottom-dont-consume': OverflowEdgeBottomDontConsume,
|
|
1388
|
+
'all-but-left': OverflowEdgeAllButLeft,
|
|
1389
|
+
'all-but-top': OverflowEdgeAllButTop,
|
|
1390
|
+
'all-but-right': OverflowEdgeAllButRight,
|
|
1391
|
+
'all-but-bottom': OverflowEdgeAllButBottom,
|
|
1392
|
+
};
|
|
1413
1393
|
function parseEdges(edges) {
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
for (
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
break;
|
|
1427
|
-
case 'left':
|
|
1428
|
-
if (newValue === -1) {
|
|
1429
|
-
newValue = OverflowEdgeLeft;
|
|
1430
|
-
}
|
|
1431
|
-
else {
|
|
1432
|
-
newValue |= OverflowEdgeLeft;
|
|
1433
|
-
}
|
|
1434
|
-
break;
|
|
1435
|
-
case 'top':
|
|
1436
|
-
if (newValue === -1) {
|
|
1437
|
-
newValue = OverflowEdgeTop;
|
|
1438
|
-
}
|
|
1439
|
-
else {
|
|
1440
|
-
newValue |= OverflowEdgeTop;
|
|
1441
|
-
}
|
|
1442
|
-
break;
|
|
1443
|
-
case 'right':
|
|
1444
|
-
if (newValue === -1) {
|
|
1445
|
-
newValue = OverflowEdgeRight;
|
|
1446
|
-
}
|
|
1447
|
-
else {
|
|
1448
|
-
newValue |= OverflowEdgeRight;
|
|
1449
|
-
}
|
|
1450
|
-
break;
|
|
1451
|
-
case 'bottom':
|
|
1452
|
-
if (newValue === -1) {
|
|
1453
|
-
newValue = OverflowEdgeBottom;
|
|
1454
|
-
}
|
|
1455
|
-
else {
|
|
1456
|
-
newValue |= OverflowEdgeBottom;
|
|
1457
|
-
}
|
|
1458
|
-
break;
|
|
1459
|
-
case 'dont-apply':
|
|
1460
|
-
newValue = OverflowEdgeDontApply;
|
|
1461
|
-
break;
|
|
1462
|
-
case 'left-dont-consume':
|
|
1463
|
-
if (newValue === -1) {
|
|
1464
|
-
newValue = OverflowEdgeLeftDontConsume;
|
|
1465
|
-
}
|
|
1466
|
-
else {
|
|
1467
|
-
newValue |= OverflowEdgeLeftDontConsume;
|
|
1468
|
-
}
|
|
1469
|
-
break;
|
|
1470
|
-
case 'top-dont-consume':
|
|
1471
|
-
if (newValue === -1) {
|
|
1472
|
-
newValue = OverflowEdgeTopDontConsume;
|
|
1473
|
-
}
|
|
1474
|
-
else {
|
|
1475
|
-
newValue |= OverflowEdgeTopDontConsume;
|
|
1476
|
-
}
|
|
1477
|
-
break;
|
|
1478
|
-
case 'right-dont-consume':
|
|
1479
|
-
if (newValue === -1) {
|
|
1480
|
-
newValue = OverflowEdgeRightDontConsume;
|
|
1481
|
-
}
|
|
1482
|
-
else {
|
|
1483
|
-
newValue |= OverflowEdgeRightDontConsume;
|
|
1484
|
-
}
|
|
1485
|
-
break;
|
|
1486
|
-
case 'bottom-dont-consume':
|
|
1487
|
-
if (newValue === -1) {
|
|
1488
|
-
newValue = OverflowEdgeBottomDontConsume;
|
|
1489
|
-
}
|
|
1490
|
-
else {
|
|
1491
|
-
newValue |= OverflowEdgeBottomDontConsume;
|
|
1492
|
-
}
|
|
1493
|
-
case 'all-but-left':
|
|
1494
|
-
if (newValue === -1) {
|
|
1495
|
-
newValue = OverflowEdgeAllButLeft;
|
|
1496
|
-
}
|
|
1497
|
-
else {
|
|
1498
|
-
newValue |= OverflowEdgeAllButLeft;
|
|
1499
|
-
}
|
|
1500
|
-
case 'all-but-top':
|
|
1501
|
-
if (newValue === -1) {
|
|
1502
|
-
newValue = OverflowEdgeAllButTop;
|
|
1503
|
-
}
|
|
1504
|
-
else {
|
|
1505
|
-
newValue |= OverflowEdgeAllButTop;
|
|
1506
|
-
}
|
|
1507
|
-
case 'all-but-right':
|
|
1508
|
-
if (newValue === -1) {
|
|
1509
|
-
newValue = OverflowEdgeAllButRight;
|
|
1510
|
-
}
|
|
1511
|
-
else {
|
|
1512
|
-
newValue |= OverflowEdgeAllButRight;
|
|
1513
|
-
}
|
|
1514
|
-
case 'all-but-bottom':
|
|
1515
|
-
if (newValue === -1) {
|
|
1516
|
-
newValue = OverflowEdgeAllButBottom;
|
|
1517
|
-
}
|
|
1518
|
-
else {
|
|
1519
|
-
newValue |= OverflowEdgeAllButBottom;
|
|
1520
|
-
}
|
|
1521
|
-
break;
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
if (newValue === -1) {
|
|
1525
|
-
return null;
|
|
1526
|
-
}
|
|
1527
|
-
return newValue;
|
|
1394
|
+
let result = 0;
|
|
1395
|
+
const values = edges.split(',');
|
|
1396
|
+
for (const raw of values) {
|
|
1397
|
+
const value = edgeMap[raw.trim()];
|
|
1398
|
+
if (value === undefined)
|
|
1399
|
+
continue;
|
|
1400
|
+
// dont-apply overrides everything else
|
|
1401
|
+
if (value === OverflowEdgeDontApply)
|
|
1402
|
+
return value;
|
|
1403
|
+
result |= value;
|
|
1404
|
+
}
|
|
1405
|
+
return result === 0 ? null : result;
|
|
1528
1406
|
}
|
|
1529
1407
|
export class ContainerView extends View {
|
|
1408
|
+
constructor() {
|
|
1409
|
+
super();
|
|
1410
|
+
this.androidOverflowEdge = 'none';
|
|
1411
|
+
}
|
|
1530
1412
|
}
|
|
1531
1413
|
export class CustomLayoutView extends ContainerView {
|
|
1532
1414
|
createNativeView() {
|