mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
properly handle the activity window of the snooze time dialog
This commit is contained in:
@@ -63,6 +63,7 @@ public class TimePickerDialog extends AppCompatDialogFragment implements OnValue
|
|||||||
private static final int PULSE_ANIMATOR_DELAY = 300;
|
private static final int PULSE_ANIMATOR_DELAY = 300;
|
||||||
|
|
||||||
private OnTimeSetListener mCallback;
|
private OnTimeSetListener mCallback;
|
||||||
|
private DialogInterface.OnDismissListener dismissListener;
|
||||||
|
|
||||||
private HapticFeedbackController mHapticFeedbackController;
|
private HapticFeedbackController mHapticFeedbackController;
|
||||||
|
|
||||||
@@ -998,4 +999,15 @@ public class TimePickerDialog extends AppCompatDialogFragment implements OnValue
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDismissListener( DialogInterface.OnDismissListener listener ) {
|
||||||
|
dismissListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
if( dismissListener != null )
|
||||||
|
dismissListener.onDismiss(dialog);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,11 @@
|
|||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value=".activities.habits.list.ListHabitsActivity"/>
|
android:value=".activities.habits.list.ListHabitsActivity"/>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".notifications.SnoozeDelayActivity"></activity>
|
<activity android:name=".notifications.SnoozeDelayActivity"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:launchMode="singleInstance"
|
||||||
|
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||||
|
</activity>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".widgets.CheckmarkWidgetProvider"
|
android:name=".widgets.CheckmarkWidgetProvider"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import static org.isoron.uhabits.core.ui.ThemeSwitcher.THEME_DARK;
|
|||||||
import static org.isoron.uhabits.core.utils.DateUtils.applyTimezone;
|
import static org.isoron.uhabits.core.utils.DateUtils.applyTimezone;
|
||||||
|
|
||||||
public class SnoozeDelayActivity extends FragmentActivity implements
|
public class SnoozeDelayActivity extends FragmentActivity implements
|
||||||
TimePickerDialog.OnTimeSetListener {
|
TimePickerDialog.OnTimeSetListener, DialogInterface.OnDismissListener {
|
||||||
|
|
||||||
public static final String ACTION_ASK_SNOOZE = "org.isoron.uhabits.ACTION_ASK_SNOOZE";
|
public static final String ACTION_ASK_SNOOZE = "org.isoron.uhabits.ACTION_ASK_SNOOZE";
|
||||||
|
|
||||||
@@ -54,6 +54,7 @@ public class SnoozeDelayActivity extends FragmentActivity implements
|
|||||||
hour, minute, DateFormat.is24HourFormat(this));
|
hour, minute, DateFormat.is24HourFormat(this));
|
||||||
HabitsApplicationComponent component = ((HabitsApplication) getApplicationContext()).getComponent();
|
HabitsApplicationComponent component = ((HabitsApplication) getApplicationContext()).getComponent();
|
||||||
dialog.setThemeDark(component.getPreferences().getTheme() == THEME_DARK);
|
dialog.setThemeDark(component.getPreferences().getTheme() == THEME_DARK);
|
||||||
|
dialog.setDismissListener(this);
|
||||||
dialog.show(getSupportFragmentManager(),"timePicker");
|
dialog.show(getSupportFragmentManager(),"timePicker");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +74,6 @@ public class SnoozeDelayActivity extends FragmentActivity implements
|
|||||||
this, ReminderReceiver.class );
|
this, ReminderReceiver.class );
|
||||||
intent.putExtra("reminderTime", time);
|
intent.putExtra("reminderTime", time);
|
||||||
sendBroadcast(intent);
|
sendBroadcast(intent);
|
||||||
|
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -83,7 +82,11 @@ public class SnoozeDelayActivity extends FragmentActivity implements
|
|||||||
Intent intent = new Intent( ReminderReceiver.ACTION_DISMISS_REMINDER, getIntent().getData(),
|
Intent intent = new Intent( ReminderReceiver.ACTION_DISMISS_REMINDER, getIntent().getData(),
|
||||||
this, ReminderReceiver.class );
|
this, ReminderReceiver.class );
|
||||||
sendBroadcast(intent);
|
sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialogInterface)
|
||||||
|
{
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user