当前位置: 首页>>代码示例>>Java>>正文


Java WindowInsets.getSystemWindowInsetRight方法代码示例

本文整理汇总了Java中android.view.WindowInsets.getSystemWindowInsetRight方法的典型用法代码示例。如果您正苦于以下问题:Java WindowInsets.getSystemWindowInsetRight方法的具体用法?Java WindowInsets.getSystemWindowInsetRight怎么用?Java WindowInsets.getSystemWindowInsetRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.WindowInsets的用法示例。


在下文中一共展示了WindowInsets.getSystemWindowInsetRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onApplyWindowInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        mInsets[0] = insets.getSystemWindowInsetLeft();
        mInsets[1] = insets.getSystemWindowInsetTop();
        mInsets[2] = insets.getSystemWindowInsetRight();
        mInsets[3] = insets.getSystemWindowInsetBottom();

        post(new Runnable() {
            @Override
            public void run() {
                notifyListener();
            }
        });
        return super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0,
                insets.getSystemWindowInsetRight(), lockHeight ? 0 : insets.getSystemWindowInsetBottom()));
    } else {
        return super.onApplyWindowInsets(insets);
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:21,代码来源:UILayoutImpl.java

示例2: onApplyWindowInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
    int l = insets.getSystemWindowInsetLeft();
    int t = insets.getSystemWindowInsetTop();
    int r = insets.getSystemWindowInsetRight();

    toolbar.setPadding(l, toolbar.getPaddingTop() + t, 0, 0);

    final boolean ltr = recyclerView.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;

    setPadding(getPaddingLeft(), getPaddingTop(), getPaddingEnd() + (ltr ? r : 0),
            getPaddingBottom()
    );

    setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
}
 
开发者ID:Assassinss,项目名称:Interessant,代码行数:18,代码来源:InsetsDrawerLayout.java

示例3: onApplyWindowInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
public WindowInsets onApplyWindowInsets(@Nullable WindowInsets insets) {
    if (insets != null) {
        mInsets = new Rect(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(),
                insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom());
    }

    for (int i = 0; i < mView.getChildCount(); i++) {
        final View child = mView.getChildAt(i);

        if (!(child instanceof InsetsDispatchReceiver)) {
            InsetsDispatcherLayoutParamsHelper helper = ((InsetsDispatcherLayoutParams) child.getLayoutParams()).getHelper();
            if (helper != null) {
                applyInsets(mInsets, child, helper.useLeftInset, helper.useTopInset, helper.useRightInset, helper.useBottomInset, helper.insetsUseMargin);
            } else {
                applyInsets(mInsets, child, false, false, false, false, false);
            }
        }
    }

    applyInsets(mInsets, mView, mUseLeftInset, mUseTopInset, mUseRightInset, mUseBottomInset, mInsetsUseMargin);

    ViewCompat.postInvalidateOnAnimation(mView);

    return insets;
}
 
开发者ID:plusCubed,项目名称:insets-dispatcher,代码行数:27,代码来源:InsetsDispatcherHelper.java

示例4: applySystemWindowInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
private boolean applySystemWindowInsets(WindowInsets insets) {
    boolean consumed = false;

    mInsets = new Rect(
            insets.getSystemWindowInsetLeft(),
            insets.getSystemWindowInsetTop(),
            insets.getSystemWindowInsetRight(),
            insets.getSystemWindowInsetBottom());

    for (int i = 0; i < getChildCount(); i++) {
        View child = getChildAt(i);

        Rect childInsets = new Rect(
                insets.getSystemWindowInsetLeft(),
                insets.getSystemWindowInsetTop(),
                insets.getSystemWindowInsetRight(),
                insets.getSystemWindowInsetBottom());

        child.dispatchApplyWindowInsets(insets.replaceSystemWindowInsets(childInsets));

        consumed = true;
    }

    return consumed;
}
 
开发者ID:oxoooo,项目名称:excited-android,代码行数:26,代码来源:InsetsCoordinatorLayout.java

