1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-10-31 22:52:59 +01:00

Added calendar color and name to CalendarEventSpec

Tested on banglejs
This commit is contained in:
Gabriele Monaco 2022-08-23 17:05:38 +02:00 committed by Gitea
parent e6411d8f68
commit 004355f69f
6 changed files with 14 additions and 0 deletions

View File

@ -203,6 +203,8 @@ public class CalendarReceiver extends BroadcastReceiver {
calendarEventSpec.description = calendarEvent.getDescription();
calendarEventSpec.location = calendarEvent.getLocation();
calendarEventSpec.type = CalendarEventSpec.TYPE_UNKNOWN;
calendarEventSpec.calName = calendarEvent.getUniqueCalName();
calendarEventSpec.color = calendarEvent.getColor();
if (syncState == EventState.NEEDS_UPDATE) {
GBApplication.deviceService(mGBDevice).onDeleteCalendarEvent(CalendarEventSpec.TYPE_UNKNOWN, i);
}

View File

@ -404,6 +404,8 @@ public class GBDeviceService implements DeviceService {
.putExtra(EXTRA_CALENDAREVENT_ALLDAY, calendarEventSpec.allDay)
.putExtra(EXTRA_CALENDAREVENT_TITLE, calendarEventSpec.title)
.putExtra(EXTRA_CALENDAREVENT_DESCRIPTION, calendarEventSpec.description)
.putExtra(EXTRA_CALENDAREVENT_CALNAME, calendarEventSpec.calName)
.putExtra(EXTRA_CALENDAREVENT_COLOR, calendarEventSpec.color)
.putExtra(EXTRA_CALENDAREVENT_LOCATION, calendarEventSpec.location);
invokeService(intent);
}

View File

@ -28,5 +28,7 @@ public class CalendarEventSpec {
public String title;
public String description;
public String location;
public String calName;
public int color;
public boolean allDay;
}

View File

@ -147,6 +147,8 @@ public interface DeviceService extends EventHandler {
String EXTRA_CALENDAREVENT_TITLE = "calendarevent_title";
String EXTRA_CALENDAREVENT_DESCRIPTION = "calendarevent_description";
String EXTRA_CALENDAREVENT_LOCATION = "calendarevent_location";
String EXTRA_CALENDAREVENT_CALNAME = "calendarevent_calname";
String EXTRA_CALENDAREVENT_COLOR = "calendarevent_color";
void start();

View File

@ -149,6 +149,8 @@ import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_CAL
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_CALENDAREVENT_ALLDAY;
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_CALENDAREVENT_TITLE;
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_CALENDAREVENT_TYPE;
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_CALENDAREVENT_CALNAME;
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_CALENDAREVENT_COLOR;
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_CALL_COMMAND;
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_CALL_DISPLAYNAME;
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_CALL_DNDSUPPRESSED;
@ -728,6 +730,8 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
calendarEventSpec.title = sanitizeNotifText(intent.getStringExtra(EXTRA_CALENDAREVENT_TITLE), device);
calendarEventSpec.description = sanitizeNotifText(intent.getStringExtra(EXTRA_CALENDAREVENT_DESCRIPTION), device);
calendarEventSpec.location = sanitizeNotifText(intent.getStringExtra(EXTRA_CALENDAREVENT_LOCATION), device);
calendarEventSpec.calName = sanitizeNotifText(intent.getStringExtra(EXTRA_CALENDAREVENT_CALNAME), device);
calendarEventSpec.color = intent.getIntExtra(EXTRA_CALENDAREVENT_COLOR, 0);
deviceSupport.onAddCalendarEvent(calendarEventSpec);
break;
}

View File

@ -1142,6 +1142,8 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
o.put("title", calendarEventSpec.title);
o.put("description", calendarEventSpec.description);
o.put("location", calendarEventSpec.location);
o.put("calName", calendarEventSpec.calName);
o.put("color", calendarEventSpec.color);
o.put("allDay", calendarEventSpec.allDay);
uartTxJSON("onAddCalendarEvent", o);
} catch (JSONException e) {