up to segmented-bar.ios

This commit is contained in:
Hristo Hristov
2016-12-08 18:20:25 +02:00
parent 007b78325c
commit befb494a50
43 changed files with 847 additions and 1044 deletions

View File

@@ -1,17 +1,9 @@
import { Progress as ProgressDefinition } from "ui/progress";
import { View, Property } from "ui/core/view";
import { View, Property, CoercibleProperty } from "ui/core/view";
export * from "ui/core/view";
export class ProgressBase extends View implements ProgressDefinition {
constructor() {
super();
// This calls make both platforms have default values from 0 to 100.
this.maxValue = 100;
this.value = 0;
}
public value: number;
public maxValue: number;
// get maxValue(): number {
@@ -38,11 +30,11 @@ export class ProgressBase extends View implements ProgressDefinition {
/**
* Represents the observable property backing the value property of each Progress instance.
*/
export const valueProperty = new Property<ProgressBase, number>({ name: "value", defaultValue: 0 });
export const valueProperty = new CoercibleProperty<ProgressBase, number>({ name: "value", defaultValue: 0, coerceValue: (t, v) => v < 0 ? 0 : Math.min(v, t.maxValue) });
valueProperty.register(ProgressBase);
/**
* Represents the observable property backing the maxValue property of each Progress instance.
*/
export const maxValueProperty = new Property<ProgressBase, number>({ name: "maxValue", defaultValue: 100 });
export const maxValueProperty = new Property<ProgressBase, number>({ name: "maxValue", defaultValue: 100, valueChanged: (target, oldValue, newValue) => valueProperty.coerce(target) });
maxValueProperty.register(ProgressBase);

View File

@@ -1,5 +1,7 @@
import { ProgressBase, valueProperty, maxValueProperty } from "./progress-common";
import { View, Color, colorProperty, backgroundColorProperty, backgroundInternalProperty } from "ui/core/view";
import {
View, Color, ProgressBase, valueProperty, maxValueProperty,
colorProperty, backgroundColorProperty, backgroundInternalProperty
} from "./progress-common";
export * from "./progress-common";

View File

@@ -1,16 +1,12 @@
import { ProgressBase, valueProperty, maxValueProperty } from "./progress-common";
import { View, Color, colorProperty, backgroundColorProperty, backgroundInternalProperty } from "ui/core/view";
import {
ProgressBase, View, Color, valueProperty, maxValueProperty,
colorProperty, backgroundColorProperty, backgroundInternalProperty
} from "./progress-common";
export * from "./progress-common";
export class Progress extends ProgressBase {
private _ios: UIProgressView;
constructor() {
super();
this._ios = UIProgressView.new();
}
private _ios = UIProgressView.new();
get ios(): UIProgressView {
return this._ios;
@@ -51,11 +47,11 @@ export class Progress extends ProgressBase {
this._ios.trackTintColor = value;
}
}
get [backgroundInternalProperty.native](): UIColor {
return null;
}
set [backgroundInternalProperty.native](value: Color) {
//
//
}
}