| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.compositor.layouts.phone; | 5 package org.chromium.chrome.browser.compositor.layouts.phone; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.RectF; | 8 import android.graphics.RectF; |
| 9 import android.view.animation.Interpolator; | 9 import android.view.animation.Interpolator; |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 * A cached {@link LayoutTab} representation of the currently closing tab. I
f it's not | 62 * A cached {@link LayoutTab} representation of the currently closing tab. I
f it's not |
| 63 * null, it means tabClosing() has been called to start animation setup but | 63 * null, it means tabClosing() has been called to start animation setup but |
| 64 * tabClosed() has not yet been called to finish animation startup | 64 * tabClosed() has not yet been called to finish animation startup |
| 65 */ | 65 */ |
| 66 private LayoutTab mClosedTab; | 66 private LayoutTab mClosedTab; |
| 67 | 67 |
| 68 private LayoutTab mAnimatedTab; | 68 private LayoutTab mAnimatedTab; |
| 69 private final TabListSceneLayer mSceneLayer; | 69 private final TabListSceneLayer mSceneLayer; |
| 70 private final BlackHoleEventFilter mBlackHoleEventFilter; | 70 private final BlackHoleEventFilter mBlackHoleEventFilter; |
| 71 | 71 |
| 72 private boolean mForegroundTabCreationAnimationDisabled; |
| 73 |
| 72 /** | 74 /** |
| 73 * Creates an instance of the {@link SimpleAnimationLayout}. | 75 * Creates an instance of the {@link SimpleAnimationLayout}. |
| 74 * @param context The current Android's context. | 76 * @param context The current Android's context. |
| 75 * @param updateHost The {@link LayoutUpdateHost} view for this layout. | 77 * @param updateHost The {@link LayoutUpdateHost} view for this layout. |
| 76 * @param renderHost The {@link LayoutRenderHost} view for this layout. | 78 * @param renderHost The {@link LayoutRenderHost} view for this layout. |
| 77 * @param eventFilter The {@link EventFilter} that is needed for this view. | |
| 78 */ | 79 */ |
| 79 public SimpleAnimationLayout( | 80 public SimpleAnimationLayout( |
| 80 Context context, LayoutUpdateHost updateHost, LayoutRenderHost rende
rHost) { | 81 Context context, LayoutUpdateHost updateHost, LayoutRenderHost rende
rHost) { |
| 81 super(context, updateHost, renderHost); | 82 super(context, updateHost, renderHost); |
| 82 mBlackHoleEventFilter = new BlackHoleEventFilter(context); | 83 mBlackHoleEventFilter = new BlackHoleEventFilter(context); |
| 83 mSceneLayer = new TabListSceneLayer(); | 84 mSceneLayer = new TabListSceneLayer(); |
| 84 } | 85 } |
| 85 | 86 |
| 86 @Override | 87 @Override |
| 87 public ViewportMode getViewportMode() { | 88 public ViewportMode getViewportMode() { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 FOREGROUND_ANIMATION_DURATION, 0, false, interpolator); | 190 FOREGROUND_ANIMATION_DURATION, 0, false, interpolator); |
| 190 addToAnimation(newLayoutTab, LayoutTab.Property.ALPHA, 0.f, 1.f, | 191 addToAnimation(newLayoutTab, LayoutTab.Property.ALPHA, 0.f, 1.f, |
| 191 FOREGROUND_ANIMATION_DURATION, 0, false, interpolator); | 192 FOREGROUND_ANIMATION_DURATION, 0, false, interpolator); |
| 192 addToAnimation(newLayoutTab, LayoutTab.Property.X, originX, 0.f, | 193 addToAnimation(newLayoutTab, LayoutTab.Property.X, originX, 0.f, |
| 193 FOREGROUND_ANIMATION_DURATION, 0, false, interpolator); | 194 FOREGROUND_ANIMATION_DURATION, 0, false, interpolator); |
| 194 addToAnimation(newLayoutTab, LayoutTab.Property.Y, originY, 0.f, | 195 addToAnimation(newLayoutTab, LayoutTab.Property.Y, originY, 0.f, |
| 195 FOREGROUND_ANIMATION_DURATION, 0, false, interpolator); | 196 FOREGROUND_ANIMATION_DURATION, 0, false, interpolator); |
| 196 | 197 |
| 197 mTabModelSelector.selectModel(newIsIncognito); | 198 mTabModelSelector.selectModel(newIsIncognito); |
| 198 startHiding(id, false); | 199 startHiding(id, false); |
| 200 |
| 201 if (mForegroundTabCreationAnimationDisabled) forceAnimationToFinish(); |
| 199 } | 202 } |
| 200 | 203 |
| 201 /** | 204 /** |
| 202 * Animate opening a tab in the background. | 205 * Animate opening a tab in the background. |
| 203 * | 206 * |
| 204 * @param id The id of the new tab to animate. | 207 * @param id The id of the new tab to animate. |
| 205 * @param sourceId The id of the tab that spawned this new tab. | 208 * @param sourceId The id of the tab that spawned this new tab. |
| 206 * @param newIsIncognito true if the new tab is an incognito tab. | 209 * @param newIsIncognito true if the new tab is an incognito tab. |
| 207 * @param originX The X screen coordinate in dp of the last touch dow
n event that spawned | 210 * @param originX The X screen coordinate in dp of the last touch dow
n event that spawned |
| 208 * this tab. | 211 * this tab. |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 protected void updateSceneLayer(RectF viewport, RectF contentViewport, | 426 protected void updateSceneLayer(RectF viewport, RectF contentViewport, |
| 424 LayerTitleCache layerTitleCache, TabContentManager tabContentManager
, | 427 LayerTitleCache layerTitleCache, TabContentManager tabContentManager
, |
| 425 ResourceManager resourceManager, ChromeFullscreenManager fullscreenM
anager) { | 428 ResourceManager resourceManager, ChromeFullscreenManager fullscreenM
anager) { |
| 426 super.updateSceneLayer(viewport, contentViewport, layerTitleCache, tabCo
ntentManager, | 429 super.updateSceneLayer(viewport, contentViewport, layerTitleCache, tabCo
ntentManager, |
| 427 resourceManager, fullscreenManager); | 430 resourceManager, fullscreenManager); |
| 428 assert mSceneLayer != null; | 431 assert mSceneLayer != null; |
| 429 // The content viewport is intentionally sent as both params below. | 432 // The content viewport is intentionally sent as both params below. |
| 430 mSceneLayer.pushLayers(getContext(), contentViewport, contentViewport, t
his, | 433 mSceneLayer.pushLayers(getContext(), contentViewport, contentViewport, t
his, |
| 431 layerTitleCache, tabContentManager, resourceManager, fullscreenM
anager); | 434 layerTitleCache, tabContentManager, resourceManager, fullscreenM
anager); |
| 432 } | 435 } |
| 436 |
| 437 /** |
| 438 * Sets whether the foreground tab animation is disabled. |
| 439 * TODO(twellington): Remove this after Chrome Home NTP animations are compl
ete. |
| 440 * @param disabled Whether the foreground tab animation should be disabled. |
| 441 */ |
| 442 public void setForegroundTabAnimationDisabled(boolean disabled) { |
| 443 mForegroundTabCreationAnimationDisabled = disabled; |
| 444 } |
| 433 } | 445 } |
| OLD | NEW |