Created
August 20, 2015 22:45
-
-
Save NightlyNexus/63c74e424afa6c52fd53 to your computer and use it in GitHub Desktop.
...until https://code.google.com/p/android/issues/detail?id=183378 is fixed
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
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.view.WindowInsets; | |
public final class GridViewPager extends android.support.wearable.view.GridViewPager { | |
private WindowInsets insets = null; | |
public GridViewPager(Context context) { | |
super(context); | |
} | |
public GridViewPager(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public GridViewPager(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
} | |
@Override | |
public WindowInsets onApplyWindowInsets(WindowInsets insets) { | |
insets = super.onApplyWindowInsets(insets); | |
this.insets = insets; | |
return insets; | |
} | |
@Override | |
public void addView(View child, int index, ViewGroup.LayoutParams params) { | |
super.addView(child, index, params); | |
WindowInsets insets = this.insets; | |
if (insets != null) { | |
child.dispatchApplyWindowInsets(insets); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment