Java Code Examples for android.view.WindowInsets#consumeSystemWindowInsets()

The following examples show how to use android.view.WindowInsets#consumeSystemWindowInsets() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InsetsDrawerLayout.java    From Interessant with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example 2
Source File: DispatchWindowInsetsListener.java    From scene with Apache License 2.0 5 votes vote down vote up
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
    WindowInsets copy = new WindowInsets(insets);
    ViewGroup viewGroup = (ViewGroup) v;
    final int count = viewGroup.getChildCount();
    for (int i = 0; i < count; i++) {
        viewGroup.getChildAt(i).dispatchApplyWindowInsets(copy);
    }
    return insets.consumeSystemWindowInsets();
}
 
Example 3
Source File: InsetsFrameLayout.java    From Moment with GNU General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example 4
Source File: OverlayView.java    From Telecine with Apache License 2.0 5 votes vote down vote up
@Override public WindowInsets onApplyWindowInsets(WindowInsets insets) {
  ViewGroup.LayoutParams lp = getLayoutParams();
  lp.height = insets.getSystemWindowInsetTop();

  listener.onResize();

  return insets.consumeSystemWindowInsets();
}
 
Example 5
Source File: DrawerLayoutCompatApi21.java    From 920-text-editor-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
    final DrawerLayoutImpl drawerLayout = (DrawerLayoutImpl) v;
    drawerLayout.setChildInsets(insets, insets.getSystemWindowInsetTop() > 0);
    return insets.consumeSystemWindowInsets();
}
 
Example 6
Source File: DrawerLayout.java    From Dashchan with Apache License 2.0 4 votes vote down vote up
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
	final DrawerLayout drawerLayout = (DrawerLayout) v;
	drawerLayout.setChildInsets(insets, insets.getSystemWindowInsetTop() > 0);
	return insets.consumeSystemWindowInsets();
}
 
Example 7
Source File: DrawerLayoutCompatApi21.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
    final DrawerLayoutImpl drawerLayout = (DrawerLayoutImpl) v;
    drawerLayout.setChildInsets(insets, insets.getSystemWindowInsetTop() > 0);
    return insets.consumeSystemWindowInsets();
}
 
Example 8
Source File: DrawerLayoutCompatApi21.java    From debugdrawer with Apache License 2.0 4 votes vote down vote up
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
	final DrawerLayoutImpl drawerLayout = (DrawerLayoutImpl) v;
	drawerLayout.setChildInsets(insets, insets.getSystemWindowInsetTop() > 0);
	return insets.consumeSystemWindowInsets();
}
 
Example 9
Source File: DrawerLayoutCompatApi21.java    From u2020 with Apache License 2.0 4 votes vote down vote up
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
  final DrawerLayoutImpl drawerLayout = (DrawerLayoutImpl) v;
  drawerLayout.setChildInsets(insets, insets.getSystemWindowInsetTop() > 0);
  return insets.consumeSystemWindowInsets();
}
 
Example 10
Source File: CatchSystemInsets.java    From cathode with Apache License 2.0 4 votes vote down vote up
@Override public WindowInsets onApplyWindowInsets(WindowInsets insets) {
  this.insets = new WindowInsets(insets);
  return insets.consumeSystemWindowInsets();
}
 
Example 11
Source File: InsetsFrameLayout.java    From cathode with Apache License 2.0 3 votes vote down vote up
@Override public WindowInsets onApplyWindowInsets(WindowInsets insets) {
  this.insets = new WindowInsets(insets);

  setPadding(0, insets.getSystemWindowInsetTop(), 0, 0);

  return insets.consumeSystemWindowInsets();
}