2024-01-10 18:54:00 +01:00
|
|
|
/* Copyright (C) 2015-2024 Andreas Shimokawa, AnthonyDiGirolamo, Carsten
|
|
|
|
Pfeiffer, Daniele Gobbetti, Davis Mosenkovs, Frank Slezak, José Rebelo,
|
|
|
|
Kaz Wolfe, Kevin Richter, Lukas Veneziano, Maxim Baz, musover
|
2017-03-10 14:53:19 +01:00
|
|
|
|
|
|
|
This file is part of Gadgetbridge.
|
|
|
|
|
|
|
|
Gadgetbridge is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Gadgetbridge is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
2024-01-10 18:54:00 +01:00
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
2015-09-13 00:39:53 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.model;
|
|
|
|
|
2022-06-14 20:15:51 +02:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
2016-12-09 17:54:19 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.pebble.PebbleColor;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.pebble.PebbleIconID;
|
|
|
|
|
2015-09-24 14:45:21 +02:00
|
|
|
public enum NotificationType {
|
2015-09-13 00:39:53 +02:00
|
|
|
|
2017-03-02 00:27:54 +01:00
|
|
|
// TODO: this this pebbleism needs to be moved somewhere else
|
2017-09-19 13:24:31 +02:00
|
|
|
UNKNOWN(PebbleIconID.NOTIFICATION_GENERIC, PebbleColor.DarkCandyAppleRed),
|
2016-12-09 17:54:19 +01:00
|
|
|
|
2017-09-14 07:10:22 +02:00
|
|
|
AMAZON(PebbleIconID.NOTIFICATION_AMAZON, PebbleColor.ChromeYellow),
|
|
|
|
BBM(PebbleIconID.NOTIFICATION_BLACKBERRY_MESSENGER, PebbleColor.DarkGray),
|
2016-12-09 17:54:19 +01:00
|
|
|
CONVERSATIONS(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.Inchworm),
|
2017-09-14 07:10:22 +02:00
|
|
|
FACEBOOK(PebbleIconID.NOTIFICATION_FACEBOOK, PebbleColor.CobaltBlue),
|
|
|
|
FACEBOOK_MESSENGER(PebbleIconID.NOTIFICATION_FACEBOOK_MESSENGER, PebbleColor.BlueMoon),
|
|
|
|
GENERIC_ALARM_CLOCK(PebbleIconID.ALARM_CLOCK, PebbleColor.Red),
|
|
|
|
GENERIC_CALENDAR(PebbleIconID.TIMELINE_CALENDAR, PebbleColor.BlueMoon),
|
|
|
|
GENERIC_EMAIL(PebbleIconID.GENERIC_EMAIL, PebbleColor.Orange),
|
2016-12-09 17:54:19 +01:00
|
|
|
GENERIC_NAVIGATION(PebbleIconID.LOCATION, PebbleColor.Orange),
|
2017-09-14 07:10:22 +02:00
|
|
|
GENERIC_PHONE(PebbleIconID.DURING_PHONE_CALL, PebbleColor.JaegerGreen),
|
2016-12-09 17:54:19 +01:00
|
|
|
GENERIC_SMS(PebbleIconID.GENERIC_SMS, PebbleColor.VividViolet),
|
2017-08-28 19:14:06 +02:00
|
|
|
GMAIL(PebbleIconID.NOTIFICATION_GMAIL, PebbleColor.Red),
|
2017-09-14 07:10:22 +02:00
|
|
|
GOOGLE_HANGOUTS(PebbleIconID.NOTIFICATION_GOOGLE_HANGOUTS, PebbleColor.JaegerGreen),
|
|
|
|
GOOGLE_INBOX(PebbleIconID.NOTIFICATION_GOOGLE_INBOX, PebbleColor.BlueMoon),
|
|
|
|
GOOGLE_MAPS(PebbleIconID.NOTIFICATION_GOOGLE_MAPS, PebbleColor.BlueMoon),
|
|
|
|
GOOGLE_MESSENGER(PebbleIconID.NOTIFICATION_GOOGLE_MESSENGER, PebbleColor.VividCerulean),
|
|
|
|
GOOGLE_PHOTOS(PebbleIconID.NOTIFICATION_GOOGLE_PHOTOS, PebbleColor.BlueMoon),
|
|
|
|
HIPCHAT(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.CobaltBlue),
|
|
|
|
INSTAGRAM(PebbleIconID.NOTIFICATION_INSTAGRAM, PebbleColor.CobaltBlue),
|
|
|
|
KAKAO_TALK(PebbleIconID.NOTIFICATION_KAKAOTALK, PebbleColor.Yellow),
|
|
|
|
KIK(PebbleIconID.NOTIFICATION_KIK, PebbleColor.IslamicGreen),
|
2017-09-19 13:24:31 +02:00
|
|
|
LIGHTHOUSE(PebbleIconID.NOTIFICATION_LIGHTHOUSE, PebbleColor.PictonBlue), // ??? - No idea what this is, but it works.
|
2017-09-14 07:10:22 +02:00
|
|
|
LINE(PebbleIconID.NOTIFICATION_LINE, PebbleColor.IslamicGreen),
|
|
|
|
LINKEDIN(PebbleIconID.NOTIFICATION_LINKEDIN, PebbleColor.CobaltBlue),
|
|
|
|
MAILBOX(PebbleIconID.NOTIFICATION_MAILBOX, PebbleColor.VividCerulean),
|
|
|
|
OUTLOOK(PebbleIconID.NOTIFICATION_OUTLOOK, PebbleColor.BlueMoon),
|
2018-01-08 15:28:57 +01:00
|
|
|
BUSINESS_CALENDAR(PebbleIconID.TIMELINE_CALENDAR, PebbleColor.BlueMoon),
|
2017-01-03 20:36:39 +01:00
|
|
|
RIOT(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.LavenderIndigo),
|
2016-12-09 17:54:19 +01:00
|
|
|
SIGNAL(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.BlueMoon),
|
2020-10-24 22:27:01 +02:00
|
|
|
WIRE(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.BlueMoon),
|
2017-09-14 07:10:22 +02:00
|
|
|
SKYPE(PebbleIconID.NOTIFICATION_SKYPE, PebbleColor.VividCerulean),
|
|
|
|
SLACK(PebbleIconID.NOTIFICATION_SLACK, PebbleColor.Folly),
|
|
|
|
SNAPCHAT(PebbleIconID.NOTIFICATION_SNAPCHAT, PebbleColor.Icterine),
|
2017-12-27 09:19:17 +01:00
|
|
|
TELEGRAM(PebbleIconID.NOTIFICATION_TELEGRAM, PebbleColor.VividCerulean),
|
|
|
|
THREEMA(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.JaegerGreen),
|
2018-02-17 17:33:34 +01:00
|
|
|
KONTALK(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.JaegerGreen),
|
2018-02-17 17:39:15 +01:00
|
|
|
ANTOX(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.JaegerGreen),
|
2021-11-21 19:06:32 +01:00
|
|
|
DISCORD(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.Purpureus),
|
2017-09-19 13:24:31 +02:00
|
|
|
TRANSIT(PebbleIconID.LOCATION, PebbleColor.JaegerGreen),
|
2016-12-09 17:54:19 +01:00
|
|
|
TWITTER(PebbleIconID.NOTIFICATION_TWITTER, PebbleColor.BlueMoon),
|
2017-09-14 07:10:22 +02:00
|
|
|
VIBER(PebbleIconID.NOTIFICATION_VIBER, PebbleColor.VividViolet),
|
|
|
|
WECHAT(PebbleIconID.NOTIFICATION_WECHAT, PebbleColor.KellyGreen),
|
|
|
|
WHATSAPP(PebbleIconID.NOTIFICATION_WHATSAPP, PebbleColor.IslamicGreen),
|
2023-10-08 09:30:33 +02:00
|
|
|
YAHOO_MAIL(PebbleIconID.NOTIFICATION_YAHOO_MAIL, PebbleColor.Indigo),
|
2024-04-12 09:21:54 +02:00
|
|
|
COL_REMINDER(PebbleIconID.NOTIFICATION_REMINDER, PebbleColor.IslamicGreen),
|
|
|
|
DELTACHAT(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.BlueMoon);
|
2017-09-14 07:10:22 +02:00
|
|
|
|
2017-03-02 00:27:54 +01:00
|
|
|
// Note: if you add any more constants, update all clients as well
|
2015-09-13 00:39:53 +02:00
|
|
|
|
2017-04-09 01:09:23 +02:00
|
|
|
public final int icon;
|
|
|
|
public final byte color;
|
2016-12-09 17:54:19 +01:00
|
|
|
|
|
|
|
NotificationType(int icon, byte color) {
|
|
|
|
this.icon = icon;
|
|
|
|
this.color = color;
|
|
|
|
}
|
2016-10-10 22:39:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the enum constant as a fixed String value, e.g. to be used
|
|
|
|
* as preference key. In case the keys are ever changed, this method
|
|
|
|
* may be used to bring backward compatibility.
|
|
|
|
*/
|
|
|
|
public String getFixedValue() {
|
|
|
|
return name().toLowerCase();
|
|
|
|
}
|
2016-10-11 15:20:55 +02:00
|
|
|
|
|
|
|
public String getGenericType() {
|
|
|
|
switch (this) {
|
|
|
|
case GENERIC_EMAIL:
|
|
|
|
case GENERIC_NAVIGATION:
|
|
|
|
case GENERIC_SMS:
|
2024-04-10 14:20:20 +02:00
|
|
|
case GENERIC_PHONE:
|
|
|
|
case GENERIC_CALENDAR:
|
2017-02-07 23:49:10 +01:00
|
|
|
case GENERIC_ALARM_CLOCK:
|
2016-10-11 15:20:55 +02:00
|
|
|
return getFixedValue();
|
|
|
|
case FACEBOOK:
|
|
|
|
case TWITTER:
|
2017-09-14 07:10:22 +02:00
|
|
|
case SNAPCHAT:
|
|
|
|
case INSTAGRAM:
|
|
|
|
case LINKEDIN:
|
2016-10-11 15:20:55 +02:00
|
|
|
return "generic_social";
|
|
|
|
case CONVERSATIONS:
|
|
|
|
case FACEBOOK_MESSENGER:
|
2017-01-03 20:36:39 +01:00
|
|
|
case RIOT:
|
2016-10-11 15:20:55 +02:00
|
|
|
case SIGNAL:
|
2020-10-24 22:27:01 +02:00
|
|
|
case WIRE:
|
2016-10-11 15:20:55 +02:00
|
|
|
case TELEGRAM:
|
2017-12-27 08:59:09 +01:00
|
|
|
case THREEMA:
|
2018-02-17 17:33:34 +01:00
|
|
|
case KONTALK:
|
2018-02-17 17:39:15 +01:00
|
|
|
case ANTOX:
|
2016-12-09 17:54:19 +01:00
|
|
|
case WHATSAPP:
|
2017-08-28 19:14:06 +02:00
|
|
|
case GOOGLE_MESSENGER:
|
2017-09-14 07:10:22 +02:00
|
|
|
case GOOGLE_HANGOUTS:
|
|
|
|
case HIPCHAT:
|
|
|
|
case SKYPE:
|
|
|
|
case WECHAT:
|
|
|
|
case KIK:
|
|
|
|
case KAKAO_TALK:
|
|
|
|
case SLACK:
|
2017-10-18 00:04:45 +02:00
|
|
|
case LINE:
|
|
|
|
case VIBER:
|
2021-11-21 19:06:32 +01:00
|
|
|
case DISCORD:
|
2024-04-12 09:21:54 +02:00
|
|
|
case DELTACHAT:
|
2016-10-11 15:20:55 +02:00
|
|
|
return "generic_chat";
|
2017-08-28 04:21:45 +02:00
|
|
|
case GMAIL:
|
|
|
|
case GOOGLE_INBOX:
|
2017-09-14 07:10:22 +02:00
|
|
|
case MAILBOX:
|
|
|
|
case OUTLOOK:
|
|
|
|
case YAHOO_MAIL:
|
2017-08-28 04:21:45 +02:00
|
|
|
return "generic_email";
|
2023-10-08 09:30:33 +02:00
|
|
|
case COL_REMINDER:
|
2016-10-11 15:20:55 +02:00
|
|
|
case UNKNOWN:
|
|
|
|
default:
|
|
|
|
return "generic";
|
|
|
|
}
|
|
|
|
}
|
2022-06-14 20:15:51 +02:00
|
|
|
|
|
|
|
public static NotificationType[] sortedValues() {
|
|
|
|
final NotificationType[] sorted = NotificationType.values();
|
|
|
|
Arrays.sort(sorted, new Comparator<NotificationType>() {
|
|
|
|
@Override public int compare(final NotificationType n1, final NotificationType n2) {
|
|
|
|
// Keep unknown first
|
|
|
|
if (n1.equals(NotificationType.UNKNOWN)) {
|
|
|
|
return -1;
|
|
|
|
} else if (n2.equals(NotificationType.UNKNOWN)) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return n1.name().compareToIgnoreCase(n2.name());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return sorted;
|
|
|
|
}
|
2015-09-13 00:39:53 +02:00
|
|
|
}
|