From ac89eb3de0bd0d30f371bd8906de822fb8feac9f Mon Sep 17 00:00:00 2001 From: frankknoll Date: Wed, 18 Dec 2024 13:42:35 +0100 Subject: [PATCH] refactoring --- .../DevelopmentSettingsFragment.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/plugins/development/DevelopmentSettingsFragment.java b/OsmAnd/src/net/osmand/plus/plugins/development/DevelopmentSettingsFragment.java index 32bc2987ecb..3e530f110b1 100644 --- a/OsmAnd/src/net/osmand/plus/plugins/development/DevelopmentSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/plugins/development/DevelopmentSettingsFragment.java @@ -316,11 +316,11 @@ private void setupResetToDefaultButton() { resetToDefault.setIcon(getActiveIcon(R.drawable.ic_action_reset_to_default_dark)); } - private static abstract class ShowableSearchablePreferenceDialog { + private static abstract class ShowableSearchablePreferenceDialog { - public final SearchablePreferenceDialog searchablePreferenceDialog; + public final T searchablePreferenceDialog; - public ShowableSearchablePreferenceDialog(final SearchablePreferenceDialog searchablePreferenceDialog) { + public ShowableSearchablePreferenceDialog(final T searchablePreferenceDialog) { this.searchablePreferenceDialog = searchablePreferenceDialog; } @@ -330,7 +330,7 @@ public ShowableSearchablePreferenceDialog(final SearchablePreferenceDialog searc @Override public boolean onPreferenceClick(Preference preference) { String prefId = preference.getKey(); - final Optional preferenceDialog = createPreferenceDialog(preference, this); + final Optional> preferenceDialog = createPreferenceDialog(preference, this); if (preferenceDialog.isPresent()) { preferenceDialog.get().show(); return true; @@ -362,11 +362,11 @@ public boolean onPreferenceClick(Preference preference) { return super.onPreferenceClick(preference); } - private Optional createPreferenceDialog(final Preference preference, - final DevelopmentSettingsFragment target) { + private Optional> createPreferenceDialog(final Preference preference, + final DevelopmentSettingsFragment target) { if (SIMULATE_YOUR_LOCATION.equals(preference.getKey())) { return Optional.of( - new ShowableSearchablePreferenceDialog( + new ShowableSearchablePreferenceDialog<>( SimulateLocationFragment.createInstance( null, false)) { @@ -382,7 +382,7 @@ public void show() { } if (settings.MEMORY_ALLOCATED_FOR_ROUTING.getId().equals(preference.getKey())) { return Optional.of( - new ShowableSearchablePreferenceDialog( + new ShowableSearchablePreferenceDialog<>( AllocatedRoutingMemoryBottomSheet.createInstance( preference.getKey(), target, @@ -400,7 +400,7 @@ public void show() { } if (settings.LOCATION_INTERPOLATION_PERCENT.getId().equals(preference.getKey())) { return Optional.of( - new ShowableSearchablePreferenceDialog( + new ShowableSearchablePreferenceDialog<>( LocationInterpolationBottomSheet.createInstance( preference, target, @@ -425,7 +425,7 @@ public Optional> .map(showableSearchablePreferenceDialog -> showableSearchablePreferenceDialog.searchablePreferenceDialog) .map(searchablePreferenceDialog -> new PreferenceDialogAndSearchableInfoByPreferenceDialogProvider<>( - (Fragment) searchablePreferenceDialog, + searchablePreferenceDialog, _preferenceDialog -> searchablePreferenceDialog.getSearchableInfo())); }