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.toolbar; | 5 package org.chromium.chrome.browser.toolbar; |
6 | 6 |
7 import android.animation.Animator; | 7 import android.animation.Animator; |
8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
9 import android.animation.ObjectAnimator; | 9 import android.animation.ObjectAnimator; |
10 import android.animation.ValueAnimator; | 10 import android.animation.ValueAnimator; |
11 import android.content.Context; | 11 import android.content.Context; |
12 import android.content.res.TypedArray; | 12 import android.content.res.TypedArray; |
13 import android.support.v7.app.ActionBar; | 13 import android.support.v7.app.ActionBar; |
14 import android.util.Property; | 14 import android.util.Property; |
15 | 15 |
16 import org.chromium.chrome.R; | 16 import org.chromium.chrome.R; |
17 | 17 |
18 /** | 18 /** |
19 * This class controls the how toolbar animates while the action mode bar is bei
ng shown. It also | 19 * This class controls the how toolbar animates while the action mode bar is bei
ng shown. It also |
20 * manages a {@link ToolbarActionModeCallback}. | 20 * manages a {@link ToolbarActionModeCallback}. |
21 */ | 21 */ |
22 public class ActionModeController { | 22 public class ActionModeController { |
23 | 23 |
24 private static final int SLIDE_DURATION_MS = 200; | 24 private static final int SLIDE_DURATION_MS = 200; |
25 | 25 |
26 private ToolbarActionModeCallback mToolbarActionModeCallback; | 26 private ToolbarActionModeCallback mToolbarActionModeCallback; |
27 private ObjectAnimator mCurrentAnimation = null; | 27 private ObjectAnimator mCurrentAnimation; |
28 private boolean mShowingActionMode = false; | 28 private boolean mShowingActionMode; |
29 private float mTabStripHeight; | 29 private float mTabStripHeight; |
30 private final Context mContext; | 30 private final Context mContext; |
31 private final ActionBarDelegate mActionBarDelegate; | 31 private final ActionBarDelegate mActionBarDelegate; |
32 | 32 |
33 /** Property for animating the top margin of ActionBarDelegate. */ | 33 /** Property for animating the top margin of ActionBarDelegate. */ |
34 public static final Property<ActionBarDelegate, Integer> TOP_MARGIN_ANIM_PRO
PERTY = | 34 public static final Property<ActionBarDelegate, Integer> TOP_MARGIN_ANIM_PRO
PERTY = |
35 new Property<ActionBarDelegate, Integer>(Integer.class, "controlTopM
argin") { | 35 new Property<ActionBarDelegate, Integer>(Integer.class, "controlTopM
argin") { |
36 @Override | 36 @Override |
37 public Integer get(ActionBarDelegate delegate) { | 37 public Integer get(ActionBarDelegate delegate) { |
38 return delegate.getControlTopMargin(); | 38 return delegate.getControlTopMargin(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 public void onAnimationEnd(Animator animation) { | 184 public void onAnimationEnd(Animator animation) { |
185 mCurrentAnimation = null; | 185 mCurrentAnimation = null; |
186 mActionBarDelegate.setActionBarBackgroundVisibility(false); | 186 mActionBarDelegate.setActionBarBackgroundVisibility(false); |
187 } | 187 } |
188 }); | 188 }); |
189 | 189 |
190 mCurrentAnimation.start(); | 190 mCurrentAnimation.start(); |
191 mShowingActionMode = false; | 191 mShowingActionMode = false; |
192 } | 192 } |
193 } | 193 } |
OLD | NEW |