org.chromium.chrome.browser.ResourceId Java Examples

The following examples show how to use org.chromium.chrome.browser.ResourceId. 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: CardUnmaskBridge.java    From delion with Apache License 2.0 6 votes vote down vote up
public CardUnmaskBridge(long nativeCardUnmaskPromptViewAndroid, String title,
        String instructions, String confirmButtonLabel, int iconId,
        boolean shouldRequestExpirationDate, boolean canStoreLocally,
        boolean defaultToStoringLocally, WindowAndroid windowAndroid) {
    mNativeCardUnmaskPromptViewAndroid = nativeCardUnmaskPromptViewAndroid;
    Activity activity = windowAndroid.getActivity().get();
    if (activity == null) {
        mCardUnmaskPrompt = null;
        // Clean up the native counterpart.  This is posted to allow the native counterpart
        // to fully finish the construction of this glue object before we attempt to delete it.
        new Handler().post(new Runnable() {
            @Override
            public void run() {
                dismissed();
            }
        });
    } else {
        mCardUnmaskPrompt = new CardUnmaskPrompt(activity, this, title, instructions,
                confirmButtonLabel, ResourceId.mapToDrawableId(iconId),
                shouldRequestExpirationDate, canStoreLocally, defaultToStoringLocally);
    }
}
 
Example #2
Source File: ConnectionInfoPopup.java    From delion with Apache License 2.0 6 votes vote down vote up
private View addSection(int enumeratedIconId, String headline, String description) {
    View section = LayoutInflater.from(mContext).inflate(R.layout.connection_info,
            null);
    ImageView i = (ImageView) section.findViewById(R.id.connection_info_icon);
    int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);
    i.setImageResource(drawableId);

    TextView h = (TextView) section.findViewById(R.id.connection_info_headline);
    h.setText(headline);
    if (TextUtils.isEmpty(headline)) h.setVisibility(View.GONE);

    TextView d = (TextView) section.findViewById(R.id.connection_info_description);
    d.setText(description);
    d.setTextSize(DESCRIPTION_TEXT_SIZE_SP);
    if (TextUtils.isEmpty(description)) d.setVisibility(View.GONE);

    mContainer.addView(section);
    return section;
}
 
Example #3
Source File: GroupedPermissionInfoBar.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void createContent(InfoBarLayout layout) {
    InfoBarControlLayout control = layout.addControlLayout();

    if (mPermissionIcons.length == 1) {
        control.addIcon(ResourceId.mapToDrawableId(mPermissionIcons[0]),
                R.color.light_normal_color, mPermissionText[0], null);
    } else {
        for (int i = 0; i < mPermissionIcons.length; i++) {
            control.addSwitch(ResourceId.mapToDrawableId(mPermissionIcons[i]),
                    R.color.light_normal_color, mPermissionText[i], i, true);
        }
    }

    // Call this last to ensure that if a persistence toggle is added, it's added last.
    super.createContent(layout);
}
 
Example #4
Source File: CardUnmaskBridge.java    From 365browser with Apache License 2.0 6 votes vote down vote up
public CardUnmaskBridge(long nativeCardUnmaskPromptViewAndroid, String title,
        String instructions, String confirmButtonLabel, int iconId,
        boolean shouldRequestExpirationDate, boolean canStoreLocally,
        boolean defaultToStoringLocally, long successMessageDurationMilliseconds,
        WindowAndroid windowAndroid) {
    mNativeCardUnmaskPromptViewAndroid = nativeCardUnmaskPromptViewAndroid;
    Activity activity = windowAndroid.getActivity().get();
    if (activity == null) {
        mCardUnmaskPrompt = null;
        // Clean up the native counterpart.  This is posted to allow the native counterpart
        // to fully finish the construction of this glue object before we attempt to delete it.
        new Handler().post(new Runnable() {
            @Override
            public void run() {
                dismissed();
            }
        });
    } else {
        mCardUnmaskPrompt = new CardUnmaskPrompt(activity, this, title, instructions,
                confirmButtonLabel, ResourceId.mapToDrawableId(iconId),
                shouldRequestExpirationDate, canStoreLocally, defaultToStoringLocally,
                successMessageDurationMilliseconds);
    }
}
 
