Zepp OS: Add setting to disable calendar event reminders

This commit is contained in:
José Rebelo
2026-03-09 22:46:06 +00:00
parent 63d94b3121
commit 50338052b6
7 changed files with 23 additions and 1 deletions
@@ -95,6 +95,7 @@ public class DeviceSettingsPreferenceConst {
public static final String PREF_CALENDAR_SYNC_ALL_DAY = "calendar_sync_all_day";
public static final String PREF_CALENDAR_SYNC_WORKING_LOCATION = "calendar_sync_working_location";
public static final String PREF_CALENDAR_SYNC_COLOR_BLACKLIST = "calendar_sync_color_blacklist";
public static final String PREF_CALENDAR_SYNC_EVENT_REMINDERS = "calendar_sync_event_reminders";
public static final String PREF_TIME_SYNC = "time_sync";
public static final String PREF_WEIGHT_SCALE_UNIT = "pref_weight_scale_unit";
public static final String PREF_USE_CUSTOM_DEVICEICON = "use_custom_deviceicon";
@@ -1045,6 +1045,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
addPreferenceHandlerFor(PREF_CALENDAR_SYNC_FOCUS_TIME);
addPreferenceHandlerFor(PREF_CALENDAR_SYNC_ALL_DAY);
addPreferenceHandlerFor(PREF_CALENDAR_SYNC_WORKING_LOCATION);
addPreferenceHandlerFor(PREF_CALENDAR_SYNC_EVENT_REMINDERS);
}
addPreferenceHandlerFor(PREF_ATC_BLE_OEPL_MODEL);
@@ -498,6 +498,10 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
DeviceSpecificSettingsScreen.CALENDAR,
R.xml.devicesettings_sync_calendar
);
deviceSpecificSettings.addRootScreen(
DeviceSpecificSettingsScreen.CALENDAR,
R.xml.devicesettings_sync_calendar_event_reminders
);
}
//
@@ -571,6 +571,7 @@ public abstract class AbstractDeviceSupport implements DeviceSupport {
case DeviceSettingsPreferenceConst.PREF_CALENDAR_SYNC_ALL_DAY:
case DeviceSettingsPreferenceConst.PREF_CALENDAR_SYNC_WORKING_LOCATION:
case DeviceSettingsPreferenceConst.PREF_CALENDAR_SYNC_COLOR_BLACKLIST:
case DeviceSettingsPreferenceConst.PREF_CALENDAR_SYNC_EVENT_REMINDERS:
CalendarReceiver.forceSync(getDevice());
break;
}
@@ -23,6 +23,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
@@ -143,7 +144,8 @@ public class ZeppOsCalendarService extends AbstractZeppOsService {
buf.putInt(calendarEventSpec.timestamp + calendarEventSpec.durationInSeconds);
// Remind
if (calendarEventSpec.reminders != null && !calendarEventSpec.reminders.isEmpty()) {
final boolean syncReminders = getDevicePrefs().getBoolean(DeviceSettingsPreferenceConst.PREF_CALENDAR_SYNC_EVENT_REMINDERS, false);
if (syncReminders && calendarEventSpec.reminders != null && !calendarEventSpec.reminders.isEmpty()) {
buf.putInt((int) (calendarEventSpec.reminders.get(0) / 1000L));
} else {
buf.putInt(0);
+2
View File
@@ -464,6 +464,8 @@
<string name="pref_title_calendar_sync_all_day">Sync all day events</string>
<string name="pref_summary_calendar_sync_working_location">Calendar events that are special \"Working Locations\" will be synced to the device</string>
<string name="pref_title_calendar_sync_working_location">Sync working location events</string>
<string name="pref_summary_calendar_sync_event_reminders">Event reminder notifications will be synced to the device</string>
<string name="pref_title_calendar_sync_event_reminders">Sync event reminders</string>
<string name="pref_summary_relax_firmware_checks">Relax firmware checks</string>
<string name="pref_title_relax_firmware_checks">Enable this if you want to flash a firmware not intended for your device (at your own risk)</string>
<string name="pref_title_vibration_strength">Vibration strength</string>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreferenceCompat
android:defaultValue="false"
android:dependency="sync_calendar"
android:icon="@drawable/ic_access_alarms"
android:key="calendar_sync_event_reminders"
android:layout="@layout/preference_checkbox"
android:summary="@string/pref_summary_calendar_sync_event_reminders"
android:title="@string/pref_title_calendar_sync_event_reminders" />
</androidx.preference.PreferenceScreen>