osmeditor4android icon indicating copy to clipboard operation
osmeditor4android copied to clipboard

Add reset to default button for each preference individually

Open jidanni opened this issue 2 years ago • 3 comments
trafficstars

Each time we want to reset an individual preference to its default, for example: Screenshot_20230316-105457.jpg We must first look it up in Help to find what the default value is:

Max line width Maximum width lines will increase to when zooming in. Default: 16 pixels.

It would be great if each preference had its own Reset to Default button too.

jidanni avatar Mar 16 '23 02:03 jidanni

This would seem to be an awful lot of work for something that would essentially never be used. Note that in the odd case you want to use the original value, they are all documented here http://vespucci.io/help/en/Advanced%20preferences/#max-line-width

simonpoole avatar Mar 16 '23 11:03 simonpoole

I guess we've all grown to expect them everywhere setting might be, example: Screenshot_20230316_165127_Learn Tagalog Lite.jpg

jidanni avatar Mar 17 '23 13:03 jidanni

https://developer.android.com/reference/androidx/preference/Preference doesn't retain the default value and doesn't provide a method to access it.

It is possible to reset all preferences at once by clearing all current values and then forcing a reread of the XML file, see https://developer.android.com/reference/androidx/preference/PreferenceManager#setDefaultValues(android.content.Context,int,boolean)

Potentially something could be hacked by sub-classing all the Preference classes we use and overriding https://developer.android.com/reference/androidx/preference/Preference#onGetDefaultValue(android.content.res.TypedArray,int) however this would only work for new installs (and as already pointed out an insane amount of work relative to the value add this feature would provide).

simonpoole avatar Nov 19 '23 13:11 simonpoole