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-11943: implemented dismissKeyboard event. #6431

Closed
wants to merge 1 commit into from
Closed
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
Expand Up @@ -109,6 +109,15 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
super.onLayout(changed, left, top, right, bottom);
TiUIHelper.firePostLayoutEvent(proxy);
}

@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event)
{
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
TiUIHelper.fireKeyboarDismissedEvent(proxy);
}
return super.onKeyPreIme(keyCode, event);
}
}

public TiUIText(TiViewProxy proxy, boolean field)
Expand Down
5 changes: 5 additions & 0 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Expand Up @@ -113,6 +113,11 @@ public class TiC
*/
public static final String EVENT_DESTROY = "destroy";

/**
* @module.api
*/
public static final String EVENT_DISMISS_KEYBOARD = "dismissKeyboard";

/**
* @module.api
*/
Expand Down
Expand Up @@ -1089,4 +1089,11 @@ public static void firePostLayoutEvent(TiViewProxy proxy)
proxy.fireEvent(TiC.EVENT_POST_LAYOUT, null, false);
}
}

public static void fireKeyboarDismissedEvent(TiViewProxy proxy)
{
if (proxy != null && proxy.hasListeners(TiC.EVENT_DISMISS_KEYBOARD)) {
proxy.fireEvent(TiC.EVENT_DISMISS_KEYBOARD, null, true);
}
}
}
5 changes: 5 additions & 0 deletions apidoc/Titanium/UI/SearchBar.yml
Expand Up @@ -91,6 +91,11 @@ events:
- name: blur
summary: Fired when the search bar loses focus.

- name: dismissKeyboard
summary: Fired when the keyboard is dismissed by pressing the BACK button.
since: {android: "3.6.0"}
platforms: [android]

- name: bookmark
summary: Fired when the bookmark button is pressed.

Expand Down
7 changes: 6 additions & 1 deletion apidoc/Titanium/UI/TextArea.yml
Expand Up @@ -320,7 +320,12 @@ events:
- name: value
summary: New value of this text area.
type: String


- name: dismissKeyboard
summary: Fired when the keyboard is dismissed by pressing the BACK button.
since: {android: "3.6.0"}
platforms: [android]

- name: focus
summary: Fired when this text area gains focus.
properties:
Expand Down
9 changes: 7 additions & 2 deletions apidoc/Titanium/UI/TextField.yml
Expand Up @@ -441,14 +441,19 @@ events:
- name: value
summary: New value of the field.
type: String


- name: dismissKeyboard
summary: Fired when the keyboard is dismissed by pressing the BACK button.
since: {android: "3.6.0"}
platforms: [android]

- name: focus
summary: Fired when the field gains focus.
properties:
- name: value
summary: Value of the field.
type: String

- name: return
summary: Fired when the return key is pressed on the keyboard.
properties:
Expand Down