Commit 572689ae authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Fix navigation bubble visibility on KitKat

This CL fixes a bug that makes navigation bubble invisible after a
certain animation.

- set NavigationBubble layer type to software
- Removed an unnecessary, seemingly offending navigation when
  gesture is canceled. It performed 2 animations in succession,
  but the 2nd one is not necessary since the bubble will have
  already disappeared from the screen after the 1st one.
- Do not clear animation at the gesture start.

Bug: 988341
Change-Id: Ifce226a148c88b5c7db6290c0ebf2fafd10c3c85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724071Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682050}
parent 7f8d2aa0
......@@ -4,6 +4,7 @@
package org.chromium.chrome.browser.gesturenav;
import android.content.Context;
import android.os.Build;
import android.support.annotation.DrawableRes;
import android.util.AttributeSet;
import android.view.View;
......@@ -38,6 +39,13 @@ public class NavigationBubble extends LinearLayout {
public NavigationBubble(Context context, AttributeSet attrs) {
super(context, attrs);
// Workaround to a bug that makes this view sometimes stay invisible after animation.
// https://stackoverflow.com/questions/24258832
// https://stackoverflow.com/questions/25099043
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
// Reset icon and background. Height is used as corner radius to ensure we have a circle.
mRippleBackgroundHelper = new RippleBackgroundHelper(this,
R.color.navigation_bubble_background_color, R.color.navigation_bubble_ripple_color,
......
......@@ -112,7 +112,6 @@ public class SideSlideLayout extends ViewGroup {
private AnimationSet mHidingAnimation;
private int mAnimationViewWidth;
private AnimationListener mCancelAnimationListener;
private boolean mIsForward;
private boolean mCloseIndicatorEnabled;
......@@ -280,7 +279,6 @@ public class SideSlideLayout extends ViewGroup {
*/
public boolean start() {
if (!isEnabled() || mNavigating || mListener == null) return false;
mArrowView.clearAnimation();
mTotalMotion = 0;
mIsBeingDragged = true;
initializeOffset();
......@@ -357,25 +355,10 @@ public class SideSlideLayout extends ViewGroup {
}
// Cancel navigation
mNavigating = false;
if (mCancelAnimationListener == null) {
mCancelAnimationListener = new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
startHidingAnimation(mNavigateListener);
}
@Override
public void onAnimationRepeat(Animation animation) {}
};
}
mFrom = mCurrentTargetOffset;
mAnimateToStartPosition.reset();
mAnimateToStartPosition.setDuration(ANIMATE_TO_START_DURATION_MS);
mAnimateToStartPosition.setInterpolator(mDecelerateInterpolator);
mArrowView.setAnimationListener(mCancelAnimationListener);
mArrowView.clearAnimation();
mArrowView.startAnimation(mAnimateToStartPosition);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment