Loading src/com/android/deskclock/DeskClock.java +22 −1 Original line number Diff line number Diff line Loading @@ -88,6 +88,9 @@ public class DeskClock extends BaseActivity private TabsAdapter mTabsAdapter; private int mSelectedTab; /** {@code true} when a settings change necessitates recreating this activity. */ private boolean mRecreateActivity; @Override public void onNewIntent(Intent newIntent) { super.onNewIntent(newIntent); Loading Loading @@ -213,6 +216,24 @@ public class DeskClock extends BaseActivity DataModel.getDataModel().setApplicationInForeground(true); } @Override protected void onPostResume() { super.onPostResume(); if (mRecreateActivity) { mRecreateActivity = false; // A runnable must be posted here or the new DeskClock activity will be recreated in a // paused state, even though it is the foreground activity. mViewPager.post(new Runnable() { @Override public void run() { recreate(); } }); } } @Override public void onPause() { DataModel.getDataModel().setApplicationInForeground(false); Loading Loading @@ -251,7 +272,7 @@ public class DeskClock extends BaseActivity // Recreate the activity if any settings have been changed if (requestCode == SettingMenuItemController.REQUEST_CHANGE_SETTINGS && resultCode == RESULT_OK) { recreate(); mRecreateActivity = true; } } Loading Loading
src/com/android/deskclock/DeskClock.java +22 −1 Original line number Diff line number Diff line Loading @@ -88,6 +88,9 @@ public class DeskClock extends BaseActivity private TabsAdapter mTabsAdapter; private int mSelectedTab; /** {@code true} when a settings change necessitates recreating this activity. */ private boolean mRecreateActivity; @Override public void onNewIntent(Intent newIntent) { super.onNewIntent(newIntent); Loading Loading @@ -213,6 +216,24 @@ public class DeskClock extends BaseActivity DataModel.getDataModel().setApplicationInForeground(true); } @Override protected void onPostResume() { super.onPostResume(); if (mRecreateActivity) { mRecreateActivity = false; // A runnable must be posted here or the new DeskClock activity will be recreated in a // paused state, even though it is the foreground activity. mViewPager.post(new Runnable() { @Override public void run() { recreate(); } }); } } @Override public void onPause() { DataModel.getDataModel().setApplicationInForeground(false); Loading Loading @@ -251,7 +272,7 @@ public class DeskClock extends BaseActivity // Recreate the activity if any settings have been changed if (requestCode == SettingMenuItemController.REQUEST_CHANGE_SETTINGS && resultCode == RESULT_OK) { recreate(); mRecreateActivity = true; } } Loading