diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/ColorConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/ColorConst.java new file mode 100644 index 000000000..9d7cea1bd --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/ColorConst.java @@ -0,0 +1,76 @@ +package nodomain.freeyourgadget.gadgetbridge.devices.pebble; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public final class ColorConst { + private static final Logger LOG = LoggerFactory.getLogger(ColorConst.class); + + public static final byte COLOR_Black = (byte) 0b11000000; + public static final byte COLOR_OxfordBlue = (byte) 0b11000001; + public static final byte COLOR_DukeBlue = (byte) 0b11000010; + public static final byte COLOR_Blue = (byte) 0b11000011; + public static final byte COLOR_DarkGreen = (byte) 0b11000100; + public static final byte COLOR_MidnightGreen = (byte) 0b11000101; + public static final byte COLOR_CobaltBlue = (byte) 0b11000110; + public static final byte COLOR_BlueMoon = (byte) 0b11000111; + public static final byte COLOR_IslamicGreen = (byte) 0b11001000; + public static final byte COLOR_JaegerGreen = (byte) 0b11001001; + public static final byte COLOR_TiffanyBlue = (byte) 0b11001010; + public static final byte COLOR_VividCerulean = (byte) 0b11001011; + public static final byte COLOR_Green = (byte) 0b11001100; + public static final byte COLOR_Malachite = (byte) 0b11001101; + public static final byte COLOR_MediumSpringGreen = (byte) 0b11001110; + public static final byte COLOR_Cyan = (byte) 0b11001111; + public static final byte COLOR_BulgarianRose = (byte) 0b11010000; + public static final byte COLOR_ImperialPurple = (byte) 0b11010001; + public static final byte COLOR_Indigo = (byte) 0b11010010; + public static final byte COLOR_ElectricUltramarine = (byte) 0b11010011; + public static final byte COLOR_ArmyGreen = (byte) 0b11010100; + public static final byte COLOR_DarkGray = (byte) 0b11010101; + public static final byte COLOR_Liberty = (byte) 0b11010110; + public static final byte COLOR_VeryLightBlue = (byte) 0b11010111; + public static final byte COLOR_KellyGreen = (byte) 0b11011000; + public static final byte COLOR_MayGreen = (byte) 0b11011001; + public static final byte COLOR_CadetBlue = (byte) 0b11011010; + public static final byte COLOR_PictonBlue = (byte) 0b11011011; + public static final byte COLOR_BrightGreen = (byte) 0b11011100; + public static final byte COLOR_ScreaminGreen = (byte) 0b11011101; + public static final byte COLOR_MediumAquamarine = (byte) 0b11011110; + public static final byte COLOR_ElectricBlue = (byte) 0b11011111; + public static final byte COLOR_DarkCandyAppleRed = (byte) 0b11100000; + public static final byte COLOR_JazzberryJam = (byte) 0b11100001; + public static final byte COLOR_Purple = (byte) 0b11100010; + public static final byte COLOR_VividViolet = (byte) 0b11100011; + public static final byte COLOR_WindsorTan = (byte) 0b11100100; + public static final byte COLOR_RoseVale = (byte) 0b11100101; + public static final byte COLOR_Purpureus = (byte) 0b11100110; + public static final byte COLOR_LavenderIndigo = (byte) 0b11100111; + public static final byte COLOR_Limerick = (byte) 0b11101000; + public static final byte COLOR_Brass = (byte) 0b11101001; + public static final byte COLOR_LightGray = (byte) 0b11101010; + public static final byte COLOR_BabyBlueEyes = (byte) 0b11101011; + public static final byte COLOR_SpringBud = (byte) 0b11101100; + public static final byte COLOR_Inchworm = (byte) 0b11101101; + public static final byte COLOR_MintGreen = (byte) 0b11101110; + public static final byte COLOR_Celeste = (byte) 0b11101111; + public static final byte COLOR_Red = (byte) 0b11110000; + public static final byte COLOR_Folly = (byte) 0b11110001; + public static final byte COLOR_FashionMagenta = (byte) 0b11110010; + public static final byte COLOR_Magenta = (byte) 0b11110011; + public static final byte COLOR_Orange = (byte) 0b11110100; + public static final byte COLOR_SunsetOrange = (byte) 0b11110101; + public static final byte COLOR_BrilliantRose = (byte) 0b11110110; + public static final byte COLOR_ShockingPink = (byte) 0b11110111; + public static final byte COLOR_ChromeYellow = (byte) 0b11111000; + public static final byte COLOR_Rajah = (byte) 0b11111001; + public static final byte COLOR_Melon = (byte) 0b11111010; + public static final byte COLOR_RichBrilliantLavender = (byte) 0b11111011; + public static final byte COLOR_Yellow = (byte) 0b11111100; + public static final byte COLOR_Icterine = (byte) 0b11111101; + public static final byte COLOR_PastelYellow = (byte) 0b11111110; + public static final byte COLOR_White = (byte) 0b11111111; + public static final byte COLOR_Clear = (byte) 0b00000000; + +} + diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java index fc5b494cd..5c46d2e3e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java @@ -13,6 +13,7 @@ import java.util.Random; import java.util.SimpleTimeZone; import java.util.UUID; +import nodomain.freeyourgadget.gadgetbridge.devices.pebble.ColorConst; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventAppInfo; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventAppManagement; @@ -699,29 +700,37 @@ public class PebbleProtocol extends GBDeviceProtocol { String[] parts = {title, subtitle, body}; int icon_id; + byte color_id; switch (type) { case NOTIFICATION_EMAIL: icon_id = ICON_GENERIC_EMAIL; + color_id = ColorConst.COLOR_JaegerGreen; break; case NOTIFICATION_SMS: icon_id = ICON_GENERIC_SMS; + color_id = ColorConst.COLOR_VividViolet; break; default: switch(notificationKind){ case TWITTER: icon_id = ICON_NOTIFICATION_TWITTER; + color_id = ColorConst.COLOR_BlueMoon; break; case EMAIL: icon_id = ICON_GENERIC_EMAIL; + color_id = ColorConst.COLOR_JaegerGreen; break; case FACEBOOK: icon_id = ICON_NOTIFICATION_FACEBOOK; + color_id = ColorConst.COLOR_VeryLightBlue; break; case CHAT: icon_id = ICON_NOTIFICATION_HIPCHAT; + color_id = ColorConst.COLOR_Inchworm; break; default: icon_id = ICON_NOTIFICATION_GENERIC; + color_id = ColorConst.COLOR_Red; break; } break; @@ -744,8 +753,8 @@ public class PebbleProtocol extends GBDeviceProtocol { actions_length = (short) (ACTION_LENGTH_MIN * actions_count + dismiss_string.length() + open_string.length()); } - byte attributes_count = 1; // icon - short attributes_length = (short) (7 + actions_length); // icon + byte attributes_count = 2; // icon + short attributes_length = (short) (11 + actions_length); if (parts != null) { for (String s : parts) { if (s == null || s.equals("")) { @@ -800,6 +809,10 @@ public class PebbleProtocol extends GBDeviceProtocol { buf.putShort((short) 4); // length of int buf.putInt(0x80000000 | icon_id); + buf.put((byte) 28); // background_color + buf.putShort((short) 1); // length of int + buf.put(color_id); + // dismiss action buf.put(dismiss_action_id); buf.put((byte) 0x02); // generic action, dismiss did not do anything