1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-07 13:47:49 +02:00

Debug Activity: Add confirmation dialog before removing device preferences

This commit is contained in:
José Rebelo 2022-10-30 09:37:42 +00:00
parent f7074c327d
commit 3a72a11e17
2 changed files with 15 additions and 6 deletions

View File

@ -478,12 +478,19 @@ public class DebugActivity extends AbstractGBActivity {
removeDevicePreferencesButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = getApplicationContext();
GBApplication gbApp = (GBApplication) context;
List<GBDevice> devices = gbApp.getDeviceManager().getSelectedDevices();
for(GBDevice device : devices){
GBApplication.deleteDeviceSpecificSharedPrefs(device.getAddress());
}
new AlertDialog.Builder(DebugActivity.this)
.setCancelable(true)
.setTitle(R.string.debugactivity_confirm_remove_device_preferences_title)
.setMessage(R.string.debugactivity_confirm_remove_device_preferences)
.setPositiveButton(R.string.ok, (dialog, which) -> {
final GBApplication gbApp = (GBApplication) getApplicationContext();
final List<GBDevice> devices = gbApp.getDeviceManager().getSelectedDevices();
for(final GBDevice device : devices){
GBApplication.deleteDeviceSpecificSharedPrefs(device.getAddress());
}
})
.setNegativeButton(R.string.Cancel, (dialog, which) -> {})
.show();
}
});

View File

@ -95,6 +95,8 @@
<string name="title_activity_debug">Debug</string>
<string name="debugactivity_really_factoryreset_title">Really factory reset?</string>
<string name="debugactivity_really_factoryreset">Doing a factory reset will delete all data from the connected device (if supported). Xiaomi/Huami devices also change Bluetooth MAC address, so they appear as a new devices to Gadgetbridge.</string>
<string name="debugactivity_confirm_remove_device_preferences_title">Remove device preferences?</string>
<string name="debugactivity_confirm_remove_device_preferences">This will reset the device preferences for all connected devices. Are you sure?</string>
<!-- Strings related to AppManager -->
<string name="title_activity_appmanager">App Manager</string>
<string name="appmanager_cached_watchapps_watchfaces">Apps in cache</string>