1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

added data loss fix to debug activity

This commit is contained in:
DESKTOP-IF738U6\Tim 2022-01-14 15:21:00 +08:00 committed by vanous
parent 470f1e0165
commit 5de5f7bb14

View File

@ -101,6 +101,8 @@ import nodomain.freeyourgadget.gadgetbridge.util.WidgetPreferenceStorage;
public class DebugActivity extends AbstractGBActivity {
private static final Logger LOG = LoggerFactory.getLogger(DebugActivity.class);
private static Bundle dataLossSave;
private static final String EXTRA_REPLY = "reply";
private static final String ACTION_REPLY
= "nodomain.freeyourgadget.gadgetbridge.DebugActivity.action.reply";
@ -508,6 +510,29 @@ public class DebugActivity extends AbstractGBActivity {
}
@Override
protected void onPause() {
super.onPause();
if (dataLossSave != null ) {
dataLossSave.clear();
dataLossSave = null ;
}
dataLossSave = new Bundle();
dataLossSave.putString("editContent", editContent.getText().toString());
}
@Override
protected void onResume() {
super.onResume();
if (dataLossSave != null ) {
editContent.setText(dataLossSave.getString("editContent", ""));
}else{
editContent.setText("Test");
}
}
private void deleteWidgetsPrefs() {
WidgetPreferenceStorage widgetPreferenceStorage = new WidgetPreferenceStorage();
widgetPreferenceStorage.deleteWidgetsPrefs(DebugActivity.this);