Skip to content

Commit

Permalink
Merge pull request #8224 from hansemannn/TIMOB-14410
Browse files Browse the repository at this point in the history
[TIMOB-14410] iOS/Android: Add missing hintText properties (Parity)
  • Loading branch information
hansemannn committed Jul 20, 2017
2 parents 5856177 + 53907b5 commit d2b5f0b
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
TiC.PROPERTY_FONT,
TiC.PROPERTY_FULLSCREEN,
TiC.PROPERTY_HINT_TEXT,
TiC.PROPERTY_HINT_TEXT_ID,
TiC.PROPERTY_HINT_TEXT_COLOR,
TiC.PROPERTY_INPUT_TYPE,
TiC.PROPERTY_KEYBOARD_TYPE,
Expand Down Expand Up @@ -71,6 +72,13 @@ public TiUIView createView(Activity activity)
{
return new TiUIText(this, true);
}

@Override
protected KrollDict getLangConversionTable() {
KrollDict table = new KrollDict();
table.put(TiC.PROPERTY_HINT_TEXT, TiC.PROPERTY_HINT_TEXT_ID);
return table;
}

@Kroll.method
public Boolean hasText()
Expand Down
5 changes: 5 additions & 0 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,11 @@ public class TiC
* @module.api
*/
public static final String PROPERTY_HINT_TEXT = "hintText";

/**
* @module.api
*/
public static final String PROPERTY_HINT_TEXT_ID = "hinttextid";

/**
* @module.api
Expand Down
49 changes: 38 additions & 11 deletions apidoc/Titanium/UI/AlertDialog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,15 @@ properties:
since: "5.4.0"
platforms: [iphone, ipad]

- name: loginhinttextid
summary: |
Key identifying a string from the locale file to use for the
[loginHintText](Titanium.UI.AlertDialog.loginHintText) property.
description: Only one of `loginHintText` or `loginhinttextid` should be specified.
type: String
since: "6.2.0"
platforms: [iphone, ipad]

- name: loginReturnKeyType
summary: Specifies the text to display on the keyboard `Return` key when this field is focused.
description: |
Expand Down Expand Up @@ -361,6 +370,15 @@ properties:
since: "5.4.0"
platforms: [iphone, ipad]

- name: passwordhinttextid
summary: |
Key identifying a string from the locale file to use for the
[passwordHintText](Titanium.UI.AlertDialog.passwordHintText) property.
description: Only one of `passwordHintText` or `hinttextid` should be specified.
type: String
since: "6.2.0"
platforms: [iphone, ipad]

- name: passwordReturnKeyType
summary: Specifies the text to display on the keyboard `Return` key when this field is focused.
description: |
Expand Down Expand Up @@ -413,6 +431,15 @@ properties:
since: "5.4.0"
platforms: [iphone, ipad]

- name: hinttextid
summary: |
Key identifying a string from the locale file to use for the
[hintText](Titanium.UI.AlertDialog.hintText) property.
description: Only one of `hintText` or `hinttextid` should be specified.
type: String
since: "6.2.0"
platforms: [iphone, ipad]

- name: persistent
summary: Boolean value indicating if the alert dialog should only be cancelled by user gesture or by hide method.
description: |
Expand Down Expand Up @@ -482,7 +509,7 @@ examples:
fullscreen: false
});
win.addEventListener('click', function(e){
win.addEventListener('click', function(e) {
alert('The file has been deleted');
});
win.open();
Expand All @@ -500,7 +527,7 @@ examples:
fullscreen: false
});
win.addEventListener('click', function(e){
win.addEventListener('click', function(e) {
var dialog = Ti.UI.createAlertDialog({
message: 'The file has been deleted',
ok: 'Okay',
Expand All @@ -522,15 +549,15 @@ examples:
exitOnClose: true,
fullscreen: false
});
win.addEventListener('click', function(e){
win.addEventListener('click', function(e) {
var dialog = Ti.UI.createAlertDialog({
cancel: 1,
buttonNames: ['Confirm', 'Cancel', 'Help'],
message: 'Would you like to delete the file?',
title: 'Delete'
});
dialog.addEventListener('click', function(e){
if (e.index === e.source.cancel){
dialog.addEventListener('click', function(e) {
if (e.index === e.source.cancel) {
Ti.API.info('The cancel button was clicked');
}
Ti.API.info('e.cancel: ' + e.cancel);
Expand All @@ -551,13 +578,13 @@ examples:
var win = Ti.UI.createWindow({
title: 'Click window to test'
});
win.addEventListener('click', function(e){
win.addEventListener('click', function(e) {
var dialog = Ti.UI.createAlertDialog({
title: 'Enter text',
style: Ti.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT,
buttonNames: ['OK']
});
dialog.addEventListener('click', function(e){
dialog.addEventListener('click', function(e) {
Ti.API.info('e.text: ' + e.text);
});
dialog.show();
Expand Down Expand Up @@ -589,10 +616,10 @@ examples:
alertdialog.js:
function showDialog(){
function showDialog() {
$.dialog.show();
};
}
function doClick(e){
function doClick(e) {
Ti.API.info('e.text: ' + e.text);
};
}
8 changes: 8 additions & 0 deletions apidoc/Titanium/UI/TextField.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ properties:
type: String
default: The platform's default hint text color.

- name: hinttextid
summary: |
Key identifying a string from the locale file to use for the
[hintText](Titanium.UI.TextField.hintText) property.
description: Only one of `hintText` or `hinttextid` should be specified.
type: String
since: "6.2.0"

- name: inputType
summary: Input type to accept in the text field. Also influences the Keyboard type to display.
description: |
Expand Down
3 changes: 3 additions & 0 deletions iphone/Classes/TiUIAlertDialogProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ -(NSMutableDictionary*)langConversionTable
@"title",@"titleid",
@"ok",@"okid",
@"message",@"messageid",
@"hintText",@"hinttextid",
@"loginHintText",@"loginhinttextid",
@"passwordHintText",@"passwordhinttextid",
nil];
}

Expand Down
5 changes: 5 additions & 0 deletions iphone/Classes/TiUITextFieldProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ -(NSString*)apiName
return @"Ti.UI.TextField";
}

-(NSMutableDictionary*)langConversionTable
{
return [NSMutableDictionary dictionaryWithObjectsAndKeys:@"hintText",@"hinttextid",nil];
}

@end


Expand Down

0 comments on commit d2b5f0b

Please sign in to comment.