am 8ae8c761: Cleanup settings
* commit '8ae8c761493867be7364806cdc4d7103a46dc181': Cleanup settingsmain
commit
1d2d36d1ee
|
@ -92,11 +92,6 @@
|
||||||
android:summary="@string/gesture_input_summary"
|
android:summary="@string/gesture_input_summary"
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:defaultValue="true" />
|
android:defaultValue="true" />
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="usability_study_mode"
|
|
||||||
android:title="@string/prefs_usability_study_mode"
|
|
||||||
android:persistent="true"
|
|
||||||
android:defaultValue="false" />
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="pref_advanced_settings"
|
android:key="pref_advanced_settings"
|
||||||
android:title="@string/advanced_settings"
|
android:title="@string/advanced_settings"
|
||||||
|
@ -145,5 +140,10 @@
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="debug_settings"
|
||||||
|
android:title="Debug settings"
|
||||||
|
android:persistent="true"
|
||||||
|
android:defaultValue="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -48,4 +48,10 @@
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="usability_study_mode"
|
||||||
|
android:title="@string/prefs_usability_study_mode"
|
||||||
|
android:persistent="true"
|
||||||
|
android:defaultValue="false" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -23,10 +23,12 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
||||||
|
import com.android.inputmethod.research.ResearchLogger;
|
||||||
|
|
||||||
public class DebugSettings extends PreferenceFragment
|
public class DebugSettings extends PreferenceFragment
|
||||||
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
@ -34,6 +36,7 @@ public class DebugSettings extends PreferenceFragment
|
||||||
private static final String TAG = DebugSettings.class.getSimpleName();
|
private static final String TAG = DebugSettings.class.getSimpleName();
|
||||||
private static final String DEBUG_MODE_KEY = "debug_mode";
|
private static final String DEBUG_MODE_KEY = "debug_mode";
|
||||||
public static final String FORCE_NON_DISTINCT_MULTITOUCH_KEY = "force_non_distinct_multitouch";
|
public static final String FORCE_NON_DISTINCT_MULTITOUCH_KEY = "force_non_distinct_multitouch";
|
||||||
|
public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode";
|
||||||
|
|
||||||
private boolean mServiceNeedsRestart = false;
|
private boolean mServiceNeedsRestart = false;
|
||||||
private CheckBoxPreference mDebugMode;
|
private CheckBoxPreference mDebugMode;
|
||||||
|
@ -45,6 +48,14 @@ public class DebugSettings extends PreferenceFragment
|
||||||
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
|
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
|
||||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
final Preference usabilityStudyPref = findPreference(PREF_USABILITY_STUDY_MODE);
|
||||||
|
if (usabilityStudyPref instanceof CheckBoxPreference) {
|
||||||
|
final CheckBoxPreference checkbox = (CheckBoxPreference)usabilityStudyPref;
|
||||||
|
checkbox.setChecked(prefs.getBoolean(PREF_USABILITY_STUDY_MODE,
|
||||||
|
ResearchLogger.DEFAULT_USABILITY_STUDY_MODE));
|
||||||
|
checkbox.setSummary(R.string.settings_warning_researcher_mode);
|
||||||
|
}
|
||||||
|
|
||||||
mServiceNeedsRestart = false;
|
mServiceNeedsRestart = false;
|
||||||
mDebugMode = (CheckBoxPreference) findPreference(DEBUG_MODE_KEY);
|
mDebugMode = (CheckBoxPreference) findPreference(DEBUG_MODE_KEY);
|
||||||
updateDebugMode();
|
updateDebugMode();
|
||||||
|
|
|
@ -39,12 +39,10 @@ import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.define.ProductionFlag;
|
import com.android.inputmethod.latin.define.ProductionFlag;
|
||||||
import com.android.inputmethod.research.ResearchLogger;
|
|
||||||
import com.android.inputmethodcommon.InputMethodSettingsFragment;
|
import com.android.inputmethodcommon.InputMethodSettingsFragment;
|
||||||
|
|
||||||
public final class Settings extends InputMethodSettingsFragment
|
public final class Settings extends InputMethodSettingsFragment
|
||||||
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
public static final boolean ENABLE_INTERNAL_SETTINGS = ProductionFlag.IS_INTERNAL;
|
|
||||||
|
|
||||||
// In the same order as xml/prefs.xml
|
// In the same order as xml/prefs.xml
|
||||||
public static final String PREF_GENERAL_SETTINGS = "general_settings";
|
public static final String PREF_GENERAL_SETTINGS = "general_settings";
|
||||||
|
@ -58,7 +56,6 @@ public final class Settings extends InputMethodSettingsFragment
|
||||||
public static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold";
|
public static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold";
|
||||||
public static final String PREF_SHOW_SUGGESTIONS_SETTING = "show_suggestions_setting";
|
public static final String PREF_SHOW_SUGGESTIONS_SETTING = "show_suggestions_setting";
|
||||||
public static final String PREF_MISC_SETTINGS = "misc_settings";
|
public static final String PREF_MISC_SETTINGS = "misc_settings";
|
||||||
public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode";
|
|
||||||
public static final String PREF_LAST_USER_DICTIONARY_WRITE_TIME =
|
public static final String PREF_LAST_USER_DICTIONARY_WRITE_TIME =
|
||||||
"last_user_dictionary_write_time";
|
"last_user_dictionary_write_time";
|
||||||
public static final String PREF_ADVANCED_SETTINGS = "pref_advanced_settings";
|
public static final String PREF_ADVANCED_SETTINGS = "pref_advanced_settings";
|
||||||
|
@ -133,14 +130,6 @@ public final class Settings extends InputMethodSettingsFragment
|
||||||
mAutoCorrectionThresholdPreference =
|
mAutoCorrectionThresholdPreference =
|
||||||
(ListPreference) findPreference(PREF_AUTO_CORRECTION_THRESHOLD);
|
(ListPreference) findPreference(PREF_AUTO_CORRECTION_THRESHOLD);
|
||||||
mBigramPrediction = (CheckBoxPreference) findPreference(PREF_BIGRAM_PREDICTIONS);
|
mBigramPrediction = (CheckBoxPreference) findPreference(PREF_BIGRAM_PREDICTIONS);
|
||||||
mDebugSettingsPreference = findPreference(PREF_DEBUG_SETTINGS);
|
|
||||||
if (mDebugSettingsPreference != null) {
|
|
||||||
final Intent debugSettingsIntent = new Intent(Intent.ACTION_MAIN);
|
|
||||||
debugSettingsIntent.setClassName(
|
|
||||||
context.getPackageName(), DebugSettings.class.getName());
|
|
||||||
mDebugSettingsPreference.setIntent(debugSettingsIntent);
|
|
||||||
}
|
|
||||||
|
|
||||||
ensureConsistencyOfAutoCorrectionSettings();
|
ensureConsistencyOfAutoCorrectionSettings();
|
||||||
|
|
||||||
final PreferenceGroup generalSettings =
|
final PreferenceGroup generalSettings =
|
||||||
|
@ -150,6 +139,18 @@ public final class Settings extends InputMethodSettingsFragment
|
||||||
final PreferenceGroup miscSettings =
|
final PreferenceGroup miscSettings =
|
||||||
(PreferenceGroup) findPreference(PREF_MISC_SETTINGS);
|
(PreferenceGroup) findPreference(PREF_MISC_SETTINGS);
|
||||||
|
|
||||||
|
mDebugSettingsPreference = findPreference(PREF_DEBUG_SETTINGS);
|
||||||
|
if (mDebugSettingsPreference != null) {
|
||||||
|
if (ProductionFlag.IS_INTERNAL) {
|
||||||
|
final Intent debugSettingsIntent = new Intent(Intent.ACTION_MAIN);
|
||||||
|
debugSettingsIntent.setClassName(
|
||||||
|
context.getPackageName(), DebugSettingsActivity.class.getName());
|
||||||
|
mDebugSettingsPreference.setIntent(debugSettingsIntent);
|
||||||
|
} else {
|
||||||
|
miscSettings.removePreference(mDebugSettingsPreference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final boolean showVoiceKeyOption = res.getBoolean(
|
final boolean showVoiceKeyOption = res.getBoolean(
|
||||||
R.bool.config_enable_show_voice_key_option);
|
R.bool.config_enable_show_voice_key_option);
|
||||||
if (!showVoiceKeyOption) {
|
if (!showVoiceKeyOption) {
|
||||||
|
@ -218,24 +219,6 @@ public final class Settings extends InputMethodSettingsFragment
|
||||||
setPreferenceEnabled(gestureFloatingPreviewText, gestureInputEnabledByUser);
|
setPreferenceEnabled(gestureFloatingPreviewText, gestureInputEnabledByUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean showUsabilityStudyModeOption =
|
|
||||||
res.getBoolean(R.bool.config_enable_usability_study_mode_option)
|
|
||||||
|| ProductionFlag.IS_EXPERIMENTAL || ENABLE_INTERNAL_SETTINGS;
|
|
||||||
final Preference usabilityStudyPref = findPreference(PREF_USABILITY_STUDY_MODE);
|
|
||||||
if (!showUsabilityStudyModeOption) {
|
|
||||||
if (usabilityStudyPref != null) {
|
|
||||||
miscSettings.removePreference(usabilityStudyPref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
|
||||||
if (usabilityStudyPref instanceof CheckBoxPreference) {
|
|
||||||
CheckBoxPreference checkbox = (CheckBoxPreference)usabilityStudyPref;
|
|
||||||
checkbox.setChecked(prefs.getBoolean(PREF_USABILITY_STUDY_MODE,
|
|
||||||
ResearchLogger.DEFAULT_USABILITY_STUDY_MODE));
|
|
||||||
checkbox.setSummary(R.string.settings_warning_researcher_mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mKeypressVibrationDurationSettingsPref =
|
mKeypressVibrationDurationSettingsPref =
|
||||||
(PreferenceScreen) findPreference(PREF_VIBRATION_DURATION_SETTINGS);
|
(PreferenceScreen) findPreference(PREF_VIBRATION_DURATION_SETTINGS);
|
||||||
if (mKeypressVibrationDurationSettingsPref != null) {
|
if (mKeypressVibrationDurationSettingsPref != null) {
|
||||||
|
|
|
@ -410,7 +410,7 @@ public final class SettingsValues {
|
||||||
// Likewise
|
// Likewise
|
||||||
public static boolean getUsabilityStudyMode(final SharedPreferences prefs) {
|
public static boolean getUsabilityStudyMode(final SharedPreferences prefs) {
|
||||||
// TODO: use mUsabilityStudyMode instead of reading it again here
|
// TODO: use mUsabilityStudyMode instead of reading it again here
|
||||||
return prefs.getBoolean(Settings.PREF_USABILITY_STUDY_MODE, true);
|
return prefs.getBoolean(DebugSettings.PREF_USABILITY_STUDY_MODE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getLastUserHistoryWriteTime(final SharedPreferences prefs,
|
public static long getLastUserHistoryWriteTime(final SharedPreferences prefs,
|
||||||
|
|
Loading…
Reference in New Issue