mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #2547 from NativeScript/hhristov/zindex-fix-lower-apis
z-index handler added only for API 21+
This commit is contained in:
@@ -10,6 +10,7 @@ import style = require("ui/styling/style");
|
|||||||
import enums = require("ui/enums");
|
import enums = require("ui/enums");
|
||||||
import background = require("ui/styling/background");
|
import background = require("ui/styling/background");
|
||||||
import {CommonLayoutParams, Thickness} from "ui/styling/style";
|
import {CommonLayoutParams, Thickness} from "ui/styling/style";
|
||||||
|
import {device} from "platform";
|
||||||
|
|
||||||
global.moduleMerge(viewCommon, exports);
|
global.moduleMerge(viewCommon, exports);
|
||||||
|
|
||||||
@@ -51,6 +52,8 @@ function onIsUserInteractionEnabledPropertyChanged(data: dependencyObservable.Pr
|
|||||||
}
|
}
|
||||||
(<proxy.PropertyMetadata>viewCommon.View.isUserInteractionEnabledProperty.metadata).onSetNativeValue = onIsUserInteractionEnabledPropertyChanged;
|
(<proxy.PropertyMetadata>viewCommon.View.isUserInteractionEnabledProperty.metadata).onSetNativeValue = onIsUserInteractionEnabledPropertyChanged;
|
||||||
|
|
||||||
|
let styleHandlersInitialized: boolean;
|
||||||
|
|
||||||
export class View extends viewCommon.View {
|
export class View extends viewCommon.View {
|
||||||
private _disableUserInteractionListener: android.view.View.OnTouchListener = new android.view.View.OnTouchListener({
|
private _disableUserInteractionListener: android.view.View.OnTouchListener = new android.view.View.OnTouchListener({
|
||||||
onTouch: function (view: android.view.View, event: android.view.MotionEvent) {
|
onTouch: function (view: android.view.View, event: android.view.MotionEvent) {
|
||||||
@@ -58,6 +61,14 @@ export class View extends viewCommon.View {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
if (!styleHandlersInitialized) {
|
||||||
|
styleHandlersInitialized = true;
|
||||||
|
ViewStyler.registerHandlers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public _updateOnTouchListener(isUserInteractionEnabled: boolean) {
|
public _updateOnTouchListener(isUserInteractionEnabled: boolean) {
|
||||||
// User interaction is disabled -- we stop it and we do not care whether someone wants to listen for gestures.
|
// User interaction is disabled -- we stop it and we do not care whether someone wants to listen for gestures.
|
||||||
if (!isUserInteractionEnabled) {
|
if (!isUserInteractionEnabled) {
|
||||||
@@ -784,12 +795,12 @@ export class ViewStyler implements style.Styler {
|
|||||||
style.registerHandler(style.translateYProperty, new style.StylePropertyChangedHandler(
|
style.registerHandler(style.translateYProperty, new style.StylePropertyChangedHandler(
|
||||||
ViewStyler.setTranslateYProperty,
|
ViewStyler.setTranslateYProperty,
|
||||||
ViewStyler.resetTranslateYProperty));
|
ViewStyler.resetTranslateYProperty));
|
||||||
|
|
||||||
style.registerHandler(style.zIndexProperty, new style.StylePropertyChangedHandler(
|
if (parseInt(device.sdkVersion, 10) >= 21) {
|
||||||
ViewStyler.setZIndexProperty,
|
style.registerHandler(style.zIndexProperty, new style.StylePropertyChangedHandler(
|
||||||
ViewStyler.resetZIndexProperty,
|
ViewStyler.setZIndexProperty,
|
||||||
ViewStyler.getZIndexProperty));
|
ViewStyler.resetZIndexProperty,
|
||||||
|
ViewStyler.getZIndexProperty));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewStyler.registerHandlers();
|
|
||||||
Reference in New Issue
Block a user