Use software layer for rounded borders on android 17

This commit is contained in:
vakrilov
2015-11-09 16:29:21 +02:00
parent ad3bd942cd
commit 67f992fc57

View File

@ -13,6 +13,8 @@ var btn;
global.moduleMerge(stylersCommon, exports);
var SDK = android.os.Build.VERSION.SDK_INT;
var ignorePropertyHandler = new stylersCommon.StylePropertyChangedHandler(
(view, val) => {
// empty
@ -51,6 +53,12 @@ function onBackgroundOrBorderPropertyChanged(v: view.View) {
bkg.cornerRadius = v.borderRadius;
bkg.borderColor = v.borderColor ? v.borderColor.android : android.graphics.Color.TRANSPARENT;
bkg.background = backgroundValue;
if (SDK < 18) {
// Switch to software because of unsupported canvas methods if hardware acceleration is on:
// http://developer.android.com/guide/topics/graphics/hardware-accel.html
nativeView.setLayerType(android.view.View.LAYER_TYPE_SOFTWARE, null);
}
}
else {
// reset the value with the default native value
@ -64,6 +72,11 @@ function onBackgroundOrBorderPropertyChanged(v: view.View) {
nativeView.setBackground(_defaultBackgrounds.get(viewClass));
}
}
if (SDK < 18) {
// Reset layer type to hardware
nativeView.setLayerType(android.view.View.LAYER_TYPE_HARDWARE, null);
}
}
var density = utils.layout.getDisplayDensity();