From b6e046e88407d7c1726183dfcbddff177a46b163 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Fri, 25 Mar 2016 12:05:41 +0200 Subject: [PATCH] TransformationMethod set to null in order to apply formattedText --- .../decoration-transform-formattedtext.xml | 40 +++++++++++++++++++ ui/button/button.android.ts | 28 +++++++++---- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/apps/ui-tests-app/css/decoration-transform-formattedtext.xml b/apps/ui-tests-app/css/decoration-transform-formattedtext.xml index d8eb2c6bf..907492a0b 100644 --- a/apps/ui-tests-app/css/decoration-transform-formattedtext.xml +++ b/apps/ui-tests-app/css/decoration-transform-formattedtext.xml @@ -12,6 +12,16 @@ + + @@ -36,6 +56,16 @@ + + + + + + + + + + @@ -48,6 +78,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ui/button/button.android.ts b/ui/button/button.android.ts index d80a2d163..fbe2593da 100644 --- a/ui/button/button.android.ts +++ b/ui/button/button.android.ts @@ -26,16 +26,16 @@ export class Button extends common.Button { this._android.setOnClickListener(new android.view.View.OnClickListener( { - 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); } }