forked from upstream-mirrors/OpenTracks
Cleanup: use PreferenceUtils.isKey(List).
This commit is contained in:
@@ -62,7 +62,7 @@ public class StatisticsRecordingFragment extends Fragment {
|
||||
updateDataOnUI();
|
||||
}
|
||||
|
||||
if (PreferencesUtils.isKey(R.string.stats_custom_layouts_key, key) || PreferencesUtils.isKey(R.string.stats_custom_layout_selected_layout_key, key)) {
|
||||
if (PreferencesUtils.isKey(List.of(R.string.stats_custom_layouts_key, R.string.stats_custom_layout_selected_layout_key), key)) {
|
||||
onLayoutChanged(PreferencesUtils.getCustomLayout());
|
||||
}
|
||||
};
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.mediarouter.media.MediaRouter;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
||||
import de.dennisguse.opentracks.R;
|
||||
import de.dennisguse.opentracks.data.ContentProviderUtils;
|
||||
@@ -219,7 +220,7 @@ public class VoiceAnnouncementManager implements SharedPreferences.OnSharedPrefe
|
||||
setFrequency(PreferencesUtils.getVoiceAnnouncementFrequency());
|
||||
}
|
||||
|
||||
if (PreferencesUtils.isKey(new int[]{R.string.voice_announcement_distance_key, R.string.stats_units_key}, key)) {
|
||||
if (PreferencesUtils.isKey(List.of(R.string.voice_announcement_distance_key, R.string.stats_units_key), key)) {
|
||||
setFrequency(PreferencesUtils.getVoiceAnnouncementDistance());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class PreferencesUtils {
|
||||
return key == null || key.equals(getKey(keyId));
|
||||
}
|
||||
|
||||
public static boolean isKey(int[] keyIds, String key) {
|
||||
public static boolean isKey(List<Integer> keyIds, String key) {
|
||||
for (int keyId : keyIds) {
|
||||
if (isKey(keyId, key)) {
|
||||
return true;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class IntervalsFragment extends Fragment {
|
||||
private IntervalListViewBinding viewBinding;
|
||||
|
||||
protected final SharedPreferences.OnSharedPreferenceChangeListener sharedPreferenceChangeListener = (sharedPreferences, key) -> {
|
||||
if (PreferencesUtils.isKey(R.string.stats_units_key, key) || PreferencesUtils.isKey(R.string.stats_rate_key, key)) {
|
||||
if (PreferencesUtils.isKey(List.of(R.string.stats_units_key, R.string.stats_rate_key), key)) {
|
||||
updateIntervals(PreferencesUtils.getUnitSystem(), selectedInterval);
|
||||
if (intervalsAdapter != null) {
|
||||
intervalsAdapter.notifyDataSetChanged();
|
||||
|
||||
Reference in New Issue
Block a user