Files
NativeScript/ui/button/button.android.ts
Vladimir Enchev 7783f19ff3 Button added
2014-06-13 11:00:34 +03:00

37 lines
1.0 KiB
TypeScript

import observable = require("ui/core/observable");
import view = require("ui/core/view");
import application = require("application");
export class Button extends view.View {
private static textProperty = "text";
private _android: android.widget.Button;
constructor() {
super();
this._android = new android.widget.Button(application.android.currentContext);
var that = this;
this._android.setOnClickListener(new android.view.View.OnClickListener({
onClick: function (v) { that.emit("click"); }
}));
}
get android(): android.widget.Button {
return this._android;
}
get text(): string {
return this.android.getText().toString();
}
set text(value: string) {
this.setProperty(Button.textProperty, value);
}
public setNativeProperty(data: observable.PropertyChangeData) {
if (data.propertyName === Button.textProperty) {
this.android.setText(data.value);
} else if (true) {
//
}
}
}