Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-19939] Deprecating KEYBOARD_ for KEYBOARD_TYPE #7459

Merged
merged 4 commits into from Nov 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions android/modules/ui/src/java/ti/modules/titanium/ui/UIModule.java
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions apidoc/Titanium/UI/AlertDialog.yml
Expand Up @@ -216,8 +216,8 @@ properties:
type: Number
since: 5.1.0
platforms: [iphone, ipad]
constants: Titanium.UI.KEYBOARD_*
default: <Titanium.UI.KEYBOARD_DEFAULT>
constants: Titanium.UI.KEYBOARD_TYPE_*
default: <Titanium.UI.KEYBOARD_TYPE_DEFAULT>

- name: keyboardAppearance
summary: Keyboard appearance to be displayed when the text field inside the dialog is focused.
Expand Down
11 changes: 10 additions & 1 deletion apidoc/Titanium/UI/SearchBar.yml
Expand Up @@ -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: <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: <Titanium.UI.KEYBOARD_APPEARANCE_DEFAULT>

- name: prompt
summary: Single line of text displayed at the top of the search bar.
Expand Down
14 changes: 12 additions & 2 deletions apidoc/Titanium/UI/TextArea.yml
Expand Up @@ -72,9 +72,19 @@ properties:
constants: Titanium.UI.KEYBOARD_APPEARANCE_*
default: <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: <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.
Expand Down
16 changes: 13 additions & 3 deletions apidoc/Titanium/UI/TextField.yml
Expand Up @@ -75,7 +75,17 @@ properties:
constants: Titanium.UI.KEYBOARD_APPEARANCE_*
default: <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: <Titanium.UI.KEYBOARD_APPEARANCE_DEFAULT>
platforms: [iphone, ipad]

- name: attributedString
summary: TextField attributed string.
description: |
Expand Down Expand Up @@ -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: <Titanium.UI.KEYBOARD_DEFAULT>
constants: Titanium.UI.KEYBOARD_TYPE_*
default: <Titanium.UI.KEYBOARD_TYPE_DEFAULT>

- name: leftButton
summary: Left button view to display in the `TextField`.
Expand Down
163 changes: 142 additions & 21 deletions apidoc/Titanium/UI/UI.yml
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -1466,18 +1472,24 @@ 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: |
Use with the <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -1505,10 +1523,13 @@ properties:
On iPad, this behaves the same as <Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION>.

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: |
Expand All @@ -1518,11 +1539,111 @@ properties:
On iPad, this behaves the same as <Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION>.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this property name change?

summary: Use a keyboard optimized for entering URLs, with the standard keyboard layout.
description: |
Use with the <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
properties.

On iPad, this behaves the same as <Titanium.UI.KEYBOARD_TYPE_DEFAULT>.
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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
properties.

Note: on Mobile Web, if you enable `passwordType`, the `keyboardType` value will be
overridden with `KEYBOARD_TYPE_DEFAULT`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobileweb stays KEYBOARD_DEFAULT for now. @cheekiatng or where should he change those?

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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
properties.

On iPad, this behaves the same as <Titanium.UI.KEYBOARD_TYPE_NUMBERS_PUNCTUATION>.

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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
properties.

On iPad, this behaves the same as <Titanium.UI.KEYBOARD_TYPE_NUMBERS_PUNCTUATION>.

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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
Expand All @@ -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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
Expand All @@ -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 <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
Use with the <Titanium.UI.TextField.keyboardType> and <Titanium.UI.TextArea.keyboardType>
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 <Titanium.Gesture> module,
<Titanium.UI.PORTRAIT>,
<Titanium.UI.UPSIDE_PORTRAIT>,
<Titanium.UI.LANDSCAPE_LEFT>,
<Titanium.UI.LANDSCAPE_RIGHT>,
<Titanium.UI.FACE_UP>,
<Titanium.UI.FACE_DOWN>,
<Titanium.UI.PORTRAIT>,
<Titanium.UI.UPSIDE_PORTRAIT>,
<Titanium.UI.LANDSCAPE_LEFT>,
<Titanium.UI.LANDSCAPE_RIGHT>,
<Titanium.UI.FACE_UP>,
<Titanium.UI.FACE_DOWN>,
and <Titanium.UI.UNKNOWN>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restore this part as it is just whitespacing.

type: Number
permission: read-only
Expand Down
5 changes: 5 additions & 0 deletions iphone/Classes/TiUISearchBar.m
Expand Up @@ -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]];
Expand Down
12 changes: 11 additions & 1 deletion iphone/Classes/TiUITextWidget.m
Expand Up @@ -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
Expand Down