mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Huawei: Enforce 7d calendar lookahead
This commit is contained in:
+7
@@ -29,6 +29,7 @@ import java.util.Set;
|
||||
import java.util.Collections;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.ui.HuaweiStressCalibrationActivity;
|
||||
@@ -162,6 +163,12 @@ public class HuaweiSettingsCustomizer implements DeviceSpecificSettingsCustomize
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
// Huawei devices do not support lookahead > 7 days
|
||||
final Preference calendarLookahead = handler.findPreference(DeviceSettingsPreferenceConst.PREF_CALENDAR_LOOKAHEAD_DAYS);
|
||||
if (calendarLookahead != null) {
|
||||
calendarLookahead.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ public class HuaweiP2PCalendarService extends HuaweiBaseP2PService {
|
||||
|
||||
private List<CalendarEvent> getCalendarEventList() {
|
||||
final CalendarManager upcomingEvents = new CalendarManager(manager.getSupportProvider().getContext(), manager.getSupportProvider().getDevice().getAddress());
|
||||
return upcomingEvents.getCalendarEventList();
|
||||
return upcomingEvents.getCalendarEventList(7);
|
||||
}
|
||||
|
||||
private JsonArray getFullCalendarData() {
|
||||
|
||||
+6
-1
@@ -92,12 +92,17 @@ public class CalendarManager {
|
||||
}
|
||||
|
||||
public List<CalendarEvent> getCalendarEventList() {
|
||||
final Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(deviceAddress));
|
||||
final int lookaheadDays = Math.max(1, prefs.getInt(DeviceSettingsPreferenceConst.PREF_CALENDAR_LOOKAHEAD_DAYS, 7));
|
||||
return getCalendarEventList(lookaheadDays);
|
||||
}
|
||||
|
||||
public List<CalendarEvent> getCalendarEventList(final int lookaheadDays) {
|
||||
loadCalendarsBlackList();
|
||||
|
||||
final Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(deviceAddress));
|
||||
|
||||
final List<CalendarEvent> calendarEventList = new ArrayList<>();
|
||||
final int lookaheadDays = Math.max(1, prefs.getInt("calendar_lookahead_days", 7));
|
||||
|
||||
if (prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SYNC_CALENDAR, false)) {
|
||||
calendarEventList.addAll(getCalendarEvents(lookaheadDays));
|
||||
|
||||
Reference in New Issue
Block a user