From 6f139a82a577ae95b16495fb34497f9ce2c63c52 Mon Sep 17 00:00:00 2001 From: Rajat Sharma Date: Thu, 12 Oct 2023 23:39:55 -0400 Subject: [PATCH] Issue #109 Replaced instanceof check and cast with instanceof String string --- .../opentracks/settings/SensorsSettingsFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/settings/SensorsSettingsFragment.java b/src/main/java/de/dennisguse/opentracks/settings/SensorsSettingsFragment.java index 3f39f6377..20fa8cc42 100644 --- a/src/main/java/de/dennisguse/opentracks/settings/SensorsSettingsFragment.java +++ b/src/main/java/de/dennisguse/opentracks/settings/SensorsSettingsFragment.java @@ -52,9 +52,9 @@ public void onDisplayPreferenceDialog(Preference preference) { private void setWheelCircumferenceInputFilter() { EditTextPreference wheelPreference = findPreference(getString(R.string.settings_sensor_bluetooth_cycling_speed_wheel_circumference_key)); wheelPreference.setOnPreferenceChangeListener((preference, newValue) -> { - if (newValue instanceof String) { + if (newValue instanceof String string) { try { - int newValueInt = Integer.parseInt((String) newValue); + int newValueInt = Integer.parseInt(string); return newValueInt >= 100 && newValueInt < 4000; } catch (NumberFormatException e) { Log.w(TAG, "Entered string is no number.");