Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ActionModeController.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ContextualMenuBar.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ActionModeController.java |
| similarity index 80% |
| rename from chrome/android/java/src/org/chromium/chrome/browser/ContextualMenuBar.java |
| rename to chrome/android/java/src/org/chromium/chrome/browser/toolbar/ActionModeController.java |
| index eab406d7cb5af4ce816efbbe222a5c7e5297c8ff..d0a6340cc960874ad44d75819bf166a584c3ea30 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ContextualMenuBar.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ActionModeController.java |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -package org.chromium.chrome.browser; |
| +package org.chromium.chrome.browser.toolbar; |
| import android.animation.Animator; |
| import android.animation.AnimatorListenerAdapter; |
| @@ -16,16 +16,16 @@ import android.util.Property; |
| import org.chromium.chrome.R; |
| /** |
| - * This class handles the animation for the contextual menu bar and adds a custom |
| - * ActionMode.Callback to the menu bar. |
| + * This class controls the how toolbar animates while the action mode bar is being shown. It also |
| + * manages a {@link ToolbarActionModeCallback}. |
| */ |
| -public class ContextualMenuBar { |
| +public class ActionModeController { |
| private static final int SLIDE_DURATION_MS = 200; |
| - private CustomSelectionActionModeCallback mCustomSelectionActionModeCallback; |
| + private ToolbarActionModeCallback mCustomSelectionActionModeCallback; |
|
David Trainor- moved to gerrit
2015/08/18 18:32:50
change variable name too?
Ian Wen
2015/08/19 18:35:36
Done.
|
| private ObjectAnimator mCurrentAnimation = null; |
| - private boolean mShowingContextualActionBar = false; |
| + private boolean mShowingActionMode = false; |
| private float mTabStripHeight; |
| private final Context mContext; |
| private final ActionBarDelegate mActionBarDelegate; |
| @@ -44,8 +44,8 @@ public class ContextualMenuBar { |
| }; |
| /** |
| - * This is an interface for objects that the contextualMenuBar can use for animating the action |
| - * bar. |
| + * This is an interface for to let the controller animate the position of {@link Toolbar}, while |
| + * action mode is showing. |
| */ |
| public interface ActionBarDelegate { |
| @@ -73,14 +73,11 @@ public class ContextualMenuBar { |
| } |
| /** |
| - * Creates the contextual menu bar and ties it to an action bar using the given action bar |
| - * delegate. |
| - * @param context The context which the contextual action menu bar should be using for accessing |
| - * resources. |
| - * @param actionBarDelegate The delegate for communicating with the action bar while animating |
| - * it. |
| + * Creates the {@link ActionModeController} and ties it to an action bar using the given action |
| + * bar delegate. |
| + * @param actionBarDelegate The delegate for communicating with toolbar for animation. |
| */ |
| - public ContextualMenuBar(Context context, ActionBarDelegate actionBarDelegate) { |
| + public ActionModeController(Context context, ActionBarDelegate actionBarDelegate) { |
| mActionBarDelegate = actionBarDelegate; |
| mContext = context; |
| mTabStripHeight = mContext.getResources().getDimension(R.dimen.tab_strip_height); |
| @@ -94,7 +91,7 @@ public class ContextualMenuBar { |
| } |
| /** |
| - * @return The delegate handling action bar positioning for the contextual menu bar. |
| + * @return The delegate handling action bar positioning for the custom action bar. |
| */ |
| public ActionBarDelegate getActionBarDelegate() { |
| return mActionBarDelegate; |
| @@ -105,16 +102,16 @@ public class ContextualMenuBar { |
| * @param customSelectionActionModeCallback |
| */ |
| public void setCustomSelectionActionModeCallback( |
| - CustomSelectionActionModeCallback customSelectionActionModeCallback) { |
| + ToolbarActionModeCallback customSelectionActionModeCallback) { |
|
David Trainor- moved to gerrit
2015/08/18 18:32:50
Change parameter name too?
Ian Wen
2015/08/19 18:35:36
Done.
|
| if (customSelectionActionModeCallback.equals(mCustomSelectionActionModeCallback)) return; |
| mCustomSelectionActionModeCallback = customSelectionActionModeCallback; |
| - mCustomSelectionActionModeCallback.setContextualMenuBar(this); |
| + mCustomSelectionActionModeCallback.setActionModeController(this); |
| } |
| /** |
| * @return The custom ActionMode.Callback. |
| */ |
| - public CustomSelectionActionModeCallback getCustomSelectionActionModeCallback() { |
| + public ToolbarActionModeCallback getActionModeCallback() { |
| return mCustomSelectionActionModeCallback; |
| } |
| @@ -136,15 +133,15 @@ public class ContextualMenuBar { |
| * Show controls after orientation change if previously visible. |
| */ |
| public void showControlsOnOrientationChange() { |
| - if (mShowingContextualActionBar && mCurrentAnimation == null) { |
| - showControls(); |
| + if (mShowingActionMode && mCurrentAnimation == null) { |
| + startShowAnimation(); |
| } |
| } |
| /** |
| * Animation for the textview if the action bar is visible. |
| */ |
| - public void showControls() { |
| + public void startShowAnimation() { |
| if (mCurrentAnimation != null) mCurrentAnimation.cancel(); |
| mCurrentAnimation = ObjectAnimator.ofInt(mActionBarDelegate, TOP_MARGIN_ANIM_PROPERTY, |
| @@ -171,13 +168,13 @@ public class ContextualMenuBar { |
| mActionBarDelegate.setActionBarBackgroundVisibility(true); |
| mCurrentAnimation.start(); |
| - mShowingContextualActionBar = true; |
| + mShowingActionMode = true; |
| } |
| /** |
| * Hide animation for the textview if the action bar is not visible. |
| */ |
| - public void hideControls() { |
| + public void startHideAnimation() { |
| if (mCurrentAnimation != null) mCurrentAnimation.cancel(); |
| mCurrentAnimation = ObjectAnimator.ofInt(mActionBarDelegate, TOP_MARGIN_ANIM_PROPERTY, |
| @@ -192,6 +189,6 @@ public class ContextualMenuBar { |
| }); |
| mCurrentAnimation.start(); |
| - mShowingContextualActionBar = false; |
| + mShowingActionMode = false; |
| } |
| } |