1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 09:17:29 +01:00

Categorized Google Voice messages as GENERIC_SMS, cleaned up some Casio support code, added portion of message text to notification title

This commit is contained in:
foxstidious 2023-09-28 00:11:52 -04:00 committed by José Rebelo
parent 6ef6c9be43
commit d9d6a8dc29
2 changed files with 12 additions and 5 deletions

View File

@ -61,6 +61,7 @@ public class AppNotificationType extends HashMap<String, NotificationType> {
put("com.google.android.talk", NotificationType.GOOGLE_HANGOUTS);
put("com.google.android.apps.maps", NotificationType.GOOGLE_MAPS);
put("com.google.android.apps.photos", NotificationType.GOOGLE_PHOTOS);
put("com.google.android.apps.googlevoice", NotificationType.GENERIC_SMS);
// Conversations
put("eu.siacs.conversations", NotificationType.CONVERSATIONS);

View File

@ -256,6 +256,9 @@ public class CasioGBX100DeviceSupport extends Casio2C2DSupport implements Shared
}
private void showNotification(byte icon, String sender, String title, String message, int id, boolean delete) {
title = title + "-" + message;
title = title.substring(0, Math.min(title.length(), 30));
title = title + "..";
byte[] titleBytes = new byte[0];
if(title != null)
titleBytes = title.getBytes(StandardCharsets.UTF_8);
@ -342,20 +345,23 @@ public class CasioGBX100DeviceSupport extends Casio2C2DSupport implements Shared
public void onNotification(final NotificationSpec notificationSpec) {
byte icon;
boolean autoremove = false;
switch (notificationSpec.type.getGenericType()) {
case "generic_calendar":
switch (notificationSpec.type) {
case GENERIC_CALENDAR:
icon = CasioConstants.CATEGORY_SCHEDULE_AND_ALARM;
break;
case "generic_email":
case GENERIC_EMAIL:
icon = CasioConstants.CATEGORY_EMAIL;
break;
case "generic_sms":
case GENERIC_SMS:
icon = CasioConstants.CATEGORY_SNS;
SharedPreferences sharedPreferences = GBApplication.getDeviceSpecificSharedPrefs(getDevice().getAddress());
autoremove = sharedPreferences.getBoolean(PREF_AUTOREMOVE_MESSAGE, false);
break;
case GENERIC_PHONE:
icon = CasioConstants.CATEGORY_INCOMING_CALL;
break;
default:
icon = CasioConstants.CATEGORY_SNS;
icon = CasioConstants.CATEGORY_OTHER;
break;
}
LOG.info("onNotification id=" + notificationSpec.getId());