Skip to content

Commit

Permalink
displaying progress when building search database
Browse files Browse the repository at this point in the history
  • Loading branch information
KnollFrank committed Nov 28, 2024
1 parent b523c2d commit 759e955
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion OsmAnd/build-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
3 changes: 2 additions & 1 deletion OsmAnd/src/net/osmand/plus/activities/MapActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -966,7 +967,7 @@ protected void onStart() {
{
final var createSearchDatabaseTask = _getCreateSearchDatabaseTask();
this.createSearchDatabaseTask = Optional.of(createSearchDatabaseTask);
createSearchDatabaseTask.execute();
createSearchDatabaseTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ public class SettingsSearchButtonHelper {
private final BaseSettingsFragment rootSearchPreferenceFragment;
private final @IdRes int fragmentContainerViewId;
private final SearchDatabaseStatusHandler searchDatabaseStatusHandler;
private final Supplier<Optional<LongRunningTask<MergedPreferenceScreenData>>> getCreateSearchDatabaseTask;

public SettingsSearchButtonHelper(final BaseSettingsFragment rootSearchPreferenceFragment,
final @IdRes int fragmentContainerViewId,
final OsmandApplication app) {
final OsmandApplication app,
final Supplier<Optional<LongRunningTask<MergedPreferenceScreenData>>> 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) {
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 759e955

Please sign in to comment.