Bring back long press timeout settings
Bug: 18025209 Change-Id: Id8dbb051e04270f6892cae12a443103bd0d32dcbmain
parent
bd4693cd3f
commit
ad2f695083
|
@ -28,8 +28,6 @@
|
|||
<string name="sliding_key_input_preview">Show slide indicator</string>
|
||||
<!-- Option summary to enable sliding key input indicator. The user can see a rubber band-like effect during sliding key input. [CHAR LIMIT=66]-->
|
||||
<string name="sliding_key_input_preview_summary">Display visual cue while sliding from Shift or Symbol keys</string>
|
||||
<!-- Title of the settings for key long press delay [CHAR LIMIT=35] -->
|
||||
<string name="prefs_key_longpress_timeout_settings">Key long press delay</string>
|
||||
<!-- Title of the settings for customize key popup animation parameters [CHAR LIMIT=35] -->
|
||||
<string name="prefs_customize_key_preview_animation">Customize key preview animation</string>
|
||||
<!-- Title of the settings for key popup show up animation duration (in milliseconds) [CHAR LIMIT=35] -->
|
||||
|
|
|
@ -361,6 +361,8 @@ mobile devices. [CHAR LIMIT=25] -->
|
|||
<string name="prefs_keypress_vibration_duration_settings">Keypress vibration duration</string>
|
||||
<!-- Title of the settings for keypress sound volume [CHAR LIMIT=35] -->
|
||||
<string name="prefs_keypress_sound_volume_settings">Keypress sound volume</string>
|
||||
<!-- Title of the settings for key long press delay [CHAR LIMIT=35] -->
|
||||
<string name="prefs_key_longpress_timeout_settings">Key long press delay</string>
|
||||
|
||||
<!-- Title of the button to revert to the default value of the device in the settings dialog [CHAR LIMIT=15] -->
|
||||
<string name="button_default">Default</string>
|
||||
|
|
|
@ -31,6 +31,12 @@
|
|||
android:key="pref_keypress_sound_volume"
|
||||
android:title="@string/prefs_keypress_sound_volume_settings"
|
||||
latin:maxValue="100" /> <!-- percent -->
|
||||
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||
android:key="pref_key_longpress_timeout"
|
||||
android:title="@string/prefs_key_longpress_timeout_settings"
|
||||
latin:minValue="@integer/config_min_longpress_timeout"
|
||||
latin:maxValue="@integer/config_max_longpress_timeout"
|
||||
latin:stepValue="@integer/config_longpress_timeout_step" />
|
||||
<!-- The settings for showing setup wizard application icon shouldn't be persistent and
|
||||
the default value is added programmatically. -->
|
||||
<CheckBoxPreference
|
||||
|
|
|
@ -46,12 +46,6 @@
|
|||
android:summary="@string/sliding_key_input_preview_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||
android:key="pref_key_longpress_timeout"
|
||||
android:title="@string/prefs_key_longpress_timeout_settings"
|
||||
latin:minValue="@integer/config_min_longpress_timeout"
|
||||
latin:maxValue="@integer/config_max_longpress_timeout"
|
||||
latin:stepValue="@integer/config_longpress_timeout_step" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_has_custom_key_preview_animation_params"
|
||||
android:title="@string/prefs_customize_key_preview_animation"
|
||||
|
|
|
@ -113,6 +113,7 @@ public final class AdvancedSettingsFragment extends SubScreenFragment {
|
|||
|
||||
setupKeypressVibrationDurationSettings();
|
||||
setupKeypressSoundVolumeSettings();
|
||||
setupKeyLongpressTimeoutSettings();
|
||||
refreshEnablingsOfKeypressSoundAndVibrationSettings();
|
||||
}
|
||||
|
||||
|
@ -249,4 +250,43 @@ public final class AdvancedSettingsFragment extends SubScreenFragment {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupKeyLongpressTimeoutSettings() {
|
||||
final SharedPreferences prefs = getSharedPreferences();
|
||||
final Resources res = getResources();
|
||||
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) {
|
||||
prefs.edit().putInt(key, value).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDefaultValue(final String key) {
|
||||
prefs.edit().remove(key).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readValue(final String key) {
|
||||
return Settings.readKeyLongpressTimeout(prefs, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readDefaultValue(final String key) {
|
||||
return Settings.readDefaultKeyLongpressTimeout(res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueText(final int value) {
|
||||
return res.getString(R.string.abbreviation_unit_milliseconds, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void feedbackValue(final int value) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ public final class DebugSettings {
|
|||
"force_physical_keyboard_special_key";
|
||||
public static final String PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS =
|
||||
"pref_has_custom_key_preview_animation_params";
|
||||
public static final String PREF_KEY_LONGPRESS_TIMEOUT = "pref_key_longpress_timeout";
|
||||
public static final String PREF_KEY_PREVIEW_DISMISS_DURATION =
|
||||
"pref_key_preview_dismiss_duration";
|
||||
public static final String PREF_KEY_PREVIEW_DISMISS_END_X_SCALE =
|
||||
|
|
|
@ -73,7 +73,6 @@ public final class DebugSettingsFragment extends SubScreenFragment
|
|||
dictDumpPreferenceGroup.addPreference(pref);
|
||||
}
|
||||
final Resources res = getResources();
|
||||
setupKeyLongpressTimeoutSettings();
|
||||
setupKeyPreviewAnimationDuration(DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_DURATION,
|
||||
res.getInteger(R.integer.config_key_preview_show_up_duration));
|
||||
setupKeyPreviewAnimationDuration(DebugSettings.PREF_KEY_PREVIEW_DISMISS_DURATION,
|
||||
|
@ -163,45 +162,6 @@ public final class DebugSettingsFragment extends SubScreenFragment
|
|||
}
|
||||
}
|
||||
|
||||
private void setupKeyLongpressTimeoutSettings() {
|
||||
final SharedPreferences prefs = getSharedPreferences();
|
||||
final Resources res = getResources();
|
||||
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(
|
||||
DebugSettings.PREF_KEY_LONGPRESS_TIMEOUT);
|
||||
if (pref == null) {
|
||||
return;
|
||||
}
|
||||
pref.setInterface(new SeekBarDialogPreference.ValueProxy() {
|
||||
@Override
|
||||
public void writeValue(final int value, final String key) {
|
||||
prefs.edit().putInt(key, value).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDefaultValue(final String key) {
|
||||
prefs.edit().remove(key).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readValue(final String key) {
|
||||
return Settings.readKeyLongpressTimeout(prefs, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readDefaultValue(final String key) {
|
||||
return Settings.readDefaultKeyLongpressTimeout(res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueText(final int value) {
|
||||
return res.getString(R.string.abbreviation_unit_milliseconds, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void feedbackValue(final int value) {}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupKeyPreviewAnimationScale(final String prefKey, final float defaultValue) {
|
||||
final SharedPreferences prefs = getSharedPreferences();
|
||||
final Resources res = getResources();
|
||||
|
|
|
@ -48,7 +48,6 @@ public class LocalSettingsConstants {
|
|||
DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH,
|
||||
DebugSettings.PREF_FORCE_PHYSICAL_KEYBOARD_SPECIAL_KEY,
|
||||
DebugSettings.PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS,
|
||||
DebugSettings.PREF_KEY_LONGPRESS_TIMEOUT,
|
||||
DebugSettings.PREF_KEY_PREVIEW_DISMISS_DURATION,
|
||||
DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_X_SCALE,
|
||||
DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_Y_SCALE,
|
||||
|
|
|
@ -93,8 +93,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
public static final String PREF_GESTURE_INPUT = "gesture_input";
|
||||
public static final String PREF_VIBRATION_DURATION_SETTINGS =
|
||||
"pref_vibration_duration_settings";
|
||||
public static final String PREF_KEYPRESS_SOUND_VOLUME =
|
||||
"pref_keypress_sound_volume";
|
||||
public static final String PREF_KEYPRESS_SOUND_VOLUME = "pref_keypress_sound_volume";
|
||||
public static final String PREF_KEY_LONGPRESS_TIMEOUT = "pref_key_longpress_timeout";
|
||||
public static final String PREF_GESTURE_PREVIEW_TRAIL = "pref_gesture_preview_trail";
|
||||
public static final String PREF_GESTURE_FLOATING_PREVIEW_TEXT =
|
||||
"pref_gesture_floating_preview_text";
|
||||
|
@ -317,7 +317,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
public static int readKeyLongpressTimeout(final SharedPreferences prefs,
|
||||
final Resources res) {
|
||||
final int milliseconds = prefs.getInt(
|
||||
DebugSettings.PREF_KEY_LONGPRESS_TIMEOUT, UNDEFINED_PREFERENCE_VALUE_INT);
|
||||
PREF_KEY_LONGPRESS_TIMEOUT, UNDEFINED_PREFERENCE_VALUE_INT);
|
||||
return (milliseconds != UNDEFINED_PREFERENCE_VALUE_INT) ? milliseconds
|
||||
: readDefaultKeyLongpressTimeout(res);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue