org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost Java Examples

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost. 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: StackLayout.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * @param context     The current Android's context.
 * @param updateHost  The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost  The {@link LayoutRenderHost} view for this layout.
 * @param eventFilter The {@link EventFilter} that is needed for this view.
 */
public StackLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost,
        EventFilter eventFilter) {
    super(context, updateHost, renderHost, eventFilter);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinDirectionThreshold = configuration.getScaledTouchSlop();
    mMinShortPressThresholdSqr =
            configuration.getScaledPagingTouchSlop() * configuration.getScaledPagingTouchSlop();

    mMinMaxInnerMargin = (int) (MIN_INNER_MARGIN_PERCENT_DP + 0.5);
    mFlingSpeed = FLING_SPEED_DP;
    mStacks = new Stack[2];
    mStacks[0] = new Stack(context, this);
    mStacks[1] = new Stack(context, this);
    mStackRects = new RectF[2];
    mStackRects[0] = new RectF();
    mStackRects[1] = new RectF();

    mViewContainer = new FrameLayout(getContext());
    mSceneLayer = new TabListSceneLayer();
}
 
Example #2
Source File: StackLayout.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * @param context     The current Android's context.
 * @param updateHost  The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost  The {@link LayoutRenderHost} view for this layout.
 * @param eventFilter The {@link EventFilter} that is needed for this view.
 */
public StackLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost) {
    super(context, updateHost, renderHost);

    mGestureHandler = new StackLayoutGestureHandler();
    mGestureEventFilter = new GestureEventFilter(context, mGestureHandler);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinDirectionThreshold = configuration.getScaledTouchSlop();
    mMinShortPressThresholdSqr =
            configuration.getScaledPagingTouchSlop() * configuration.getScaledPagingTouchSlop();

    mMinMaxInnerMargin = (int) (MIN_INNER_MARGIN_PERCENT_DP + 0.5);
    mFlingSpeed = FLING_SPEED_DP;
    mStacks = new Stack[2];
    mStacks[0] = new Stack(context, this);
    mStacks[1] = new Stack(context, this);
    mStackRects = new RectF[2];
    mStackRects[0] = new RectF();
    mStackRects[1] = new RectF();

    mViewContainer = new FrameLayout(getContext());
    mSceneLayer = new TabListSceneLayer();
}
 
Example #3
Source File: StackLayout.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * @param context     The current Android's context.
 * @param updateHost  The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost  The {@link LayoutRenderHost} view for this layout.
 * @param eventFilter The {@link EventFilter} that is needed for this view.
 */
public StackLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost,
        EventFilter eventFilter) {
    super(context, updateHost, renderHost, eventFilter);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinDirectionThreshold = configuration.getScaledTouchSlop();
    mMinShortPressThresholdSqr =
            configuration.getScaledPagingTouchSlop() * configuration.getScaledPagingTouchSlop();

    mMinMaxInnerMargin = (int) (MIN_INNER_MARGIN_PERCENT_DP + 0.5);
    mFlingSpeed = FLING_SPEED_DP;
    mStacks = new Stack[2];
    mStacks[0] = new Stack(context, this);
    mStacks[1] = new Stack(context, this);
    mStackRects = new RectF[2];
    mStackRects[0] = new RectF();
    mStackRects[1] = new RectF();

    mViewContainer = new FrameLayout(getContext());
    mSceneLayer = new TabListSceneLayer();
}
 
Example #4
Source File: ContextualSearchPanel.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param eventHost The {@link EventFilterHost} for propagating events.
 * @param panelManager The object managing the how different panels are shown.
 */
public ContextualSearchPanel(Context context, LayoutUpdateHost updateHost,
            EventFilterHost eventHost, OverlayPanelManager panelManager) {
    super(context, updateHost, eventHost, panelManager);
    mSceneLayer = createNewContextualSearchSceneLayer();
    mPanelMetrics = new ContextualSearchPanelMetrics();

    mBarShadowHeightPx = ApiCompatibilityUtils.getDrawable(mContext.getResources(),
            R.drawable.contextual_search_bar_shadow).getIntrinsicHeight();
    mEndButtonWidthDp = mPxToDp * (float) mContext.getResources().getDimensionPixelSize(
            R.dimen.contextual_search_end_button_width);
}
 
