Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bae9d56 authored by satok's avatar satok Committed by Android (Google) Code Review
Browse files

Merge "Show usability study mode for research purposes"

parents a76c62e9 e0dfc54c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -166,4 +166,5 @@
    <string name="dictionary_pack_package_name">com.google.android.inputmethod.latin.dictionarypack</string>
    <string name="dictionary_pack_settings_activity">com.google.android.inputmethod.latin.dictionarypack.DictionarySettingsActivity</string>
    <string name="settings_ms">ms</string>
    <string name="settings_warning_researcher_mode">Attention!  You are using the special keyboard for research purposes.</string>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -78,4 +78,8 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang

    public static void onPrintAllUsabilityStudyLogs() {
    }

    public static boolean isResearcherPackage() {
        return false;
    }
}
+15 −6
Original line number Diff line number Diff line
@@ -242,12 +242,21 @@ public class Settings extends InputMethodSettingsActivity
            textCorrectionGroup.removePreference(dictionaryLink);
        }

        final boolean showUsabilityModeStudyOption = res.getBoolean(
                R.bool.config_enable_usability_study_mode_option);
        if (!showUsabilityModeStudyOption || !ENABLE_EXPERIMENTAL_SETTINGS) {
            final Preference pref = findPreference(PREF_USABILITY_STUDY_MODE);
            if (pref != null) {
                miscSettings.removePreference(pref);
        final boolean isResearcherPackage = LatinImeLogger.isResearcherPackage();
        final boolean showUsabilityStudyModeOption =
                res.getBoolean(R.bool.config_enable_usability_study_mode_option)
                        || isResearcherPackage || ENABLE_EXPERIMENTAL_SETTINGS;
        final Preference usabilityStudyPref = findPreference(PREF_USABILITY_STUDY_MODE);
        if (!showUsabilityStudyModeOption) {
            if (usabilityStudyPref != null) {
                miscSettings.removePreference(usabilityStudyPref);
            }
        }
        if (isResearcherPackage) {
            if (usabilityStudyPref instanceof CheckBoxPreference) {
                CheckBoxPreference checkbox = (CheckBoxPreference)usabilityStudyPref;
                checkbox.setChecked(prefs.getBoolean(PREF_USABILITY_STUDY_MODE, true));
                checkbox.setSummary(R.string.settings_warning_researcher_mode);
            }
        }