android.view.View#dispatchApplyWindowInsets ( )源码实例Demo

下面列出了android.view.View#dispatchApplyWindowInsets ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: scene   文件: CompatSceneLayout.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
    StatusBarView statusBarView = findViewById(R.id.scene_status_bar);
    if (statusBarView != null) {
        if (statusBarView.getParent() != this) {
            throw new IllegalStateException("StatusBarView parent must be " + getClass().getSimpleName());
        }
        insets = statusBarView.dispatchApplyWindowInsets(insets);
    }

    if (insets.isConsumed()) {
        return insets;
    }

    NavigationBarView navigationBarView = findViewById(R.id.scene_navigation_bar);
    if (navigationBarView != null) {
        if (navigationBarView.getParent() != this) {
            throw new IllegalStateException("NavigationBarView parent must be " + getClass().getSimpleName());
        }
        insets = navigationBarView.dispatchApplyWindowInsets(insets);
    }

    if (insets.isConsumed()) {
        return insets;
    }

    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        View childView = getChildAt(i);
        if (childView == statusBarView || childView == navigationBarView) {
            continue;
        }
        insets = childView.dispatchApplyWindowInsets(insets);
        if (insets.isConsumed()) {
            break;
        }
    }
    return insets;
}
 
源代码2 项目: TelePlus-Android   文件: DrawerLayoutContainer.java
@SuppressLint("NewApi")
private void dispatchChildInsets(View child, Object insets, int drawerGravity)
{
    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());
    }
    child.dispatchApplyWindowInsets(wi);
}
 
源代码3 项目: TelePlus-Android   文件: DrawerLayoutContainer.java
@SuppressLint("NewApi")
private void dispatchChildInsets(View child, Object insets, int drawerGravity)
{
    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());
    }
    child.dispatchApplyWindowInsets(wi);
}
 
源代码4 项目: letv   文件: ViewCompatLollipop.java
public static WindowInsetsCompat dispatchApplyWindowInsets(View v, WindowInsetsCompat insets) {
    if (!(insets instanceof WindowInsetsCompatApi21)) {
        return insets;
    }
    WindowInsets unwrapped = ((WindowInsetsCompatApi21) insets).unwrap();
    WindowInsets result = v.dispatchApplyWindowInsets(unwrapped);
    if (result != unwrapped) {
        return new WindowInsetsCompatApi21(result);
    }
    return insets;
}
 
public static void dispatchChildInsets(View child, 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());
    }
    child.dispatchApplyWindowInsets(wi);
}
 
源代码6 项目: Dashchan   文件: DrawerLayout.java
@Override
public void dispatchChildInsets(View child, Object insets, int drawerGravity) {
	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());
	}
	child.dispatchApplyWindowInsets(wi);
}
 
public static void dispatchChildInsets(View child, 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());
    }
    child.dispatchApplyWindowInsets(wi);
}
 
源代码8 项目: debugdrawer   文件: DrawerLayoutCompatApi21.java
public static void dispatchChildInsets(View child, 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());
	}
	child.dispatchApplyWindowInsets(wi);
}
 
源代码9 项目: Telegram-FOSS   文件: DrawerLayoutContainer.java
@SuppressLint("NewApi")
private void dispatchChildInsets(View child, Object insets, int drawerGravity) {
    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());
    }
    child.dispatchApplyWindowInsets(wi);
}
 
源代码10 项目: u2020   文件: DrawerLayoutCompatApi21.java
public static void dispatchChildInsets(View child, 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());
  }
  child.dispatchApplyWindowInsets(wi);
}
 
源代码11 项目: cathode   文件: CatchSystemInsets.java
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  if (insets != null) {
    for (int i = 0, childCount = getChildCount(); i < childCount; i++) {
      View child = getChildAt(i);
      child.dispatchApplyWindowInsets(insets);
    }
  }

  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
 
源代码12 项目: Telegram   文件: DrawerLayoutContainer.java
@SuppressLint("NewApi")
private void dispatchChildInsets(View child, Object insets, int drawerGravity) {
    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());
    }
    child.dispatchApplyWindowInsets(wi);
}
 
 方法所在类
 同类方法