mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-01 03:55:47 +02:00
Reminders without time use UTC and do so also when changing the date
This commit is contained in:
parent
8a4aca06e6
commit
76fb19a1b9
@ -156,9 +156,9 @@ public class ConfigureReminders extends AbstractGBActivity {
|
|||||||
if (gbDevice.getDeviceCoordinator().getRemindersHaveTime()) {
|
if (gbDevice.getDeviceCoordinator().getRemindersHaveTime()) {
|
||||||
reminder.setDate(Calendar.getInstance().getTime());
|
reminder.setDate(Calendar.getInstance().getTime());
|
||||||
} else {
|
} else {
|
||||||
Calendar noonGMT = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
Calendar noonUTC = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||||
noonGMT.set(noonGMT.get(Calendar.YEAR), noonGMT.get(Calendar.MONTH), noonGMT.get(Calendar.DAY_OF_MONTH), 12, 0);
|
noonUTC.set(noonUTC.get(Calendar.YEAR), noonUTC.get(Calendar.MONTH), noonUTC.get(Calendar.DAY_OF_MONTH), 12, 0);
|
||||||
reminder.setDate(noonGMT.getTime());
|
reminder.setDate(noonUTC.getTime());
|
||||||
}
|
}
|
||||||
reminder.setMessage("");
|
reminder.setMessage("");
|
||||||
reminder.setDeviceId(device.getId());
|
reminder.setDeviceId(device.getId());
|
||||||
|
@ -41,6 +41,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -206,8 +207,16 @@ public class ReminderDetails extends AbstractGBActivity implements TimePickerDia
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) {
|
public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) {
|
||||||
|
final DeviceCoordinator coordinator = device.getDeviceCoordinator();
|
||||||
|
|
||||||
|
if (coordinator.getRemindersHaveTime()) {
|
||||||
final Calendar date = new GregorianCalendar(year, month, dayOfMonth);
|
final Calendar date = new GregorianCalendar(year, month, dayOfMonth);
|
||||||
reminder.setDate(new Date(date.getTimeInMillis()));
|
reminder.setDate(new Date(date.getTimeInMillis()));
|
||||||
|
} else {
|
||||||
|
Calendar noonUTC = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||||
|
noonUTC.set(year, month, dayOfMonth, 12, 0);
|
||||||
|
reminder.setDate(noonUTC.getTime());
|
||||||
|
}
|
||||||
updateUiFromReminder();
|
updateUiFromReminder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,7 +642,7 @@ public abstract class Casio2C2DSupport extends CasioSupport {
|
|||||||
System.arraycopy(message, 0, data[2*pos], 2, Math.min(message.length, 18));
|
System.arraycopy(message, 0, data[2*pos], 2, Math.min(message.length, 18));
|
||||||
Arrays.fill(data[2*pos], 2+message.length, 20, (byte) 0);
|
Arrays.fill(data[2*pos], 2+message.length, 20, (byte) 0);
|
||||||
|
|
||||||
LocalDate start = LocalDate.ofInstant(reminder.getDate().toInstant(), ZoneId.of("GMT"));
|
LocalDate start = LocalDate.ofInstant(reminder.getDate().toInstant(), ZoneId.of("UTC"));
|
||||||
if (start.getYear() < 2000) {
|
if (start.getYear() < 2000) {
|
||||||
if (reminder.getRepetition() == Reminder.EVERY_WEEK) {
|
if (reminder.getRepetition() == Reminder.EVERY_WEEK) {
|
||||||
final LocalDate first = LocalDate.of(2000, 1, 1);
|
final LocalDate first = LocalDate.of(2000, 1, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user