Example #5
Source File: OverviewListLayout.java    From 365browser with Apache License 2.0 5 votes vote down vote up
public OverviewListLayout(
        Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost) {
    super(context, updateHost, renderHost);
    mBlackHoleEventFilter = new BlackHoleEventFilter(context);
    mDpToPx = context.getResources().getDisplayMetrics().density;
    mSceneLayer = new SceneLayer();
}
 
Example #6
Source File: OverlayPanel.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param eventHost The {@link EventFilterHost} used to propagate events.
 * @param panelManager The {@link OverlayPanelManager} responsible for showing panels.
 */
public OverlayPanel(
        Context context, LayoutUpdateHost updateHost, OverlayPanelManager panelManager) {
    super(context, updateHost);
    mContentFactory = this;

    mPanelManager = panelManager;
    mPanelManager.registerPanel(this);
    mEventFilter = new OverlayPanelEventFilter(mContext, this);
}
 
Example #7
Source File: ContextualSearchPanel.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param panelManager The object managing the how different panels are shown.
 */
public ContextualSearchPanel(
        Context context, LayoutUpdateHost updateHost, OverlayPanelManager panelManager) {
    super(context, updateHost, panelManager);
    mSceneLayer = createNewContextualSearchSceneLayer();
    mPanelMetrics = new ContextualSearchPanelMetrics();

    mBarShadowHeightPx = ApiCompatibilityUtils.getDrawable(mContext.getResources(),
            R.drawable.contextual_search_bar_shadow).getIntrinsicHeight();
    mEndButtonWidthDp = mPxToDp * (float) mContext.getResources().getDimensionPixelSize(
            R.dimen.contextual_search_end_button_width);
}
 
Example #8
Source File: ReaderModePanel.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param panelManager The {@link OverlayPanelManager} used to control panel show/hide.
 * @param contentViewDelegate Notifies the activity that a ContentViewCore has been created.
 */
public ReaderModePanel(Context context, LayoutUpdateHost updateHost,
        OverlayPanelManager panelManager, OverlayPanelContentViewDelegate contentViewDelegate) {
    super(context, updateHost, panelManager);
    mSceneLayer = createNewReaderModeSceneLayer();
    mContentViewDelegate = contentViewDelegate;
}
 
Example #9
Source File: SimpleAnimationLayout.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of the {@link SimpleAnimationLayout}.
 * @param context     The current Android's context.
 * @param updateHost  The {@link LayoutUpdateHost} view for this layout.
 * @param renderHost  The {@link LayoutRenderHost} view for this layout.
 */
public SimpleAnimationLayout(
        Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost) {
    super(context, updateHost, renderHost);
    mBlackHoleEventFilter = new BlackHoleEventFilter(context);
    mSceneLayer = new TabListSceneLayer();
}
 
Example #10
Source File: StripLayoutHelperManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of the {@link StripLayoutHelperManager}.
 * @param context           The current Android {@link Context}.
 * @param updateHost        The parent {@link LayoutUpdateHost}.
 * @param renderHost        The {@link LayoutRenderHost}.
 */
public StripLayoutHelperManager(
        Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost) {
    mUpdateHost = updateHost;
    mTabStripTreeProvider = new TabStripSceneLayer(context);
    mTabStripEventHandler = new TabStripEventHandler();
    mEventFilter =
            new AreaGestureEventFilter(context, mTabStripEventHandler, null, false, false);

    mNormalHelper = new StripLayoutHelper(context, updateHost, renderHost, false);
    mIncognitoHelper = new StripLayoutHelper(context, updateHost, renderHost, true);

    CompositorOnClickHandler selectorClickHandler = new CompositorOnClickHandler() {
        @Override
        public void onClick(long time) {
            handleModelSelectorButtonClick();
        }
    };
    mModelSelectorButton = new CompositorButton(context, MODEL_SELECTOR_BUTTON_WIDTH_DP,
            MODEL_SELECTOR_BUTTON_HEIGHT_DP, selectorClickHandler);
    mModelSelectorButton.setIncognito(false);
    mModelSelectorButton.setVisible(false);
    // Pressed resources are the same as the unpressed resources.
    mModelSelectorButton.setResources(R.drawable.btn_tabstrip_switch_normal,
            R.drawable.btn_tabstrip_switch_normal, R.drawable.btn_tabstrip_switch_incognito,
            R.drawable.btn_tabstrip_switch_incognito);
    mModelSelectorButton.setY(MODEL_SELECTOR_BUTTON_Y_OFFSET_DP);

    Resources res = context.getResources();
    mHeight = res.getDimension(R.dimen.tab_strip_height) / res.getDisplayMetrics().density;
    mModelSelectorButton.setAccessibilityDescription(
            res.getString(R.string.accessibility_tabstrip_btn_incognito_toggle_standard),
            res.getString(R.string.accessibility_tabstrip_btn_incognito_toggle_incognito));

    onContextChanged(context);
}
 
