Merge pull request #169 from NativeScript/text-field-secure

Fixed TextField.text not appearing.
This commit is contained in:
Rossen Hristov
2015-03-12 15:01:35 +02:00
4 changed files with 9 additions and 10 deletions

View File

@ -22,6 +22,7 @@ export class EditableTextBase extends common.EditableTextBase {
this._imm = <android.view.inputmethod.InputMethodManager>this._context.getSystemService(android.content.Context.INPUT_METHOD_SERVICE);
this._android = new android.widget.EditText(this._context);
this._configureEditText();
this.android.setTag(this.android.getKeyListener());
var that = new WeakRef(this);
@ -91,6 +92,10 @@ export class EditableTextBase extends common.EditableTextBase {
this._android.setOnEditorActionListener(editorActionListener);
}
public _configureEditText() {
// abstract
}
public _onDetached(force?: boolean) {
this._imm = undefined;
this._android = undefined;

View File

@ -56,7 +56,6 @@ export class ListPicker extends common.ListPicker {
},
format: function (index: number) {
console.log("format(" + index + ")");
if (this.owner) {
return this.owner._getItemAsString(index);
}
@ -71,7 +70,6 @@ export class ListPicker extends common.ListPicker {
},
onValueChange: function (picker: android.widget.NumberPicker, oldVal: number, newVal: number) {
console.log("onValueChange("+oldVal+", "+newVal+")");
if (this.owner) {
this.owner._onPropertyChangedFromNative(common.ListPicker.selectedIndexProperty, newVal);
}

View File

@ -54,12 +54,10 @@ declare var exports;
require("utils/module-merge").merge(common, exports);
export class TextField extends common.TextField {
public _createUI() {
super._createUI();
public _configureEditText() {
this.android.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_NORMAL | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
this.android.setLines(1);
this.android.setMaxLines(1);
this.android.setHorizontallyScrolling(true);
this.android.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_NORMAL | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
}
}

View File

@ -5,10 +5,8 @@ declare var exports;
require("utils/module-merge").merge(common, exports);
export class TextView extends common.TextView {
public _createUI() {
super._createUI();
public _configureEditText() {
this.android.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_NORMAL | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE);
this.android.setGravity(android.view.Gravity.TOP | android.view.Gravity.LEFT);
this.android.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
}
}