TransformationMethod set to null in order to apply formattedText

This commit is contained in:
Vladimir Enchev
2016-03-25 12:05:41 +02:00
parent f42b13322a
commit b6e046e884
2 changed files with 60 additions and 8 deletions

View File

@@ -26,16 +26,16 @@ export class Button extends common.Button {
this._android.setOnClickListener(new android.view.View.OnClickListener(
<utils.Owned & android.view.View.IOnClickListener>{
get owner() {
return that.get();
},
get owner() {
return that.get();
},
onClick: function (v) {
if (this.owner) {
this.owner._emit(common.Button.tapEvent);
onClick: function(v) {
if (this.owner) {
this.owner._emit(common.Button.tapEvent);
}
}
}
}));
}));
}
public _onTextPropertyChanged(data: dependencyObservable.PropertyChangeData) {
@@ -44,9 +44,21 @@ export class Button extends common.Button {
}
}
private _transformationMethod;
public _setFormattedTextPropertyToNative(value) {
var newText = value ? value._formattedText : null;
if (this.android) {
if (newText) {
if (!this._transformationMethod) {
this._transformationMethod = this.android.getTransformationMethod();
}
this.android.setTransformationMethod(null);
} else {
if (this._transformationMethod && !this.android.getTransformationMethod()) {
this.android.setTransformationMethod(this._transformationMethod);
}
}
this.android.setText(newText);
}
}