Skip to content

Commit

Permalink
Merge pull request #7310 from hansemannn/TIMOB-19733
Browse files Browse the repository at this point in the history
[TIMOB-19733] iOS9: Support "Continue" return key + new keyboards
  • Loading branch information
cheekiatng committed Oct 21, 2015
2 parents 4ad3159 + bbcef67 commit 6edd60f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 15 deletions.
42 changes: 39 additions & 3 deletions apidoc/Titanium/UI/UI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1507,9 +1507,31 @@ properties:
`KEYBOARD_DEFAULT`.
type: Number
permission: read-only


- name: KEYBOARD_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>
properties. This type features the space and . characters prominently.
Note: This keyboard automatically sets the return key to "Go" (localized).
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "5.2.0"

- name: KEYBOARD_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>
properties.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "5.2.0"

- name: KEYBOARD_URL
summary: Use an keyboard optimized for entering URLs, with the standard keyboard layout.
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.
Expand Down Expand Up @@ -1690,7 +1712,21 @@ properties:
and <Titanium.UI.UNKNOWN>.
type: Number
permission: read-only


- name: RETURNKEY_CONTINUE
summary: Set the return key text to "Continue".
description: |
Use with the <Titanium.UI.TextField.returnKeyType> and
<Titanium.UI.TextArea.returnKeyType> properties.
Note: This constant is only available on iOS devices running iOS 9 or later. Older iOS
devices will display <Titanium.UI.RETURNKEY_DEFAULT>.
type: Number
permission: read-only
platforms: [iphone, ipad]
osver: {ios: {min: "9.0"}}
since: "5.2.0"

- name: RETURNKEY_DEFAULT
summary: Use the default return key on the virtual keyboard.
description: |
Expand Down
3 changes: 3 additions & 0 deletions iphone/Classes/UIModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
@property(nonatomic,readonly) NSNumber *RETURNKEY_YAHOO;
@property(nonatomic,readonly) NSNumber *RETURNKEY_DONE;
@property(nonatomic,readonly) NSNumber *RETURNKEY_EMERGENCY_CALL;
@property(nonatomic,readonly) NSNumber *RETURNKEY_CONTINUE;

@property(nonatomic,readonly) NSNumber *KEYBOARD_DEFAULT;
@property(nonatomic,readonly) NSNumber *KEYBOARD_ASCII;
Expand All @@ -74,6 +75,8 @@
@property(nonatomic,readonly) NSNumber *KEYBOARD_PHONE_PAD;
@property(nonatomic,readonly) NSNumber *KEYBOARD_NAMEPHONE_PAD;
@property(nonatomic,readonly) NSNumber *KEYBOARD_EMAIL;
@property(nonatomic,readonly) NSNumber *KEYBOARD_WEBSEARCH;
@property(nonatomic,readonly) NSNumber *KEYBOARD_TWITTER;

@property(nonatomic,readonly) NSNumber *KEYBOARD_APPEARANCE_DEFAULT;
@property(nonatomic,readonly) NSNumber *KEYBOARD_APPEARANCE_ALERT;
Expand Down
25 changes: 13 additions & 12 deletions iphone/Classes/UIModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,27 @@ -(TiUIActivityIndicatorStyleProxy*)ActivityIndicatorStyle
MAKE_SYSTEM_PROP(RETURNKEY_DONE,UIReturnKeyDone);
MAKE_SYSTEM_PROP(RETURNKEY_EMERGENCY_CALL,UIReturnKeyEmergencyCall);

-(NSNumber*)RETURNKEY_CONTINUE
{
#if IS_XCODE_7
if ([TiUtils isIOS9OrGreater] == YES) {
return [NSNumber numberWithInt:UIReturnKeyContinue];
}
#endif
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);

/* Because this is a new feature in 4.1, we have to guard against it in both compiling AND runtime.*/
-(NSNumber*)KEYBOARD_DECIMAL_PAD
{
#if __IPHONE_4_1 <= __IPHONE_OS_VERSION_MAX_ALLOWED
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.1){
return [NSNumber numberWithInt:UIKeyboardTypeDecimalPad];
}
#endif
return [NSNumber numberWithInt:UIKeyboardTypeNumbersAndPunctuation];
}

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_APPEARANCE_DEFAULT,UIKeyboardAppearanceDefault);
MAKE_SYSTEM_PROP(KEYBOARD_APPEARANCE_ALERT,UIKeyboardAppearanceAlert);
Expand Down

0 comments on commit 6edd60f

Please sign in to comment.