1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-03 17:02:13 +01:00

Enabling calendar sync for bangle

This commit is contained in:
glemco 2022-05-25 21:40:10 +02:00 committed by Gabriele Monaco
parent e1ced2e80b
commit f4e6d953ff
4 changed files with 47 additions and 3 deletions

View File

@ -93,7 +93,7 @@ public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator {
@Override @Override
public boolean supportsCalendarEvents() { public boolean supportsCalendarEvents() {
return false; return true;
} }
@Override @Override

View File

@ -973,12 +973,33 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
@Override @Override
public void onAddCalendarEvent(CalendarEventSpec calendarEventSpec) { public void onAddCalendarEvent(CalendarEventSpec calendarEventSpec) {
try {
JSONObject o = new JSONObject();
o.put("t", "calendar"); //TODO implement command
o.put("id", calendarEventSpec.id);
o.put("type", calendarEventSpec.type); //implement this too? (sunrise and set)
o.put("timestamp", calendarEventSpec.timestamp);
o.put("durationInSeconds", calendarEventSpec.durationInSeconds);
o.put("title", calendarEventSpec.title);
o.put("description", calendarEventSpec.description);
o.put("location", calendarEventSpec.location);
o.put("allDay", calendarEventSpec.allDay);
uartTxJSON("onAddCalendarEvent", o);
} catch (JSONException e) {
LOG.info("JSONException: " + e.getLocalizedMessage());
}
} }
@Override @Override
public void onDeleteCalendarEvent(byte type, long id) { public void onDeleteCalendarEvent(byte type, long id) {
try {
JSONObject o = new JSONObject();
o.put("t", "calendar-");
o.put("id", id);
uartTxJSON("onDeleteCalendarEvent", o);
} catch (JSONException e) {
LOG.info("JSONException: " + e.getLocalizedMessage());
}
} }
@Override @Override

View File

@ -277,6 +277,8 @@
<string name="pref_title_pebble_enable_bgjs">Enable background JS</string> <string name="pref_title_pebble_enable_bgjs">Enable background JS</string>
<string name="pref_summary_pebble_enable_bgjs">When enabled, allows watchfaces to show weather, battery info etc.</string> <string name="pref_summary_pebble_enable_bgjs">When enabled, allows watchfaces to show weather, battery info etc.</string>
<string name="pref_title_pebble_reconnect_attempts">Reconnection attempts</string> <string name="pref_title_pebble_reconnect_attempts">Reconnection attempts</string>
<string name="pref_title_banglejs_settings">Bangle.js settings</string>
<string name="pref_header_banglejs_agenda">Bangle.js agenda</string>
<string name="pref_summary_expose_hr">Allows other apps to access HR data in realtime while Gadgetbridge is connected</string> <string name="pref_summary_expose_hr">Allows other apps to access HR data in realtime while Gadgetbridge is connected</string>
<string name="pref_title_expose_hr">3rd party realtime HR access</string> <string name="pref_title_expose_hr">3rd party realtime HR access</string>
<string name="pref_title_connected_advertisement">Visible while connected</string> <string name="pref_title_connected_advertisement">Visible while connected</string>

View File

@ -294,6 +294,27 @@
android:title="Emulator Port" /> android:title="Emulator Port" />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>
<PreferenceScreen
android:icon="@drawable/ic_device_pinetime"
android:key="pref_key_banglejs"
android:title="@string/pref_title_banglejs_settings">
<PreferenceCategory android:title="@string/pref_header_banglejs_agenda">
<CheckBoxPreference
android:layout="@layout/preference_checkbox"
android:defaultValue="true"
android:key="enable_calendar_sync"
android:summary="@string/pref_summary_enable_calendar_sync"
android:title="@string/pref_title_enable_calendar_sync" />
<Preference
android:key="pref_key_blacklist_calendars_bangle"
android:title="@string/pref_blacklist_calendars" />
<CheckBoxPreference
android:layout="@layout/preference_checkbox"
android:key="send_sunrise_sunset"
android:summary="@string/pref_summary_sunrise_sunset"
android:title="@string/pref_title_sunrise_sunset" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen <PreferenceScreen
android:icon="@drawable/ic_device_hplus" android:icon="@drawable/ic_device_hplus"
android:key="pref_key_hplus" android:key="pref_key_hplus"