mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +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);
|
||||
} else {
|
||||
const nativeView = this.nativeViewProtected;
|
||||
org.nativescript.widgets.ViewHelper.setBackground(nativeView, value);
|
||||
nativeView.setBackground(value);
|
||||
|
||||
const style = this.style;
|
||||
const paddingTop = paddingTopProperty.isSet(style) ? this.effectivePaddingTop : this._defaultPaddingTop;
|
||||
|
@ -205,7 +205,7 @@ export class SearchBar extends SearchBarBase {
|
||||
if (value instanceof Color) {
|
||||
textView.setBackgroundColor(value.android);
|
||||
} else {
|
||||
org.nativescript.widgets.ViewHelper.setBackground(textView, value);
|
||||
textView.setBackground(value);
|
||||
}
|
||||
}
|
||||
[textFieldHintColorProperty.getDefault](): number {
|
||||
|
@ -157,7 +157,7 @@ export class SegmentedBarItem extends SegmentedBarItemBase {
|
||||
if (apiLevel > 21 && backgroundDrawable) {
|
||||
const newDrawable = tryCloneDrawable(backgroundDrawable, nativeView.getResources());
|
||||
newDrawable.setColorFilter(color, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
org.nativescript.widgets.ViewHelper.setBackground(viewGroup, newDrawable);
|
||||
viewGroup.setBackground(newDrawable);
|
||||
} else {
|
||||
const stateDrawable = new android.graphics.drawable.StateListDrawable();
|
||||
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;
|
||||
stateDrawable.addState(arr, colorDrawable);
|
||||
stateDrawable.setBounds(0, 15, viewGroup.getRight(), viewGroup.getBottom());
|
||||
org.nativescript.widgets.ViewHelper.setBackground(viewGroup, stateDrawable);
|
||||
viewGroup.setBackground(stateDrawable);
|
||||
}
|
||||
} else {
|
||||
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)) {
|
||||
backgroundDrawable = new org.nativescript.widgets.BorderDrawable(layout.getDisplayDensity(), view.toString());
|
||||
refreshBorderDrawable(view, backgroundDrawable);
|
||||
org.nativescript.widgets.ViewHelper.setBackground(nativeView, backgroundDrawable);
|
||||
nativeView.setBackground(backgroundDrawable);
|
||||
} else {
|
||||
refreshBorderDrawable(view, backgroundDrawable);
|
||||
}
|
||||
@ -80,7 +80,7 @@ export module ad {
|
||||
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?
|
||||
androidView._cachedDrawable = undefined;
|
||||
}
|
||||
|
Reference in New Issue
Block a user