mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Fixed the ActivityIndicator busy/visibility problems.
This commit is contained in:
@ -16,29 +16,21 @@ export class ActivityIndicator extends ActivityIndicatorBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get [busyProperty.native](): boolean {
|
get [busyProperty.native](): boolean {
|
||||||
return this._progressBar.getVisibility() === android.view.View.VISIBLE;
|
return false;
|
||||||
}
|
}
|
||||||
set [busyProperty.native](value: boolean) {
|
set [busyProperty.native](value: boolean) {
|
||||||
|
if (this.visibility === Visibility.VISIBLE) {
|
||||||
this._progressBar.setVisibility(value ? android.view.View.VISIBLE : android.view.View.INVISIBLE);
|
this._progressBar.setVisibility(value ? android.view.View.VISIBLE : android.view.View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get [visibilityProperty.native](): Visibility {
|
get [visibilityProperty.native](): Visibility {
|
||||||
let nativeVisibility = this._progressBar.getVisibility();
|
|
||||||
switch (nativeVisibility) {
|
|
||||||
case android.view.View.VISIBLE:
|
|
||||||
return Visibility.VISIBLE;
|
|
||||||
case android.view.View.INVISIBLE:
|
|
||||||
return Visibility.HIDDEN;
|
return Visibility.HIDDEN;
|
||||||
case android.view.View.GONE:
|
|
||||||
return Visibility.COLLAPSE;
|
|
||||||
default:
|
|
||||||
throw new Error(`Unsupported android.view.View visibility: ${nativeVisibility}. Currently supported values are android.view.View.VISIBLE, android.view.View.INVISIBLE, android.view.View.GONE.`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
set [visibilityProperty.native](value: Visibility) {
|
set [visibilityProperty.native](value: Visibility) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case Visibility.VISIBLE:
|
case Visibility.VISIBLE:
|
||||||
this._progressBar.setVisibility(android.view.View.VISIBLE);
|
this._progressBar.setVisibility(this.busy ? android.view.View.VISIBLE : android.view.View.INVISIBLE);
|
||||||
break;
|
break;
|
||||||
case Visibility.HIDDEN:
|
case Visibility.HIDDEN:
|
||||||
this._progressBar.setVisibility(android.view.View.INVISIBLE);
|
this._progressBar.setVisibility(android.view.View.INVISIBLE);
|
||||||
|
@ -33,13 +33,6 @@ export class ActivityIndicator extends ActivityIndicatorBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get [visibilityProperty.native](): Visibility {
|
|
||||||
return this.nativeView.hidden ? Visibility.COLLAPSE : Visibility.VISIBLE;
|
|
||||||
}
|
|
||||||
set [visibilityProperty.native](value: Visibility) {
|
|
||||||
this.nativeView.hidden = value !== Visibility.VISIBLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
get [colorProperty.native](): UIColor {
|
get [colorProperty.native](): UIColor {
|
||||||
return this.nativeView.color;
|
return this.nativeView.color;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user