private TimePickerPreference mStart;
private TimePickerPreference mEnd;
private SwitchPreference mExitAtAlarm;
+ private AlertDialog mDayDialog;
private ScheduleInfo mSchedule;
updateEndSummary();
}
-
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
List<AbstractPreferenceController> controllers = new ArrayList<>();
return MetricsEvent.NOTIFICATION_ZEN_MODE_SCHEDULE_RULE;
}
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ if (mDayDialog != null && mDayDialog.isShowing()) {
+ mDayDialog.dismiss();
+ mDayDialog = null;
+ }
+ }
+
private void showDaysDialog() {
- new AlertDialog.Builder(mContext)
+ mDayDialog = new AlertDialog.Builder(mContext)
.setTitle(R.string.zen_mode_schedule_rule_days)
.setView(new ZenModeScheduleDaysSelection(mContext, mSchedule.days) {
- @Override
- protected void onChanged(final int[] days) {
- if (mDisableListeners) return;
- if (Arrays.equals(days, mSchedule.days)) return;
- if (DEBUG) Log.d(TAG, "days.onChanged days=" + Arrays.asList(days));
- mSchedule.days = days;
- updateRule(ZenModeConfig.toScheduleConditionId(mSchedule));
- }
+ @Override
+ protected void onChanged(final int[] days) {
+ if (mDisableListeners) return;
+ if (Arrays.equals(days, mSchedule.days)) return;
+ if (DEBUG) Log.d(TAG, "days.onChanged days=" + Arrays.asList(days));
+ mSchedule.days = days;
+ updateRule(ZenModeConfig.toScheduleConditionId(mSchedule));
+ }
})
.setOnDismissListener(new OnDismissListener() {
@Override
super(context);
mContext = context;
setPersistent(false);
- setOnPreferenceClickListener(new OnPreferenceClickListener(){
+ setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
final TimePickerFragment frag = new TimePickerFragment();