From eda1532dcd8ab6b742ac25ac005e65c14113a32f Mon Sep 17 00:00:00 2001 From: Frank Knoll Date: Wed, 29 May 2024 21:36:55 +0200 Subject: [PATCH] updating SearchPreference dependency --- OsmAnd/build-common.gradle | 2 +- .../settings/fragments/BaseSettingsFragment.java | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/OsmAnd/build-common.gradle b/OsmAnd/build-common.gradle index 8d013574dbd..a36a170661f 100644 --- a/OsmAnd/build-common.gradle +++ b/OsmAnd/build-common.gradle @@ -386,7 +386,7 @@ dependencies { implementation "androidx.car.app:app-projected:1.2.0" implementation 'com.google.android.gms:play-services-location:21.0.1' - implementation 'com.github.KnollFrank:SearchPreference:ce6f01bad4' + implementation 'com.github.KnollFrank:SearchPreference:0bb034822d' implementation 'com.google.guava:guava:33.2.0-android' //implementation "androidx.tracing:tracing:1.1.0" diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index 719dbeb4ea2..efe3698762f 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -37,7 +37,6 @@ import androidx.preference.Preference.OnPreferenceChangeListener; import androidx.preference.Preference.OnPreferenceClickListener; import androidx.preference.PreferenceCategory; -import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceGroup; import androidx.preference.PreferenceGroupAdapter; import androidx.preference.PreferenceManager; @@ -49,7 +48,6 @@ import com.bytehamster.lib.preferencesearch.BaseSearchPreferenceFragment; import com.bytehamster.lib.preferencesearch.PreferenceFragments; -import com.bytehamster.lib.preferencesearch.PreferenceScreensProvider; import com.bytehamster.lib.preferencesearch.SearchConfiguration; import com.bytehamster.lib.preferencesearch.SearchPreference; import com.google.android.material.appbar.AppBarLayout; @@ -88,7 +86,6 @@ import java.io.Serializable; import java.util.Set; -import java.util.stream.Collectors; public abstract class BaseSettingsFragment extends BaseSearchPreferenceFragment implements OnPreferenceChangeListener, OnPreferenceClickListener, AppModeChangedListener, OnConfirmPreferenceChange, OnPreferenceChanged { @@ -398,19 +395,11 @@ private void setupSearchablePreferences() { final SearchConfiguration config = searchPreference.getSearchConfiguration(); config.setActivity(getMapActivity()); config.setFragmentContainerViewId(FRAGMENT_CONTAINER_VIEW); - config.setPreferenceFragmentsSupplier(() -> getPreferenceFragments(new MainSettingsFragment())); + config.setPreferenceFragmentsSupplier(() -> PreferenceFragments.getPreferenceFragments(new MainSettingsFragment(), getActivity(), FRAGMENT_CONTAINER_VIEW)); config.setFuzzySearchEnabled(false); } } - private Set> getPreferenceFragments(final PreferenceFragmentCompat root) { - return new PreferenceScreensProvider(new PreferenceFragments(getActivity(), FRAGMENT_CONTAINER_VIEW)) - .getPreferenceScreens(root) - .stream() - .map(preferenceScreenWithHost -> preferenceScreenWithHost.host) - .collect(Collectors.toSet()); - } - protected void onBindPreferenceViewHolder(@NonNull Preference preference, @NonNull PreferenceViewHolder holder) { if (preference.isSelectable()) { View selectableView = holder.itemView.findViewById(R.id.selectable_list_item);