diff --git a/apps/editable-text-demo/main-page.xml b/apps/editable-text-demo/main-page.xml
index 161031346..bb622051a 100644
--- a/apps/editable-text-demo/main-page.xml
+++ b/apps/editable-text-demo/main-page.xml
@@ -2,7 +2,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/ui/editable-text-base/editable-text-base-common.ts b/ui/editable-text-base/editable-text-base-common.ts
index f6162fce7..5e0289857 100644
--- a/ui/editable-text-base/editable-text-base-common.ts
+++ b/ui/editable-text-base/editable-text-base-common.ts
@@ -28,6 +28,12 @@ var updateTextTriggerProperty = new dependencyObservable.Property(
new proxy.PropertyMetadata(enums.UpdateTextTrigger.textChanged, dependencyObservable.PropertyMetadataSettings.None)
);
+var autocapitalizationTypeProperty = new dependencyObservable.Property(
+ "autocapitalizationType",
+ "EditableTextBase",
+ new proxy.PropertyMetadata(enums.AutocapitalizationType.sentences, dependencyObservable.PropertyMetadataSettings.None)
+ );
+
function onKeyboardTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
var editableTextBase = data.object;
editableTextBase._onKeyboardTypePropertyChanged(data);
@@ -49,6 +55,13 @@ function onEditablePropertyChanged(data: dependencyObservable.PropertyChangeData
(editableProperty.metadata).onSetNativeValue = onEditablePropertyChanged;
+function onAutocapitalizationTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
+ var editableTextBase = data.object;
+ editableTextBase._onAutocapitalizationTypePropertyChanged(data);
+}
+
+(autocapitalizationTypeProperty.metadata).onSetNativeValue = onAutocapitalizationTypePropertyChanged;
+
export class EditableTextBase extends textBase.TextBase implements definition.EditableTextBase {
public static keyboardTypeProperty = keyboardTypeProperty;
@@ -59,6 +72,8 @@ export class EditableTextBase extends textBase.TextBase implements definition.Ed
public static updateTextTriggerProperty = updateTextTriggerProperty;
+ public static autocapitalizationTypeProperty = autocapitalizationTypeProperty;
+
constructor(options?: definition.Options) {
super(options);
}
@@ -95,6 +110,14 @@ export class EditableTextBase extends textBase.TextBase implements definition.Ed
this._setValue(EditableTextBase.updateTextTriggerProperty, value);
}
+ get autocapitalizationType(): string {
+ return this._getValue(EditableTextBase.autocapitalizationTypeProperty);
+ }
+
+ set autocapitalizationType(value: string) {
+ this._setValue(EditableTextBase.autocapitalizationTypeProperty, value);
+ }
+
public dismissSoftInput() {
//
}
@@ -111,4 +134,8 @@ export class EditableTextBase extends textBase.TextBase implements definition.Ed
public _onEditablePropertyChanged(data: dependencyObservable.PropertyChangeData) {
//
}
+
+ public _onAutocapitalizationTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
+ //
+ }
}
\ No newline at end of file
diff --git a/ui/editable-text-base/editable-text-base.android.ts b/ui/editable-text-base/editable-text-base.android.ts
index dfacb1c75..4574a6a09 100644
--- a/ui/editable-text-base/editable-text-base.android.ts
+++ b/ui/editable-text-base/editable-text-base.android.ts
@@ -23,7 +23,7 @@ export class EditableTextBase extends common.EditableTextBase {
this._android = new android.widget.EditText(this._context);
this.android.setTag(this.android.getKeyListener());
-
+
var that = new WeakRef(this);
var textWatcher = new android.text.TextWatcher({
@@ -182,4 +182,34 @@ export class EditableTextBase extends common.EditableTextBase {
this.android.setKeyListener(null);
}
}
+
+ public _onAutocapitalizationTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
+ var editableTextBase = data.object;
+ if (!editableTextBase.android) {
+ return;
+ }
+
+ var inputType = editableTextBase.android.getInputType();
+ inputType = inputType & ~28762; //28762 (0x00007000) 13,14,15bits
+
+ switch (data.newValue) {
+ case enums.AutocapitalizationType.none:
+ //Do nothing, we have lowered the three bits above.
+ break;
+ case enums.AutocapitalizationType.words:
+ inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_CAP_WORDS; //8192 (0x00002000) 14th bit
+ break;
+ case enums.AutocapitalizationType.sentences:
+ inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; //16384(0x00004000) 15th bit
+ break;
+ case enums.AutocapitalizationType.allCharacters:
+ inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; //4096 (0x00001000) 13th bit
+ break;
+ default:
+ inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
+ break;
+ }
+
+ editableTextBase.android.setInputType(inputType);
+ }
}
\ No newline at end of file
diff --git a/ui/editable-text-base/editable-text-base.d.ts b/ui/editable-text-base/editable-text-base.d.ts
index 5aa4b0dc9..1f0c24998 100644
--- a/ui/editable-text-base/editable-text-base.d.ts
+++ b/ui/editable-text-base/editable-text-base.d.ts
@@ -10,6 +10,7 @@
public static returnKeyTypeProperty: dependencyObservable.Property;
public static editableProperty: dependencyObservable.Property;
public static updateTextTriggerProperty: dependencyObservable.Property;
+ public static autocapitalizationTypeProperty: dependencyObservable.Property;
constructor(options?: Options);
@@ -34,6 +35,11 @@
*/
updateTextTrigger: string;
+ /**
+ * Gets or sets the autocapitalization type. Possible values are contained in the [AutocapitalizationType enumeration](../enums/AutocapitalizationType/README.md).
+ */
+ autocapitalizationType: string;
+
/**
* Hides the soft input method, ususally a soft keyboard.
*/
@@ -64,5 +70,10 @@
* Possible values are contained in the UpdateTextTrigger enumeration located in "ui/enums" module.
*/
updateTextTrigger?: string;
+
+ /**
+ * Gets or sets the autocapitalization type.
+ */
+ autocapitalizationType?: string;
}
}
\ No newline at end of file
diff --git a/ui/editable-text-base/editable-text-base.ios.ts b/ui/editable-text-base/editable-text-base.ios.ts
index a617a80be..105de7f3a 100644
--- a/ui/editable-text-base/editable-text-base.ios.ts
+++ b/ui/editable-text-base/editable-text-base.ios.ts
@@ -9,7 +9,7 @@ export class EditableTextBase extends common.EditableTextBase {
}
public dismissSoftInput() {
- this.ios.resignFirstResponder();
+ (this.ios).resignFirstResponder();
}
public _onKeyboardTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
@@ -35,7 +35,7 @@ export class EditableTextBase extends common.EditableTextBase {
break;
}
- this.ios.keyboardType = newKeyboardType;
+ (this.ios).keyboardType = newKeyboardType;
}
public _onReturnKeyTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
@@ -61,6 +61,29 @@ export class EditableTextBase extends common.EditableTextBase {
break;
}
- this.ios.returnKeyType = newReturnKeyType;
+ (this.ios).returnKeyType = newReturnKeyType;
+ }
+
+ public _onAutocapitalizationTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
+ var newValue;
+ switch (data.newValue) {
+ case enums.AutocapitalizationType.none:
+ newValue = UITextAutocapitalizationType.UITextAutocapitalizationTypeNone;
+ break;
+ case enums.AutocapitalizationType.words:
+ newValue = UITextAutocapitalizationType.UITextAutocapitalizationTypeWords;
+ break;
+ case enums.AutocapitalizationType.sentences:
+ newValue = UITextAutocapitalizationType.UITextAutocapitalizationTypeSentences;
+ break;
+ case enums.AutocapitalizationType.allCharacters:
+ newValue = UITextAutocapitalizationType.UITextAutocapitalizationTypeAllCharacters;
+ break;
+ default:
+ newValue = UITextAutocapitalizationType.UITextAutocapitalizationTypeSentences;
+ break;
+ }
+
+ (this.ios).autocapitalizationType = newValue;
}
}
\ No newline at end of file
diff --git a/ui/enums/enums.d.ts b/ui/enums/enums.d.ts
index fa8964ce2..835945852 100644
--- a/ui/enums/enums.d.ts
+++ b/ui/enums/enums.d.ts
@@ -285,4 +285,30 @@
*/
export var bottom: string;
}
+
+ /**
+ * Represents the auto-capitalization style for a text input.
+ */
+ module AutocapitalizationType {
+ /**
+ * Do not capitalize any text automatically.
+ */
+ export var none: string;
+
+ /**
+ * Capitalize the first letter of each word automatically.
+ */
+ export var words: string;
+
+ /**
+ * Capitalize the first letter of each sentence automatically.
+ */
+ export var sentences: string;
+
+ /**
+ * Capitalize all characters automatically.
+ */
+ export var allCharacters: string;
+ }
+
}
diff --git a/ui/enums/enums.ts b/ui/enums/enums.ts
index d4b86036e..2b8e62bd9 100644
--- a/ui/enums/enums.ts
+++ b/ui/enums/enums.ts
@@ -77,4 +77,11 @@ export module Dock {
export var top: string = "top";
export var right: string = "right";
export var bottom: string = "bottom";
+}
+
+export module AutocapitalizationType {
+ export var none: string = "none";
+ export var words: string = "words";
+ export var sentences: string = "sentences";
+ export var allCharacters: string = "allCharacters";
}
\ No newline at end of file
diff --git a/ui/text-field/text-field.android.ts b/ui/text-field/text-field.android.ts
index a8496321e..7bcf01e54 100644
--- a/ui/text-field/text-field.android.ts
+++ b/ui/text-field/text-field.android.ts
@@ -60,6 +60,6 @@ export class TextField extends common.TextField {
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);
+ this.android.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_NORMAL | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
}
}
\ No newline at end of file
diff --git a/ui/text-view/text-view.android.ts b/ui/text-view/text-view.android.ts
index 4aaf39a6a..c0ebc0f47 100644
--- a/ui/text-view/text-view.android.ts
+++ b/ui/text-view/text-view.android.ts
@@ -9,6 +9,6 @@ export class TextView extends common.TextView {
super._createUI();
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);
+ 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);
}
}
\ No newline at end of file