// If we are already on home, then just animate back to the workspace,
// otherwise, just wait until onResume to set the state back to Workspace
if (alreadyOnHome) {
- showWorkspace(true);
- if (mWorkspace.isInOverviewMode()) {
- mWorkspace.exitOverviewMode();
- }
+ showWorkspace();
} else {
mOnResumeState = State.WORKSPACE;
}
}
}
+ protected void showWorkspace() {
+ showWorkspace(true);
+ if (mWorkspace.isInOverviewMode()) {
+ mWorkspace.exitOverviewMode();
+ }
+ }
+
@Override
public void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state);
}
}
+ protected void moveToCustomContentScreen(boolean animate) {
+ mWorkspace.moveToCustomContentScreen(animate);
+ }
/**
* Process a shortcut drop.
*
}
private void updateStateForCustomContent(int screenCenter) {
- if (hasCustomContent() && !isSmall() && !isSwitchingState()) {
+ if (hasCustomContent()) {
int index = mScreenOrder.indexOf(CUSTOM_CONTENT_SCREEN_ID);
int scrollDelta = getScrollForPage(index + 1) - getScrollX();
float translationX = Math.max(scrollDelta, 0);
}
}
- void moveToDefaultScreen(boolean animate) {
+ private void moveToScreen(int page, boolean animate) {
if (!isSmall()) {
if (animate) {
- snapToPage(mDefaultPage);
+ snapToPage(page);
} else {
- setCurrentPage(mDefaultPage);
+ setCurrentPage(page);
}
}
- View child = getChildAt(mDefaultPage);
+ View child = getChildAt(page);
if (child != null) {
child.requestFocus();
}
}
+ void moveToDefaultScreen(boolean animate) {
+ moveToScreen(mDefaultPage, animate);
+ }
+
+ void moveToCustomContentScreen(boolean animate) {
+ if (hasCustomContent()) {
+ int ccIndex = getPageIndexForScreenId(CUSTOM_CONTENT_SCREEN_ID);
+ if (animate) {
+ snapToPage(ccIndex);
+ } else {
+ setCurrentPage(ccIndex);
+ }
+ View child = getChildAt(ccIndex);
+ if (child != null) {
+ child.requestFocus();
+ }
+ }
+ }
+
@Override
protected int getPageIndicatorMarker(int pageIndex) {
if (getScreenIdForPageIndex(pageIndex) == CUSTOM_CONTENT_SCREEN_ID) {