Files
NativeScript/tns-core-modules/ui/activity-indicator/activity-indicator.android.ts
2016-12-13 15:51:18 +02:00

44 lines
1.5 KiB
TypeScript

import { ActivityIndicatorBase, busyProperty, colorProperty, visibilityProperty } from "./activity-indicator-common";
export * from "./activity-indicator-common";
export class ActivityIndicator extends ActivityIndicatorBase {
nativeView: android.widget.ProgressBar;
public _createUI() {
this.nativeView = new android.widget.ProgressBar(this._context);
this.nativeView.setVisibility(android.view.View.INVISIBLE);
this.nativeView.setIndeterminate(true);
}
get android(): android.widget.ProgressBar {
return this.nativeView;
}
get [busyProperty.native](): boolean {
return this.nativeView.getVisibility() === android.view.View.VISIBLE;
}
set [busyProperty.native](value: boolean) {
this.nativeView.setVisibility(value ? android.view.View.VISIBLE : android.view.View.INVISIBLE);
}
get [visibilityProperty.native](): number {
return this.nativeView.getVisibility();
}
set [visibilityProperty.native](value: number) {
this.busy = value === android.view.View.VISIBLE;
this.nativeView.setVisibility(value);
}
get [colorProperty.native](): number {
return -1;
}
set [colorProperty.native](value: number) {
if (value < 0) {
this.nativeView.getIndeterminateDrawable().clearColorFilter();
}
else {
this.nativeView.getIndeterminateDrawable().setColorFilter(value, android.graphics.PorterDuff.Mode.SRC_IN);
}
}
}