Merge "Add workaround for invalidation bug on API 21-22" into mnc-ub-dev

am: 0799afc

* commit '0799afc163bd5d8f9bfd6869e451c4be5640c971':
  Add workaround for invalidation bug on API 21-22

Change-Id: Ib1450fdbc7832b158464e6603177faa11720500a

GitOrigin-RevId=b21b5491bcd540843e1d6fe0fdaaddd03d2c5165

PiperOrigin-RevId: 140560484
This commit is contained in:
Chris Banes 2016-11-30 04:01:55 +00:00 committed by Travis Collins
parent e0d66731a8
commit 86cbc614f6
2 changed files with 1 additions and 18 deletions

View File

@ -1203,7 +1203,7 @@ public class AppBarLayout extends LinearLayout {
// any vertical gap, and overlap
final Behavior ablBehavior = (Behavior) behavior;
final int offset = ablBehavior.getTopBottomOffsetForScrollingSibling();
child.offsetTopAndBottom((dependency.getBottom() - child.getTop())
ViewCompat.offsetTopAndBottom(child, (dependency.getBottom() - child.getTop())
+ ablBehavior.mOffsetDelta
+ getVerticalLayoutGap()
- getOverlapPixelsForOffset(dependency));

View File

@ -16,10 +16,8 @@
package android.support.design.widget;
import android.os.Build;
import android.support.v4.view.ViewCompat;
import android.view.View;
import android.view.ViewParent;
/**
* Utility helper for moving a {@link android.view.View} around using
@ -54,21 +52,6 @@ class ViewOffsetHelper {
private void updateOffsets() {
ViewCompat.offsetTopAndBottom(mView, mOffsetTop - (mView.getTop() - mLayoutTop));
ViewCompat.offsetLeftAndRight(mView, mOffsetLeft - (mView.getLeft() - mLayoutLeft));
// Manually invalidate the view and parent to make sure we get drawn pre-M
if (Build.VERSION.SDK_INT < 23) {
tickleInvalidationFlag(mView);
final ViewParent vp = mView.getParent();
if (vp instanceof View) {
tickleInvalidationFlag((View) vp);
}
}
}
private static void tickleInvalidationFlag(View view) {
final float y = ViewCompat.getTranslationY(view);
ViewCompat.setTranslationY(view, y + 1);
ViewCompat.setTranslationY(view, y);
}
/**