Skip to content

Commit

Permalink
Revert "[TIMOB-19919] Android: Reverting changes for onBackPressed "
Browse files Browse the repository at this point in the history
  • Loading branch information
ashcoding committed Jun 27, 2016
1 parent 5da41d7 commit b14b37b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Expand Up @@ -847,24 +847,18 @@ public void onBackPressed()

TiWindowProxy topWindow = topWindowOnStack();

// Prevent default Android behavior for "back" press
// if the top window has a listener to handle the event.
if (topWindow != null && topWindow.hasListeners(TiC.EVENT_ANDROID_BACK)) {
topWindow.fireEvent(TiC.EVENT_ANDROID_BACK, null);
// TIMOB-19919 This code is being commented out/reverted till after 6.0.0
// As this is a breaking change.
/*
}

// Override default Android behavior for "back" press
// if the top window has a callback to handle the event.
if (topWindow != null && topWindow.hasProperty(TiC.PROPERTY_ON_BACK)) {
KrollFunction onBackCallback = (KrollFunction) topWindow.getProperty(TiC.PROPERTY_ON_BACK);
onBackCallback.callAsync(activityProxy.getKrollObject(), new Object[] {});
*/
} else {
// Original Comment: If event is not handled by any listeners allow default behavior.
// TIMOB-19919 Comment: If event is not handled by custom callback allow default behavior.
// If event is not handled by custom callback allow default behavior.
super.onBackPressed();
}
}
Expand Down
Expand Up @@ -43,8 +43,7 @@
@Kroll.proxy(propertyAccessors={
TiC.PROPERTY_EXIT_ON_CLOSE,
TiC.PROPERTY_FULLSCREEN,
// Poperty to be added in the future (TIMOB-19919)
//TiC.PROPERTY_ON_BACK,
TiC.PROPERTY_ON_BACK,
TiC.PROPERTY_TITLE,
TiC.PROPERTY_TITLEID,
TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE
Expand Down
11 changes: 10 additions & 1 deletion apidoc/Titanium/UI/Window.yml
Expand Up @@ -587,7 +587,16 @@ properties:
`backgroundColor` property as well, unless you want the window to be completely
transparent.
type: Number


- name: onBack
summary: |
Callback function that overrides the default behavior when the user presses the **Back**
button.
description: |
This was separated from the <Ti.UI.Window.androidback> event. You need to define this
callback if you explicitly want to override the back button behavior.
type: Callback<Object>

- name: orientationModes
summary: |
Array of supported orientation modes, specified using the orientation
Expand Down

0 comments on commit b14b37b

Please sign in to comment.