Java Code Examples for android.view.View.getFitsSystemWindows()

The following are Jave code examples for showing how to use getFitsSystemWindows() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: airgram   File: DrawerLayoutContainer.java   View Source Code Vote up 5 votes
@SuppressLint("NewApi")
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int widthSize = MeasureSpec.getSize(widthMeasureSpec);
    int heightSize = MeasureSpec.getSize(heightMeasureSpec);

    setMeasuredDimension(widthSize, heightSize);

    final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21;

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

        if (child.getVisibility() == GONE) {
            continue;
        }

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        if (applyInsets) {
            if (child.getFitsSystemWindows()) {
                dispatchChildInsets(child, lastInsets, lp.gravity);
            } else if (child.getTag() == null) {
                applyMarginInsets(lp, lastInsets, lp.gravity, Build.VERSION.SDK_INT >= 21);
            }
        }

        if (drawerLayout != child) {
            final int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize - lp.leftMargin - lp.rightMargin, MeasureSpec.EXACTLY);
            final int contentHeightSpec = MeasureSpec.makeMeasureSpec(heightSize - lp.topMargin - lp.bottomMargin, MeasureSpec.EXACTLY);
            child.measure(contentWidthSpec, contentHeightSpec);
        } else {
            child.setPadding(0, 0, 0, 0);
            final int drawerWidthSpec = getChildMeasureSpec(widthMeasureSpec, minDrawerMargin + lp.leftMargin + lp.rightMargin, lp.width);
            final int drawerHeightSpec = getChildMeasureSpec(heightMeasureSpec, lp.topMargin + lp.bottomMargin, lp.height);
            child.measure(drawerWidthSpec, drawerHeightSpec);
        }
    }
}
 
Example 2
Project: qmui   File: QMUIWindowInsetHelper.java   View Source Code Vote up 5 votes
@SuppressWarnings("deprecation")
@TargetApi(19)
private boolean jumpDispatch(View child) {
    return !child.getFitsSystemWindows() &&
            !(child instanceof QMUIWindowInsetLayout) &&
            !(child instanceof CoordinatorLayout);
}
 
Example 3
Project: letv   File: ViewCompatJB.java   View Source Code Vote up 4 votes
public static boolean getFitsSystemWindows(View view) {
    return view.getFitsSystemWindows();
}
 
Example 4
Project: PlusGram   File: DrawerLayoutContainer.java   View Source Code Vote up 4 votes
@SuppressLint("NewApi")
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int widthSize = MeasureSpec.getSize(widthMeasureSpec);
    int heightSize = MeasureSpec.getSize(heightMeasureSpec);

    setMeasuredDimension(widthSize, heightSize);

    final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21;

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

        if (child.getVisibility() == GONE) {
            continue;
        }

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        if (applyInsets) {
            if (child.getFitsSystemWindows()) {
                dispatchChildInsets(child, lastInsets, lp.gravity);
            } else if (child.getTag() == null) {
                applyMarginInsets(lp, lastInsets, lp.gravity, Build.VERSION.SDK_INT >= 21);
            }
        }

        if (drawerLayout != child) {
            final int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize - lp.leftMargin - lp.rightMargin, MeasureSpec.EXACTLY);
            final int contentHeightSpec = MeasureSpec.makeMeasureSpec(heightSize - lp.topMargin - lp.bottomMargin, MeasureSpec.EXACTLY);
            child.measure(contentWidthSpec, contentHeightSpec);
        } else {
            child.setPadding(0, 0, 0, 0);
            final int drawerWidthSpec = getChildMeasureSpec(widthMeasureSpec, minDrawerMargin + lp.leftMargin + lp.rightMargin, lp.width);
            final int drawerHeightSpec = getChildMeasureSpec(heightMeasureSpec, lp.topMargin + lp.bottomMargin, lp.height);
            child.measure(drawerWidthSpec, drawerHeightSpec);
        }
    }
    //Telegram
    updateListBG();
}
 
Example 5
Project: boohee_v5.6   File: ViewCompatJB.java   View Source Code Vote up 4 votes
public static boolean getFitsSystemWindows(View view) {
    return view.getFitsSystemWindows();
}
 
Example 6
Project: QMUI_Android   File: QMUIWindowInsetHelper.java   View Source Code Vote up 4 votes
@SuppressWarnings("deprecation")
@TargetApi(19)
public static boolean jumpDispatch(View child) {
    return !child.getFitsSystemWindows() && !isHandleContainer(child);
}