Example #11
Source File: OverlayPanel.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param eventHost The {@link EventFilterHost} used to propagate events.
 * @param panelManager The {@link OverlayPanelManager} responsible for showing panels.
 */
public OverlayPanel(Context context, LayoutUpdateHost updateHost, EventFilterHost eventHost,
            OverlayPanelManager panelManager) {
    super(context, updateHost);
    mContentFactory = this;

    mPanelManager = panelManager;
    mPanelManager.registerPanel(this);
    mEventFilter = new OverlayPanelEventFilter(mContext, eventHost, this);
}
 
Example #12
Source File: ReaderModePanel.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param eventHost The {@link EventFilterHost} for propagating events.
 * @param panelManager The {@link OverlayPanelManager} used to control panel show/hide.
 * @param contentViewDelegate Notifies the activity that a ContentViewCore has been created.
 */
public ReaderModePanel(Context context, LayoutUpdateHost updateHost, EventFilterHost eventHost,
            OverlayPanelManager panelManager,
            OverlayPanelContentViewDelegate contentViewDelegate) {
    super(context, updateHost, eventHost, panelManager);
    mSceneLayer = createNewReaderModeSceneLayer();
    mContentViewDelegate = contentViewDelegate;
}
 
Example #13
Source File: StripLayoutHelperManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of the {@link StripLayoutHelperManager}.
 * @param context           The current Android {@link Context}.
 * @param updateHost        The parent {@link LayoutUpdateHost}.
 * @param renderHost        The {@link LayoutRenderHost}.
 */
public StripLayoutHelperManager(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, AreaGestureEventFilter eventFilter) {
    mUpdateHost = updateHost;
    mTabStripTreeProvider = new TabStripSceneLayer(context);

    mEventFilter = eventFilter;

    mNormalHelper = new StripLayoutHelper(context, updateHost, renderHost, false);
    mIncognitoHelper = new StripLayoutHelper(context, updateHost, renderHost, true);

    mModelSelectorButton = new CompositorButton(
            context, MODEL_SELECTOR_BUTTON_WIDTH_DP, MODEL_SELECTOR_BUTTON_HEIGHT_DP);
    mModelSelectorButton.setIncognito(false);
    mModelSelectorButton.setVisible(false);
    // Pressed resources are the same as the unpressed resources.
    mModelSelectorButton.setResources(R.drawable.btn_tabstrip_switch_normal,
            R.drawable.btn_tabstrip_switch_normal, R.drawable.btn_tabstrip_switch_incognito,
            R.drawable.btn_tabstrip_switch_incognito);
    mModelSelectorButton.setY(MODEL_SELECTOR_BUTTON_Y_OFFSET_DP);

    Resources res = context.getResources();
    mHeight = res.getDimension(R.dimen.tab_strip_height) / res.getDisplayMetrics().density;
    mModelSelectorButton.setAccessibilityDescription(
            res.getString(R.string.accessibility_tabstrip_btn_incognito_toggle_standard),
            res.getString(R.string.accessibility_tabstrip_btn_incognito_toggle_incognito));

    onContextChanged(context);
}
 
Example #14
Source File: StripLayoutHelperManager.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of the {@link StripLayoutHelperManager}.
 * @param context           The current Android {@link Context}.
 * @param updateHost        The parent {@link LayoutUpdateHost}.
 * @param renderHost        The {@link LayoutRenderHost}.
 */
