9
9
Style ,
10
10
booleanConverter
11
11
} from "tns-core-modules/ui/core/view" ;
12
- declare const android : any ;
12
+ declare const android : any , java : any ;
13
13
14
14
export const checkedProperty = new Property < CheckBox , boolean > ( {
15
15
name : "checked" ,
@@ -41,8 +41,14 @@ export const tintColorProperty = new CssProperty<Style, string>({
41
41
}
42
42
} ) ;
43
43
44
+ export const enum BoxType {
45
+ Circle = 1 ,
46
+ Square = 2
47
+ }
48
+
44
49
export class CheckBox extends View implements CheckBoxInterface {
45
50
private _android : any ; /// android.widget.CheckBox
51
+ private _boxType : number ;
46
52
private _checkStyle : string ;
47
53
private _checkPadding : string ;
48
54
private _checkPaddingLeft : string ;
@@ -58,6 +64,14 @@ export class CheckBox extends View implements CheckBoxInterface {
58
64
return this . _android ;
59
65
}
60
66
67
+ set boxType ( value : number ) {
68
+ this . _boxType = value ;
69
+ }
70
+
71
+ get boxType ( ) {
72
+ return this . _boxType ;
73
+ }
74
+
61
75
get checkStyle ( ) {
62
76
return this . _checkStyle ;
63
77
}
@@ -115,7 +129,7 @@ export class CheckBox extends View implements CheckBoxInterface {
115
129
return "" ;
116
130
}
117
131
[ textProperty . setNative ] ( value : string ) {
118
- this . nativeView . setText ( value ) ;
132
+ this . nativeView . setText ( java . lang . String . valueOf ( value ) ) ;
119
133
}
120
134
121
135
get fillColor ( ) : string {
@@ -140,10 +154,11 @@ export class CheckBox extends View implements CheckBoxInterface {
140
154
}
141
155
142
156
public createNativeView ( ) {
143
- this . _android = new android . support . v7 . widget . AppCompatCheckBox (
144
- this . _context ,
145
- null
146
- ) ;
157
+ this . _android = new android . support . v7 . widget [
158
+ this . boxType == BoxType . Circle
159
+ ? "AppCompatRadioButton"
160
+ : "AppCompatCheckBox"
161
+ ] ( this . _context , null ) ;
147
162
if ( this . checkPaddingLeft ) {
148
163
this . _android . setPadding (
149
164
parseInt ( this . checkPaddingLeft ) ,
0 commit comments