Loading src/com/android/launcher3/DropTargetBar.java +1 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static com.android.launcher3.ButtonDropTarget.TOOLTIP_DEFAULT; import static com.android.launcher3.ButtonDropTarget.TOOLTIP_LEFT; import static com.android.launcher3.ButtonDropTarget.TOOLTIP_RIGHT; import static com.android.launcher3.anim.AlphaUpdateListener.updateVisibility; import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled; import android.animation.TimeInterpolator; import android.content.Context; Loading @@ -47,7 +46,7 @@ public class DropTargetBar extends FrameLayout protected static final TimeInterpolator DEFAULT_INTERPOLATOR = Interpolators.ACCEL; private final Runnable mFadeAnimationEndRunnable = () -> updateVisibility(DropTargetBar.this, isAccessibilityEnabled(getContext())); () -> updateVisibility(DropTargetBar.this); @ViewDebug.ExportedProperty(category = "launcher") protected boolean mDeferOnDragEnd; Loading src/com/android/launcher3/anim/AlphaUpdateListener.java +15 −27 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.launcher3.anim; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.view.View; Loading @@ -25,44 +24,24 @@ import android.view.View; /** * A convenience class to update a view's visibility state after an alpha animation. */ public class AlphaUpdateListener extends AnimatorListenerAdapter implements AnimatorUpdateListener { public class AlphaUpdateListener extends AnimationSuccessListener implements AnimatorUpdateListener { private static final float ALPHA_CUTOFF_THRESHOLD = 0.01f; private View mView; private boolean mAccessibilityEnabled; private boolean mCanceled = false; public AlphaUpdateListener(View v, boolean accessibilityEnabled) { public AlphaUpdateListener(View v) { mView = v; mAccessibilityEnabled = accessibilityEnabled; } @Override public void onAnimationUpdate(ValueAnimator arg0) { updateVisibility(mView, mAccessibilityEnabled); } public static void updateVisibility(View view, boolean accessibilityEnabled) { // We want to avoid the extra layout pass by setting the views to GONE unless // accessibility is on, in which case not setting them to GONE causes a glitch. int invisibleState = accessibilityEnabled ? View.GONE : View.INVISIBLE; if (view.getAlpha() < ALPHA_CUTOFF_THRESHOLD && view.getVisibility() != invisibleState) { view.setVisibility(invisibleState); } else if (view.getAlpha() > ALPHA_CUTOFF_THRESHOLD && view.getVisibility() != View.VISIBLE) { view.setVisibility(View.VISIBLE); } updateVisibility(mView); } @Override public void onAnimationCancel(Animator animation) { mCanceled = true; } @Override public void onAnimationEnd(Animator arg0) { if (mCanceled) return; updateVisibility(mView, mAccessibilityEnabled); public void onAnimationSuccess(Animator animator) { updateVisibility(mView); } @Override Loading @@ -70,4 +49,13 @@ public class AlphaUpdateListener extends AnimatorListenerAdapter implements Anim // We want the views to be visible for animation, so fade-in/out is visible mView.setVisibility(View.VISIBLE); } public static void updateVisibility(View view) { if (view.getAlpha() < ALPHA_CUTOFF_THRESHOLD && view.getVisibility() != View.INVISIBLE) { view.setVisibility(View.INVISIBLE); } else if (view.getAlpha() > ALPHA_CUTOFF_THRESHOLD && view.getVisibility() != View.VISIBLE) { view.setVisibility(View.VISIBLE); } } } No newline at end of file src/com/android/launcher3/anim/PropertySetter.java +2 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.launcher3.anim; import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled; import android.animation.Animator; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; Loading @@ -34,7 +32,7 @@ public class PropertySetter { public void setViewAlpha(View view, float alpha, TimeInterpolator interpolator) { if (view != null) { view.setAlpha(alpha); AlphaUpdateListener.updateVisibility(view, isAccessibilityEnabled(view.getContext())); AlphaUpdateListener.updateVisibility(view); } } Loading Loading @@ -64,8 +62,7 @@ public class PropertySetter { return; } ObjectAnimator anim = ObjectAnimator.ofFloat(view, View.ALPHA, alpha); anim.addListener(new AlphaUpdateListener( view, isAccessibilityEnabled(view.getContext()))); anim.addListener(new AlphaUpdateListener(view)); anim.setDuration(mDuration).setInterpolator(interpolator); mStateAnimator.play(anim); } Loading Loading
src/com/android/launcher3/DropTargetBar.java +1 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static com.android.launcher3.ButtonDropTarget.TOOLTIP_DEFAULT; import static com.android.launcher3.ButtonDropTarget.TOOLTIP_LEFT; import static com.android.launcher3.ButtonDropTarget.TOOLTIP_RIGHT; import static com.android.launcher3.anim.AlphaUpdateListener.updateVisibility; import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled; import android.animation.TimeInterpolator; import android.content.Context; Loading @@ -47,7 +46,7 @@ public class DropTargetBar extends FrameLayout protected static final TimeInterpolator DEFAULT_INTERPOLATOR = Interpolators.ACCEL; private final Runnable mFadeAnimationEndRunnable = () -> updateVisibility(DropTargetBar.this, isAccessibilityEnabled(getContext())); () -> updateVisibility(DropTargetBar.this); @ViewDebug.ExportedProperty(category = "launcher") protected boolean mDeferOnDragEnd; Loading
src/com/android/launcher3/anim/AlphaUpdateListener.java +15 −27 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.launcher3.anim; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.view.View; Loading @@ -25,44 +24,24 @@ import android.view.View; /** * A convenience class to update a view's visibility state after an alpha animation. */ public class AlphaUpdateListener extends AnimatorListenerAdapter implements AnimatorUpdateListener { public class AlphaUpdateListener extends AnimationSuccessListener implements AnimatorUpdateListener { private static final float ALPHA_CUTOFF_THRESHOLD = 0.01f; private View mView; private boolean mAccessibilityEnabled; private boolean mCanceled = false; public AlphaUpdateListener(View v, boolean accessibilityEnabled) { public AlphaUpdateListener(View v) { mView = v; mAccessibilityEnabled = accessibilityEnabled; } @Override public void onAnimationUpdate(ValueAnimator arg0) { updateVisibility(mView, mAccessibilityEnabled); } public static void updateVisibility(View view, boolean accessibilityEnabled) { // We want to avoid the extra layout pass by setting the views to GONE unless // accessibility is on, in which case not setting them to GONE causes a glitch. int invisibleState = accessibilityEnabled ? View.GONE : View.INVISIBLE; if (view.getAlpha() < ALPHA_CUTOFF_THRESHOLD && view.getVisibility() != invisibleState) { view.setVisibility(invisibleState); } else if (view.getAlpha() > ALPHA_CUTOFF_THRESHOLD && view.getVisibility() != View.VISIBLE) { view.setVisibility(View.VISIBLE); } updateVisibility(mView); } @Override public void onAnimationCancel(Animator animation) { mCanceled = true; } @Override public void onAnimationEnd(Animator arg0) { if (mCanceled) return; updateVisibility(mView, mAccessibilityEnabled); public void onAnimationSuccess(Animator animator) { updateVisibility(mView); } @Override Loading @@ -70,4 +49,13 @@ public class AlphaUpdateListener extends AnimatorListenerAdapter implements Anim // We want the views to be visible for animation, so fade-in/out is visible mView.setVisibility(View.VISIBLE); } public static void updateVisibility(View view) { if (view.getAlpha() < ALPHA_CUTOFF_THRESHOLD && view.getVisibility() != View.INVISIBLE) { view.setVisibility(View.INVISIBLE); } else if (view.getAlpha() > ALPHA_CUTOFF_THRESHOLD && view.getVisibility() != View.VISIBLE) { view.setVisibility(View.VISIBLE); } } } No newline at end of file
src/com/android/launcher3/anim/PropertySetter.java +2 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.launcher3.anim; import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled; import android.animation.Animator; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; Loading @@ -34,7 +32,7 @@ public class PropertySetter { public void setViewAlpha(View view, float alpha, TimeInterpolator interpolator) { if (view != null) { view.setAlpha(alpha); AlphaUpdateListener.updateVisibility(view, isAccessibilityEnabled(view.getContext())); AlphaUpdateListener.updateVisibility(view); } } Loading Loading @@ -64,8 +62,7 @@ public class PropertySetter { return; } ObjectAnimator anim = ObjectAnimator.ofFloat(view, View.ALPHA, alpha); anim.addListener(new AlphaUpdateListener( view, isAccessibilityEnabled(view.getContext()))); anim.addListener(new AlphaUpdateListener(view)); anim.setDuration(mDuration).setInterpolator(interpolator); mStateAnimator.play(anim); } Loading