@@ -60,24 +60,6 @@ let TextView: typeof com.nativescript.label.EllipsizingTextView;
60
60
const CHILD_FORMATTED_TEXT = 'formattedText' ;
61
61
62
62
const resetSymbol = Symbol ( 'textPropertyDefault' ) ;
63
- enum SuspendType {
64
- Incremental = 0 ,
65
- Loaded = 1 << 20 ,
66
- NativeView = 1 << 21 ,
67
- UISetup = 1 << 22 ,
68
- IncrementalCountMask = ~ ( ( 1 << 20 ) + ( 1 << 21 ) + ( 1 << 22 ) )
69
- }
70
- declare module '@nativescript/core/ui/core/view-base' {
71
- interface ViewBase {
72
- _resumeNativeUpdates ( type : SuspendType ) ;
73
- _defaultPaddingTop : number ;
74
- _defaultPaddingRight : number ;
75
- _defaultPaddingBottom : number ;
76
- _defaultPaddingLeft : number ;
77
- _isPaddingRelative : boolean ;
78
- _androidView : any ;
79
- }
80
- }
81
63
declare module '@nativescript/core/ui/text-base' {
82
64
interface TextBase {
83
65
_setTappableState ( tappable : boolean ) ;
@@ -245,15 +227,15 @@ abstract class LabelBase extends View implements LabelViewDefinition {
245
227
@cssProperty paddingLeft : CoreTypes . LengthType ;
246
228
247
229
// for now code is duplicated as Android version is a full rewrite
248
- _canChangeText = true ;
249
- _needFormattedStringComputation = false ;
230
+ mCanChangeText = true ;
231
+ mNeedFormattedStringComputation = false ;
250
232
public onResumeNativeUpdates ( ) : void {
251
233
// {N} suspends properties update on `_suspendNativeUpdates`. So we only need to do this in onResumeNativeUpdates
252
- this . _canChangeText = false ;
234
+ this . mCanChangeText = false ;
253
235
super . onResumeNativeUpdates ( ) ;
254
- this . _canChangeText = true ;
255
- if ( this . _needFormattedStringComputation ) {
256
- this . _needFormattedStringComputation = false ;
236
+ this . mCanChangeText = true ;
237
+ if ( this . mNeedFormattedStringComputation ) {
238
+ this . mNeedFormattedStringComputation = false ;
257
239
this . _setNativeText ( ) ;
258
240
}
259
241
}
@@ -319,9 +301,10 @@ abstract class LabelBase extends View implements LabelViewDefinition {
319
301
export class Label extends LabelBase {
320
302
nativeViewProtected : com . nativescript . label . EllipsizingTextView ;
321
303
mHandleFontSize = true ;
304
+ mTappable = false ;
322
305
private mAutoFontSize = false ;
323
306
324
- private _defaultMovementMethod : android . text . method . MovementMethod ;
307
+ private mDefaultMovementMethod : android . text . method . MovementMethod ;
325
308
get nativeTextViewProtected ( ) {
326
309
return this . nativeViewProtected ;
327
310
}
@@ -616,23 +599,22 @@ export class Label extends LabelBase {
616
599
}
617
600
return result ;
618
601
}
619
- _tappable = false ;
620
602
_setTappableState ( tappable : boolean ) {
621
- if ( this . _tappable !== tappable ) {
622
- this . _tappable = tappable ;
623
- if ( this . _tappable ) {
603
+ if ( this . mTappable !== tappable ) {
604
+ this . mTappable = tappable ;
605
+ if ( this . mTappable ) {
624
606
this . nativeViewProtected . setMovementMethod ( android . text . method . LinkMovementMethod . getInstance ( ) ) ;
625
607
this . nativeViewProtected . setHighlightColor ( null ) ;
626
608
} else {
627
- this . nativeViewProtected . setMovementMethod ( this . _defaultMovementMethod ) ;
609
+ this . nativeViewProtected . setMovementMethod ( this . mDefaultMovementMethod ) ;
628
610
}
629
611
}
630
612
}
631
613
632
614
@profile
633
615
_setNativeText ( reset : boolean = false ) : void {
634
- if ( ! this . _canChangeText ) {
635
- this . _needFormattedStringComputation = true ;
616
+ if ( ! this . mCanChangeText ) {
617
+ this . mNeedFormattedStringComputation = true ;
636
618
return ;
637
619
}
638
620
if ( reset ) {
@@ -657,52 +639,14 @@ export class Label extends LabelBase {
657
639
}
658
640
this . nativeTextViewProtected . setText ( transformedText ) ;
659
641
}
660
-
661
- @profile
662
- public _setupUI ( context : android . content . Context , atIndex ?: number , parentIsLoaded ?: boolean ) : void {
663
- if ( this . _context === context ) {
664
- return ;
665
- } else if ( this . _context ) {
666
- this . _tearDownUI ( true ) ;
667
- }
668
-
669
- this . _context = context ;
670
-
671
- // This will account for nativeView that is created in createNativeView, recycled
672
- // or for backward compatability - set before _setupUI in iOS contructor.
673
- let nativeView = this . nativeViewProtected ;
674
-
675
- if ( ! nativeView ) {
676
- nativeView = this . createNativeView ( ) ;
677
- }
678
-
679
- this . _androidView = nativeView ;
680
- // if (nativeView) {
681
- // if (this._isPaddingRelative === undefined) {
682
- // this._isPaddingRelative = false;
683
- // }
684
-
685
- // this._defaultPaddingTop = 0;
686
- // this._defaultPaddingRight = 0;
687
- // this._defaultPaddingBottom = 0;
688
- // this._defaultPaddingLeft = 0;
689
-
690
- // }
691
-
692
- this . setNativeView ( nativeView ) ;
693
- if ( this . parent ) {
694
- this . _isAddedToNativeVisualTree = this . parent . _addViewToNativeVisualTree ( this , undefined ) ;
695
- }
696
- this . _resumeNativeUpdates ( SuspendType . UISetup ) ;
697
- }
698
642
}
699
643
700
644
function getCapitalizedString ( str : string ) : string {
701
645
const words = str . split ( ' ' ) ;
702
646
const newWords = [ ] ;
703
647
for ( let i = 0 , length = words . length ; i < length ; i ++ ) {
704
648
const word = words [ i ] . toLowerCase ( ) ;
705
- newWords . push ( word . substr ( 0 , 1 ) . toUpperCase ( ) + word . substring ( 1 ) ) ;
649
+ newWords . push ( word . substring ( 0 , 1 ) . toUpperCase ( ) + word . substring ( 1 ) ) ;
706
650
}
707
651
708
652
return newWords . join ( ' ' ) ;
0 commit comments