diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/GeneralProfileSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/GeneralProfileSettingsFragment.java index 022d5fc499d..2bb4b509c62 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/GeneralProfileSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/GeneralProfileSettingsFragment.java @@ -425,9 +425,11 @@ public void onApplyPreferenceChange(String prefId, boolean applyToAllProfiles, O public boolean onPreferenceClick(Preference preference) { { final Optional preferenceDialog = - createPreferenceDialog( - preference, - this); + this + .createPreferenceDialog( + preference, + this) + .map(SearchablePreferenceDialogFragmentHolder::searchablePreferenceDialogFragment); if (preferenceDialog.isPresent()) { show(preferenceDialog.get()); return true; @@ -484,15 +486,17 @@ public boolean showPreferenceFragment(final PreferenceFragmentCompat preferenceF return Optional.empty(); } - private Optional createPreferenceDialog(final Preference preference, - final GeneralProfileSettingsFragment target) { + private Optional> createPreferenceDialog( + final Preference preference, + final GeneralProfileSettingsFragment target) { if (settings.PRECISE_DISTANCE_NUMBERS.getId().equals(preference.getKey())) { return Optional.of( - DistanceDuringNavigationBottomSheet.createInstance( - preference, - target, - getSelectedAppMode(), - false)); + SearchablePreferenceDialogFragmentHolder.of( + DistanceDuringNavigationBottomSheet.createInstance( + preference, + target, + getSelectedAppMode(), + false))); } return Optional.empty(); } @@ -508,10 +512,11 @@ private void show(final SearchablePreferenceDialog dialog) { public Optional> getPreferenceDialogAndSearchableInfoByPreferenceDialogProvider(final Preference preference) { return this .createPreferenceDialog(preference, null) - .map(preferenceDialog -> + .map(SearchablePreferenceDialogFragmentHolder::searchablePreferenceDialogFragment) + .map(searchablePreferenceDialog -> new PreferenceDialogAndSearchableInfoByPreferenceDialogProvider<>( - (Fragment) preferenceDialog, - _preferenceDialog -> preferenceDialog.getSearchableInfo())); + searchablePreferenceDialog, + _preferenceDialog -> searchablePreferenceDialog.getSearchableInfo())); } private void updateDialogControllerCallbacks() { diff --git a/OsmAnd/test/java/net/osmand/plus/settings/fragments/search/SettingsSearchParameterizedTest.java b/OsmAnd/test/java/net/osmand/plus/settings/fragments/search/SettingsSearchParameterizedTest.java index 291d30f6434..d278eb4ed59 100644 --- a/OsmAnd/test/java/net/osmand/plus/settings/fragments/search/SettingsSearchParameterizedTest.java +++ b/OsmAnd/test/java/net/osmand/plus/settings/fragments/search/SettingsSearchParameterizedTest.java @@ -73,6 +73,8 @@ public static Iterable data() { {"ResetProfilePrefsBottomSheet: description", searchQuery(R.string.reset_all_profile_settings_descr)}, {"ResetProfilePrefsBottomSheet: reset_confirmation_descr", searchQuery("Tapping Reset discards all your changes")}, + {"GeneralProfileSettingsFragment", searchQuery(R.string.distance_during_navigation)} + // FK-TODO: enable development plugin for these two test cases // {"LocationInterpolationBottomSheet: title", Either.ofLeft(R.string.location_interpolation_percent)}, // {"LocationInterpolationBottomSheet: description", Either.ofLeft(R.string.location_interpolation_percent_desc)}