Resetting AllApps to first page when turning screen off/hitting home.

Change-Id: If988bbcf48c54aad3603425bb290fde011e9bd75
This commit is contained in:
Winson Chung
2011-03-30 10:39:30 -07:00
parent f27b5e7540
commit 337cd9d3f6
6 changed files with 30 additions and 0 deletions
+4
View File
@@ -341,6 +341,10 @@ public class AllApps2D
public void surrender() {
}
public void reset() {
// Do nothing
}
}
+4
View File
@@ -1470,4 +1470,8 @@ public class AllApps3D extends RSSurfaceView
sRS.contextDump();
}
}
public void reset() {
// Do nothing
}
}
@@ -450,6 +450,11 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
// do nothing?
}
public void reset() {
setCurrentPage(0);
invalidatePageData();
}
private void setupPage(PagedViewCellLayout layout) {
layout.setCellCount(mCellCountX, mCellCountY);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop, mPageLayoutPaddingRight,
@@ -248,6 +248,10 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans
mAllApps.surrender();
}
public void reset() {
mAllApps.reset();
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (ev.getY() > mAllApps.getBottom()) {
@@ -41,6 +41,9 @@ public interface AllAppsView {
public void updateApps(ArrayList<ApplicationInfo> list);
// Resets the AllApps page to the front
public void reset();
public void dumpState();
public void surrender();
+10
View File
@@ -1253,6 +1253,11 @@ public final class Launcher extends Activity
if (Intent.ACTION_SCREEN_OFF.equals(action)) {
mUserPresent = false;
updateRunning();
// Reset AllApps to it's initial state
if (mAllAppsGrid != null) {
mAllAppsGrid.reset();
}
} else if (Intent.ACTION_USER_PRESENT.equals(action)) {
mUserPresent = true;
updateRunning();
@@ -1424,6 +1429,11 @@ public final class Launcher extends Activity
INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
// Reset AllApps to it's initial state
if (mAllAppsGrid != null) {
mAllAppsGrid.reset();
}
}
}