11import * as style from "ui/styling/style" ;
22import { PropertyMetadata , PropertyMetadataSettings } from "ui/core/dependency-observable" ;
3- import * as styleProperty from "ui/styling/style-property" ;
43import * as view from "ui/core/view" ;
54import * as buttonModule from "ui/button" ;
65import * as pages from "ui/page" ;
@@ -10,46 +9,46 @@ import {isAndroid} from "platform";
109// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
1110let AffectsLayout = isAndroid ? PropertyMetadataSettings . None : PropertyMetadataSettings . AffectsLayout ;
1211
13- export var fontFamilyProperty = new styleProperty . Property ( "fontFamily" , "font-family" , new PropertyMetadata ( undefined , AffectsLayout ) ) ;
12+ // export var fontFamilyProperty = new styleProperty.Property("fontFamily", "font-family", new PropertyMetadata(undefined, AffectsLayout));
1413
15- export class MyTextViewStyler implements style . Styler {
16- public static setFontFamilyProperty ( view : view . View , newValue : any ) {
17- if ( view . android ) {
18- ( < android . widget . TextView > view . android ) . setTypeface ( android . graphics . Typeface . create ( newValue , android . graphics . Typeface . NORMAL ) ) ;
19- }
20- else if ( view . ios ) {
21- var fontSize = ( < UIButton > view . _nativeView ) . titleLabel . font . pointSize ;
22- ( < UIButton > view . _nativeView ) . titleLabel . font = UIFont . fontWithNameSize ( newValue , fontSize ) ;
23- }
24- }
14+ // export class MyTextViewStyler implements style.Styler {
15+ // public static setFontFamilyProperty(view: view.View, newValue: any) {
16+ // if (view.android) {
17+ // (<android.widget.TextView>view.android).setTypeface(android.graphics.Typeface.create(newValue, android.graphics.Typeface.NORMAL));
18+ // }
19+ // else if (view.ios) {
20+ // var fontSize = (<UIButton>view._nativeView).titleLabel.font.pointSize;
21+ // (<UIButton>view._nativeView).titleLabel.font = UIFont.fontWithNameSize(newValue, fontSize);
22+ // }
23+ // }
2524
26- public static resetFontFamilyProperty ( view : view . View , nativeValue : any ) {
27- if ( view . android ) {
28- ( < android . widget . TextView > view . android ) . setTypeface ( android . graphics . Typeface . create ( nativeValue , android . graphics . Typeface . NORMAL ) ) ;
29- }
30- else if ( view . ios ) {
31- var fontSize = ( < UIButton > view . _nativeView ) . titleLabel . font . pointSize ;
32- ( < UIButton > view . _nativeView ) . titleLabel . font = UIFont . fontWithNameSize ( nativeValue , fontSize ) ; ;
33- }
34- }
25+ // public static resetFontFamilyProperty(view: view.View, nativeValue: any) {
26+ // if (view.android) {
27+ // (<android.widget.TextView>view.android).setTypeface(android.graphics.Typeface.create(nativeValue, android.graphics.Typeface.NORMAL));
28+ // }
29+ // else if (view.ios) {
30+ // var fontSize = (<UIButton>view._nativeView).titleLabel.font.pointSize;
31+ // (<UIButton>view._nativeView).titleLabel.font = UIFont.fontWithNameSize(nativeValue, fontSize);;
32+ // }
33+ // }
3534
36- public static getNativeFontFamilyValue = function ( view : view . View ) : any {
37- if ( view . android ) {
38- return ( < android . widget . TextView > view . android ) . getTypeface ( ) ;
39- }
40- else if ( view . ios ) {
41- return ( < UIButton > view . _nativeView ) . titleLabel . font . fontName ;
42- }
43- return null ;
44- }
35+ // public static getNativeFontFamilyValue = function (view: view.View): any {
36+ // if (view.android) {
37+ // return (<android.widget.TextView>view.android).getTypeface();
38+ // }
39+ // else if (view.ios) {
40+ // return (<UIButton>view._nativeView).titleLabel.font.fontName;
41+ // }
42+ // return null;
43+ // }
4544
46- public static registerHandlers ( ) {
47- style . registerHandler ( fontFamilyProperty , new style . StylePropertyChangedHandler (
48- MyTextViewStyler . setFontFamilyProperty ,
49- MyTextViewStyler . resetFontFamilyProperty ,
50- MyTextViewStyler . getNativeFontFamilyValue ) , "MyButton" ) ;
51- }
52- }
45+ // public static registerHandlers() {
46+ // style.registerHandler(fontFamilyProperty, new style.StylePropertyChangedHandler(
47+ // MyTextViewStyler.setFontFamilyProperty,
48+ // MyTextViewStyler.resetFontFamilyProperty,
49+ // MyTextViewStyler.getNativeFontFamilyValue), "MyButton");
50+ // }
51+ // }
5352
5453//export class MyStyle extends styles.Style {
5554// get fontFamily(): string {
@@ -75,7 +74,7 @@ export class MyButton extends buttonModule.Button {
7574
7675}
7776
78- MyTextViewStyler . registerHandlers ( ) ;
77+ // MyTextViewStyler.registerHandlers();
7978
8079export function createPage ( ) {
8180 var stackLayout = new stackLayoutDef . StackLayout ( ) ;
0 commit comments