diff --git a/res/xml/default_workspace.xml b/res/xml/default_workspace.xml index 2c8b8ff44c..df7ca1ec33 100644 --- a/res/xml/default_workspace.xml +++ b/res/xml/default_workspace.xml @@ -16,31 +16,28 @@ -com.android.camera - - - + - + - - - - + + + - + 0) { - // Select the first icon when we gain keyboard focus - mArrowNavigation = true; - mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE, - SELECTED_FOCUSED); - mRollo.mState.save(); + if (mRollo != null) { + gainFocus(); + } else { + mShouldGainFocus = true; } } else { - if (mArrowNavigation) { - // Clear selection when we lose focus - mRollo.clearSelectedIcon(); - mRollo.setHomeSelected(SELECTED_NONE); - mRollo.mState.save(); - mArrowNavigation = false; + if (mRollo != null) { + if (mArrowNavigation) { + // Clear selection when we lose focus + mRollo.clearSelectedIcon(); + mRollo.setHomeSelected(SELECTED_NONE); + mRollo.mState.save(); + mArrowNavigation = false; + } + } else { + mShouldGainFocus = false; } } } + private void gainFocus() { + if (!mArrowNavigation && mRollo.mState.iconCount > 0) { + // Select the first icon when we gain keyboard focus + mArrowNavigation = true; + mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE, + SELECTED_FOCUSED); + mRollo.mState.save(); + } + } + @Override public boolean onKeyDown(int keyCode, KeyEvent event) {