stylers removed

This commit is contained in:
Vladimir Enchev
2015-12-21 15:10:06 +02:00
parent 22af9e8199
commit d50e2fdb37
48 changed files with 2531 additions and 2457 deletions

View File

@@ -1,6 +1,9 @@
import common = require("./progress-common");
import dependencyObservable = require("ui/core/dependency-observable");
import proxy = require("ui/core/proxy");
import styling = require("ui/styling");
import style = require("ui/styling/style");
import view = require("ui/core/view");
const R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL = 0x01010078;
@@ -39,3 +42,49 @@ export class Progress extends common.Progress {
return this._android;
}
}
export class ProgressStyler implements style.Styler {
private static setColorProperty(view: view.View, newValue: any) {
var bar = <android.widget.ProgressBar>view._nativeView;
bar.getProgressDrawable().setColorFilter(newValue, android.graphics.PorterDuff.Mode.SRC_IN);
}
private static resetColorProperty(view: view.View, nativeValue: number) {
var bar = <android.widget.ProgressBar>view._nativeView;
bar.getProgressDrawable().clearColorFilter();
}
private static setBackgroundAndBorderProperty(view: view.View, newValue: any) {
var bar = <android.widget.ProgressBar>view._nativeView;
var progressDrawable = <android.graphics.drawable.LayerDrawable>bar.getProgressDrawable();
if (progressDrawable.getNumberOfLayers && progressDrawable.getNumberOfLayers() > 0) {
var backgroundDrawable = progressDrawable.getDrawable(0);
if (backgroundDrawable) {
backgroundDrawable.setColorFilter(newValue, android.graphics.PorterDuff.Mode.SRC_IN);
}
}
}
private static resetBackgroundAndBorderProperty(view: view.View, nativeValue: number) {
var bar = <android.widget.ProgressBar>view._nativeView;
// Do nothing.
}
public static registerHandlers() {
style.registerHandler(style.colorProperty, new style.StylePropertyChangedHandler(
ProgressStyler.setColorProperty,
ProgressStyler.resetColorProperty), "Progress");
style.registerHandler(style.backgroundColorProperty, new style.StylePropertyChangedHandler(
ProgressStyler.setBackgroundAndBorderProperty,
ProgressStyler.resetBackgroundAndBorderProperty), "Progress");
style.registerHandler(style.borderWidthProperty, style.ignorePropertyHandler, "Progress");
style.registerHandler(style.borderColorProperty, style.ignorePropertyHandler, "Progress");
style.registerHandler(style.borderRadiusProperty, style.ignorePropertyHandler, "Progress");
style.registerHandler(style.backgroundInternalProperty, style.ignorePropertyHandler, "Progress");
}
}
ProgressStyler.registerHandlers();

View File

@@ -1,6 +1,9 @@
import common = require("./progress-common");
import dependencyObservable = require("ui/core/dependency-observable");
import proxy = require("ui/core/proxy");
import styling = require("ui/styling");
import style = require("ui/styling/style");
import view = require("ui/core/view");
function onValuePropertyChanged(data: dependencyObservable.PropertyChangeData) {
var progress = <Progress>data.object;
@@ -31,3 +34,50 @@ export class Progress extends common.Progress {
return this._ios;
}
}
export class ProgressStyler implements style.Styler {
//Text color methods
private static setColorProperty(view: view.View, newValue: any) {
var bar = <UIProgressView>view.ios;
bar.progressTintColor = newValue;
}
private static resetColorProperty(view: view.View, nativeValue: any) {
var bar = <UIProgressView>view.ios;
bar.progressTintColor = nativeValue;
}
private static getNativeColorValue(view: view.View): any {
var bar = <UIProgressView>view.ios;
return bar.progressTintColor;
}
private static setBackgroundColorProperty(view: view.View, newValue: any) {
var bar = <UIProgressView>view.ios;
bar.trackTintColor = newValue;
}
private static resetBackgroundColorProperty(view: view.View, nativeValue: any) {
var bar = <UIProgressView>view.ios;
bar.trackTintColor = nativeValue;
}
private static getBackgroundColorProperty(view: view.View): any {
var bar = <UIProgressView>view.ios;
return bar.trackTintColor;
}
public static registerHandlers() {
style.registerHandler(style.colorProperty, new style.StylePropertyChangedHandler(
ProgressStyler.setColorProperty,
ProgressStyler.resetColorProperty,
ProgressStyler.getNativeColorValue), "Progress");
style.registerHandler(style.backgroundColorProperty, new style.StylePropertyChangedHandler(
ProgressStyler.setBackgroundColorProperty,
ProgressStyler.resetBackgroundColorProperty,
ProgressStyler.getBackgroundColorProperty), "Progress");
}
}
ProgressStyler.registerHandlers();