Java Code Examples for org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile#getLanguageCode()

The following examples show how to use org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile#getLanguageCode() . 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: AutofillProfileEditor.java    From delion with Apache License 2.0 4 votes vote down vote up
private void createAndPopulateEditFields() {
    AutofillProfile profile = PersonalDataManager.getInstance().getProfile(mGUID);

    if (profile != null) {
        if (!TextUtils.isEmpty(profile.getPhoneNumber())) {
            mPhoneLabel.getEditText().setText(profile.getPhoneNumber());
        }

        if (!TextUtils.isEmpty(profile.getEmailAddress())) {
            mEmailLabel.getEditText().setText(profile.getEmailAddress());
        }

        mLanguageCodeString = profile.getLanguageCode();
        mUseSavedProfileLanguage = true;

        mCurrentCountryPos = mCountryCodes.indexOf(profile.getCountryCode());
        if (mCurrentCountryPos == -1) {
            // Use the default country code if profile code is invalid.
            mCurrentCountryPos = mCountryCodes.indexOf(
                    AutofillProfileBridge.getDefaultCountryCode());
            if (mCurrentCountryPos == -1) {
                // Use the first item in country spinner if the default country code is
                // invalid.
                mCurrentCountryPos = 0;
            }
        }

        resetFormFields(mCurrentCountryPos, false);

        setFieldText(AddressField.ADMIN_AREA, profile.getRegion());
        setFieldText(AddressField.LOCALITY, profile.getLocality());
        setFieldText(AddressField.DEPENDENT_LOCALITY, profile.getDependentLocality());
        setFieldText(AddressField.SORTING_CODE, profile.getSortingCode());
        setFieldText(AddressField.POSTAL_CODE, profile.getPostalCode());
        setFieldText(AddressField.STREET_ADDRESS, profile.getStreetAddress());
        setFieldText(AddressField.ORGANIZATION, profile.getCompanyName());
        setFieldText(AddressField.RECIPIENT, profile.getFullName());
    } else {
        mCurrentCountryPos = mCountryCodes.indexOf(
                AutofillProfileBridge.getDefaultCountryCode());
        if (mCurrentCountryPos == -1) {
            // Use the first item in country spinner if the default country code is
            // invalid.
            mCurrentCountryPos = 0;
        }
        resetFormFields(mCurrentCountryPos, true);
    }

    mCountriesDropdown.setSelection(mCurrentCountryPos);
}
 
Example 2
Source File: AutofillProfileEditor.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private void createAndPopulateEditFields() {
    AutofillProfile profile = PersonalDataManager.getInstance().getProfile(mGUID);

    if (profile != null) {
        if (!TextUtils.isEmpty(profile.getPhoneNumber())) {
            mPhoneLabel.getEditText().setText(profile.getPhoneNumber());
        }

        if (!TextUtils.isEmpty(profile.getEmailAddress())) {
            mEmailLabel.getEditText().setText(profile.getEmailAddress());
        }

        mLanguageCodeString = profile.getLanguageCode();
        mUseSavedProfileLanguage = true;

        mCurrentCountryPos = mCountryCodes.indexOf(profile.getCountryCode());
        if (mCurrentCountryPos == -1) {
            // Use the default country code if profile code is invalid.
            mCurrentCountryPos = mCountryCodes.indexOf(
                    AutofillProfileBridge.getDefaultCountryCode());
            if (mCurrentCountryPos == -1) {
                // Use the first item in country spinner if the default country code is
                // invalid.
                mCurrentCountryPos = 0;
            }
        }

        resetFormFields(mCurrentCountryPos, false);

        setFieldText(AddressField.ADMIN_AREA, profile.getRegion());
        setFieldText(AddressField.LOCALITY, profile.getLocality());
        setFieldText(AddressField.DEPENDENT_LOCALITY, profile.getDependentLocality());
        setFieldText(AddressField.SORTING_CODE, profile.getSortingCode());
        setFieldText(AddressField.POSTAL_CODE, profile.getPostalCode());
        setFieldText(AddressField.STREET_ADDRESS, profile.getStreetAddress());
        setFieldText(AddressField.ORGANIZATION, profile.getCompanyName());
        setFieldText(AddressField.RECIPIENT, profile.getFullName());
    } else {
        mCurrentCountryPos = mCountryCodes.indexOf(
                AutofillProfileBridge.getDefaultCountryCode());
        if (mCurrentCountryPos == -1) {
            // Use the first item in country spinner if the default country code is
            // invalid.
            mCurrentCountryPos = 0;
        }
        resetFormFields(mCurrentCountryPos, true);
    }

    mCountriesDropdown.setSelection(mCurrentCountryPos);
}
 
Example 3
Source File: AutofillProfileEditor.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void createAndPopulateEditFields() {
    AutofillProfile profile = PersonalDataManager.getInstance().getProfile(mGUID);

    if (profile != null) {
        if (!TextUtils.isEmpty(profile.getPhoneNumber())) {
            mPhoneLabel.getEditText().setText(profile.getPhoneNumber());
        }

        if (!TextUtils.isEmpty(profile.getEmailAddress())) {
            mEmailLabel.getEditText().setText(profile.getEmailAddress());
        }

        mLanguageCodeString = profile.getLanguageCode();
        mUseSavedProfileLanguage = true;

        mCurrentCountryPos = mCountryCodes.indexOf(profile.getCountryCode());
        if (mCurrentCountryPos == -1) {
            // Use the default country code if profile code is invalid.
            mCurrentCountryPos = mCountryCodes.indexOf(
                    AutofillProfileBridge.getDefaultCountryCode());
            if (mCurrentCountryPos == -1) {
                // Use the first item in country spinner if the default country code is
                // invalid.
                mCurrentCountryPos = 0;
            }
        }

        resetFormFields(mCurrentCountryPos, false);

        setFieldText(AddressField.ADMIN_AREA, profile.getRegion());
        setFieldText(AddressField.LOCALITY, profile.getLocality());
        setFieldText(AddressField.DEPENDENT_LOCALITY, profile.getDependentLocality());
        setFieldText(AddressField.SORTING_CODE, profile.getSortingCode());
        setFieldText(AddressField.POSTAL_CODE, profile.getPostalCode());
        setFieldText(AddressField.STREET_ADDRESS, profile.getStreetAddress());
        setFieldText(AddressField.ORGANIZATION, profile.getCompanyName());
        setFieldText(AddressField.RECIPIENT, profile.getFullName());
    } else {
        mCurrentCountryPos = mCountryCodes.indexOf(
                AutofillProfileBridge.getDefaultCountryCode());
        if (mCurrentCountryPos == -1) {
            // Use the first item in country spinner if the default country code is
            // invalid.
            mCurrentCountryPos = 0;
        }
        resetFormFields(mCurrentCountryPos, true);
    }

    mCountriesDropdown.setSelection(mCurrentCountryPos);
}