List of usage examples for android.support.v4.view WindowInsetsCompat getSystemWindowInsetRight
public int getSystemWindowInsetRight()
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.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();//ww w . j ava2s . com 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: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// w ww . j a v a2 s . 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: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 ww .j a v a 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) { 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 ww w . jav 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(ScrimInsetsFrameLayout.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()); }/*from w w w . j a v a 2 s . c o m*/ }
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 a 2 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:org.mariotaku.twidere.view.TintedStatusFrameLayout.java
public TintedStatusFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TintedStatusLayout); setSetPaddingEnabled(a.getBoolean(R.styleable.TintedStatusLayout_setPadding, false)); a.recycle();/*w w w . jav a 2 s .c o m*/ mColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mSystemWindowsInsets = new Rect(); setWillNotDraw(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { final int top = insets.getSystemWindowInsetTop(); final int left = insets.getSystemWindowInsetLeft(); final int right = insets.getSystemWindowInsetRight(); final int bottom = insets.getSystemWindowInsetBottom(); if (mSetPadding) { setPadding(left, top, right, bottom); } setStatusBarHeight(top); if (mWindowInsetsListener != null) { mWindowInsetsListener.onApplyWindowInsets(left, top, right, bottom); } return insets.consumeSystemWindowInsets(); } }); } }