mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-11 17:41:57 +01:00
Debug Activity: Add confirmation dialog before removing device preferences
This commit is contained in:
parent
f7074c327d
commit
3a72a11e17
@ -478,12 +478,19 @@ public class DebugActivity extends AbstractGBActivity {
|
|||||||
removeDevicePreferencesButton.setOnClickListener(new View.OnClickListener() {
|
removeDevicePreferencesButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Context context = getApplicationContext();
|
new AlertDialog.Builder(DebugActivity.this)
|
||||||
GBApplication gbApp = (GBApplication) context;
|
.setCancelable(true)
|
||||||
List<GBDevice> devices = gbApp.getDeviceManager().getSelectedDevices();
|
.setTitle(R.string.debugactivity_confirm_remove_device_preferences_title)
|
||||||
for(GBDevice device : devices){
|
.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());
|
GBApplication.deleteDeviceSpecificSharedPrefs(device.getAddress());
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.Cancel, (dialog, which) -> {})
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -95,6 +95,8 @@
|
|||||||
<string name="title_activity_debug">Debug</string>
|
<string name="title_activity_debug">Debug</string>
|
||||||
<string name="debugactivity_really_factoryreset_title">Really factory reset?</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_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 -->
|
<!-- Strings related to AppManager -->
|
||||||
<string name="title_activity_appmanager">App Manager</string>
|
<string name="title_activity_appmanager">App Manager</string>
|
||||||
<string name="appmanager_cached_watchapps_watchfaces">Apps in cache</string>
|
<string name="appmanager_cached_watchapps_watchfaces">Apps in cache</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user