org.chromium.chrome.browser.PasswordUIView Java Examples

The following examples show how to use org.chromium.chrome.browser.PasswordUIView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SavePasswordsPreferences.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (PasswordUIView.shouldUseSmartLockBranding()) {
        getActivity().setTitle(R.string.prefs_smart_lock_for_passwords);
    } else {
        getActivity().setTitle(R.string.prefs_saved_passwords);
    }
    setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getActivity()));
    mPasswordManagerHandler.addObserver(this);

    mEmptyView = new TextView(getActivity(), null);
    mEmptyView.setText(R.string.saved_passwords_none_text);
    mEmptyView.setGravity(Gravity.CENTER);
    mEmptyView.setVisibility(View.GONE);
}
 
Example #2
Source File: SavePasswordsPreferences.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (PasswordUIView.shouldUseSmartLockBranding()) {
        getActivity().setTitle(R.string.prefs_smart_lock_for_passwords);
    } else {
        getActivity().setTitle(R.string.prefs_saved_passwords);
    }
    setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getActivity()));
    mPasswordManagerHandler.addObserver(this);

    mEmptyView = new TextView(getActivity(), null);
    mEmptyView.setText(R.string.saved_passwords_none_text);
    mEmptyView.setGravity(Gravity.CENTER);
    mEmptyView.setVisibility(View.GONE);
}
 
Example #3
Source File: MainPreferences.java    From delion with Apache License 2.0 5 votes vote down vote up
private void updatePreferences() {
    if (getPreferenceScreen() != null) getPreferenceScreen().removeAll();
    addPreferencesFromResource(R.xml.main_preferences);

    ChromeBasePreference autofillPref =
            (ChromeBasePreference) findPreference(PREF_AUTOFILL_SETTINGS);
    setOnOffSummary(autofillPref, PersonalDataManager.isAutofillEnabled());
    autofillPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBasePreference passwordsPref =
            (ChromeBasePreference) findPreference(PREF_SAVED_PASSWORDS);
    if (PasswordUIView.shouldUseSmartLockBranding()) {
        passwordsPref.setTitle(getResources().getString(
                R.string.prefs_smart_lock_for_passwords));
    }
    setOnOffSummary(passwordsPref,
            PrefServiceBridge.getInstance().isRememberPasswordsEnabled());
    passwordsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    Preference homepagePref = findPreference(PREF_HOMEPAGE);
    if (HomepageManager.shouldShowHomepageSetting()) {
        setOnOffSummary(homepagePref,
                HomepageManager.getInstance(getActivity()).getPrefHomepageEnabled());
    } else {
        getPreferenceScreen().removePreference(homepagePref);
    }

    ChromeBasePreference dataReduction =
            (ChromeBasePreference) findPreference(PREF_DATA_REDUCTION);
    if (DataReductionProxySettings.getInstance().isDataReductionProxyAllowed()) {
        dataReduction.setSummary(
                DataReductionPreferences.generateSummary(getResources()));
        dataReduction.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    } else {
        getPreferenceScreen().removePreference(dataReduction);
    }
}
 
Example #4
Source File: SavePasswordsPreferences.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void passwordListAvailable(int count) {
    resetList(PREF_CATEGORY_SAVED_PASSWORDS);
    mNoPasswords = count == 0;
    if (mNoPasswords) {
        if (mNoPasswordExceptions) displayEmptyScreenMessage();
        return;
    }

    displayManageAccountLink();

    PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
    profileCategory.setKey(PREF_CATEGORY_SAVED_PASSWORDS);
    profileCategory.setTitle(R.string.section_saved_passwords);
    profileCategory.setOrder(ORDER_SAVED_PASSWORDS);
    getPreferenceScreen().addPreference(profileCategory);
    for (int i = 0; i < count; i++) {
        PasswordUIView.SavedPasswordEntry saved =
                mPasswordManagerHandler.getSavedPasswordEntry(i);
        PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
        String url = saved.getUrl();
        String name = saved.getUserName();
        screen.setTitle(url);
        screen.setOnPreferenceClickListener(this);
        screen.setSummary(name);
        Bundle args = screen.getExtras();
        args.putString(PASSWORD_LIST_NAME, name);
        args.putString(PASSWORD_LIST_URL, url);
        args.putInt(PASSWORD_LIST_ID, i);
        profileCategory.addPreference(screen);
    }
}
 
Example #5
Source File: MainPreferences.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onPreferenceClick(Preference preference) {
    Intent intent = new Intent(
              Intent.ACTION_VIEW,
              Uri.parse(PasswordUIView.getAccountDashboardURL()));
    intent.setPackage(getActivity().getPackageName());
    getActivity().startActivity(intent);
    return true;
}
 
Example #6
Source File: SavePasswordsPreferences.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void passwordListAvailable(int count) {
    resetList(PREF_CATEGORY_SAVED_PASSWORDS);
    mNoPasswords = count == 0;
    if (mNoPasswords) {
        if (mNoPasswordExceptions) displayEmptyScreenMessage();
        return;
    }

    displayManageAccountLink();

    PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
    profileCategory.setKey(PREF_CATEGORY_SAVED_PASSWORDS);
    profileCategory.setTitle(R.string.section_saved_passwords);
    profileCategory.setOrder(ORDER_SAVED_PASSWORDS);
    getPreferenceScreen().addPreference(profileCategory);
    for (int i = 0; i < count; i++) {
        PasswordUIView.SavedPasswordEntry saved =
                mPasswordManagerHandler.getSavedPasswordEntry(i);
        PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
        String url = saved.getUrl();
        String name = saved.getUserName();
        screen.setTitle(url);
        screen.setOnPreferenceClickListener(this);
        screen.setSummary(name);
        Bundle args = screen.getExtras();
        args.putString(PASSWORD_LIST_NAME, name);
        args.putString(PASSWORD_LIST_URL, url);
        args.putInt(PASSWORD_LIST_ID, i);
        profileCategory.addPreference(screen);
    }
}
 
