Search in sources :

Example 26 with Tab

use of org.chromium.chrome.browser.tab.Tab in project AndroidChromium by JackyAndroid.

the class LayoutManagerChrome method doneHiding.

@Override
public void doneHiding() {
    Layout layoutBeingHidden = getActiveLayout();
    if (getNextLayout() == getDefaultLayout()) {
        Tab tab = getTabModelSelector() != null ? getTabModelSelector().getCurrentTab() : null;
        emptyCachesExcept(tab != null ? tab.getId() : Tab.INVALID_TAB_ID);
    }
    super.doneHiding();
    if (isOverviewLayout(layoutBeingHidden)) {
        for (OverviewModeObserver observer : mOverviewModeObservers) {
            observer.onOverviewModeFinishedHiding();
        }
    }
}
Also used : LayoutTab(org.chromium.chrome.browser.compositor.layouts.components.LayoutTab) Tab(org.chromium.chrome.browser.tab.Tab) OverviewListLayout(org.chromium.chrome.browser.widget.OverviewListLayout)

Example 27 with Tab

use of org.chromium.chrome.browser.tab.Tab in project AndroidChromium by JackyAndroid.

the class LayoutManagerChrome method tabClosed.

private void tabClosed(int tabId, boolean incognito, boolean tabRemoved) {
    Tab currentTab = getTabModelSelector() != null ? getTabModelSelector().getCurrentTab() : null;
    int nextTabId = currentTab != null ? currentTab.getId() : Tab.INVALID_TAB_ID;
    tabClosed(tabId, nextTabId, incognito, tabRemoved);
}
Also used : LayoutTab(org.chromium.chrome.browser.compositor.layouts.components.LayoutTab) Tab(org.chromium.chrome.browser.tab.Tab)

Example 28 with Tab

use of org.chromium.chrome.browser.tab.Tab in project AndroidChromium by JackyAndroid.

the class StackViewAnimation method createNewTabOpenedAnimator.

private Animator createNewTabOpenedAnimator(StackTab[] tabs, ViewGroup container, TabModel model, int focusIndex) {
    Tab tab = model.getTabAt(focusIndex);
    if (tab == null || !tab.isNativePage())
        return null;
    View view = tab.getView();
    if (view == null)
        return null;
    // Set up the view hierarchy
    if (view.getParent() != null)
        ((ViewGroup) view.getParent()).removeView(view);
    ViewGroup bgView = new FrameLayout(view.getContext());
    bgView.setBackgroundColor(tab.getBackgroundColor());
    bgView.addView(view);
    container.addView(bgView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    // Update any compositor state that needs to change
    if (tabs != null && focusIndex >= 0 && focusIndex < tabs.length) {
        tabs[focusIndex].setAlpha(0.f);
    }
    // Build the view animations
    PropertyValuesHolder xScale = PropertyValuesHolder.ofFloat(View.SCALE_X, 0.f, 1.f);
    PropertyValuesHolder yScale = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.f, 1.f);
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0.f, 1.f);
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(bgView, xScale, yScale, alpha);
    animator.setDuration(TAB_OPENED_ANIMATION_DURATION);
    animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_FOLLOW_THROUGH_CURVE);
    float insetPx = TAB_OPENED_PIVOT_INSET_DP * mDpToPx;
    bgView.setPivotY(TAB_OPENED_PIVOT_INSET_DP);
    bgView.setPivotX(LocalizationUtils.isLayoutRtl() ? mWidthDp * mDpToPx - insetPx : insetPx);
    return animator;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) Tab(org.chromium.chrome.browser.tab.Tab) ViewGroup(android.view.ViewGroup) ObjectAnimator(android.animation.ObjectAnimator) FrameLayout(android.widget.FrameLayout) PropertyValuesHolder(android.animation.PropertyValuesHolder) View(android.view.View)

Example 29 with Tab

use of org.chromium.chrome.browser.tab.Tab in project AndroidChromium by JackyAndroid.

the class StripLayoutHelper method computeAndUpdateTabOrders.

private void computeAndUpdateTabOrders(boolean delayResize) {
    final int count = mModel.getCount();
    StripLayoutTab[] tabs = new StripLayoutTab[count];
    for (int i = 0; i < count; i++) {
        final Tab tab = mModel.getTabAt(i);
        final int id = tab.getId();
        final StripLayoutTab oldTab = findTabById(id);
        tabs[i] = oldTab != null ? oldTab : createStripTab(id);
        setAccessibilityDescription(tabs[i], tab);
    }
    int oldStripLength = mStripTabs.length;
    mStripTabs = tabs;
    if (mStripTabs.length != oldStripLength)
        resizeTabStrip(delayResize);
    updateVisualTabOrdering();
}
Also used : Tab(org.chromium.chrome.browser.tab.Tab) SuppressLint(android.annotation.SuppressLint)

Example 30 with Tab

use of org.chromium.chrome.browser.tab.Tab in project AndroidChromium by JackyAndroid.

the class StripLayoutHelperManager method getUpdatedSceneOverlayTree.

@Override
public SceneOverlayLayer getUpdatedSceneOverlayTree(LayerTitleCache layerTitleCache, ResourceManager resourceManager, float yOffset) {
    assert mTabStripTreeProvider != null;
    Tab selectedTab = mTabModelSelector.getCurrentModel().getTabAt(mTabModelSelector.getCurrentModel().index());
    int selectedTabId = selectedTab == null ? TabModel.INVALID_TAB_INDEX : selectedTab.getId();
    mTabStripTreeProvider.pushAndUpdateStrip(this, layerTitleCache, resourceManager, getActiveStripLayoutHelper().getStripLayoutTabsToRender(), yOffset, selectedTabId);
    return mTabStripTreeProvider;
}
Also used : Tab(org.chromium.chrome.browser.tab.Tab)

Aggregations

Tab (org.chromium.chrome.browser.tab.Tab)116 LayoutTab (org.chromium.chrome.browser.compositor.layouts.components.LayoutTab)13 TabModel (org.chromium.chrome.browser.tabmodel.TabModel)10 LoadUrlParams (org.chromium.content_public.browser.LoadUrlParams)9 SuppressLint (android.annotation.SuppressLint)8 TabModelSelectorTabObserver (org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver)8 Intent (android.content.Intent)5 FrameLayout (android.widget.FrameLayout)4 ContentViewCore (org.chromium.content.browser.ContentViewCore)4 WebContents (org.chromium.content_public.browser.WebContents)4 Activity (android.app.Activity)3 Bitmap (android.graphics.Bitmap)3 TabLaunchType (org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType)3 PendingIntent (android.app.PendingIntent)2 Context (android.content.Context)2 Bundle (android.os.Bundle)2 StrictMode (android.os.StrictMode)2 CustomTabsIntent (android.support.customtabs.CustomTabsIntent)2 MenuItem (android.view.MenuItem)2 View (android.view.View)2