Search in sources :

Example 1 with ChromeBaseCheckBoxPreference

use of org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference in project AndroidChromium by JackyAndroid.

the class SavePasswordsPreferences method createAutoSignInCheckbox.

private void createAutoSignInCheckbox() {
    if (!ChromeFeatureList.isEnabled(CREDENTIAL_MANAGER_API)) {
        return;
    }
    mAutoSignInSwitch = new ChromeBaseCheckBoxPreference(getActivity(), null);
    mAutoSignInSwitch.setKey(PREF_AUTOSIGNIN_SWITCH);
    mAutoSignInSwitch.setTitle(R.string.passwords_auto_signin_title);
    mAutoSignInSwitch.setOrder(ORDER_AUTO_SIGNIN_CHECKBOX);
    mAutoSignInSwitch.setSummary(R.string.passwords_auto_signin_description);
    mAutoSignInSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            PrefServiceBridge.getInstance().setPasswordManagerAutoSigninEnabled((boolean) newValue);
            return true;
        }
    });
    mAutoSignInSwitch.setManagedPreferenceDelegate(new ManagedPreferenceDelegate() {

        @Override
        public boolean isPreferenceControlledByPolicy(Preference preference) {
            return PrefServiceBridge.getInstance().isPasswordManagerAutoSigninManaged();
        }
    });
    getPreferenceScreen().addPreference(mAutoSignInSwitch);
    mAutoSignInSwitch.setChecked(PrefServiceBridge.getInstance().isPasswordManagerAutoSigninEnabled());
}
Also used : ManagedPreferenceDelegate(org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate) ChromeBaseCheckBoxPreference(org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference) ChromeSwitchPreference(org.chromium.chrome.browser.preferences.ChromeSwitchPreference) ChromeBasePreference(org.chromium.chrome.browser.preferences.ChromeBasePreference) ChromeBaseCheckBoxPreference(org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference) Preference(android.preference.Preference) OnPreferenceChangeListener(android.preference.Preference.OnPreferenceChangeListener)

Example 2 with ChromeBaseCheckBoxPreference

use of org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference in project AndroidChromium by JackyAndroid.

the class PrivacyPreferences method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();
    privacyPrefManager.migrateNetworkPredictionPreferences();
    addPreferencesFromResource(R.xml.privacy_preferences);
    getActivity().setTitle(R.string.prefs_privacy);
    setHasOptionsMenu(true);
    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
    mManagedPreferenceDelegate = createManagedPreferenceDelegate();
    ChromeBaseCheckBoxPreference networkPredictionPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
    networkPredictionPref.setChecked(prefServiceBridge.getNetworkPredictionEnabled());
    networkPredictionPref.setOnPreferenceChangeListener(this);
    networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    ChromeBaseCheckBoxPreference navigationErrorPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_NAVIGATION_ERROR);
    navigationErrorPref.setOnPreferenceChangeListener(this);
    navigationErrorPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    ChromeBaseCheckBoxPreference searchSuggestionsPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
    searchSuggestionsPref.setOnPreferenceChangeListener(this);
    searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (!ContextualSearchFieldTrial.isEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_CONTEXTUAL_SEARCH));
    }
    // Listen to changes to both Extended Reporting prefs.
    ChromeBaseCheckBoxPreference legacyExtendedReportingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_EXTENDED_REPORTING);
    legacyExtendedReportingPref.setOnPreferenceChangeListener(this);
    legacyExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    ChromeBaseCheckBoxPreference scoutReportingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_SCOUT_REPORTING);
    scoutReportingPref.setOnPreferenceChangeListener(this);
    scoutReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    // Remove the extended reporting preference that is NOT active.
    String extended_reporting_pref_to_remove = prefServiceBridge.isSafeBrowsingScoutReportingActive() ? PREF_SAFE_BROWSING_EXTENDED_REPORTING : PREF_SAFE_BROWSING_SCOUT_REPORTING;
    preferenceScreen.removePreference(findPreference(extended_reporting_pref_to_remove));
    ChromeBaseCheckBoxPreference safeBrowsingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
    safeBrowsingPref.setOnPreferenceChangeListener(this);
    safeBrowsingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    if (!PhysicalWeb.featureIsEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_PHYSICAL_WEB));
    }
    updateSummaries();
}
Also used : PrefServiceBridge(org.chromium.chrome.browser.preferences.PrefServiceBridge) ChromeBaseCheckBoxPreference(org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference) PreferenceScreen(android.preference.PreferenceScreen)

Example 3 with ChromeBaseCheckBoxPreference

use of org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference in project AndroidChromium by JackyAndroid.

the class SingleCategoryPreferences method updateThirdPartyCookiesCheckBox.

private void updateThirdPartyCookiesCheckBox() {
    ChromeBaseCheckBoxPreference thirdPartyCookiesPref = (ChromeBaseCheckBoxPreference) getPreferenceScreen().findPreference(THIRD_PARTY_COOKIES_TOGGLE_KEY);
    thirdPartyCookiesPref.setEnabled(PrefServiceBridge.getInstance().isAcceptCookiesEnabled());
    thirdPartyCookiesPref.setManagedPreferenceDelegate(new ManagedPreferenceDelegate() {

        @Override
        public boolean isPreferenceControlledByPolicy(Preference preference) {
            return PrefServiceBridge.getInstance().isBlockThirdPartyCookiesManaged();
        }
    });
}
Also used : ManagedPreferenceDelegate(org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate) ChromeBaseCheckBoxPreference(org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference) ChromeSwitchPreference(org.chromium.chrome.browser.preferences.ChromeSwitchPreference) ChromeBasePreference(org.chromium.chrome.browser.preferences.ChromeBasePreference) ChromeBaseCheckBoxPreference(org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference) Preference(android.preference.Preference)

Example 4 with ChromeBaseCheckBoxPreference

use of org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference in project AndroidChromium by JackyAndroid.

the class SingleCategoryPreferences method updateNotificationsVibrateCheckBox.

private void updateNotificationsVibrateCheckBox() {
    ChromeBaseCheckBoxPreference preference = (ChromeBaseCheckBoxPreference) getPreferenceScreen().findPreference(NOTIFICATIONS_VIBRATE_TOGGLE_KEY);
    preference.setEnabled(PrefServiceBridge.getInstance().isNotificationsEnabled());
}
Also used : ChromeBaseCheckBoxPreference(org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference)

Aggregations

ChromeBaseCheckBoxPreference (org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference)4 Preference (android.preference.Preference)2 ChromeBasePreference (org.chromium.chrome.browser.preferences.ChromeBasePreference)2 ChromeSwitchPreference (org.chromium.chrome.browser.preferences.ChromeSwitchPreference)2 ManagedPreferenceDelegate (org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate)2 OnPreferenceChangeListener (android.preference.Preference.OnPreferenceChangeListener)1 PreferenceScreen (android.preference.PreferenceScreen)1 PrefServiceBridge (org.chromium.chrome.browser.preferences.PrefServiceBridge)1