public StripLayoutHelperManager(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, AreaGestureEventFilter eventFilter) {
    mUpdateHost = updateHost;
    mTabStripTreeProvider = new TabStripSceneLayer(context);

    mEventFilter = eventFilter;

    mNormalHelper = new StripLayoutHelper(context, updateHost, renderHost, false);
    mIncognitoHelper = new StripLayoutHelper(context, updateHost, renderHost, true);

    mModelSelectorButton = new CompositorButton(
            context, MODEL_SELECTOR_BUTTON_WIDTH_DP, MODEL_SELECTOR_BUTTON_HEIGHT_DP);
    mModelSelectorButton.setIncognito(false);
    mModelSelectorButton.setVisible(false);
    // Pressed resources are the same as the unpressed resources.
    mModelSelectorButton.setResources(R.drawable.btn_tabstrip_switch_normal,
            R.drawable.btn_tabstrip_switch_normal, R.drawable.btn_tabstrip_switch_incognito,
            R.drawable.btn_tabstrip_switch_incognito);
    mModelSelectorButton.setY(MODEL_SELECTOR_BUTTON_Y_OFFSET_DP);

    Resources res = context.getResources();
    mHeight = res.getDimension(R.dimen.tab_strip_height) / res.getDisplayMetrics().density;
    mModelSelectorButton.setAccessibilityDescription(
            res.getString(R.string.accessibility_tabstrip_btn_incognito_toggle_standard),
            res.getString(R.string.accessibility_tabstrip_btn_incognito_toggle_incognito));

    onContextChanged(context);
}
 
Example #15
Source File: ReaderModePanel.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param eventHost The {@link EventFilterHost} for propagating events.
 * @param panelManager The {@link OverlayPanelManager} used to control panel show/hide.
 * @param contentViewDelegate Notifies the activity that a ContentViewCore has been created.
 */
public ReaderModePanel(Context context, LayoutUpdateHost updateHost, EventFilterHost eventHost,
            OverlayPanelManager panelManager,
            OverlayPanelContentViewDelegate contentViewDelegate) {
    super(context, updateHost, eventHost, panelManager);
    mSceneLayer = createNewReaderModeSceneLayer();
    mContentViewDelegate = contentViewDelegate;
}
 
Example #16
Source File: ContextualSearchPanel.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param eventHost The {@link EventFilterHost} for propagating events.
 * @param panelManager The object managing the how different panels are shown.
 */
public ContextualSearchPanel(Context context, LayoutUpdateHost updateHost,
            EventFilterHost eventHost, OverlayPanelManager panelManager) {
    super(context, updateHost, eventHost, panelManager);
    mSceneLayer = createNewContextualSearchSceneLayer();
    mPanelMetrics = new ContextualSearchPanelMetrics();

    mBarShadowHeightPx = ApiCompatibilityUtils.getDrawable(mContext.getResources(),
            R.drawable.contextual_search_bar_shadow).getIntrinsicHeight();
}
 
Example #17
Source File: OverlayPanel.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 * @param eventHost The {@link EventFilterHost} used to propagate events.
 * @param panelManager The {@link OverlayPanelManager} responsible for showing panels.
 */
public OverlayPanel(Context context, LayoutUpdateHost updateHost, EventFilterHost eventHost,
            OverlayPanelManager panelManager) {
    super(context, updateHost);
    mContentFactory = this;

    mPanelManager = panelManager;
    mPanelManager.registerPanel(this);
    mEventFilter = new OverlayPanelEventFilter(mContext, eventHost, this);
}
 
Example #18
Source File: OverviewListLayout.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
public OverviewListLayout(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, EventFilter eventFilter) {
    super(context, updateHost, renderHost, eventFilter);
    mDpToPx = context.getResources().getDisplayMetrics().density;
    mSceneLayer = new SceneLayer();
}
 
Example #19
Source File: StripLayoutHelper.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an instance of the {@link StripLayoutHelper}.
 * @param context         The current Android {@link Context}.
 * @param updateHost      The parent {@link LayoutUpdateHost}.
 * @param renderHost      The {@link LayoutRenderHost}.
 * @param incognito       Whether or not this tab strip is incognito.
 */
