Java Code Examples for org.chromium.chrome.browser.tabmodel.TabModel#getTabAt()
The following examples show how to use
org.chromium.chrome.browser.tabmodel.TabModel#getTabAt() .
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: StackViewAnimation.java From delion with Apache License 2.0 | 5 votes |
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; }
Example 2
Source File: Tab.java From delion with Apache License 2.0 | 5 votes |
/** * @return The most recently used rank for this tab in the given TabModel. */ private static int computeMRURank(Tab tab, TabModel model) { final long tabLastShow = tab.getTabUma().getLastShownTimestamp(); int mruRank = 0; for (int i = 0; i < model.getCount(); i++) { Tab otherTab = model.getTabAt(i); if (otherTab != tab && otherTab.getTabUma() != null && otherTab.getTabUma().getLastShownTimestamp() > tabLastShow) { mruRank++; } } return mruRank; }
Example 3
Source File: StackViewAnimation.java From AndroidChromium with Apache License 2.0 | 5 votes |
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; }
Example 4
Source File: Tab.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * @return The most recently used rank for this tab in the given TabModel. */ private static int computeMRURank(Tab tab, TabModel model) { final long tabLastShow = tab.getTabUma().getLastShownTimestamp(); int mruRank = 0; for (int i = 0; i < model.getCount(); i++) { Tab otherTab = model.getTabAt(i); if (otherTab != tab && otherTab.getTabUma() != null && otherTab.getTabUma().getLastShownTimestamp() > tabLastShow) { mruRank++; } } return mruRank; }
Example 5
Source File: StackViewAnimation.java From 365browser with Apache License 2.0 | 5 votes |
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; }
Example 6
Source File: Tab.java From 365browser with Apache License 2.0 | 5 votes |
/** * @return The most recently used rank for this tab in the given TabModel. */ private static int computeMRURank(Tab tab, TabModel model) { final long tabLastShow = tab.getTabUma().getLastShownTimestamp(); int mruRank = 0; for (int i = 0; i < model.getCount(); i++) { Tab otherTab = model.getTabAt(i); if (otherTab != tab && otherTab.getTabUma() != null && otherTab.getTabUma().getLastShownTimestamp() > tabLastShow) { mruRank++; } } return mruRank; }