mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
NativeView recycled for android
This commit is contained in:
@@ -8,40 +8,31 @@ export * from "./progress-common";
|
||||
const R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL = 0x01010078;
|
||||
|
||||
export class Progress extends ProgressBase {
|
||||
private _android: android.widget.ProgressBar;
|
||||
nativeView: android.widget.ProgressBar;
|
||||
|
||||
public _createNativeView() {
|
||||
const progressBar = this._android = new android.widget.ProgressBar(this._context, null, R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL);
|
||||
return progressBar;
|
||||
}
|
||||
|
||||
get android(): android.widget.ProgressBar {
|
||||
return this._android;
|
||||
}
|
||||
|
||||
get nativeView(): android.widget.ProgressBar {
|
||||
return this._android;
|
||||
return new android.widget.ProgressBar(this._context, null, R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL);
|
||||
}
|
||||
|
||||
[valueProperty.getDefault](): number {
|
||||
return 0;
|
||||
}
|
||||
[valueProperty.setNative](value: number) {
|
||||
this._android.setProgress(value);
|
||||
this.nativeView.setProgress(value);
|
||||
}
|
||||
|
||||
[maxValueProperty.getDefault](): number {
|
||||
return 100;
|
||||
}
|
||||
[maxValueProperty.setNative](value: number) {
|
||||
this._android.setMax(value);
|
||||
this.nativeView.setMax(value);
|
||||
}
|
||||
|
||||
[colorProperty.getDefault](): android.graphics.drawable.Drawable {
|
||||
return null;
|
||||
}
|
||||
[colorProperty.setNative](value: Color) {
|
||||
let progressDrawable = this._android.getProgressDrawable();
|
||||
let progressDrawable = this.nativeView.getProgressDrawable();
|
||||
if (!progressDrawable) {
|
||||
return;
|
||||
}
|
||||
@@ -57,7 +48,7 @@ export class Progress extends ProgressBase {
|
||||
return null;
|
||||
}
|
||||
[backgroundColorProperty.setNative](value: Color) {
|
||||
let progressDrawable = this._android.getProgressDrawable();
|
||||
let progressDrawable = this.nativeView.getProgressDrawable();
|
||||
if (!progressDrawable) {
|
||||
return;
|
||||
}
|
||||
@@ -80,4 +71,4 @@ export class Progress extends ProgressBase {
|
||||
[backgroundInternalProperty.setNative](value: Color) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user