public StripLayoutHelper(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, boolean incognito) {
    mTabOverlapWidth = TAB_OVERLAP_WIDTH_DP;
    mNewTabButtonWidth = NEW_TAB_BUTTON_WIDTH_DP;

    mRightMargin = LocalizationUtils.isLayoutRtl() ? 0 : mNewTabButtonWidth;
    mLeftMargin = LocalizationUtils.isLayoutRtl() ? mNewTabButtonWidth : 0;
    mMinTabWidth = MIN_TAB_WIDTH_DP;
    mMaxTabWidth = MAX_TAB_WIDTH_DP;
    mReorderMoveStartThreshold = REORDER_MOVE_START_THRESHOLD_DP;
    mUpdateHost = updateHost;
    mRenderHost = renderHost;
    mNewTabButton =
            new CompositorButton(context, NEW_TAB_BUTTON_WIDTH_DP, NEW_TAB_BUTTON_HEIGHT_DP);
    mNewTabButton.setResources(R.drawable.btn_tabstrip_new_tab_normal,
            R.drawable.btn_tabstrip_new_tab_pressed,
            R.drawable.btn_tabstrip_new_incognito_tab_normal,
            R.drawable.btn_tabstrip_new_incognito_tab_pressed);
    mNewTabButton.setIncognito(incognito);
    mNewTabButton.setY(NEW_TAB_BUTTON_Y_OFFSET_DP);
    mNewTabButton.setClickSlop(NEW_TAB_BUTTON_CLICK_SLOP_DP);
    Resources res = context.getResources();
    mNewTabButton.setAccessibilityDescription(
            res.getString(R.string.accessibility_toolbar_btn_new_tab),
            res.getString(R.string.accessibility_toolbar_btn_new_incognito_tab));
    mContext = context;
    mIncognito = incognito;
    mBrightness = 1.f;

    // Create tab menu
    mTabMenu = new ListPopupWindow(mContext);
    mTabMenu.setAdapter(new ArrayAdapter<String>(mContext, R.layout.bookmark_popup_item,
            new String[] {
                    mContext.getString(!mIncognito ? R.string.menu_close_all_tabs
                                                   : R.string.menu_close_all_incognito_tabs)}));
    mTabMenu.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            mTabMenu.dismiss();
            if (position == ID_CLOSE_ALL_TABS) {
                mModel.closeAllTabs(false, false);
            }
        }
    });

    int menuWidth = mContext.getResources().getDimensionPixelSize(R.dimen.menu_width);
    mTabMenu.setWidth(menuWidth);
    mTabMenu.setModal(true);

    int screenWidthDp = context.getResources().getConfiguration().screenWidthDp;
    mShouldCascadeTabs = screenWidthDp >= DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP;
    mStripStacker = mShouldCascadeTabs ? mCascadingStripStacker : mScrollingStripStacker;
    mIsFirstLayoutPass = true;
}
 
Example #20
Source File: ToolbarLayout.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void setLayoutUpdateHost(LayoutUpdateHost layoutUpdateHost) { }
 
Example #21
Source File: ToolbarPhone.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void setLayoutUpdateHost(LayoutUpdateHost layoutUpdateHost) {
    mLayoutUpdateHost = layoutUpdateHost;
}
 
Example #22
Source File: OverlayPanelAnimation.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 */
public OverlayPanelAnimation(Context context, LayoutUpdateHost updateHost) {
    super(context);
    mUpdateHost = updateHost;
}
 
Example #23
Source File: OverlayPanelAnimation.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 */
public OverlayPanelAnimation(Context context, LayoutUpdateHost updateHost) {
    super(context);
    mUpdateHost = updateHost;
}
 
Example #24
Source File: StripLayoutHelper.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an instance of the {@link StripLayoutHelper}.
 * @param context         The current Android {@link Context}.
 * @param updateHost      The parent {@link LayoutUpdateHost}.
 * @param renderHost      The {@link LayoutRenderHost}.
 * @param incognito       Whether or not this tab strip is incognito.
 */
