Move some advanced settings to debug settings
This CL moves "Show slide indicator" and "Key long press delay" advanced options to the debug settings. Bug: 11866784 Change-Id: Iec16e09ba6e7c9f82ce0fa73a0d75766b843b44bmain
parent
e581d8f8ab
commit
a3920c7e6a
|
@ -157,13 +157,6 @@
|
||||||
android:summary="@string/include_other_imes_in_language_switch_list_summary"
|
android:summary="@string/include_other_imes_in_language_switch_list_summary"
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
<!-- Values for popup dismiss delay are added programmatically -->
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="pref_sliding_key_input_preview"
|
|
||||||
android:title="@string/sliding_key_input_preview"
|
|
||||||
android:summary="@string/sliding_key_input_preview_summary"
|
|
||||||
android:persistent="true"
|
|
||||||
android:defaultValue="true" />
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="pref_keyboard_layout_20110916"
|
android:key="pref_keyboard_layout_20110916"
|
||||||
android:title="@string/keyboard_color_scheme"
|
android:title="@string/keyboard_color_scheme"
|
||||||
|
@ -179,12 +172,6 @@
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="pref_key_preview_popup_dismiss_delay"
|
android:key="pref_key_preview_popup_dismiss_delay"
|
||||||
android:title="@string/key_preview_popup_dismiss_delay" />
|
android:title="@string/key_preview_popup_dismiss_delay" />
|
||||||
<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" />
|
|
||||||
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||||
android:key="pref_vibration_duration_settings"
|
android:key="pref_vibration_duration_settings"
|
||||||
android:title="@string/prefs_keypress_vibration_duration_settings"
|
android:title="@string/prefs_keypress_vibration_duration_settings"
|
||||||
|
|
|
@ -41,6 +41,18 @@
|
||||||
android:title="@string/prefs_usability_study_mode"
|
android:title="@string/prefs_usability_study_mode"
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_sliding_key_input_preview"
|
||||||
|
android:title="@string/sliding_key_input_preview"
|
||||||
|
android:summary="@string/sliding_key_input_preview_summary"
|
||||||
|
android:persistent="true"
|
||||||
|
android:defaultValue="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" />
|
||||||
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||||
android:key="pref_key_preview_show_up_start_scale"
|
android:key="pref_key_preview_show_up_start_scale"
|
||||||
android:title="@string/prefs_key_popup_show_up_start_scale_settings"
|
android:title="@string/prefs_key_popup_show_up_start_scale_settings"
|
||||||
|
|
|
@ -55,6 +55,8 @@ public final class DebugSettings extends PreferenceFragment
|
||||||
private static final String PREF_DUMP_USER_DICT = "dump_user_dict";
|
private static final String PREF_DUMP_USER_DICT = "dump_user_dict";
|
||||||
private static final String PREF_DUMP_USER_HISTORY_DICT = "dump_user_history_dict";
|
private static final String PREF_DUMP_USER_HISTORY_DICT = "dump_user_history_dict";
|
||||||
private static final String PREF_DUMP_PERSONALIZATION_DICT = "dump_personalization_dict";
|
private static final String PREF_DUMP_PERSONALIZATION_DICT = "dump_personalization_dict";
|
||||||
|
public static final String PREF_SLIDING_KEY_INPUT_PREVIEW = "pref_sliding_key_input_preview";
|
||||||
|
public static final String PREF_KEY_LONGPRESS_TIMEOUT = "pref_key_longpress_timeout";
|
||||||
|
|
||||||
private static final boolean SHOW_STATISTICS_LOGGING = false;
|
private static final boolean SHOW_STATISTICS_LOGGING = false;
|
||||||
|
|
||||||
|
@ -110,6 +112,7 @@ public final class DebugSettings extends PreferenceFragment
|
||||||
findPreference(PREF_DUMP_PERSONALIZATION_DICT).setOnPreferenceClickListener(
|
findPreference(PREF_DUMP_PERSONALIZATION_DICT).setOnPreferenceClickListener(
|
||||||
dictDumpPrefClickListener);
|
dictDumpPrefClickListener);
|
||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
|
setupKeyLongpressTimeoutSettings(prefs, res);
|
||||||
setupKeyPreviewAnimationDuration(prefs, res, PREF_KEY_PREVIEW_SHOW_UP_DURATION,
|
setupKeyPreviewAnimationDuration(prefs, res, PREF_KEY_PREVIEW_SHOW_UP_DURATION,
|
||||||
res.getInteger(R.integer.config_key_preview_show_up_duration));
|
res.getInteger(R.integer.config_key_preview_show_up_duration));
|
||||||
setupKeyPreviewAnimationDuration(prefs, res, PREF_KEY_PREVIEW_DISMISS_DURATION,
|
setupKeyPreviewAnimationDuration(prefs, res, PREF_KEY_PREVIEW_DISMISS_DURATION,
|
||||||
|
@ -200,6 +203,44 @@ public final class DebugSettings extends PreferenceFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupKeyLongpressTimeoutSettings(final SharedPreferences sp,
|
||||||
|
final Resources res) {
|
||||||
|
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(
|
||||||
|
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 void writeDefaultValue(final String key) {
|
||||||
|
sp.edit().remove(key).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 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 SharedPreferences sp, final Resources res,
|
private void setupKeyPreviewAnimationScale(final SharedPreferences sp, final Resources res,
|
||||||
final String prefKey, final float defaultValue) {
|
final String prefKey, final float defaultValue) {
|
||||||
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(prefKey);
|
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(prefKey);
|
||||||
|
|
|
@ -72,8 +72,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static final String PREF_BIGRAM_PREDICTIONS = "next_word_prediction";
|
public static final String PREF_BIGRAM_PREDICTIONS = "next_word_prediction";
|
||||||
public static final String PREF_GESTURE_SETTINGS = "gesture_typing_settings";
|
public static final String PREF_GESTURE_SETTINGS = "gesture_typing_settings";
|
||||||
public static final String PREF_GESTURE_INPUT = "gesture_input";
|
public static final String PREF_GESTURE_INPUT = "gesture_input";
|
||||||
public static final String PREF_SLIDING_KEY_INPUT_PREVIEW = "pref_sliding_key_input_preview";
|
|
||||||
public static final String PREF_KEY_LONGPRESS_TIMEOUT = "pref_key_longpress_timeout";
|
|
||||||
public static final String PREF_VIBRATION_DURATION_SETTINGS =
|
public static final String PREF_VIBRATION_DURATION_SETTINGS =
|
||||||
"pref_vibration_duration_settings";
|
"pref_vibration_duration_settings";
|
||||||
public static final String PREF_KEYPRESS_SOUND_VOLUME =
|
public static final String PREF_KEYPRESS_SOUND_VOLUME =
|
||||||
|
@ -196,7 +194,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
// Accessed from the settings interface, hence public
|
// Accessed from the settings interface, hence public
|
||||||
public static boolean readKeypressSoundEnabled(final SharedPreferences prefs,
|
public static boolean readKeypressSoundEnabled(final SharedPreferences prefs,
|
||||||
final Resources res) {
|
final Resources res) {
|
||||||
return prefs.getBoolean(Settings.PREF_SOUND_ON,
|
return prefs.getBoolean(PREF_SOUND_ON,
|
||||||
res.getBoolean(R.bool.config_default_sound_enabled));
|
res.getBoolean(R.bool.config_default_sound_enabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +214,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
|
|
||||||
public static boolean readBlockPotentiallyOffensive(final SharedPreferences prefs,
|
public static boolean readBlockPotentiallyOffensive(final SharedPreferences prefs,
|
||||||
final Resources res) {
|
final Resources res) {
|
||||||
return prefs.getBoolean(Settings.PREF_BLOCK_POTENTIALLY_OFFENSIVE,
|
return prefs.getBoolean(PREF_BLOCK_POTENTIALLY_OFFENSIVE,
|
||||||
res.getBoolean(R.bool.config_block_potentially_offensive));
|
res.getBoolean(R.bool.config_block_potentially_offensive));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,12 +225,12 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static boolean readGestureInputEnabled(final SharedPreferences prefs,
|
public static boolean readGestureInputEnabled(final SharedPreferences prefs,
|
||||||
final Resources res) {
|
final Resources res) {
|
||||||
return readFromBuildConfigIfGestureInputEnabled(res)
|
return readFromBuildConfigIfGestureInputEnabled(res)
|
||||||
&& prefs.getBoolean(Settings.PREF_GESTURE_INPUT, true);
|
&& prefs.getBoolean(PREF_GESTURE_INPUT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean readPhraseGestureEnabled(final SharedPreferences prefs,
|
public static boolean readPhraseGestureEnabled(final SharedPreferences prefs,
|
||||||
final Resources res) {
|
final Resources res) {
|
||||||
return prefs.getBoolean(Settings.PREF_PHRASE_GESTURE_ENABLED,
|
return prefs.getBoolean(PREF_PHRASE_GESTURE_ENABLED,
|
||||||
res.getBoolean(R.bool.config_default_phrase_gesture_enabled));
|
res.getBoolean(R.bool.config_default_phrase_gesture_enabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +276,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
|
|
||||||
public static void writePrefAdditionalSubtypes(final SharedPreferences prefs,
|
public static void writePrefAdditionalSubtypes(final SharedPreferences prefs,
|
||||||
final String prefSubtypes) {
|
final String prefSubtypes) {
|
||||||
prefs.edit().putString(Settings.PREF_CUSTOM_INPUT_STYLES, prefSubtypes).apply();
|
prefs.edit().putString(PREF_CUSTOM_INPUT_STYLES, prefSubtypes).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float readKeypressSoundVolume(final SharedPreferences prefs,
|
public static float readKeypressSoundVolume(final SharedPreferences prefs,
|
||||||
|
@ -301,7 +299,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static int readKeyLongpressTimeout(final SharedPreferences prefs,
|
public static int readKeyLongpressTimeout(final SharedPreferences prefs,
|
||||||
final Resources res) {
|
final Resources res) {
|
||||||
final int milliseconds = prefs.getInt(
|
final int milliseconds = prefs.getInt(
|
||||||
PREF_KEY_LONGPRESS_TIMEOUT, UNDEFINED_PREFERENCE_VALUE_INT);
|
DebugSettings.PREF_KEY_LONGPRESS_TIMEOUT, UNDEFINED_PREFERENCE_VALUE_INT);
|
||||||
return (milliseconds != UNDEFINED_PREFERENCE_VALUE_INT) ? milliseconds
|
return (milliseconds != UNDEFINED_PREFERENCE_VALUE_INT) ? milliseconds
|
||||||
: readDefaultKeyLongpressTimeout(res);
|
: readDefaultKeyLongpressTimeout(res);
|
||||||
}
|
}
|
||||||
|
@ -354,18 +352,18 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (!enableSetupWizardByConfig) {
|
if (!enableSetupWizardByConfig) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!prefs.contains(Settings.PREF_SHOW_SETUP_WIZARD_ICON)) {
|
if (!prefs.contains(PREF_SHOW_SETUP_WIZARD_ICON)) {
|
||||||
final ApplicationInfo appInfo = context.getApplicationInfo();
|
final ApplicationInfo appInfo = context.getApplicationInfo();
|
||||||
final boolean isApplicationInSystemImage =
|
final boolean isApplicationInSystemImage =
|
||||||
(appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
|
(appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
|
||||||
// Default value
|
// Default value
|
||||||
return !isApplicationInSystemImage;
|
return !isApplicationInSystemImage;
|
||||||
}
|
}
|
||||||
return prefs.getBoolean(Settings.PREF_SHOW_SETUP_WIZARD_ICON, false);
|
return prefs.getBoolean(PREF_SHOW_SETUP_WIZARD_ICON, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isInternal(final SharedPreferences prefs) {
|
public static boolean isInternal(final SharedPreferences prefs) {
|
||||||
return prefs.getBoolean(Settings.PREF_KEY_IS_INTERNAL, false);
|
return prefs.getBoolean(PREF_KEY_IS_INTERNAL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeLastUsedPersonalizationToken(byte[] token) {
|
public void writeLastUsedPersonalizationToken(byte[] token) {
|
||||||
|
|
|
@ -228,7 +228,6 @@ public final class SettingsFragment extends InputMethodSettingsFragment
|
||||||
|
|
||||||
AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this);
|
AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this);
|
||||||
|
|
||||||
setupKeyLongpressTimeoutSettings(prefs, res);
|
|
||||||
setupKeypressVibrationDurationSettings(prefs, res);
|
setupKeypressVibrationDurationSettings(prefs, res);
|
||||||
setupKeypressSoundVolumeSettings(prefs, res);
|
setupKeypressSoundVolumeSettings(prefs, res);
|
||||||
refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs, res);
|
refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs, res);
|
||||||
|
@ -368,44 +367,6 @@ 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 void writeDefaultValue(final String key) {
|
|
||||||
sp.edit().remove(key).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 String getValueText(final int value) {
|
|
||||||
return res.getString(R.string.abbreviation_unit_milliseconds, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void feedbackValue(final int value) {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupKeypressSoundVolumeSettings(final SharedPreferences sp, final Resources res) {
|
private void setupKeypressSoundVolumeSettings(final SharedPreferences sp, final Resources res) {
|
||||||
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(
|
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(
|
||||||
Settings.PREF_KEYPRESS_SOUND_VOLUME);
|
Settings.PREF_KEYPRESS_SOUND_VOLUME);
|
||||||
|
|
|
@ -119,7 +119,7 @@ public final class SettingsValues {
|
||||||
mSoundOn = Settings.readKeypressSoundEnabled(prefs, res);
|
mSoundOn = Settings.readKeypressSoundEnabled(prefs, res);
|
||||||
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
|
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
|
||||||
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
||||||
Settings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
||||||
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res);
|
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res);
|
||||||
final String autoCorrectionThresholdRawValue = prefs.getString(
|
final String autoCorrectionThresholdRawValue = prefs.getString(
|
||||||
Settings.PREF_AUTO_CORRECTION_THRESHOLD,
|
Settings.PREF_AUTO_CORRECTION_THRESHOLD,
|
||||||
|
|
Loading…
Reference in New Issue