示例5: applySystemWindowInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
private boolean applySystemWindowInsets(WindowInsets insets) {
    boolean consumed = false;

    mInsets = new Rect(
            (prevent ^ PREVENT_LEFT) > 0 ? insets.getSystemWindowInsetLeft() : 0,
            (prevent ^ PREVENT_TOP) > 0 ? insets.getSystemWindowInsetTop() : 0,
            (prevent ^ PREVENT_RIGHT) > 0 ? insets.getSystemWindowInsetRight() : 0,
            (prevent ^ PREVENT_BOTTOM) > 0 ? insets.getSystemWindowInsetBottom() : 0);

    for (int i = 0; i < getChildCount(); i++) {
        View child = getChildAt(i);

        Rect childInsets = new Rect(
                (prevent ^ PREVENT_LEFT) > 0 ? insets.getSystemWindowInsetLeft() : 0,
                (prevent ^ PREVENT_TOP) > 0 ? insets.getSystemWindowInsetTop() : 0,
                (prevent ^ PREVENT_RIGHT) > 0 ? insets.getSystemWindowInsetRight() : 0,
                (prevent ^ PREVENT_BOTTOM) > 0 ? insets.getSystemWindowInsetBottom() : 0);

        child.dispatchApplyWindowInsets(insets.replaceSystemWindowInsets(childInsets));

        consumed = true;
    }

    return consumed;
}
 
开发者ID:oxoooo,项目名称:excited-android,代码行数:26,代码来源:InsetsFrameLayout.java

示例6: applyMarginInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
public static void applyMarginInsets(ViewGroup.MarginLayoutParams paramMarginLayoutParams, Object paramObject, int paramInt)
{
  WindowInsets localWindowInsets = (WindowInsets)paramObject;
  if (paramInt == 3) {
    localWindowInsets = localWindowInsets.replaceSystemWindowInsets(localWindowInsets.getSystemWindowInsetLeft(), localWindowInsets.getSystemWindowInsetTop(), 0, localWindowInsets.getSystemWindowInsetBottom());
  }
  for (;;)
  {
    paramMarginLayoutParams.leftMargin = localWindowInsets.getSystemWindowInsetLeft();
    paramMarginLayoutParams.topMargin = localWindowInsets.getSystemWindowInsetTop();
    paramMarginLayoutParams.rightMargin = localWindowInsets.getSystemWindowInsetRight();
    paramMarginLayoutParams.bottomMargin = localWindowInsets.getSystemWindowInsetBottom();
    return;
    if (paramInt == 5) {
      localWindowInsets = localWindowInsets.replaceSystemWindowInsets(0, localWindowInsets.getSystemWindowInsetTop(), localWindowInsets.getSystemWindowInsetRight(), localWindowInsets.getSystemWindowInsetBottom());
    }
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:19,代码来源:DrawerLayoutCompatApi21.java

示例7: onApplyWindowInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
    int l = insets.getSystemWindowInsetLeft();
    int t = insets.getSystemWindowInsetTop();
    int r = insets.getSystemWindowInsetRight();
    int b = insets.getSystemWindowInsetBottom();
    toolbar.setPadding(l, t, 0, 0);

    recyclerView.setPaddingRelative(recyclerView.getPaddingLeft() + l,
            recyclerView.getPaddingTop(),
            recyclerView.getPaddingRight(),
            recyclerView.getPaddingBottom() + b);

    final boolean ltr = recyclerView.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;

    setPadding(getPaddingLeft(), getPaddingTop(), getPaddingEnd() + (ltr ? r : 0),
            getPaddingBottom()
    );

    setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
}
 
开发者ID:Assassinss,项目名称:pretty-girl,代码行数:23,代码来源:InsetCoordinatorLayout.java

示例8: onApplyWindowInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
    insets = super.onApplyWindowInsets(insets);
    mInsets = new Rect(
            insets.getSystemWindowInsetLeft(),
            insets.getSystemWindowInsetTop(),
            insets.getSystemWindowInsetRight(),
            insets.getSystemWindowInsetBottom());
    setWillNotDraw(false);
    postInvalidateOnAnimation();
    if (mOnInsetsCallback != null) {
        mOnInsetsCallback.onInsetsChanged(mInsets);
    }
    return insets;
}
 
开发者ID:rashikaranpuria,项目名称:xyz-reader-2,代码行数:16,代码来源:DrawInsetsFrameLayout.java

示例9: applyMarginInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void applyMarginInsets(MarginLayoutParams lp, Object insets, int drawerGravity, boolean topOnly) {
    WindowInsets wi = (WindowInsets) insets;
    if (drawerGravity == Gravity.LEFT) {
        wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
    } else if (drawerGravity == Gravity.RIGHT) {
        wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
    }
    lp.leftMargin = wi.getSystemWindowInsetLeft();
    lp.topMargin = topOnly ? 0 : wi.getSystemWindowInsetTop();
    lp.rightMargin = wi.getSystemWindowInsetRight();
    lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:14,代码来源:DrawerLayoutContainer.java

示例10: onApplyWindowInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
    int b = insets.getSystemWindowInsetBottom();
    int r = insets.getSystemWindowInsetRight();

    pictureInfoLayout.setPadding(
            pictureInfoLayout.getPaddingLeft(),
            pictureInfoLayout.getPaddingTop(),
            pictureInfoLayout.getPaddingRight() + r,
            pictureInfoLayout.getPaddingBottom() + b);

    setOnApplyWindowInsetsListener(null);

    return insets.consumeSystemWindowInsets();
}
 
