Java Code Examples for android.view.View#dispatchApplyWindowInsets()
The following examples show how to use
android.view.View#dispatchApplyWindowInsets() .
These examples are extracted from open source projects.
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 Project: scene File: CompatSceneLayout.java License: Apache License 2.0 | 5 votes |
@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; }
Example 2
Source Project: TelePlus-Android File: DrawerLayoutContainer.java License: GNU General Public License v2.0 | 5 votes |
@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); }
Example 3
Source Project: TelePlus-Android File: DrawerLayoutContainer.java License: GNU General Public License v2.0 | 5 votes |
@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); }
Example 4
Source Project: letv File: ViewCompatLollipop.java License: Apache License 2.0 | 5 votes |
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; }
Example 5
Source Project: 920-text-editor-v2 File: DrawerLayoutCompatApi21.java License: Apache License 2.0 | 5 votes |
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); }
Example 6
Source Project: Dashchan File: DrawerLayout.java License: Apache License 2.0 | 5 votes |
@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); }
Example 7
Source Project: adt-leanback-support File: DrawerLayoutCompatApi21.java License: Apache License 2.0 | 5 votes |
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); }
Example 8
Source Project: debugdrawer File: DrawerLayoutCompatApi21.java License: Apache License 2.0 | 5 votes |
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); }
Example 9
Source Project: Telegram-FOSS File: DrawerLayoutContainer.java License: GNU General Public License v2.0 | 5 votes |
@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); }
Example 10
Source Project: u2020 File: DrawerLayoutCompatApi21.java License: Apache License 2.0 | 5 votes |
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); }
Example 11
Source Project: cathode File: CatchSystemInsets.java License: Apache License 2.0 | 5 votes |
@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); }
Example 12
Source Project: Telegram File: DrawerLayoutContainer.java License: GNU General Public License v2.0 | 5 votes |
@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); }