Example #5
Source File: ConnectionInfoPopup.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private View addSection(int enumeratedIconId, String headline, String description) {
    View section = LayoutInflater.from(mContext).inflate(R.layout.connection_info,
            null);
    ImageView i = (ImageView) section.findViewById(R.id.connection_info_icon);
    int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);
    i.setImageResource(drawableId);

    TextView h = (TextView) section.findViewById(R.id.connection_info_headline);
    h.setText(headline);
    if (TextUtils.isEmpty(headline)) h.setVisibility(View.GONE);

    TextView d = (TextView) section.findViewById(R.id.connection_info_description);
    d.setText(description);
    d.setTextSize(DESCRIPTION_TEXT_SIZE_SP);
    if (TextUtils.isEmpty(description)) d.setVisibility(View.GONE);

    mContainer.addView(section);
    return section;
}
 
Example #6
Source File: GroupedPermissionInfoBar.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void createContent(InfoBarLayout layout) {
    InfoBarControlLayout control = layout.addControlLayout();

    if (mPermissionIcons.length == 1) {
        control.addIcon(ResourceId.mapToDrawableId(mPermissionIcons[0]),
                R.color.light_normal_color, mPermissionText[0], null);
    } else {
        for (int i = 0; i < mPermissionIcons.length; i++) {
            control.addSwitch(ResourceId.mapToDrawableId(mPermissionIcons[i]),
                    R.color.light_normal_color, mPermissionText[i], i, true);
        }
    }

    // Call this last to ensure that if a persistence toggle is added, it's added last.
    super.createContent(layout);
}
 
Example #7
Source File: ConnectionInfoPopup.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private View addSection(int enumeratedIconId, String headline, String description) {
    View section = LayoutInflater.from(mContext).inflate(R.layout.connection_info,
            null);
    ImageView i = (ImageView) section.findViewById(R.id.connection_info_icon);
    int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);
    i.setImageResource(drawableId);

    TextView h = (TextView) section.findViewById(R.id.connection_info_headline);
    h.setText(headline);
    if (TextUtils.isEmpty(headline)) h.setVisibility(View.GONE);

    TextView d = (TextView) section.findViewById(R.id.connection_info_description);
    d.setText(description);
    d.setTextSize(DESCRIPTION_TEXT_SIZE_SP);
    if (TextUtils.isEmpty(description)) d.setVisibility(View.GONE);

    mContainer.addView(section);
    return section;
}
 
Example #8
Source File: CardUnmaskBridge.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
public CardUnmaskBridge(long nativeCardUnmaskPromptViewAndroid, String title,
        String instructions, String confirmButtonLabel, int iconId,
        boolean shouldRequestExpirationDate, boolean canStoreLocally,
        boolean defaultToStoringLocally, long successMessageDurationMilliseconds,
        WindowAndroid windowAndroid) {
    mNativeCardUnmaskPromptViewAndroid = nativeCardUnmaskPromptViewAndroid;
    Activity activity = windowAndroid.getActivity().get();
    if (activity == null) {
        mCardUnmaskPrompt = null;
        // Clean up the native counterpart.  This is posted to allow the native counterpart
        // to fully finish the construction of this glue object before we attempt to delete it.
        new Handler().post(new Runnable() {
            @Override
            public void run() {
                dismissed();
            }
        });
    } else {
        mCardUnmaskPrompt = new CardUnmaskPrompt(activity, this, title, instructions,
                confirmButtonLabel, ResourceId.mapToDrawableId(iconId),
                shouldRequestExpirationDate, canStoreLocally, defaultToStoringLocally,
                successMessageDurationMilliseconds);
    }
}
 
Example #9
Source File: ConfirmInfoBarDelegate.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Creates and begins the process for showing a ConfirmInfoBar.
 * @param nativeInfoBar Pointer to the C++ InfoBar corresponding to the Java InfoBar.
 * @param enumeratedIconId ID corresponding to the icon that will be shown for the InfoBar.
 *                         The ID must have been mapped using the ResourceMapper class before
 *                         passing it to this function.
 * @param message Message to display to the user indicating what the InfoBar is for.
 * @param linkText Link text to display in addition to the message.
 * @param buttonOk String to display on the OK button.
 * @param buttonCancel String to display on the Cancel button.
 */
@CalledByNative
InfoBar showConfirmInfoBar(int nativeInfoBar, int enumeratedIconId, String message,
        String linkText, String buttonOk, String buttonCancel) {
    int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);

    // Apparently, yellow was the popular choice at the time these InfoBars were implemented
    // because they stuck out more (hence the BACKGROUND_TYPE_WARNING) default.
    ConfirmInfoBar infoBar = new ConfirmInfoBar(nativeInfoBar, null,
            InfoBar.BACKGROUND_TYPE_WARNING, drawableId, message, linkText, buttonOk,
            buttonCancel);
    return infoBar;
}
 
