From 47f5b918fd14f654c632daac41f355cadef2a6b8 Mon Sep 17 00:00:00 2001 From: frankknoll Date: Sun, 15 Dec 2024 03:09:20 +0100 Subject: [PATCH] refactoring --- .../fragments/VehicleParametersFragment.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/VehicleParametersFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/VehicleParametersFragment.java index e64ee3f029f..dccaaedff93 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/VehicleParametersFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/VehicleParametersFragment.java @@ -271,16 +271,14 @@ public boolean onPreferenceClick(Preference preference) { @Override public void onDisplayPreferenceDialog(Preference preference) { - final Optional preferenceDialog = - createPreferenceDialog( + this + .createPreferenceDialog( preference, this, - false); - if (preferenceDialog.isPresent()) { - show(preferenceDialog.get()); - } else { - super.onDisplayPreferenceDialog(preference); - } + false) + .ifPresentOrElse( + this::show, + () -> super.onDisplayPreferenceDialog(preference)); } private void show(final SearchablePreferenceDialog dialog) {