diff --git a/app/src/main/java/helium314/keyboard/latin/settings/AdvancedSettingsFragment.kt b/app/src/main/java/helium314/keyboard/latin/settings/AdvancedSettingsFragment.kt index 1512420ff..b7e082aaa 100644 --- a/app/src/main/java/helium314/keyboard/latin/settings/AdvancedSettingsFragment.kt +++ b/app/src/main/java/helium314/keyboard/latin/settings/AdvancedSettingsFragment.kt @@ -486,7 +486,7 @@ class AdvancedSettingsFragment : SubScreenFragment() { override fun readValue(key: String) = Settings.readKeyLongpressTimeout(prefs, resources) - override fun readDefaultValue(key: String) = Settings.readDefaultKeyLongpressTimeout(resources) + override fun readDefaultValue(key: String) = Settings.readDefaultKeyLongpressTimeout() override fun getValueText(value: Int) = resources.getString(R.string.abbreviation_unit_milliseconds, value.toString()) diff --git a/app/src/main/java/helium314/keyboard/latin/settings/Settings.java b/app/src/main/java/helium314/keyboard/latin/settings/Settings.java index f9ab36310..ca02cd606 100644 --- a/app/src/main/java/helium314/keyboard/latin/settings/Settings.java +++ b/app/src/main/java/helium314/keyboard/latin/settings/Settings.java @@ -20,6 +20,7 @@ import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.Gravity; +import android.view.ViewConfiguration; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -346,11 +347,12 @@ public static int readKeyLongpressTimeout(final SharedPreferences prefs, final R final int milliseconds = prefs.getInt( PREF_KEY_LONGPRESS_TIMEOUT, UNDEFINED_PREFERENCE_VALUE_INT); return (milliseconds != UNDEFINED_PREFERENCE_VALUE_INT) ? milliseconds - : readDefaultKeyLongpressTimeout(res); + : readDefaultKeyLongpressTimeout(); } - public static int readDefaultKeyLongpressTimeout(final Resources res) { - return res.getInteger(R.integer.config_default_longpress_key_timeout); + public static int readDefaultKeyLongpressTimeout() { + final int default_longpress_key_timeout = ViewConfiguration.getLongPressTimeout(); + return default_longpress_key_timeout; } public static int readKeypressVibrationDuration(final SharedPreferences prefs, final Resources res) { diff --git a/app/src/main/res/values/config-common.xml b/app/src/main/res/values/config-common.xml index f8c4abc2d..1c0b217b9 100644 --- a/app/src/main/res/values/config-common.xml +++ b/app/src/main/res/values/config-common.xml @@ -28,8 +28,7 @@ false 100 - 300 - 700 + 1500 100 10 3000