Example #10
Source File: ConfirmInfoBarDelegate.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Creates and begins the process for showing a ConfirmInfoBar.
 * @param nativeInfoBar Pointer to the C++ InfoBar corresponding to the Java InfoBar.
 * @param enumeratedIconId ID corresponding to the icon that will be shown for the InfoBar.
 *                         The ID must have been mapped using the ResourceMapper class before
 *                         passing it to this function.
 * @param message Message to display to the user indicating what the InfoBar is for.
 * @param linkText Link text to display in addition to the message.
 * @param buttonOk String to display on the OK button.
 * @param buttonCancel String to display on the Cancel button.
 */
@CalledByNative
InfoBar showConfirmInfoBar(int nativeInfoBar, int enumeratedIconId, String message,
        String linkText, String buttonOk, String buttonCancel) {
    int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);

    // Apparently, yellow was the popular choice at the time these InfoBars were implemented
    // because they stuck out more (hence the BACKGROUND_TYPE_WARNING) default.
    ConfirmInfoBar infoBar = new ConfirmInfoBar(nativeInfoBar, null,
            InfoBar.BACKGROUND_TYPE_WARNING, drawableId, message, linkText, buttonOk,
            buttonCancel);
    return infoBar;
}
 
Example #11
Source File: SearchGeolocationDisclosureInfoBar.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private static InfoBar show(int enumeratedIconId, String messageText, int inlineLinkRangeStart,
        int inlineLinkRangeEnd) {
    int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);
    return new SearchGeolocationDisclosureInfoBar(
            drawableId, messageText, inlineLinkRangeStart, inlineLinkRangeEnd);
}
 
Example #12
Source File: SubresourceFilterExperimentalInfoBar.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private static InfoBar show(int enumeratedIconId, String message, String oKButtonText,
        String reloadButtonText, String toggleText, String followUpMessage) {
    return new SubresourceFilterExperimentalInfoBar(
            ResourceId.mapToDrawableId(enumeratedIconId), message, oKButtonText,
            reloadButtonText, toggleText, followUpMessage);
}
 
Example #13
Source File: PersonalDataManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@CalledByNative("CreditCard")
public static CreditCard create(String guid, String origin, boolean isLocal,
        boolean isCached, String name, String number, String obfuscatedNumber, String month,
        String year, String basicCardIssuerNetwork, int enumeratedIconId,
        String billingAddressId, String serverId) {
    return new CreditCard(guid, origin, isLocal, isCached, name, number, obfuscatedNumber,
            month, year, basicCardIssuerNetwork,
            ResourceId.mapToDrawableId(enumeratedIconId), billingAddressId, serverId);
}
 
Example #14
Source File: PermissionDialogDelegate.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Upon construction, this class takes ownership of the passed in native delegate.
 */
private PermissionDialogDelegate(long nativeDelegatePtr, Tab tab, int[] contentSettingsTypes,
        int enumeratedIconId, String message, String linkText, String primaryButtonText,
        String secondaryButtonText, boolean showPersistenceToggle) {
    mNativeDelegatePtr = nativeDelegatePtr;
    mTab = tab;
    mContentSettingsTypes = contentSettingsTypes;
    mDrawableId = ResourceId.mapToDrawableId(enumeratedIconId);
    mMessageText = message;
    mLinkText = linkText;
    mPrimaryButtonText = primaryButtonText;
    mSecondaryButtonText = secondaryButtonText;
    mShowPersistenceToggle = showPersistenceToggle;
}
 
Example #15
Source File: SearchGeolocationDisclosureInfoBar.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private static InfoBar show(int enumeratedIconId, String messageText, int inlineLinkRangeStart,
        int inlineLinkRangeEnd) {
    int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);
    return new SearchGeolocationDisclosureInfoBar(
            drawableId, messageText, inlineLinkRangeStart, inlineLinkRangeEnd);
}
 
Example #16
Source File: PersonalDataManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@CalledByNative("CreditCard")
public static CreditCard create(String guid, String origin, boolean isLocal,
        boolean isCached, String name, String number, String obfuscatedNumber, String month,
        String year, String basicCardPaymentType, int enumeratedIconId,
        String billingAddressId, String serverId) {
    return new CreditCard(guid, origin, isLocal, isCached, name, number, obfuscatedNumber,
            month, year, basicCardPaymentType, ResourceId.mapToDrawableId(enumeratedIconId),
            billingAddressId, serverId);
}
 
