Package structure: moved UI utils

Part of #963.
This commit is contained in:
Dennis Guse
2022-01-15 22:32:32 +01:00
parent 7caf33fb66
commit 7484ab03ce
23 changed files with 23 additions and 24 deletions
@@ -0,0 +1,22 @@
package de.dennisguse.opentracks.settings;
import androidx.annotation.NonNull;
import androidx.preference.Preference;
public class HackUtils {
private HackUtils() {
}
/**
* Triggers a redraw of the summary of a preference if it was set programmatically.
* Need to trigger androidx.preference.preferences.notifyChanged() to trigger a redraw, but method is protected.
* This workaround also works when this preference has not changed, but it's entries (see R.string.stats_rate_key).
* TODO
*/
public static void invalidatePreference(@NonNull Preference preference) {
boolean isEnabled = preference.isEnabled();
preference.setVisible(!isEnabled);
preference.setVisible(isEnabled);
}
}