diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index c41263515..850b1b8dc 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -87,10 +87,8 @@
-
-
-
-
+
+
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index 503e92322..6b3c891c7 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -64,10 +64,13 @@
true
400
50
- 400
+ 300
+ 10
+ 100
+ 700
- 1200
- 350
+ 1200
+ 350
false
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index fdae3020a..e39cafc7f 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -374,6 +374,8 @@
Usability study mode
+
+ Key long press delay settings
Keypress vibration duration settings
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index c398b5924..f71963ad1 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -80,8 +80,7 @@
- @bool/config_sliding_key_input_enabled
- @integer/config_key_repeat_start_timeout
- @integer/config_key_repeat_interval
- - @integer/config_long_press_key_timeout
- - @integer/config_long_press_shift_key_timeout
+ - @integer/config_longpress_shift_lock_timeout
- @integer/config_ignore_alt_code_key_timeout
- @layout/key_preview
- @dimen/key_preview_offset
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index cc1b52ba6..84e7f54ab 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -145,6 +145,13 @@
+
= 0) ? ms : readDefaultKeyLongpressTimeout(res);
+ }
+
+ public static int readDefaultKeyLongpressTimeout(final Resources res) {
+ return res.getInteger(R.integer.config_default_longpress_key_timeout);
+ }
+
public static int readKeypressVibrationDuration(final SharedPreferences prefs,
final Resources res) {
final int ms = prefs.getInt(PREF_VIBRATION_DURATION_SETTINGS, -1);
diff --git a/java/src/com/android/inputmethod/latin/SettingsFragment.java b/java/src/com/android/inputmethod/latin/SettingsFragment.java
index afe6f3594..dcbc676e1 100644
--- a/java/src/com/android/inputmethod/latin/SettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/SettingsFragment.java
@@ -164,6 +164,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
getPreferenceScreen().removePreference(gestureTypingSettings);
}
+ setupKeyLongpressTimeoutSettings(prefs, res);
setupKeypressVibrationDurationSettings(prefs, res);
setupKeypressSoundVolumeSettings(prefs, res);
refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs, res);
@@ -298,6 +299,34 @@ public final class SettingsFragment extends InputMethodSettingsFragment
});
}
+ private void setupKeyLongpressTimeoutSettings(final SharedPreferences sp,
+ final Resources res) {
+ final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(
+ Settings.PREF_KEY_LONGPRESS_TIMEOUT);
+ if (pref == null) {
+ return;
+ }
+ pref.setInterface(new SeekBarDialogPreference.ValueProxy() {
+ @Override
+ public void writeValue(final int value, final String key) {
+ sp.edit().putInt(key, value).apply();
+ }
+
+ @Override
+ public int readValue(final String key) {
+ return Settings.readKeyLongpressTimeout(sp, res);
+ }
+
+ @Override
+ public int readDefaultValue(final String key) {
+ return Settings.readDefaultKeyLongpressTimeout(res);
+ }
+
+ @Override
+ public void feedbackValue(final int value) {}
+ });
+ }
+
private void setupKeypressSoundVolumeSettings(final SharedPreferences sp, final Resources res) {
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(
Settings.PREF_KEYPRESS_SOUND_VOLUME);
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index d6556d617..29e79e4cc 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -59,6 +59,7 @@ public final class SettingsValues {
public final boolean mGestureInputEnabled;
public final boolean mGesturePreviewTrailEnabled;
public final boolean mGestureFloatingPreviewTextEnabled;
+ public final int mKeyLongpressTimeout;
// From the input box
public final InputAttributes mInputAttributes;
@@ -121,6 +122,7 @@ public final class SettingsValues {
mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res);
// Compute other readable settings
+ mKeyLongpressTimeout = Settings.readKeyLongpressTimeout(prefs, res);
mKeypressVibrationDuration = Settings.readKeypressVibrationDuration(prefs, res);
mKeypressSoundVolume = Settings.readKeypressSoundVolume(prefs, res);
mKeyPreviewPopupDismissDelay = Settings.readKeyPreviewPopupDismissDelay(prefs, res);