Commit 08ca05e2 authored by Ryan Bis's avatar Ryan Bis Committed by Gerrit Review System

Add BackPressed event.

Change-Id: I18b30064a90d55759f52388c9a413242d1861b85
parent e06e918d
......@@ -610,6 +610,10 @@ public final class YoungAndroidFormUpgrader {
// to be modified to upgrade to version 9.
srcCompVersion = 9;
}
if (srcCompVersion < 10) {
// The BackPressed event was added. No blocks need to be modified to upgrade to version 10.
srcCompVersion = 10;
}
return srcCompVersion;
}
......
......@@ -789,6 +789,10 @@ public class BlockSaveFile {
// to be modified to upgrade to version 9.
blkCompVersion = 9;
}
if (blkCompVersion < 10) {
// The BackPressed event was added. No blocks need to be modified to upgrade to version 10.
blkCompVersion = 10;
}
return blkCompVersion;
}
......
......@@ -201,8 +201,10 @@ public class YaVersion {
// - BALL_COMPONENT_VERSION was incremented to 5.
// - CANVAS_COMPONENT_VERSION was incremented to 7.
// - IMAGESPRITE_COMPONENT_VERSION was incremented to 6.
// For YOUNG_ANDROID_VERSION 66:
// - FORM_COMPONENT_VERSION was incremented to 10.
public static final int YOUNG_ANDROID_VERSION = 65;
public static final int YOUNG_ANDROID_VERSION = 66;
// ............................... Blocks Language Version Number ...............................
......@@ -387,7 +389,9 @@ public class YaVersion {
// For FORM_COMPONENT_VERSION 9:
// - The OpenScreenAnimation property was added
// - The CloseScreenAnimation property was added
public static final int FORM_COMPONENT_VERSION = 9;
// For FORM_COMPONENT_VERSION 10:
// - The BackPressed event was added.
public static final int FORM_COMPONENT_VERSION = 10;
// For FUSIONTABLESCONTROL_COMPONENT_VERSION 2:
// - The Fusiontables API was migrated from SQL to V1
......
......@@ -242,14 +242,23 @@ public class Form extends Activity
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
boolean handled = super.onKeyDown(keyCode, event);
AnimationUtil.ApplyCloseScreenAnimation(this, closeAnimType);
return handled;
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (!BackPressed()) {
boolean handled = super.onKeyDown(keyCode, event);
AnimationUtil.ApplyCloseScreenAnimation(this, closeAnimType);
return handled;
} else {
return true;
}
}
return super.onKeyDown(keyCode, event);
}
@SimpleEvent(description = "Device back button pressed.")
public boolean BackPressed() {
return EventDispatcher.dispatchEvent(this, "BackPressed");
}
// onActivityResult should be triggered in only two cases:
// (1) The result is for some other component in the app, not this Form itself
// (2) This page started another page, and that page is closing, and passing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment