Java Code Examples for org.chromium.chrome.browser.compositor.layouts.components.CompositorButton#setBounds()

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.components.CompositorButton#setBounds() . 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: StripLayoutTab.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Create a {@link StripLayoutTab} that represents the {@link Tab} with an id of
 * {@code id}.
 *
 * @param context An Android context for accessing system resources.
 * @param id The id of the {@link Tab} to visually represent.
 * @param loadTrackerCallback The {@link TabLoadTrackerCallback} to be notified of loading state
 *                            changes.
 * @param renderHost The {@link LayoutRenderHost}.
 * @param incogntio Whether or not this layout tab is icognito.
 */
public StripLayoutTab(Context context, int id, TabLoadTrackerCallback loadTrackerCallback,
        LayoutRenderHost renderHost, boolean incognito) {
    mId = id;
    mLoadTracker = new TabLoadTracker(id, loadTrackerCallback);
    mRenderHost = renderHost;
    mIncognito = incognito;
    mCloseButton = new CompositorButton(context, 0, 0);
    mCloseButton.setResources(R.drawable.btn_tab_close_normal, R.drawable.btn_tab_close_pressed,
            R.drawable.btn_tab_close_white_normal, R.drawable.btn_tab_close_white_pressed);
    mCloseButton.setIncognito(mIncognito);
    mCloseButton.setBounds(getCloseRect());
    mCloseButton.setClickSlop(0.f);
    String description =
            context.getResources().getString(R.string.accessibility_tabstrip_btn_close_tab);
    mCloseButton.setAccessibilityDescription(description, description);
}
 
Example 2
Source File: StripLayoutTab.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Create a {@link StripLayoutTab} that represents the {@link Tab} with an id of
 * {@code id}.
 *
 * @param context An Android context for accessing system resources.
 * @param id The id of the {@link Tab} to visually represent.
 * @param loadTrackerCallback The {@link TabLoadTrackerCallback} to be notified of loading state
 *                            changes.
 * @param renderHost The {@link LayoutRenderHost}.
 * @param incognito Whether or not this layout tab is incognito.
 */
public StripLayoutTab(Context context, int id, TabLoadTrackerCallback loadTrackerCallback,
        LayoutRenderHost renderHost, boolean incognito) {
    mId = id;
    mLoadTracker = new TabLoadTracker(id, loadTrackerCallback);
    mRenderHost = renderHost;
    mIncognito = incognito;
    mCloseButton = new CompositorButton(context, 0, 0);
    mCloseButton.setResources(R.drawable.btn_tab_close_normal, R.drawable.btn_tab_close_pressed,
            R.drawable.btn_tab_close_white_normal, R.drawable.btn_tab_close_white_pressed);
    mCloseButton.setIncognito(mIncognito);
    mCloseButton.setBounds(getCloseRect());
    mCloseButton.setClickSlop(0.f);
    String description =
            context.getResources().getString(R.string.accessibility_tabstrip_btn_close_tab);
    mCloseButton.setAccessibilityDescription(description, description);
}
 
Example 3
Source File: StripLayoutTab.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Create a {@link StripLayoutTab} that represents the {@link Tab} with an id of
 * {@code id}.
 *
 * @param context An Android context for accessing system resources.
 * @param id The id of the {@link Tab} to visually represent.
 * @param delegate The delegate for additional strip tab functionality.
 * @param loadTrackerCallback The {@link TabLoadTrackerCallback} to be notified of loading state
 *                            changes.
 * @param renderHost The {@link LayoutRenderHost}.
 * @param incognito Whether or not this layout tab is incognito.
 */
public StripLayoutTab(Context context, int id, StripLayoutTabDelegate delegate,
        TabLoadTrackerCallback loadTrackerCallback, LayoutRenderHost renderHost,
        boolean incognito) {
    mId = id;
    mDelegate = delegate;
    mLoadTracker = new TabLoadTracker(id, loadTrackerCallback);
    mRenderHost = renderHost;
    mIncognito = incognito;
    CompositorOnClickHandler closeClickAction = new CompositorOnClickHandler() {
        @Override
        public void onClick(long time) {
            mDelegate.handleCloseButtonClick(StripLayoutTab.this, time);
        }
    };
    mCloseButton = new CompositorButton(context, 0, 0, closeClickAction);
    mCloseButton.setResources(R.drawable.btn_tab_close_normal, R.drawable.btn_tab_close_pressed,
            R.drawable.btn_tab_close_white_normal, R.drawable.btn_tab_close_white_pressed);
    mCloseButton.setIncognito(mIncognito);
    mCloseButton.setBounds(getCloseRect());
    mCloseButton.setClickSlop(0.f);
    String description =
            context.getResources().getString(R.string.accessibility_tabstrip_btn_close_tab);
    mCloseButton.setAccessibilityDescription(description, description);
}