diff --git a/OsmAnd/build-common.gradle b/OsmAnd/build-common.gradle index 7add2932dab..e6e43c78abd 100644 --- a/OsmAnd/build-common.gradle +++ b/OsmAnd/build-common.gradle @@ -375,7 +375,7 @@ dependencies { implementation "androidx.car.app:app-projected:1.4.0" implementation 'com.google.android.gms:play-services-location:21.3.0' - implementation 'com.github.KnollFrank:SettingsSearch:ac1d019831' + implementation 'com.github.KnollFrank:SettingsSearch:290839e5ee' // https://mvnrepository.com/artifact/com.google.guava/guava implementation 'com.google.guava:guava:33.3.1-android' diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/search/IncludePreferenceInSearchResultsPredicate.java b/OsmAnd/src/net/osmand/plus/settings/fragments/search/IncludePreferenceInSearchResultsPredicate.java index 77ecf77d5e3..2f47789886c 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/search/IncludePreferenceInSearchResultsPredicate.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/search/IncludePreferenceInSearchResultsPredicate.java @@ -4,6 +4,7 @@ import androidx.preference.PreferenceFragmentCompat; +import net.osmand.plus.plugins.OsmandPlugin; import net.osmand.plus.plugins.PluginsHelper; import net.osmand.plus.plugins.development.DevelopmentSettingsFragment; import net.osmand.plus.plugins.development.OsmandDevelopmentPlugin; @@ -13,16 +14,25 @@ class IncludePreferenceInSearchResultsPredicate implements de.KnollFrank.lib.settingssearch.provider.IncludePreferenceInSearchResultsPredicate { @Override - public boolean includePreferenceOfHostInSearchResults(final SearchablePreferencePOJO preference, final Class host) { + public boolean includePreferenceInSearchResults(final SearchablePreferencePOJO preference, final Class hostOfPreference) { + return !isPreferenceConnectedToAnInactivePlugin(preference, hostOfPreference); + } + + private static boolean isPreferenceConnectedToAnInactivePlugin(final SearchablePreferencePOJO preference, final Class hostOfPreference) { // FK-TODO: handle also all the other plugins besides OsmandDevelopmentPlugin - if (isDevelopmentSettingsPreference(preference, host) && !PluginsHelper.isActive(OsmandDevelopmentPlugin.class)) { - return false; - } - return true; + return isPreferenceConnectedToInactivePlugin( + preference, + hostOfPreference, + DevelopmentSettingsFragment.class, + OsmandDevelopmentPlugin.class); } - private static boolean isDevelopmentSettingsPreference(final SearchablePreferencePOJO preference, - final Class host) { - return DevelopmentSettingsFragment.class.equals(host) || isPreferenceConnectedToPlugin(preference, OsmandDevelopmentPlugin.class); + private static boolean isPreferenceConnectedToInactivePlugin( + final SearchablePreferencePOJO preference, + final Class hostOfPreference, + final Class preferenceFragment, + final Class plugin) { + return (preferenceFragment.equals(hostOfPreference) || isPreferenceConnectedToPlugin(preference, plugin)) && + !PluginsHelper.isActive(plugin); } }