Re-enable SummaryProvider for default_activity.

This commit is contained in:
Dennis Guse
2019-11-08 07:58:30 +01:00
parent bd155cd600
commit 92d3439c3b
3 changed files with 27 additions and 6 deletions
@@ -0,0 +1,22 @@
package de.dennisguse.opentracks.util;
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.setEnabled(!isEnabled);
preference.setEnabled(isEnabled);
}
}