mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-27 11:05:49 +01:00
Fossil HR: In notifications display sender, and if not available, notification title (like other devices do too)
This commit is contained in:
parent
9cd4ee0f29
commit
3722a9b432
@ -59,6 +59,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fos
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.widget.Widget;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.widget.Widget;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.widget.WidgetsPutRequest;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.widget.WidgetsPutRequest;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||||
|
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest.MUSIC_PHONE_REQUEST;
|
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest.MUSIC_PHONE_REQUEST;
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest.MUSIC_WATCH_REQUEST;
|
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest.MUSIC_WATCH_REQUEST;
|
||||||
@ -446,16 +447,16 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean playRawNotification(NotificationSpec notificationSpec) {
|
public boolean playRawNotification(NotificationSpec notificationSpec) {
|
||||||
String sender = notificationSpec.sender;
|
String senderOrTitle = StringUtils.getFirstOf(notificationSpec.sender, notificationSpec.title);
|
||||||
if (sender == null) sender = notificationSpec.sourceName;
|
|
||||||
try {
|
try {
|
||||||
for (NotificationHRConfiguration configuration : this.notificationConfigurations){
|
for (NotificationHRConfiguration configuration : this.notificationConfigurations){
|
||||||
if(configuration.getPackageName().equals(notificationSpec.sourceAppId)){
|
if(configuration.getPackageName().equals(notificationSpec.sourceAppId)){
|
||||||
queueWrite(new PlayNotificationRequest(notificationSpec.sourceAppId, notificationSpec.sender, notificationSpec.body, this));
|
queueWrite(new PlayNotificationRequest(notificationSpec.sourceAppId, senderOrTitle, notificationSpec.body, this));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
queueWrite(new PlayNotificationRequest("generic", notificationSpec.sender, notificationSpec.body, this));
|
queueWrite(new PlayNotificationRequest("generic", senderOrTitle, notificationSpec.body, this));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user