Last active
August 4, 2017 02:55
-
-
Save nasahapps/418096bfe329abdc1c5257b40ae50ebf to your computer and use it in GitHub Desktop.
Reverts CollasingToolbarLayout.onMeasure()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package android.support.design.widget | |
import android.content.Context | |
import android.util.AttributeSet | |
public class FixedCollapsingToolbarLayout extends CollapsingToolbarLayout { | |
public FixedCollapsingToolbarLayout(Context context) { | |
this(context, null); | |
} | |
public FixedCollapsingToolbarLayout(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
// During the super call to onMeasure(), we'll save a copy of mLastInsets, | |
// consume the insets of mLastInsets so the super call has no insets to work with, | |
// then re-assign mLastInsets to what it was before the super call. | |
WindowInsetsCompat oldInsets = mLastInsets; | |
if (mLastInsets != null) { | |
mLastInsets = mLastInsets.consumeSystemWindowInsets(); | |
} | |
super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
mLastInsets = oldInsets; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment