diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/UIModule.java b/android/modules/ui/src/java/ti/modules/titanium/ui/UIModule.java index 07514cf9cdb..2a309ed396e 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/UIModule.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/UIModule.java @@ -64,6 +64,16 @@ public class UIModule extends KrollModule implements Handler.Callback @Kroll.constant public static final int KEYBOARD_NAMEPHONE_PAD = 6; @Kroll.constant public static final int KEYBOARD_DEFAULT = 7; @Kroll.constant public static final int KEYBOARD_DECIMAL_PAD = 8; + + @Kroll.constant public static final int KEYBOARD_TYPE_ASCII = 0; + @Kroll.constant public static final int KEYBOARD_TYPE_NUMBERS_PUNCTUATION = 1; + @Kroll.constant public static final int KEYBOARD_TYPE_URL = 2; + @Kroll.constant public static final int KEYBOARD_TYPE_NUMBER_PAD = 3; + @Kroll.constant public static final int KEYBOARD_TYPE_PHONE_PAD = 4; + @Kroll.constant public static final int KEYBOARD_TYPE_EMAIL = 5; + @Kroll.constant public static final int KEYBOARD_TYPE_NAMEPHONE_PAD = 6; + @Kroll.constant public static final int KEYBOARD_TYPE_DEFAULT = 7; + @Kroll.constant public static final int KEYBOARD_TYPE_DECIMAL_PAD = 8; @Kroll.constant public static final int AUTOLINK_ALL = Linkify.ALL; @Kroll.constant public static final int AUTOLINK_EMAIL_ADDRESSES = Linkify.EMAIL_ADDRESSES; diff --git a/apidoc/Titanium/UI/AlertDialog.yml b/apidoc/Titanium/UI/AlertDialog.yml index cf45a0c870f..9f8fc7c7dc8 100644 --- a/apidoc/Titanium/UI/AlertDialog.yml +++ b/apidoc/Titanium/UI/AlertDialog.yml @@ -216,8 +216,8 @@ properties: type: Number since: 5.1.0 platforms: [iphone, ipad] - constants: Titanium.UI.KEYBOARD_* - default: + constants: Titanium.UI.KEYBOARD_TYPE_* + default: - name: keyboardAppearance summary: Keyboard appearance to be displayed when the text field inside the dialog is focused. diff --git a/apidoc/Titanium/UI/SearchBar.yml b/apidoc/Titanium/UI/SearchBar.yml index 77883d3c6d9..0f6d3ca4548 100644 --- a/apidoc/Titanium/UI/SearchBar.yml +++ b/apidoc/Titanium/UI/SearchBar.yml @@ -173,7 +173,16 @@ properties: summary: Keyboard type constant to use when the field is focused. type: Number platforms: [iphone, ipad] - default: System default keyboard. + constants: Titanium.UI.KEYBOARD_TYPE_* + default: + + - name: keyboardAppearance + summary: Determines the appearance of the keyboard to be displayed the field is focused. + type: Number + since: 5.2.0 + platforms: [iphone, ipad] + constants: Titanium.UI.KEYBOARD_APPEARANCE_* + default: - name: prompt summary: Single line of text displayed at the top of the search bar. diff --git a/apidoc/Titanium/UI/TextArea.yml b/apidoc/Titanium/UI/TextArea.yml index 757692ebab3..c73081f3432 100644 --- a/apidoc/Titanium/UI/TextArea.yml +++ b/apidoc/Titanium/UI/TextArea.yml @@ -72,9 +72,19 @@ properties: constants: Titanium.UI.KEYBOARD_APPEARANCE_* default: platforms: [iphone, ipad] - + deprecated: + since: "5.2.0" + notes: Use keyboardAppearance instead + + - name: keyboardAppearance + summary: Determines the appearance of the keyboard displayed when this text area is focused. + type: Number + constants: Titanium.UI.KEYBOARD_APPEARANCE_* + default: + platforms: [iphone, ipad] + - name: attributedString - summary: TextArea attributed string. + summary: TextArea attributed string. description: | The underlying attributed string drawn by the textArea. If set, avoid setting common attributes in textArea, such as `value`, `color` and `font`, as unexpected behaviors may result. diff --git a/apidoc/Titanium/UI/TextField.yml b/apidoc/Titanium/UI/TextField.yml index 5dc306adc31..15c8c3dde57 100644 --- a/apidoc/Titanium/UI/TextField.yml +++ b/apidoc/Titanium/UI/TextField.yml @@ -75,7 +75,17 @@ properties: constants: Titanium.UI.KEYBOARD_APPEARANCE_* default: platforms: [iphone, ipad] - + deprecated: + since: "5.2.0" + notes: Use keyboardAppearance instead. + + - name: keyeyboardAppearance + summary: Determines the appearance of the keyboard displayed when this field is focused. + type: Number + constants: Titanium.UI.KEYBOARD_APPEARANCE_* + default: + platforms: [iphone, ipad] + - name: attributedString summary: TextField attributed string. description: | @@ -341,8 +351,8 @@ properties: When asking for a specific kind of user input, such as a phone number or email address, you should always specify the appropriate keyboard type. type: Number - constants: Titanium.UI.KEYBOARD_* - default: + constants: Titanium.UI.KEYBOARD_TYPE_* + default: - name: leftButton summary: Left button view to display in the `TextField`. diff --git a/apidoc/Titanium/UI/UI.yml b/apidoc/Titanium/UI/UI.yml index 53a526eabbc..d3dd05ba116 100644 --- a/apidoc/Titanium/UI/UI.yml +++ b/apidoc/Titanium/UI/UI.yml @@ -1447,6 +1447,9 @@ properties: type: Number permission: read-only platforms: [android, iphone, ipad] + deprecated: + since: "5.2.0" + notes: Use KEYBOARD_TYPE_ASCII instead. - name: KEYBOARD_DECIMAL_PAD summary: Use a keyboard with decimal numbers only, with the pad keyboard layout. @@ -1458,6 +1461,9 @@ properties: type: Number permission: read-only platforms: [android, iphone, ipad] + deprecated: + since: "5.2.0" + notes: Use KEYBOARD_TYPE_DECIMAL_PAD instead. - name: KEYBOARD_DEFAULT summary: Use the default keyboard, depending on the platform. @@ -1466,7 +1472,10 @@ properties: properties. type: Number permission: read-only - + deprecated: + since: "5.2.0" + notes: Use KEYBOARD_TYPE_DEFAULT instead. + - name: KEYBOARD_EMAIL summary: Use a keyboard suitable for composing email, with the standard keyboard layout. description: | @@ -1474,10 +1483,13 @@ properties: properties. Note: on Mobile Web, if you enable `passwordType`, the `keyboardType` value will be - overridden with `KEYBOARD_DEFAULT`. + overridden with `KEYBOARD_TYPE_DEFAULT`. type: Number permission: read-only - + deprecated: + since: "5.2.0" + notes: Use KEYBOARD_TYPE_EMAIL instead. + - name: KEYBOARD_NAMEPHONE_PAD summary: Use a keyboard suitable for entering names and phone numbers, with the pad keyboard layout. description: | @@ -1486,7 +1498,10 @@ properties: type: Number permission: read-only platforms: [android, iphone, ipad] - + deprecated: + since: "5.2.0" + notes: Use KEYBOARD_TYPE_NAMEPHONE_PAD instead. + - name: KEYBOARD_NUMBERS_PUNCTUATION summary: Use a keyboard with numbers and punctuation only, with the standard keyboard layout. description: | @@ -1495,7 +1510,10 @@ properties: type: Number permission: read-only platforms: [android, iphone, ipad] - + deprecated: + since: "5.2.0" + notes: Use KEYBOARD_TYPE_NUMBERS_PUNCTUATION instead. + - name: KEYBOARD_NUMBER_PAD summary: Use a keyboard with a number pad only, with the pad keyboard layout. description: | @@ -1505,10 +1523,13 @@ properties: On iPad, this behaves the same as . On Mobile Web, if you enable `passwordType`, the `keyboardType` value will be overridden with - `KEYBOARD_DEFAULT`. + `KEYBOARD_TYPE_DEFAULT`. type: Number permission: read-only - + deprecated: + since: "5.2.0" + notes: Use KEYBOARD_TYPE_NUMBER_PAD instead. + - name: KEYBOARD_PHONE_PAD summary: Use a keyboard with a phone-style number pad, with the pad keyboard layout. description: | @@ -1518,11 +1539,111 @@ properties: On iPad, this behaves the same as . On Mobile Web, if you enable `passwordType`, the `keyboardType` value will be overridden with - `KEYBOARD_DEFAULT`. + `KEYBOARD_TYPE_DEFAULT`. + type: Number + permission: read-only + deprecated: + since: "5.2.0" + notes: Use KEYBOARD_TYPE_PHONE_PAD instead. + + - name: KEYBOARD_URL + summary: Use a keyboard optimized for entering URLs, with the standard keyboard layout. + description: | + Use with the and + properties. + + On Mobile Web, if you enable `passwordType`, the `keyboardType` value will be overridden with + `KEYBOARD_TYPE_DEFAULT`. + type: Number + permission: read-only + deprecated: + since: "5.2.0" + notes: Use KEYBOARD_TYPE_URL instead. + + - name: KEYBOARD_TYPE_DECIMAL_PAD + summary: Use a keyboard with decimal numbers only, with the pad keyboard layout. + description: | + Use with the and + properties. + + On iPad, this behaves the same as . + type: Number + permission: read-only + platforms: [android, iphone, ipad] + + - name: KEYBOARD_TYPE_ASCII + summary: Use an ASCII keyboard, with the standard keyboard layout. + description: | + Use with the and + properties. + type: Number + permission: read-only + platforms: [android, iphone, ipad] + + - name: KEYBOARD_TYPE_DEFAULT + summary: Use the default keyboard, depending on the platform. + description: | + Use with the and + properties. type: Number permission: read-only - - name: KEYBOARD_WEBSEARCH + - name: KEYBOARD_TYPE_EMAIL + summary: Use a keyboard suitable for composing email, with the standard keyboard layout. + description: | + Use with the and + properties. + + Note: on Mobile Web, if you enable `passwordType`, the `keyboardType` value will be + overridden with `KEYBOARD_TYPE_DEFAULT`. + type: Number + permission: read-only + + - name: KEYBOARD_TYPE_NAMEPHONE_PAD + summary: Use a keyboard suitable for entering names and phone numbers, with the pad keyboard layout. + description: | + Use with the and + properties. + type: Number + permission: read-only + platforms: [android, iphone, ipad] + + - name: KEYBOARD_TYPE_NUMBERS_PUNCTUATION + summary: Use a keyboard with numbers and punctuation only, with the standard keyboard layout. + description: | + Use with the and + properties. + type: Number + permission: read-only + platforms: [android, iphone, ipad] + + - name: KEYBOARD_TYPE_NUMBER_PAD + summary: Use a keyboard with a number pad only, with the pad keyboard layout. + description: | + Use with the and + properties. + + On iPad, this behaves the same as . + + On Mobile Web, if you enable `passwordType`, the `keyboardType` value will be overridden with + `KEYBOARD_TYPE_DEFAULT`. + type: Number + permission: read-only + + - name: KEYBOARD_TYPE_PHONE_PAD + summary: Use a keyboard with a phone-style number pad, with the pad keyboard layout. + description: | + Use with the and + properties. + + On iPad, this behaves the same as . + + On Mobile Web, if you enable `passwordType`, the `keyboardType` value will be overridden with + `KEYBOARD_TYPE_DEFAULT`. + type: Number + permission: read-only + + - name: KEYBOARD_TYPE_WEBSEARCH summary: Use a keyboard optimized for web search terms and URL entry. description: | Use with the and @@ -1534,7 +1655,7 @@ properties: platforms: [iphone, ipad] since: "5.2.0" - - name: KEYBOARD_TWITTER + - name: KEYBOARD_TYPE_TWITTER summary: Use a keyboard optimized for twitter text entry, with easy access to the @ and # characters. description: | Use with the and @@ -1544,27 +1665,27 @@ properties: platforms: [iphone, ipad] since: "5.2.0" - - name: KEYBOARD_URL + - name: KEYBOARD_TYPE_URL summary: Use a keyboard optimized for entering URLs, with the standard keyboard layout. description: | - Use with the and + Use with the and properties. - + On Mobile Web, if you enable `passwordType`, the `keyboardType` value will be overridden with - `KEYBOARD_DEFAULT`. + `KEYBOARD_TYPE_DEFAULT`. type: Number permission: read-only - + - name: LANDSCAPE_LEFT summary: Standard landscape orientation (home button on left). description: | One of the group of orientation constants for the module, - , - , - , - , - , - , + , + , + , + , + , + , and . type: Number permission: read-only diff --git a/iphone/Classes/TiUISearchBar.m b/iphone/Classes/TiUISearchBar.m index 50c543b3c32..1c7f05264df 100644 --- a/iphone/Classes/TiUISearchBar.m +++ b/iphone/Classes/TiUISearchBar.m @@ -104,6 +104,11 @@ -(void)setKeyboardType_:(id)value [[self searchBar] setKeyboardType:[TiUtils intValue:value]]; } +-(void)setKeyboardAppearance_:(id)value +{ + [[self searchBar] setKeyboardAppearance:[TiUtils intValue:value]]; +} + -(void)setPrompt_:(id)value { [[self searchBar] setPrompt:[TiUtils stringValue:value]]; diff --git a/iphone/Classes/TiUITextWidget.m b/iphone/Classes/TiUITextWidget.m index 3074e476068..df755e3b8c6 100644 --- a/iphone/Classes/TiUITextWidget.m +++ b/iphone/Classes/TiUITextWidget.m @@ -162,7 +162,17 @@ -(void)setPasswordMask_:(id)value -(void)setAppearance_:(id)value { - [[self textWidgetView] setKeyboardAppearance:[TiUtils intValue:value]]; + NSString *className = [NSStringFromClass([self class]) substringFromIndex:4]; + NSString *deprecatedApi = [NSString stringWithFormat:@"UI.%@%@", className, @".appearance"]; + NSString *newApi = [NSString stringWithFormat:@"UI.%@%@", className, @".keyboardAppearance"]; + + DEPRECATED_REPLACED(deprecatedApi, @"5.2.0", newApi); + [self setKeyboardAppearance_:value]; +} + +-(void)setKeyboardAppearance_:(id)value +{ + [[self textWidgetView] setKeyboardAppearance:[TiUtils intValue:value]]; } -(void)setAutocapitalization_:(id)value diff --git a/iphone/Classes/UIModule.m b/iphone/Classes/UIModule.m index 474c135e2c2..bfe9f94b888 100644 --- a/iphone/Classes/UIModule.m +++ b/iphone/Classes/UIModule.m @@ -128,17 +128,29 @@ -(NSNumber*)RETURNKEY_CONTINUE return UIReturnKeyDefault; } -MAKE_SYSTEM_PROP(KEYBOARD_DEFAULT,UIKeyboardTypeDefault); -MAKE_SYSTEM_PROP(KEYBOARD_ASCII,UIKeyboardTypeASCIICapable); -MAKE_SYSTEM_PROP(KEYBOARD_NUMBERS_PUNCTUATION,UIKeyboardTypeNumbersAndPunctuation); -MAKE_SYSTEM_PROP(KEYBOARD_URL,UIKeyboardTypeURL); -MAKE_SYSTEM_PROP(KEYBOARD_NUMBER_PAD,UIKeyboardTypeNumberPad); -MAKE_SYSTEM_PROP(KEYBOARD_DECIMAL_PAD,UIKeyboardTypeDecimalPad); -MAKE_SYSTEM_PROP(KEYBOARD_PHONE_PAD,UIKeyboardTypePhonePad); -MAKE_SYSTEM_PROP(KEYBOARD_NAMEPHONE_PAD,UIKeyboardTypeNamePhonePad); -MAKE_SYSTEM_PROP(KEYBOARD_EMAIL,UIKeyboardTypeEmailAddress); -MAKE_SYSTEM_PROP(KEYBOARD_WEBSEARCH, UIKeyboardTypeWebSearch); -MAKE_SYSTEM_PROP(KEYBOARD_TWITTER, UIKeyboardTypeTwitter); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_DEFAULT,UIKeyboardTypeDefault); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_URL,UIKeyboardTypeURL); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_ASCII,UIKeyboardTypeASCIICapable); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_NUMBERS_PUNCTUATION,UIKeyboardTypeNumbersAndPunctuation); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_NUMBER_PAD,UIKeyboardTypeNumberPad); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_DECIMAL_PAD,UIKeyboardTypeDecimalPad); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_PHONE_PAD,UIKeyboardTypePhonePad); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_NAMEPHONE_PAD,UIKeyboardTypeNamePhonePad); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_EMAIL,UIKeyboardTypeEmailAddress); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_WEBSEARCH, UIKeyboardTypeWebSearch); +MAKE_SYSTEM_PROP(KEYBOARD_TYPE_TWITTER, UIKeyboardTypeTwitter); + +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_DEFAULT,UIKeyboardTypeDefault, @"UI.KEYBOARD_DEFAULT", @"5.2.0", @"UI.KEYBOARD_TYPE_DEFAULT"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_URL,UIKeyboardTypeURL, @"UI.KEYBOARD_URL", @"5.2.0", @"UI.KEYBOARD_TYPE_URL"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_ASCII,UIKeyboardTypeASCIICapable, @"UI.KEYBOARD_ASCII", @"5.2.0", @"UI.KEYBOARD_TYPE_ASCII"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_NUMBERS_PUNCTUATION,UIKeyboardTypeNumbersAndPunctuation, @"UI.KEYBOARD_NUMBERS_PUNCTUATION", @"5.2.0", @"UI.KEYBOARD_TYPE_NUMBERS_PUNCTUATION"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_NUMBER_PAD,UIKeyboardTypeNumberPad, @"UI.KEYBOARD_NUMBER_PAD", @"5.2.0", @"UI.KEYBOARD_TYPE_NUMBER_PAD"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_DECIMAL_PAD,UIKeyboardTypeDecimalPad, @"UI.KEYBOARD_DECIMAL_PAD", @"5.2.0", @"UI.KEYBOARD_TYPE_DECIMAL_PAD"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_PHONE_PAD,UIKeyboardTypePhonePad, @"UI.KEYBOARD_PHONE_PAD", @"5.2.0", @"UI.KEYBOARD_TYPE_PHONE_PAD"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_NAMEPHONE_PAD,UIKeyboardTypeNamePhonePad, @"UI.KEYBOARD_NAMEPHONE_PAD", @"5.2.0", @"UI.KEYBOARD_TYPE_NAMEPHONE_PAD"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_EMAIL,UIKeyboardTypeEmailAddress, @"UI.KEYBOARD_EMAIL", @"5.2.0", @"UI.KEYBOARD_TYPE_EMAIL"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_WEBSEARCH,UIKeyboardTypeWebSearch, @"UI.KEYBOARD_WEBSEARCH", @"5.2.0", @"UI.KEYBOARD_TYPE_WEBSEARCH"); +MAKE_SYSTEM_PROP_DEPRECATED_REPLACED(KEYBOARD_TWITTER,UIKeyboardTypeTwitter, @"UI.KEYBOARD_TWITTER", @"5.2.0", @"UI.KEYBOARD_TYPE_TWITTER"); MAKE_SYSTEM_PROP(KEYBOARD_APPEARANCE_DEFAULT,UIKeyboardAppearanceDefault); MAKE_SYSTEM_PROP(KEYBOARD_APPEARANCE_ALERT,UIKeyboardAppearanceAlert); diff --git a/mobileweb/titanium/Ti/UI.js b/mobileweb/titanium/Ti/UI.js index 24db7a60d6d..480a215064a 100644 --- a/mobileweb/titanium/Ti/UI.js +++ b/mobileweb/titanium/Ti/UI.js @@ -452,6 +452,11 @@ define( KEYBOARD_NUMBER_PAD: 6, KEYBOARD_PHONE_PAD: 7, KEYBOARD_URL: 8, + KEYBOARD_TYPE_DEFAULT: 2, + KEYBOARD_TYPE_EMAIL: 3, + KEYBOARD_TYPE_NUMBER_PAD: 6, + KEYBOARD_TYPE_PHONE_PAD: 7, + KEYBOARD_TYPE_URL: 8, NOTIFICATION_DURATION_LONG: 1, NOTIFICATION_DURATION_SHORT: 2, PICKER_TYPE_DATE: 2,