mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-31 19:45:27 +02:00
Xiaomi Protobuf: Fix deleting first screen
This commit is contained in:
parent
82d12e5fbe
commit
da74ad036a
@ -346,12 +346,19 @@ public class XiaomiWidgetManager implements WidgetManager {
|
|||||||
final XiaomiProto.WidgetScreens.Builder builder = XiaomiProto.WidgetScreens.newBuilder(rawWidgetScreens)
|
final XiaomiProto.WidgetScreens.Builder builder = XiaomiProto.WidgetScreens.newBuilder(rawWidgetScreens)
|
||||||
.clearWidgetScreen();
|
.clearWidgetScreen();
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
for (final XiaomiProto.WidgetScreen screen : rawWidgetScreens.getWidgetScreenList()) {
|
for (final XiaomiProto.WidgetScreen screen : rawWidgetScreens.getWidgetScreenList()) {
|
||||||
if (String.valueOf(screen.getId()).equals(widgetScreen.getId())) {
|
if (String.valueOf(screen.getId()).equals(widgetScreen.getId())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.addWidgetScreen(screen);
|
// Ensure the IDs stay sequential and start at 1
|
||||||
|
builder.addWidgetScreen(
|
||||||
|
XiaomiProto.WidgetScreen.newBuilder()
|
||||||
|
.mergeFrom(screen)
|
||||||
|
.setId(i++)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPrefs().getPreferences().edit()
|
getPrefs().getPreferences().edit()
|
||||||
|
Loading…
Reference in New Issue
Block a user