Example #17
Source File: PersonalDataManager.java    From delion with Apache License 2.0 5 votes vote down vote up
@CalledByNative("CreditCard")
public static CreditCard create(String guid, String origin, boolean isLocal,
        boolean isCached, String name, String number, String obfuscatedNumber, String month,
        String year, String basicCardPaymentType, int enumeratedIconId,
        String billingAddressId) {
    return new CreditCard(guid, origin, isLocal, isCached, name, number, obfuscatedNumber,
            month, year, basicCardPaymentType, ResourceId.mapToDrawableId(enumeratedIconId),
            billingAddressId);
}
 
Example #18
Source File: UpdatePasswordInfoBar.java    From delion with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private static InfoBar show(long nativePtr, int enumeratedIconId, String[] usernames,
        String primaryButtonText, String secondaryButtonText, String branding,
        boolean showMultipleAccounts, boolean isSmartLockEnabled) {
    return new UpdatePasswordInfoBar(nativePtr, ResourceId.mapToDrawableId(enumeratedIconId),
            usernames, primaryButtonText, secondaryButtonText, branding, showMultipleAccounts,
            isSmartLockEnabled);
}
 
Example #19
Source File: SavePasswordInfoBar.java    From delion with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private static InfoBar show(int enumeratedIconId, String message, int titleLinkStart,
        int titleLinkEnd, String primaryButtonText, String secondaryButtonText,
        String firstRunExperienceMessage) {
    return new SavePasswordInfoBar(ResourceId.mapToDrawableId(enumeratedIconId), message,
            titleLinkStart, titleLinkEnd, primaryButtonText, secondaryButtonText,
            firstRunExperienceMessage);
}
 
Example #20
Source File: PermissionDialogDelegate.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Upon construction, this class takes ownership of the passed in native delegate.
 */
private PermissionDialogDelegate(long nativeDelegatePtr, Tab tab, int[] contentSettingsTypes,
        int enumeratedIconId, String message, String linkText, String primaryButtonText,
        String secondaryButtonText, boolean showPersistenceToggle) {
    mNativeDelegatePtr = nativeDelegatePtr;
    mTab = tab;
    mContentSettingsTypes = contentSettingsTypes;
    mDrawableId = ResourceId.mapToDrawableId(enumeratedIconId);
    mMessageText = message;
    mLinkText = linkText;
    mPrimaryButtonText = primaryButtonText;
    mSecondaryButtonText = secondaryButtonText;
    mShowPersistenceToggle = showPersistenceToggle;
}
 
Example #21
Source File: GroupedPermissionInfoBar.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void createContent(InfoBarLayout layout) {
    super.createContent(layout);
    InfoBarControlLayout control = layout.addControlLayout();

    if (mPermissionIcons.length == 1) {
        control.addIcon(ResourceId.mapToDrawableId(mPermissionIcons[0]),
                R.color.light_normal_color, mPermissionText[0], null);
    } else {
        for (int i = 0; i < mPermissionIcons.length; i++) {
            control.addSwitch(ResourceId.mapToDrawableId(mPermissionIcons[i]),
                    R.color.light_normal_color, mPermissionText[i], i, true);
        }
    }
}
 
Example #22
Source File: UpdatePasswordInfoBar.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@CalledByNative
private static InfoBar show(int enumeratedIconId, String[] usernames, String message,
        int titleLinkStart, int titleLinkEnd, String primaryButtonText) {
    return new UpdatePasswordInfoBar(ResourceId.mapToDrawableId(enumeratedIconId), usernames,
            message, titleLinkStart, titleLinkEnd, primaryButtonText);
}
 
Example #23
Source File: UpdatePasswordInfoBar.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@CalledByNative
private static InfoBar show(int enumeratedIconId, String[] usernames, String message,
        int titleLinkStart, int titleLinkEnd, String primaryButtonText) {
    return new UpdatePasswordInfoBar(ResourceId.mapToDrawableId(enumeratedIconId), usernames,
            message, titleLinkStart, titleLinkEnd, primaryButtonText);
}
 
Example #24
Source File: SubresourceFilterInfoBar.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@CalledByNative
private static InfoBar show(int enumeratedIconId, String message, String primaryButtonText,
        String secondaryButtonText, String explanationMessage) {
    return new SubresourceFilterInfoBar(ResourceId.mapToDrawableId(enumeratedIconId), message,
            primaryButtonText, secondaryButtonText, explanationMessage);
}
 
Example #25
Source File: PreviewsInfoBar.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@CalledByNative
private static InfoBar show(
        int enumeratedIconId, String message, String linkText, String timestampText) {
    return new PreviewsInfoBar(
            ResourceId.mapToDrawableId(enumeratedIconId), message, linkText, timestampText);
}
 
