mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-14 14:09:28 +01:00
fixed crash
This commit is contained in:
parent
9e37f13821
commit
197243bf7a
@ -267,10 +267,31 @@ public class QHybridSupport extends QHybridBaseSupport {
|
||||
break;
|
||||
}
|
||||
case QHYBRID_COMMAND_SET_WIDGET_CONTENT: {
|
||||
String id = String.valueOf(intent.getExtras().get("EXTRA_WIDGET_ID"));
|
||||
String content = String.valueOf(intent.getExtras().get("EXTRA_CONTENT"));
|
||||
boolean render = intent.getBooleanExtra("EXTRA_RENDER", true);
|
||||
watchAdapter.setWidgetContent(id, content, render);
|
||||
HashMap<String, String> widgetValues = new HashMap<>();
|
||||
|
||||
for(String key : intent.getExtras().keySet()){
|
||||
if(key.matches("^EXTRA_WIDGET_ID_.*$")){
|
||||
widgetValues.put(key.substring(16), String.valueOf(intent.getExtras().get(key)));
|
||||
}
|
||||
}
|
||||
if(widgetValues.size() > 0){
|
||||
Iterator<String> valuesIterator = widgetValues.keySet().iterator();
|
||||
valuesIterator.next();
|
||||
|
||||
while(valuesIterator.hasNext()){
|
||||
String id = valuesIterator.next();
|
||||
watchAdapter.setWidgetContent(id, widgetValues.get(id), false);
|
||||
}
|
||||
|
||||
valuesIterator = widgetValues.keySet().iterator();
|
||||
String id = valuesIterator.next();
|
||||
watchAdapter.setWidgetContent(id, widgetValues.get(id), true);
|
||||
}else {
|
||||
String id = String.valueOf(intent.getExtras().get("EXTRA_WIDGET_ID"));
|
||||
String content = String.valueOf(intent.getExtras().get("EXTRA_CONTENT"));
|
||||
boolean render = intent.getBooleanExtra("EXTRA_RENDER", true);
|
||||
watchAdapter.setWidgetContent(id, content, render);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -338,7 +359,11 @@ public class QHybridSupport extends QHybridBaseSupport {
|
||||
public void onSetMusicInfo(MusicSpec musicSpec) {
|
||||
super.onSetMusicInfo(musicSpec);
|
||||
|
||||
watchAdapter.setMusicInfo(musicSpec);
|
||||
try {
|
||||
watchAdapter.setMusicInfo(musicSpec);
|
||||
}catch (Exception e){
|
||||
GB.log("setMusicInfo error", GB.ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,6 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music;
|
||||
|
||||
import java.nio.BufferOverflowException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@ -11,7 +12,7 @@ public class MusicInfoSetRequest extends FilePutRequest {
|
||||
super((short) 0x0400, createFile(artist, album, title), adapter);
|
||||
}
|
||||
|
||||
private static byte[] createFile(String artist, String album, String title){
|
||||
private static byte[] createFile(String artist, String album, String title) {
|
||||
int length = artist.length() + album.length() + title.length()
|
||||
+ 3 // null terminators
|
||||
+ 8; // length and header
|
||||
|
Loading…
Reference in New Issue
Block a user