am 0b42851e: Merge "Move some advanced settings to debug settings"

* commit '0b42851eed535929dedaa807cadd971a4efcd47f':
  Move some advanced settings to debug settings
main
Tadashi G. Takaoka 2014-04-28 05:34:02 +00:00 committed by Android Git Automerger
commit 3bba98be63
6 changed files with 63 additions and 64 deletions

View File

@ -157,13 +157,6 @@
android:summary="@string/include_other_imes_in_language_switch_list_summary"
android:persistent="true"
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
android:key="pref_keyboard_layout_20110916"
android:title="@string/keyboard_color_scheme"
@ -179,12 +172,6 @@
<ListPreference
android:key="pref_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
android:key="pref_vibration_duration_settings"
android:title="@string/prefs_keypress_vibration_duration_settings"

View File

@ -41,6 +41,18 @@
android:title="@string/prefs_usability_study_mode"
android:persistent="true"
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
android:key="pref_key_preview_show_up_start_scale"
android:title="@string/prefs_key_popup_show_up_start_scale_settings"

View File

@ -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_HISTORY_DICT = "dump_user_history_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;
@ -110,6 +112,7 @@ public final class DebugSettings extends PreferenceFragment
findPreference(PREF_DUMP_PERSONALIZATION_DICT).setOnPreferenceClickListener(
dictDumpPrefClickListener);
final Resources res = getResources();
setupKeyLongpressTimeoutSettings(prefs, res);
setupKeyPreviewAnimationDuration(prefs, res, PREF_KEY_PREVIEW_SHOW_UP_DURATION,
res.getInteger(R.integer.config_key_preview_show_up_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,
final String prefKey, final float defaultValue) {
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(prefKey);

View File

@ -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_GESTURE_SETTINGS = "gesture_typing_settings";
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 =
"pref_vibration_duration_settings";
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
public static boolean readKeypressSoundEnabled(final SharedPreferences prefs,
final Resources res) {
return prefs.getBoolean(Settings.PREF_SOUND_ON,
return prefs.getBoolean(PREF_SOUND_ON,
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,
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));
}
@ -227,12 +225,12 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static boolean readGestureInputEnabled(final SharedPreferences prefs,
final Resources res) {
return readFromBuildConfigIfGestureInputEnabled(res)
&& prefs.getBoolean(Settings.PREF_GESTURE_INPUT, true);
&& prefs.getBoolean(PREF_GESTURE_INPUT, true);
}
public static boolean readPhraseGestureEnabled(final SharedPreferences prefs,
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));
}
@ -278,7 +276,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static void writePrefAdditionalSubtypes(final SharedPreferences prefs,
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,
@ -301,7 +299,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static int readKeyLongpressTimeout(final SharedPreferences prefs,
final Resources res) {
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
: readDefaultKeyLongpressTimeout(res);
}
@ -354,18 +352,18 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
if (!enableSetupWizardByConfig) {
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 boolean isApplicationInSystemImage =
(appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
// Default value
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) {
return prefs.getBoolean(Settings.PREF_KEY_IS_INTERNAL, false);
return prefs.getBoolean(PREF_KEY_IS_INTERNAL, false);
}
public void writeLastUsedPersonalizationToken(byte[] token) {

View File

@ -228,7 +228,6 @@ public final class SettingsFragment extends InputMethodSettingsFragment
AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this);
setupKeyLongpressTimeoutSettings(prefs, res);
setupKeypressVibrationDurationSettings(prefs, res);
setupKeypressSoundVolumeSettings(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) {
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(
Settings.PREF_KEYPRESS_SOUND_VOLUME);

View File

@ -119,7 +119,7 @@ public final class SettingsValues {
mSoundOn = Settings.readKeypressSoundEnabled(prefs, res);
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
Settings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res);
final String autoCorrectionThresholdRawValue = prefs.getString(
Settings.PREF_AUTO_CORRECTION_THRESHOLD,