diff --git a/OsmAnd/build-common.gradle b/OsmAnd/build-common.gradle index b12f9c697f7..d8957acf2eb 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:2a9e765137' + implementation 'com.github.KnollFrank:SettingsSearch:fd20d05048' // 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/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index e300939f947..dac5c66bd20 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -15,6 +15,7 @@ import android.content.IntentFilter; import android.content.res.Configuration; import android.net.Uri; +import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.view.KeyEvent; @@ -966,7 +967,7 @@ protected void onStart() { { final var createSearchDatabaseTask = _getCreateSearchDatabaseTask(); this.createSearchDatabaseTask = Optional.of(createSearchDatabaseTask); - createSearchDatabaseTask.execute(); + createSearchDatabaseTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/MainSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/MainSettingsFragment.java index 780f5ef2d6e..a0c463ffa58 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/MainSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/MainSettingsFragment.java @@ -307,7 +307,8 @@ protected void createToolbar(@NonNull final LayoutInflater inflater, @NonNull fi new SettingsSearchButtonHelper( this, R.id.fragmentContainer, - app); + app, + getMapActivity()::getCreateSearchDatabaseTask); settingsSearchButtonHelper.configureSettingsSearchButton(view.findViewById(R.id.action_button)); } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/search/PreferenceSearchablePredicate.java b/OsmAnd/src/net/osmand/plus/settings/fragments/search/PreferenceSearchablePredicate.java index 4014a16fe25..51c2b98bbd2 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/search/PreferenceSearchablePredicate.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/search/PreferenceSearchablePredicate.java @@ -21,7 +21,7 @@ class PreferenceSearchablePredicate implements de.KnollFrank.lib.settingssearch. R.layout.drawer_divider); @Override - public boolean isPreferenceOfHostSearchable(final Preference preference, final PreferenceFragmentCompat host) { + public boolean isPreferenceSearchable(final Preference preference, final PreferenceFragmentCompat host) { return !NON_SEARCHABLE_LAYOUT_RESIDS.contains(preference.getLayoutResource()); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/search/SettingsSearchButtonHelper.java b/OsmAnd/src/net/osmand/plus/settings/fragments/search/SettingsSearchButtonHelper.java index e1f15dc60b0..a2f01d4991d 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/search/SettingsSearchButtonHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/search/SettingsSearchButtonHelper.java @@ -24,16 +24,19 @@ public class SettingsSearchButtonHelper { private final BaseSettingsFragment rootSearchPreferenceFragment; private final @IdRes int fragmentContainerViewId; private final SearchDatabaseStatusHandler searchDatabaseStatusHandler; + private final Supplier>> getCreateSearchDatabaseTask; public SettingsSearchButtonHelper(final BaseSettingsFragment rootSearchPreferenceFragment, final @IdRes int fragmentContainerViewId, - final OsmandApplication app) { + final OsmandApplication app, + final Supplier>> getCreateSearchDatabaseTask) { this.rootSearchPreferenceFragment = rootSearchPreferenceFragment; this.fragmentContainerViewId = fragmentContainerViewId; this.searchDatabaseStatusHandler = new SearchDatabaseStatusHandler( new SetStringPreference( app.getSettings().PLUGINS_COVERED_BY_SETTINGS_SEARCH)); + this.getCreateSearchDatabaseTask = getCreateSearchDatabaseTask; } public void configureSettingsSearchButton(final ImageView settingsSearchButton) { @@ -70,7 +73,7 @@ public static SearchPreferenceFragments createSearchPreferenceFragments( private void onClickShowSearchPreferenceFragment(final ImageView searchPreferenceButton) { final SearchPreferenceFragments searchPreferenceFragments = createSearchPreferenceFragments( - Optional::empty, + getCreateSearchDatabaseTask, rootSearchPreferenceFragment.requireActivity(), fragmentContainerViewId, rootSearchPreferenceFragment.getClass());