setColorFilter used if android.os.Build.VERSION.SDK_INT >= 21 (#3143)

This commit is contained in:
Vladimir Enchev
2016-11-23 09:42:31 +02:00
committed by GitHub
parent f4900959d3
commit beb70ee3f7

View File

@ -282,6 +282,10 @@ export class SegmentedBarStyler implements style.Styler {
for (let tabIndex = 0; tabIndex < tabHost.getTabWidget().getTabCount(); tabIndex++) { for (let tabIndex = 0; tabIndex < tabHost.getTabWidget().getTabCount(); tabIndex++) {
let vg = <android.view.ViewGroup>tabHost.getTabWidget().getChildTabViewAt(tabIndex); let vg = <android.view.ViewGroup>tabHost.getTabWidget().getChildTabViewAt(tabIndex);
var backgroundDrawable = vg.getBackground();
if (android.os.Build.VERSION.SDK_INT >= 21 && backgroundDrawable && types.isFunction(backgroundDrawable.setColorFilter)) {
backgroundDrawable.setColorFilter(newValue, android.graphics.PorterDuff.Mode.SRC_IN);
} else {
let stateDrawable = new android.graphics.drawable.StateListDrawable(); let stateDrawable = new android.graphics.drawable.StateListDrawable();
let arr = (<any>Array).create("int", 1); let arr = (<any>Array).create("int", 1);
@ -297,6 +301,7 @@ export class SegmentedBarStyler implements style.Styler {
} }
} }
} }
}
private static resetSelectedBackgroundColorProperty(v: view.View, nativeValue: Array<android.graphics.drawable.Drawable>) { private static resetSelectedBackgroundColorProperty(v: view.View, nativeValue: Array<android.graphics.drawable.Drawable>) {
let tabHost = <android.widget.TabHost>v._nativeView; let tabHost = <android.widget.TabHost>v._nativeView;