Skip to content

Commit 596da0e

Browse files
committed
fix View extends def, class styling android
1 parent c5ab46f commit 596da0e

File tree

4 files changed

+56
-45
lines changed

4 files changed

+56
-45
lines changed

checkbox.android.ts

+45-43
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {CheckBoxInterface} from "./";
2-
import {View} from "ui/core/view";
3-
import {Color} from "color";
4-
import {isAndroid, device} from "platform";
5-
import {Property, PropertyChangeData} from "ui/core/dependency-observable";
6-
import {PropertyMetadata} from "ui/core/proxy";
7-
import {Font} from "ui/styling/font";
1+
import { CheckBoxInterface } from "./";
2+
import { View } from "ui/core/view";
3+
import { Color } from "color";
4+
import { isAndroid, device } from "platform";
5+
import { Property, PropertyChangeData } from "ui/core/dependency-observable";
6+
import { PropertyMetadata } from "ui/core/proxy";
7+
import { Font } from "ui/styling/font";
88
import enums = require("ui/enums");
99
import style = require("ui/styling/style");
1010
import app = require("application");
@@ -51,44 +51,44 @@ export class CheckBox extends View implements CheckBoxInterface {
5151
this._checkStyle = style;
5252
}
5353

54-
set checkPadding(padding){
54+
set checkPadding(padding) {
5555
this._checkPadding = padding;
5656
}
5757

58-
get checkPadding(){
58+
get checkPadding() {
5959
return this._checkPadding;
6060
}
6161

62-
set checkPaddingLeft(padding){
62+
set checkPaddingLeft(padding) {
6363
this._checkPaddingLeft = padding;
6464
}
6565

66-
get checkPaddingLeft(){
66+
get checkPaddingLeft() {
6767
return this._checkPaddingLeft;
6868
}
6969

7070

71-
set checkPaddingTop(padding){
71+
set checkPaddingTop(padding) {
7272
this._checkPaddingTop = padding;
7373
}
7474

75-
get checkPaddingTop(){
75+
get checkPaddingTop() {
7676
return this._checkPaddingTop;
7777
}
7878

79-
set checkPaddingRight(padding){
79+
set checkPaddingRight(padding) {
8080
this._checkPaddingRight = padding;
8181
}
8282

83-
get checkPaddingRight(){
83+
get checkPaddingRight() {
8484
return this._checkPaddingRight;
8585
}
8686

87-
set checkPaddingBottom(padding){
87+
set checkPaddingBottom(padding) {
8888
this._checkPaddingBottom = padding;
8989
}
9090

91-
get checkPaddingBottom(){
91+
get checkPaddingBottom() {
9292
return this._checkPaddingBottom;
9393
}
9494

@@ -133,44 +133,46 @@ export class CheckBox extends View implements CheckBoxInterface {
133133

134134
this._android = new android.widget.CheckBox(this._context, null);
135135

136-
if(this.checkPaddingLeft){
137-
this._android.setPadding(parseInt(this.checkPaddingLeft),this._android.getPaddingTop(),this._android.getPaddingRight(),this._android.getPaddingBottom());
136+
if (this.checkPaddingLeft) {
137+
this._android.setPadding(parseInt(this.checkPaddingLeft), this._android.getPaddingTop(), this._android.getPaddingRight(), this._android.getPaddingBottom());
138138
}
139139

140-
if(this.checkPaddingTop){
141-
this._android.setPadding(this._android.getPaddingLeft(),parseInt(this.checkPaddingTop),this._android.getPaddingRight(),this._android.getPaddingBottom());
140+
if (this.checkPaddingTop) {
141+
this._android.setPadding(this._android.getPaddingLeft(), parseInt(this.checkPaddingTop), this._android.getPaddingRight(), this._android.getPaddingBottom());
142142
}
143143

144-
if(this.checkPaddingRight){
145-
this._android.setPadding(this._android.getPaddingLeft(),this._android.getPaddingTop(),parseInt(this.checkPaddingRight),this._android.getPaddingBottom());
144+
if (this.checkPaddingRight) {
145+
this._android.setPadding(this._android.getPaddingLeft(), this._android.getPaddingTop(), parseInt(this.checkPaddingRight), this._android.getPaddingBottom());
146146
}
147147

148-
if(this.checkPaddingBottom){
149-
this._android.setPadding(this._android.getPaddingLeft(),this._android.getPaddingTop(),this._android.getPaddingRight(),parseInt(this.checkPaddingBottom));
148+
if (this.checkPaddingBottom) {
149+
this._android.setPadding(this._android.getPaddingLeft(), this._android.getPaddingTop(), this._android.getPaddingRight(), parseInt(this.checkPaddingBottom));
150150
}
151151

152-
if(this.checkPadding){
153-
let pads = this.checkPadding.toString().split(',');
154-
switch(pads.length){
155-
case 1:
156-
this._android.setPadding(parseInt(pads[0]),parseInt(pads[0]),parseInt(pads[0]),parseInt(pads[0]));
157-
break;
158-
case 2:
159-
this._android.setPadding(parseInt(pads[0]),parseInt(pads[1]),parseInt(pads[0]),parseInt(pads[1]));
160-
break;
161-
case 3:
162-
this._android.setPadding(parseInt(pads[0]),parseInt(pads[1]),parseInt(pads[2]),parseInt(pads[1]));
163-
break;
164-
case 4:
165-
this._android.setPadding(parseInt(pads[0]),parseInt(pads[1]),parseInt(pads[2]),parseInt(pads[3]));
166-
break;
167-
}
152+
if (this.checkPadding) {
153+
let pads = this.checkPadding.toString().split(',');
154+
switch (pads.length) {
155+
case 1:
156+
this._android.setPadding(parseInt(pads[0]), parseInt(pads[0]), parseInt(pads[0]), parseInt(pads[0]));
157+
break;
158+
case 2:
159+
this._android.setPadding(parseInt(pads[0]), parseInt(pads[1]), parseInt(pads[0]), parseInt(pads[1]));
160+
break;
161+
case 3:
162+
this._android.setPadding(parseInt(pads[0]), parseInt(pads[1]), parseInt(pads[2]), parseInt(pads[1]));
163+
break;
164+
case 4:
165+
this._android.setPadding(parseInt(pads[0]), parseInt(pads[1]), parseInt(pads[2]), parseInt(pads[3]));
166+
break;
167+
}
168168
}
169169
if (this.text) {
170170
this._android.setText(this.text);
171171
}
172-
if (!this.style.fontSize) {
173-
this.style.fontSize = 15;
172+
173+
/// works with class styling - Brad
174+
if (!this.fontSize) {
175+
this.fontSize = 15;
174176
}
175177

176178
if (this._checkStyle) {

demo/app/main-page.css

+5
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ ListView{
1717
.list-item{
1818
padding: 10 10;
1919
}
20+
21+
22+
.fontBig {
23+
font-size: 40;
24+
}

demo/app/main-page.xml

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<TabViewItem.view>
99
<ScrollView>
1010
<StackLayout id="wrapper">
11+
12+
<CheckBox:CheckBox id="fontSizeTest" text="Font Size Test" tintColor="#fff000" checked="false" class="fontBig" />
13+
14+
1115
<Label text="Functions" class="title" />
1216
<StackLayout class="listitem">
1317
<GridLayout columns="*, auto" class="demosection">

index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
1+
import { View } from "ui/core/view";
22
/**
33
* Represents a CheckBox component.
44
*/
5-
export declare class CheckBox {
5+
export declare class CheckBox extends View {
66

77
/**
88
* Gets the native [android widget](https://developer.android.com/reference/android/widget/CheckBox.html) that represents the user interface for this component. Valid only when running on Android OS.

0 commit comments

Comments
 (0)