am 9c3601ca: Merge "Fix AppBarLayout not being drawn after rotation DO NOT MERGE" into mnc-dev
* commit '9c3601ca4562f5d0c2e4daa00e0639298f237af7':
Fix AppBarLayout not being drawn after rotation DO NOT MERGE
diff --git a/design/src/android/support/design/widget/ViewOffsetHelper.java b/design/src/android/support/design/widget/ViewOffsetHelper.java
index 942dadb..6bde40b 100644
--- a/design/src/android/support/design/widget/ViewOffsetHelper.java
+++ b/design/src/android/support/design/widget/ViewOffsetHelper.java
@@ -16,6 +16,7 @@
package android.support.design.widget;
+import android.os.Build;
import android.support.v4.view.ViewCompat;
import android.view.View;
import android.view.ViewParent;
@@ -54,15 +55,17 @@
ViewCompat.offsetTopAndBottom(mView, mOffsetTop - (mView.getTop() - mLayoutTop));
ViewCompat.offsetLeftAndRight(mView, mOffsetLeft - (mView.getLeft() - mLayoutLeft));
- // Manually invalidate the parent to make sure we get drawn
- ViewParent parent = mView.getParent();
- if (parent instanceof View) {
- tickleParentInvalidationFlag((View) parent);
+ // 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 tickleParentInvalidationFlag(View view) {
- // TODO Bug: 21413554
+ private static void tickleInvalidationFlag(View view) {
final float x = ViewCompat.getTranslationX(view);
ViewCompat.setTranslationX(view, x + 1);
ViewCompat.setTranslationX(view, x);