List of usage examples for android.support.v4.view WindowInsetsCompat consumeSystemWindowInsets
public WindowInsetsCompat consumeSystemWindowInsets()
From source file:com.gavin.mvvm.weight.VScrimInsetsFrameLayout.java
public VScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override// ww w.ja v a 2s . com public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { return insets.consumeSystemWindowInsets(); } }); }
From source file:com.isanechek.beardycast.ui.widget.InsetsPercentRelativeLayout.java
public InsetsPercentRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override/*from w w w . j ava 2 s.co m*/ public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { setWindowInsets(insets); return insets.consumeSystemWindowInsets(); } }); }
From source file:meizhi.meizhi.malin.widget.InsetsToolbar.java
public InsetsToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override/*from ww w .j a v a 2s.c om*/ public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { final int l = insets.getSystemWindowInsetLeft(); final int t = insets.getSystemWindowInsetTop(); final int r = insets.getSystemWindowInsetRight(); setPadding(l, t, r, 0); return insets.consumeSystemWindowInsets(); } }); }
From source file:meizhi.meizhi.malin.widget.InsetsRecyclerView.java
public InsetsRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.InsetsRecyclerView); padding = a.getDimensionPixelOffset(R.styleable.InsetsRecyclerView_padding, 0); a.recycle();//from www . ja v a2 s .c o m setPadding(padding, padding, padding, padding); ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { final int l = padding + insets.getSystemWindowInsetLeft(); final int r = padding + insets.getSystemWindowInsetRight(); final int b = padding + insets.getSystemWindowInsetBottom(); setPadding(l, padding, r, b); return insets.consumeSystemWindowInsets(); } }); }
From source file:com.cqu.lightutils.widget.ScrimInsetsFrameLayout.java
public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsFrameLayoutCompat, defStyleAttr, R.style.LightUtilsWidget_Design_ScrimInsetsFrameLayoutCompat); mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayoutCompat_insetsForeground); a.recycle();/* w ww .j ava 2s. com*/ setWillNotDraw(true); // No need to draw until the insets are adjusted ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); setWillNotDraw(mInsets.isEmpty() || mInsetForeground == null); ViewCompat.postInvalidateOnAnimation(ScrimInsetsFrameLayout.this); return insets.consumeSystemWindowInsets(); } }); }
From source file:at.linuxtage.companion.widgets.ScrimInsetsFrameLayout.java
public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsFrameLayout, defStyleAttr, R.style.Widget_Design_ScrimInsetsFrameLayout); mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground); a.recycle();/*from w ww . java 2 s. c om*/ setWillNotDraw(true); // No need to draw until the insets are adjusted ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { if (null == mInsets) { mInsets = new Rect(); } mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); setWillNotDraw(mInsets.isEmpty() || mInsetForeground == null); ViewCompat.postInvalidateOnAnimation(ScrimInsetsFrameLayout.this); return insets.consumeSystemWindowInsets(); } }); }
From source file:android.support.design.internal.ScrimInsetsRelativeLayout.java
public ScrimInsetsRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsFrameLayout, defStyleAttr, R.style.Widget_Design_ScrimInsetsFrameLayout); mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground); a.recycle();/*from ww w. j a va 2s . c o m*/ setWillNotDraw(true); // No need to draw until the insets are adjusted ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { if (null == mInsets) { mInsets = new Rect(); } mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); setWillNotDraw(mInsets.isEmpty() || mInsetForeground == null); ViewCompat.postInvalidateOnAnimation(ScrimInsetsRelativeLayout.this); return insets.consumeSystemWindowInsets(); } }); }
From source file:net.xpece.android.widget.ScrimInsetsLinearLayout.java
private void init(final Context context, final AttributeSet attrs, final int defStyleAttr) { final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsFrameLayout, defStyleAttr, R.style.Widget_Design_ScrimInsetsFrameLayout); mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground); a.recycle();/*from w w w. ja v a 2 s . c o m*/ setWillNotDraw(true); // No need to draw until the insets are adjusted ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { if (null == mInsets) { mInsets = new Rect(); } mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); onInsetsChanged(mInsets); setWillNotDraw(XpRect.isZero(mInsets) || mInsetForeground == null); ViewCompat.postInvalidateOnAnimation(ScrimInsetsLinearLayout.this); return insets.consumeSystemWindowInsets(); } }); }
From source file:android.support.design.internal.ScrimInsetsFrameLayout.java
public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsFrameLayout, defStyleAttr, R.style.Widget_Design_ScrimInsetsFrameLayout); mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground); a.recycle();/*w ww. j a v a 2 s. c o m*/ setWillNotDraw(true); // No need to draw until the insets are adjusted ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { if (null == mInsets) { mInsets = new Rect(); } mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); onInsetsChanged(insets); setWillNotDraw(!insets.hasSystemWindowInsets() || mInsetForeground == null); ViewCompat.postInvalidateOnAnimation(ScrimInsetsFrameLayout.this); return insets.consumeSystemWindowInsets(); } }); }
From source file:com.ericyl.utils.ui.widget.translucent.ScrimInsetsFrameLayout.java
public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MineScrimInsetsFrameLayout, defStyleAttr, R.style.defaultStyle_ScrimInsetsFrameLayout); mInsetForeground = a.getDrawable(R.styleable.MineScrimInsetsFrameLayout_insetForeground); a.recycle();//from w w w. j a va2s. c o m setWillNotDraw(true); // No need to draw until the insets are adjusted ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { if (null == mInsets) { mInsets = new Rect(); } mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); onInsetsChanged(insets); setWillNotDraw(!insets.hasSystemWindowInsets() || mInsetForeground == null); ViewCompat.postInvalidateOnAnimation(ScrimInsetsFrameLayout.this); return insets.consumeSystemWindowInsets(); } }); }