am 3dc3ecda: Merge "Hooks for subclasses to react to home presses." into jb-ub-now-jolly-elf

* commit '3dc3ecda281c078de9511dcb6349db1df629220a':
  Hooks for subclasses to react to home presses.
This commit is contained in:
Adam Copp
2013-11-15 09:24:15 -08:00
committed by Android Git Automerger
+18 -1
View File
@@ -1704,7 +1704,7 @@ public class Launcher extends Activity
// In all these cases, only animate if we're already on home // In all these cases, only animate if we're already on home
mWorkspace.exitWidgetResizeMode(); mWorkspace.exitWidgetResizeMode();
if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() && if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() &&
openFolder == null) { openFolder == null && shouldMoveToDefaultScreenOnHomeIntent()) {
mWorkspace.moveToDefaultScreen(true); mWorkspace.moveToDefaultScreen(true);
} }
@@ -1730,6 +1730,8 @@ public class Launcher extends Activity
if (mAppsCustomizeTabHost != null) { if (mAppsCustomizeTabHost != null) {
mAppsCustomizeTabHost.reset(); mAppsCustomizeTabHost.reset();
} }
onHomeIntent();
} }
if (DEBUG_RESUME_TIME) { if (DEBUG_RESUME_TIME) {
@@ -1737,6 +1739,21 @@ public class Launcher extends Activity
} }
} }
/**
* Override point for subclasses to prevent movement to the default screen when the home
* button is pressed. Used (for example) in GEL, to prevent movement during a search.
*/
protected boolean shouldMoveToDefaultScreenOnHomeIntent() {
return true;
}
/**
* Override point for subclasses to provide custom behaviour for when a home intent is fired.
*/
protected void onHomeIntent() {
// Do nothing
}
@Override @Override
public void onRestoreInstanceState(Bundle state) { public void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state); super.onRestoreInstanceState(state);