mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
refactor: remove obsolete ViewHelper.setBackground method (#6240)
This commit is contained in:
@ -785,7 +785,7 @@ export class View extends ViewCommon {
|
|||||||
androidBackground.onBackgroundOrBorderPropertyChanged(this);
|
androidBackground.onBackgroundOrBorderPropertyChanged(this);
|
||||||
} else {
|
} else {
|
||||||
const nativeView = this.nativeViewProtected;
|
const nativeView = this.nativeViewProtected;
|
||||||
org.nativescript.widgets.ViewHelper.setBackground(nativeView, value);
|
nativeView.setBackground(value);
|
||||||
|
|
||||||
const style = this.style;
|
const style = this.style;
|
||||||
const paddingTop = paddingTopProperty.isSet(style) ? this.effectivePaddingTop : this._defaultPaddingTop;
|
const paddingTop = paddingTopProperty.isSet(style) ? this.effectivePaddingTop : this._defaultPaddingTop;
|
||||||
|
@ -205,7 +205,7 @@ export class SearchBar extends SearchBarBase {
|
|||||||
if (value instanceof Color) {
|
if (value instanceof Color) {
|
||||||
textView.setBackgroundColor(value.android);
|
textView.setBackgroundColor(value.android);
|
||||||
} else {
|
} else {
|
||||||
org.nativescript.widgets.ViewHelper.setBackground(textView, value);
|
textView.setBackground(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[textFieldHintColorProperty.getDefault](): number {
|
[textFieldHintColorProperty.getDefault](): number {
|
||||||
|
@ -157,7 +157,7 @@ export class SegmentedBarItem extends SegmentedBarItemBase {
|
|||||||
if (apiLevel > 21 && backgroundDrawable) {
|
if (apiLevel > 21 && backgroundDrawable) {
|
||||||
const newDrawable = tryCloneDrawable(backgroundDrawable, nativeView.getResources());
|
const newDrawable = tryCloneDrawable(backgroundDrawable, nativeView.getResources());
|
||||||
newDrawable.setColorFilter(color, android.graphics.PorterDuff.Mode.SRC_IN);
|
newDrawable.setColorFilter(color, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
org.nativescript.widgets.ViewHelper.setBackground(viewGroup, newDrawable);
|
viewGroup.setBackground(newDrawable);
|
||||||
} else {
|
} else {
|
||||||
const stateDrawable = new android.graphics.drawable.StateListDrawable();
|
const stateDrawable = new android.graphics.drawable.StateListDrawable();
|
||||||
const colorDrawable: android.graphics.drawable.ColorDrawable = new org.nativescript.widgets.SegmentedBarColorDrawable(color, selectedIndicatorThickness);
|
const colorDrawable: android.graphics.drawable.ColorDrawable = new org.nativescript.widgets.SegmentedBarColorDrawable(color, selectedIndicatorThickness);
|
||||||
@ -165,11 +165,11 @@ export class SegmentedBarItem extends SegmentedBarItemBase {
|
|||||||
arr[0] = R_ATTR_STATE_SELECTED;
|
arr[0] = R_ATTR_STATE_SELECTED;
|
||||||
stateDrawable.addState(arr, colorDrawable);
|
stateDrawable.addState(arr, colorDrawable);
|
||||||
stateDrawable.setBounds(0, 15, viewGroup.getRight(), viewGroup.getBottom());
|
stateDrawable.setBounds(0, 15, viewGroup.getRight(), viewGroup.getBottom());
|
||||||
org.nativescript.widgets.ViewHelper.setBackground(viewGroup, stateDrawable);
|
viewGroup.setBackground(stateDrawable);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const backgroundDrawable = tryCloneDrawable(value, nativeView.getResources());
|
const backgroundDrawable = tryCloneDrawable(value, nativeView.getResources());
|
||||||
org.nativescript.widgets.ViewHelper.setBackground(viewGroup, backgroundDrawable);
|
viewGroup.setBackground(backgroundDrawable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ export module ad {
|
|||||||
if (!(drawable instanceof org.nativescript.widgets.BorderDrawable)) {
|
if (!(drawable instanceof org.nativescript.widgets.BorderDrawable)) {
|
||||||
backgroundDrawable = new org.nativescript.widgets.BorderDrawable(layout.getDisplayDensity(), view.toString());
|
backgroundDrawable = new org.nativescript.widgets.BorderDrawable(layout.getDisplayDensity(), view.toString());
|
||||||
refreshBorderDrawable(view, backgroundDrawable);
|
refreshBorderDrawable(view, backgroundDrawable);
|
||||||
org.nativescript.widgets.ViewHelper.setBackground(nativeView, backgroundDrawable);
|
nativeView.setBackground(backgroundDrawable);
|
||||||
} else {
|
} else {
|
||||||
refreshBorderDrawable(view, backgroundDrawable);
|
refreshBorderDrawable(view, backgroundDrawable);
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ export module ad {
|
|||||||
defaultDrawable = null;
|
defaultDrawable = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
org.nativescript.widgets.ViewHelper.setBackground(nativeView, defaultDrawable);
|
nativeView.setBackground(defaultDrawable);
|
||||||
// TODO: Do we need to clear the drawable here? Can't we just reuse it again?
|
// TODO: Do we need to clear the drawable here? Can't we just reuse it again?
|
||||||
androidView._cachedDrawable = undefined;
|
androidView._cachedDrawable = undefined;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user