List of usage examples for android.support.v4.view WindowInsetsCompat getSystemWindowInsetLeft
public int getSystemWindowInsetLeft()
From source file:meizhi.meizhi.malin.utils.WindowInsetsCompatUtil.java
@SuppressLint("RtlHardcoded") private static WindowInsetsCompat copyExcluded(WindowInsetsCompat source, int gravity) { int l = (gravity & Gravity.LEFT) == Gravity.LEFT ? 0 : source.getSystemWindowInsetLeft(); int t = (gravity & Gravity.TOP) == Gravity.TOP ? 0 : source.getSystemWindowInsetTop(); int r = (gravity & Gravity.RIGHT) == Gravity.RIGHT ? 0 : source.getSystemWindowInsetRight(); int b = (gravity & Gravity.BOTTOM) == Gravity.BOTTOM ? 0 : source.getSystemWindowInsetBottom(); return source.replaceSystemWindowInsets(l, t, r, b); }
From source file:ooo.oxo.mr.util.WindowInsetsCompatUtil.java
@SuppressLint("RtlHardcoded") public static WindowInsetsCompat copyExcluded(WindowInsetsCompat source, int gravity) { int l = (gravity & Gravity.LEFT) == Gravity.LEFT ? 0 : source.getSystemWindowInsetLeft(); int t = (gravity & Gravity.TOP) == Gravity.TOP ? 0 : source.getSystemWindowInsetTop(); int r = (gravity & Gravity.RIGHT) == Gravity.RIGHT ? 0 : source.getSystemWindowInsetRight(); int b = (gravity & Gravity.BOTTOM) == Gravity.BOTTOM ? 0 : source.getSystemWindowInsetBottom(); return source.replaceSystemWindowInsets(l, t, r, b); }
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 w ww. ja v a 2s. c o m 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 w w w . ja v a 2 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:net.xpece.android.widget.ScrimInsetsNonConsumingSelfPaddingNestedScrollView.java
protected void onInsetsChanged(WindowInsetsCompat insets) { setPadding(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); }
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 w w. j a va 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) { 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 . j av a2s. 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(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 w w w . j a v a2 s . co 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.ScrimInsetsNonConsumingChildPaddingFrameLayout.java
protected void onInsetsChanged(WindowInsetsCompat insets) { for (int i = 0, z = getChildCount(); i < z; i++) { final View child = getChildAt(i); child.setPadding(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); }// ww w . ja v a 2 s. c o m }
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();/* ww w . 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()); onInsetsChanged(insets); setWillNotDraw(!insets.hasSystemWindowInsets() || mInsetForeground == null); ViewCompat.postInvalidateOnAnimation(ScrimInsetsFrameLayout.this); return insets.consumeSystemWindowInsets(); } }); }