1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 13:26:50 +01:00

[Wena3/BUG] Don't hide music title when momentarily pausing and resuming

This commit is contained in:
akasaka 2023-09-25 13:32:03 +09:00
parent 488af72341
commit 1140e60a88

View File

@ -138,6 +138,7 @@ public class SonyWena3DeviceSupport extends AbstractBTLEDeviceSupport {
private static final int INCOMING_CALL_ID = 3939; private static final int INCOMING_CALL_ID = 3939;
private static final Logger LOG = LoggerFactory.getLogger(SonyWena3DeviceSupport.class); private static final Logger LOG = LoggerFactory.getLogger(SonyWena3DeviceSupport.class);
private String lastMusicInfo = null; private String lastMusicInfo = null;
private MusicStateSpec lastMusicState = null;
private final List<CalendarEventSpec> calendarEvents = new ArrayList<>(); private final List<CalendarEventSpec> calendarEvents = new ArrayList<>();
private final ActivitySyncPacketProcessor activitySyncHandler = new ActivitySyncPacketProcessor(); private final ActivitySyncPacketProcessor activitySyncHandler = new ActivitySyncPacketProcessor();
private AppSpecificNotificationSettingsRepository perAppNotificationSettingsRepository = null; private AppSpecificNotificationSettingsRepository perAppNotificationSettingsRepository = null;
@ -206,7 +207,9 @@ public class SonyWena3DeviceSupport extends AbstractBTLEDeviceSupport {
NotificationServiceStatusRequest request = new NotificationServiceStatusRequest(characteristic.getValue()); NotificationServiceStatusRequest request = new NotificationServiceStatusRequest(characteristic.getValue());
if(request.requestType == StatusRequestType.MUSIC_INFO_FETCH.value) { if(request.requestType == StatusRequestType.MUSIC_INFO_FETCH.value) {
LOG.debug("Request for music info received"); LOG.debug("Request for music info received");
sendMusicInfo(lastMusicInfo); if(lastMusicState != null && lastMusicState.state == MusicStateSpec.STATE_PLAYING && lastMusicInfo != null) {
sendMusicInfo(lastMusicInfo);
}
return true; return true;
} }
else if(request.requestType == StatusRequestType.LOCATE_PHONE.value) { else if(request.requestType == StatusRequestType.LOCATE_PHONE.value) {
@ -425,11 +428,13 @@ public class SonyWena3DeviceSupport extends AbstractBTLEDeviceSupport {
@Override @Override
public void onSetMusicState(MusicStateSpec stateSpec) { public void onSetMusicState(MusicStateSpec stateSpec) {
if(stateSpec.state == MusicStateSpec.STATE_PLAYING && lastMusicInfo != null) { if(stateSpec.state == MusicStateSpec.STATE_PLAYING && lastMusicInfo != null) {
sendMusicInfo(lastMusicInfo); if(lastMusicInfo != null) {
sendMusicInfo(lastMusicInfo);
}
} else if (stateSpec.state == MusicStateSpec.STATE_STOPPED || stateSpec.state == MusicStateSpec.STATE_PAUSED) { } else if (stateSpec.state == MusicStateSpec.STATE_STOPPED || stateSpec.state == MusicStateSpec.STATE_PAUSED) {
lastMusicInfo = "";
sendMusicInfo(""); sendMusicInfo("");
} }
lastMusicState = stateSpec;
} }
@Override @Override