Implement save and restore instance state
This commit is contained in:
@@ -222,7 +222,7 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog /*DialogFra
|
||||
}
|
||||
|
||||
if (index == MINUTE_INDEX) {
|
||||
createMinutesGrid();
|
||||
createMinuteTuners();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog /*DialogFra
|
||||
onValueSelected(HOUR_INDEX, mSelectedHourOfDay, false);
|
||||
}
|
||||
|
||||
private void createMinutesGrid() {
|
||||
private void createMinuteTuners() {
|
||||
// https://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-by.html
|
||||
// "When inflating a layout starting with a <merge />, you *must* specify a parent ViewGroup
|
||||
// and you must set attachToRoot to true (see the documentation of the LayoutInflater#inflate() method)"
|
||||
@@ -442,7 +442,7 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog /*DialogFra
|
||||
mInitialHourOfDay = savedInstanceState.getInt(KEY_HOUR_OF_DAY);
|
||||
mInitialMinute = savedInstanceState.getInt(KEY_MINUTE);
|
||||
mIs24HourMode = savedInstanceState.getBoolean(KEY_IS_24_HOUR_VIEW);
|
||||
mInKbMode = savedInstanceState.getBoolean(KEY_IN_KB_MODE);
|
||||
// mInKbMode = savedInstanceState.getBoolean(KEY_IN_KB_MODE);
|
||||
mThemeDark = savedInstanceState.getBoolean(KEY_DARK_THEME);
|
||||
}
|
||||
}
|
||||
@@ -464,7 +464,7 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog /*DialogFra
|
||||
setNumberTexts();
|
||||
setClickListenersOnButtons();
|
||||
if (mCurrentIndex == MINUTE_INDEX) {
|
||||
createMinutesGrid();
|
||||
createMinuteTuners();
|
||||
}
|
||||
|
||||
Resources res = getResources();
|
||||
@@ -676,6 +676,11 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog /*DialogFra
|
||||
// }
|
||||
// outState.putBoolean(KEY_DARK_THEME, mThemeDark);
|
||||
// }
|
||||
outState.putInt(KEY_HOUR_OF_DAY, mSelectedHourOfDay);
|
||||
outState.putInt(KEY_MINUTE, mSelectedMinute);
|
||||
outState.putBoolean(KEY_IS_24_HOUR_VIEW, mIs24HourMode);
|
||||
outState.putInt(KEY_CURRENT_ITEM_SHOWING, mCurrentIndex);
|
||||
outState.putBoolean(KEY_DARK_THEME, mThemeDark);
|
||||
}
|
||||
|
||||
// /**
|
||||
|
||||
Reference in New Issue
Block a user