public StripLayoutHelper(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, boolean incognito) {
    mTabOverlapWidth = TAB_OVERLAP_WIDTH_DP;
    mNewTabButtonWidth = NEW_TAB_BUTTON_WIDTH_DP;

    mRightMargin = LocalizationUtils.isLayoutRtl() ? 0 : mNewTabButtonWidth;
    mLeftMargin = LocalizationUtils.isLayoutRtl() ? mNewTabButtonWidth : 0;
    mMinTabWidth = MIN_TAB_WIDTH_DP;
    mMaxTabWidth = MAX_TAB_WIDTH_DP;
    mReorderMoveStartThreshold = REORDER_MOVE_START_THRESHOLD_DP;
    mUpdateHost = updateHost;
    mRenderHost = renderHost;
    CompositorOnClickHandler newTabClickHandler = new CompositorOnClickHandler() {
        @Override
        public void onClick(long time) {
            handleNewTabClick();
        }
    };
    mNewTabButton = new CompositorButton(
            context, NEW_TAB_BUTTON_WIDTH_DP, NEW_TAB_BUTTON_HEIGHT_DP, newTabClickHandler);
    mNewTabButton.setResources(R.drawable.btn_tabstrip_new_tab_normal,
            R.drawable.btn_tabstrip_new_tab_pressed,
            R.drawable.btn_tabstrip_new_incognito_tab_normal,
            R.drawable.btn_tabstrip_new_incognito_tab_pressed);
    mNewTabButton.setIncognito(incognito);
    mNewTabButton.setY(NEW_TAB_BUTTON_Y_OFFSET_DP);
    mNewTabButton.setClickSlop(NEW_TAB_BUTTON_CLICK_SLOP_DP);
    Resources res = context.getResources();
    mNewTabButton.setAccessibilityDescription(
            res.getString(R.string.accessibility_toolbar_btn_new_tab),
            res.getString(R.string.accessibility_toolbar_btn_new_incognito_tab));
    mContext = context;
    mIncognito = incognito;
    mBrightness = 1.f;

    // Create tab menu
    mTabMenu = new ListPopupWindow(mContext);
    mTabMenu.setAdapter(new ArrayAdapter<String>(mContext, R.layout.bookmark_popup_item,
            new String[] {
                    mContext.getString(!mIncognito ? R.string.menu_close_all_tabs
                                                   : R.string.menu_close_all_incognito_tabs)}));
    mTabMenu.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            mTabMenu.dismiss();
            if (position == ID_CLOSE_ALL_TABS) {
                mModel.closeAllTabs(false, false);
            }
        }
    });

    int menuWidth = mContext.getResources().getDimensionPixelSize(R.dimen.menu_width);
    mTabMenu.setWidth(menuWidth);
    mTabMenu.setModal(true);

    int screenWidthDp = context.getResources().getConfiguration().screenWidthDp;
    mShouldCascadeTabs = screenWidthDp >= DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP;
    mStripStacker = mShouldCascadeTabs ? mCascadingStripStacker : mScrollingStripStacker;
    mIsFirstLayoutPass = true;
}
 
Example #25
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public Layout createOverviewLayout(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, EventFilter eventFilter) {
    return new StackLayout(context, updateHost, renderHost, eventFilter);
}
 
Example #26
Source File: ToolbarLayout.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void setLayoutUpdateHost(LayoutUpdateHost layoutUpdateHost) { }
 
Example #27
Source File: ToolbarPhone.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void setLayoutUpdateHost(LayoutUpdateHost layoutUpdateHost) {
    mLayoutUpdateHost = layoutUpdateHost;
}
 
Example #28
Source File: OverlayPanelAnimation.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @param context The current Android {@link Context}.
 * @param updateHost The {@link LayoutUpdateHost} used to request updates in the Layout.
 */
public OverlayPanelAnimation(Context context, LayoutUpdateHost updateHost) {
    super(context);
    mUpdateHost = updateHost;
}
 
Example #29
Source File: ToolbarPhone.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void setLayoutUpdateHost(LayoutUpdateHost layoutUpdateHost) {
    mLayoutUpdateHost = layoutUpdateHost;
}
 
Example #30
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public Layout createOverviewLayout(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, EventFilter eventFilter) {
    return new StackLayout(context, updateHost, renderHost, eventFilter);
}