/** * called during app close down to save state * * @param outState */ public void saveState(SharedPreferences outState) { Log.i(TAG, "save state"); currentBiblePage.saveState(outState); currentCommentaryPage.saveState(outState); currentDictionaryPage.saveState(outState); currentGeneralBookPage.saveState(outState); SharedPreferences.Editor editor = outState.edit(); editor.putString("currentPageCategory", currentDisplayedPage.getBookCategory().getName()); editor.commit(); }
/** * called during app start-up to restore previous state * * @param inState */ public void restoreState(SharedPreferences inState) { Log.i(TAG, "restore state"); currentBiblePage.restoreState(inState); currentCommentaryPage.restoreState(inState); currentDictionaryPage.restoreState(inState); currentGeneralBookPage.restoreState(inState); String restoredPageCategoryName = inState.getString("currentPageCategory", null); if (StringUtils.isNotEmpty(restoredPageCategoryName)) { BookCategory restoredBookCategory = BookCategory.fromString(restoredPageCategoryName); currentDisplayedPage = getBookPage(restoredBookCategory); } // force an update here from default chapter/verse PassageChangeMediator.getInstance().onCurrentPageChanged(); PassageChangeMediator.getInstance().onCurrentPageDetailChanged(); }