开发者ID:Assassinss,项目名称:Moment,代码行数:16,代码来源:InsetsFrameLayout.java

示例11: applyMarginInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
public static void applyMarginInsets(ViewGroup.MarginLayoutParams lp, Object insets,
    int gravity) {
  WindowInsets wi = (WindowInsets) insets;
  if (gravity == Gravity.LEFT) {
    wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(),
        wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
  } else if (gravity == Gravity.RIGHT) {
    wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(),
        wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
  }
  lp.leftMargin = wi.getSystemWindowInsetLeft();
  lp.topMargin = wi.getSystemWindowInsetTop();
  lp.rightMargin = wi.getSystemWindowInsetRight();
  lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:16,代码来源:DrawerLayoutCompatApi21.java

示例12: applyMarginInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void applyMarginInsets(MarginLayoutParams lp, Object insets, int drawerGravity, boolean topOnly) {
    WindowInsets wi = (WindowInsets) insets;
        if (drawerGravity == Gravity.LEFT) {
            wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
        } else if (drawerGravity == Gravity.RIGHT) {
            wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
        }
        lp.leftMargin = wi.getSystemWindowInsetLeft();
        lp.topMargin = topOnly ? 0 : wi.getSystemWindowInsetTop();
        lp.rightMargin = wi.getSystemWindowInsetRight();
        lp.bottomMargin = wi.getSystemWindowInsetBottom();
    }
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:14,代码来源:DrawerLayoutContainer.java

示例13: applyMarginInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
public static void applyMarginInsets(MarginLayoutParams lp, Object insets, int gravity) {
    WindowInsets wi = (WindowInsets) insets;
    if (gravity == 3) {
        wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
    } else if (gravity == 5) {
        wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
    }
    lp.leftMargin = wi.getSystemWindowInsetLeft();
    lp.topMargin = wi.getSystemWindowInsetTop();
    lp.rightMargin = wi.getSystemWindowInsetRight();
    lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:DrawerLayoutCompatApi21.java

示例14: applyMarginInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
public static void applyMarginInsets(ViewGroup.MarginLayoutParams lp, Object insets) {
  WindowInsets wi = (WindowInsets) insets;
  lp.leftMargin = wi.getSystemWindowInsetLeft();
  lp.topMargin = wi.getSystemWindowInsetTop();
  lp.rightMargin = wi.getSystemWindowInsetRight();
  lp.bottomMargin = 0;
  Log.e("ts_layout", "apply margin insets: {" + lp.leftMargin + "," + lp.topMargin + "," + lp.rightMargin + "," + lp.bottomMargin + "}");
}
 
开发者ID:VerstSiu,项目名称:translucent_layout,代码行数:9,代码来源:DrawerLayoutCompatApi21.java

示例15: onApplyWindowInsets

import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
    public WindowInsets onApplyWindowInsets(WindowInsets insets) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            mInsets[0] = insets.getSystemWindowInsetLeft();
            mInsets[1] = insets.getSystemWindowInsetTop();
            mInsets[2] = insets.getSystemWindowInsetRight();
            mInsets[3] = insets.getSystemWindowInsetBottom();

            if (isViewShow) {
                post(new Runnable() {
                    @Override
                    public void run() {
                        notifyListener();
                    }
                });
                return super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0,
                        insets.getSystemWindowInsetRight(), lockHeight || fixHeight ? 0 : insets.getSystemWindowInsetBottom()));
            } else {
                setPadding(getPaddingLeft(), 0, getPaddingRight(), 0);
//                return super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0,
//                        insets.getSystemWindowInsetRight(), lockHeight ? 0 : insets.getSystemWindowInsetBottom()));
                return insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0,
                        insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom());
            }

        } else {
            return super.onApplyWindowInsets(insets);
        }
    }
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:30,代码来源:SoftRelativeLayout.java


注:本文中的android.view.WindowInsets.getSystemWindowInsetRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。