Skip to content

Instantly share code, notes, and snippets.

@NightlyNexus
Created August 20, 2015 22:45
Show Gist options
  • Save NightlyNexus/63c74e424afa6c52fd53 to your computer and use it in GitHub Desktop.
Save NightlyNexus/63c74e424afa6c52fd53 to your computer and use it in GitHub Desktop.
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