Example #7
Source File: MainPreferences.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onPreferenceClick(Preference preference) {
    Intent intent = new Intent(
              Intent.ACTION_VIEW,
              Uri.parse(PasswordUIView.getAccountDashboardURL()));
    intent.setPackage(getActivity().getPackageName());
    getActivity().startActivity(intent);
    return true;
}
 
Example #8
Source File: SavePasswordsPreferences.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void passwordListAvailable(int count) {
    resetList(PREF_CATEGORY_SAVED_PASSWORDS);
    resetList(PREF_CATEGORY_SAVED_PASSWORDS_NO_TEXT);

    mNoPasswords = count == 0;
    if (mNoPasswords) {
        if (mNoPasswordExceptions) displayEmptyScreenMessage();
        return;
    }

    displayManageAccountLink();

    PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
    profileCategory.setKey(PREF_CATEGORY_SAVED_PASSWORDS);
    profileCategory.setTitle(R.string.section_saved_passwords);
    profileCategory.setOrder(ORDER_SAVED_PASSWORDS);
    getPreferenceScreen().addPreference(profileCategory);
    for (int i = 0; i < count; i++) {
        PasswordUIView.SavedPasswordEntry saved =
                mPasswordManagerHandler.getSavedPasswordEntry(i);
        PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
        String url = saved.getUrl();
        String name = saved.getUserName();
        screen.setTitle(url);
        screen.setOnPreferenceClickListener(this);
        screen.setSummary(name);
        Bundle args = screen.getExtras();
        args.putString(PASSWORD_LIST_NAME, name);
        args.putString(PASSWORD_LIST_URL, url);
        args.putInt(PASSWORD_LIST_ID, i);
        profileCategory.addPreference(screen);
    }
}
 
Example #9
Source File: MainPreferences.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private void updatePreferences() {
    if (getPreferenceScreen() != null) getPreferenceScreen().removeAll();
    addPreferencesFromResource(R.xml.main_preferences);

    addBlimpPreferences();

    if (TemplateUrlService.getInstance().isLoaded()) {
        updateSummary();
    } else {
        TemplateUrlService.getInstance().registerLoadListener(this);
        TemplateUrlService.getInstance().load();
        ChromeBasePreference searchEnginePref =
                (ChromeBasePreference) findPreference(PREF_SEARCH_ENGINE);
        searchEnginePref.setEnabled(false);
    }

    ChromeBasePreference autofillPref =
            (ChromeBasePreference) findPreference(PREF_AUTOFILL_SETTINGS);
    setOnOffSummary(autofillPref, PersonalDataManager.isAutofillEnabled());
    autofillPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBasePreference passwordsPref =
            (ChromeBasePreference) findPreference(PREF_SAVED_PASSWORDS);

    ProfileSyncService syncService = ProfileSyncService.get();

    if (AndroidSyncSettings.isSyncEnabled(getActivity().getApplicationContext())
              && syncService.isBackendInitialized()
              && !syncService.isUsingSecondaryPassphrase()
              && ChromeFeatureList.isEnabled(VIEW_PASSWORDS)) {
        passwordsPref.setKey(PREF_MANAGE_ACCOUNT_LINK);
        passwordsPref.setTitle(R.string.redirect_to_passwords_text);
        passwordsPref.setSummary(R.string.redirect_to_passwords_link);
        passwordsPref.setOnPreferenceClickListener(this);
        passwordsPref.setManagedPreferenceDelegate(null);
    } else {
        if (PasswordUIView.shouldUseSmartLockBranding()) {
            passwordsPref.setTitle(getResources().getString(
                     R.string.prefs_smart_lock_for_passwords));
        } else {
            passwordsPref.setTitle(getResources().getString(
                      R.string.prefs_saved_passwords));
        }
        passwordsPref.setFragment(SavePasswordsPreferences.class.getCanonicalName());
        setOnOffSummary(passwordsPref,
                PrefServiceBridge.getInstance().isRememberPasswordsEnabled());
        passwordsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    }

    Preference homepagePref = findPreference(PREF_HOMEPAGE);
    if (HomepageManager.shouldShowHomepageSetting()) {
        setOnOffSummary(homepagePref,
                HomepageManager.getInstance(getActivity()).getPrefHomepageEnabled());
    } else {
        getPreferenceScreen().removePreference(homepagePref);
    }

    ChromeBasePreference dataReduction =
            (ChromeBasePreference) findPreference(PREF_DATA_REDUCTION);
    if (DataReductionProxySettings.getInstance().isDataReductionProxyAllowed()) {
        dataReduction.setSummary(
                DataReductionPreferences.generateSummary(getResources()));
        dataReduction.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    } else {
        getPreferenceScreen().removePreference(dataReduction);
    }

    if (!SigninManager.get(getActivity()).isSigninSupported()) {
        getPreferenceScreen().removePreference(findPreference(PREF_SIGN_IN));
    }
}