Example #26
Source File: SubresourceFilterInfoBar.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@CalledByNative
private static InfoBar show(int enumeratedIconId, String message, String primaryButtonText,
        String secondaryButtonText, String explanationMessage) {
    return new SubresourceFilterInfoBar(ResourceId.mapToDrawableId(enumeratedIconId), message,
            primaryButtonText, secondaryButtonText, explanationMessage);
}
 
Example #27
Source File: ConfirmInfoBar.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Creates and begins the process for showing a ConfirmInfoBar.
 * @param enumeratedIconId ID corresponding to the icon that will be shown for the infobar.
 *                         The ID must have been mapped using the ResourceMapper class before
 *                         passing it to this function.
 * @param iconBitmap Bitmap to use if there is no equivalent Java resource for
 *                   enumeratedIconId.
 * @param message Message to display to the user indicating what the infobar is for.
 * @param linkText Link text to display in addition to the message.
 * @param buttonOk String to display on the OK button.
 * @param buttonCancel String to display on the Cancel button.
 */
@CalledByNative
private static ConfirmInfoBar create(int enumeratedIconId, Bitmap iconBitmap, String message,
        String linkText, String buttonOk, String buttonCancel) {
    int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);

    ConfirmInfoBar infoBar = new ConfirmInfoBar(drawableId, iconBitmap, message, linkText,
            buttonOk, buttonCancel);

    return infoBar;
}
 
Example #28
Source File: GeneratedPasswordSavedInfoBarDelegate.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Creates and shows the infobar to notify that the generated password was saved.
 * @param enumeratedIconId Enum ID corresponding to the icon that the infobar will show.
 * @param messageText Message to display in the infobar.
 * @param inlineLinkRangeStart The start of the range of the messageText that should be a link.
 * @param inlineLinkRangeEnd The end of the range of the messageText that should be a link.
 * @param buttonLabel String to display on the button.
 */
@CalledByNative
private static InfoBar show(int enumeratedIconId, String messageText, int inlineLinkRangeStart,
        int inlineLinkRangeEnd, String buttonLabel) {
    return new GeneratedPasswordSavedInfoBar(ResourceId.mapToDrawableId(enumeratedIconId),
            messageText, inlineLinkRangeStart, inlineLinkRangeEnd, buttonLabel);
}
 
Example #29
Source File: AutofillCreditCardFillingInfoBar.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new instance of the infobar.
 *
 * @param nativeAutofillCreditCardFillingInfoBar The pointer to the native object for callbacks.
 * @param enumeratedIconId ID corresponding to the icon that will be shown for the InfoBar.
 *                         The ID must have been mapped using the ResourceMapper class before
 *                         passing it to this function.
 * @param iconBitmap Bitmap to use if there is no equivalent Java resource for enumeratedIconId.
 * @param message Message to display to the user indicating what the InfoBar is for.
 * @param buttonOk String to display on the OK button.
 * @param buttonCancel String to display on the Cancel button.
 */
private AutofillCreditCardFillingInfoBar(long nativeAutofillCreditCardFillingInfoBar,
        int enumeratedIconId, Bitmap iconBitmap, String message, String buttonOk,
        String buttonCancel) {
    super(ResourceId.mapToDrawableId(enumeratedIconId), iconBitmap, message, null, buttonOk,
            buttonCancel);
}
 
Example #30
Source File: AutofillKeyboardAccessoryBridge.java    From delion with Apache License 2.0 3 votes vote down vote up
/**
 * @param array AutofillSuggestion array that should get a new suggestion added.
 * @param index Index in the array where to place a new suggestion.
 * @param label Suggested text. The text that's going to be filled in the focused field, with a
 *              few exceptions:
 *              <ul>
 *                  <li>Credit card numbers are elided, e.g. "Visa ****-1234."</li>
 *                  <li>The text "CLEAR FORM" will clear the filled in text.</li>
 *                  <li>Empty text can be used to display only icons, e.g. for credit card scan
 *                      or editing autofill settings.</li>
 *              </ul>
 * @param sublabel Hint for the suggested text. The text that's going to be filled in the
 *                 unfocused fields of the form. If {@see label} is empty, then this must be
 *                 empty too.
 * @param iconId The resource ID for the icon associated with the suggestion, or 0 for no icon.
 * @param suggestionId Identifier for the suggestion type.
 */
@CalledByNative
private static void addToAutofillSuggestionArray(AutofillSuggestion[] array, int index,
        String label, String sublabel, int iconId, int suggestionId, boolean deletable) {
    int drawableId = iconId == 0 ? DropdownItem.NO_ICON : ResourceId.mapToDrawableId(iconId);
    array[index] =
            new AutofillSuggestion(label, sublabel, drawableId, suggestionId, deletable, false);
}