@Test public void testInsetDependency() { final CoordinatorLayout col = mActivityTestRule.getActivity().mCoordinatorLayout; final CoordinatorLayout.LayoutParams lpInsetLeft = col.generateDefaultLayoutParams(); lpInsetLeft.insetEdge = Gravity.LEFT; final CoordinatorLayout.LayoutParams lpInsetRight = col.generateDefaultLayoutParams(); lpInsetRight.insetEdge = Gravity.RIGHT; final CoordinatorLayout.LayoutParams lpInsetTop = col.generateDefaultLayoutParams(); lpInsetTop.insetEdge = Gravity.TOP; final CoordinatorLayout.LayoutParams lpInsetBottom = col.generateDefaultLayoutParams(); lpInsetBottom.insetEdge = Gravity.BOTTOM; final CoordinatorLayout.LayoutParams lpDodgeLeft = col.generateDefaultLayoutParams(); lpDodgeLeft.dodgeInsetEdges = Gravity.LEFT; final CoordinatorLayout.LayoutParams lpDodgeLeftAndTop = col.generateDefaultLayoutParams(); lpDodgeLeftAndTop.dodgeInsetEdges = Gravity.LEFT | Gravity.TOP; final CoordinatorLayout.LayoutParams lpDodgeAll = col.generateDefaultLayoutParams(); lpDodgeAll.dodgeInsetEdges = Gravity.FILL; final View a = new View(col.getContext()); final View b = new View(col.getContext()); assertThat(dependsOn(lpDodgeLeft, lpInsetLeft, col, a, b), is(true)); assertThat(dependsOn(lpDodgeLeft, lpInsetRight, col, a, b), is(false)); assertThat(dependsOn(lpDodgeLeft, lpInsetTop, col, a, b), is(false)); assertThat(dependsOn(lpDodgeLeft, lpInsetBottom, col, a, b), is(false)); assertThat(dependsOn(lpDodgeLeftAndTop, lpInsetLeft, col, a, b), is(true)); assertThat(dependsOn(lpDodgeLeftAndTop, lpInsetRight, col, a, b), is(false)); assertThat(dependsOn(lpDodgeLeftAndTop, lpInsetTop, col, a, b), is(true)); assertThat(dependsOn(lpDodgeLeftAndTop, lpInsetBottom, col, a, b), is(false)); assertThat(dependsOn(lpDodgeAll, lpInsetLeft, col, a, b), is(true)); assertThat(dependsOn(lpDodgeAll, lpInsetRight, col, a, b), is(true)); assertThat(dependsOn(lpDodgeAll, lpInsetTop, col, a, b), is(true)); assertThat(dependsOn(lpDodgeAll, lpInsetBottom, col, a, b), is(true)); assertThat(dependsOn(lpInsetLeft, lpDodgeLeft, col, a, b), is(false)); }
@Override protected LayoutParams generateDefaultLayoutParams() { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); }
CoordinatorLayout extends ViewGroup implements NestedScrollingParent2 { @Override protected LayoutParams generateDefaultLayoutParams() { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } }
CoordinatorLayout extends ViewGroup implements NestedScrollingParent2 { @Override protected LayoutParams generateDefaultLayoutParams() { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } CoordinatorLayout(@NonNull Context context);  CoordinatorLayout(@NonNull Context context, @Nullable AttributeSet attrs);  CoordinatorLayout(@NonNull Context context, @Nullable AttributeSet attrs,
            @AttrRes int defStyleAttr); }
CoordinatorLayout extends ViewGroup implements NestedScrollingParent2 { @Override protected LayoutParams generateDefaultLayoutParams() { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } CoordinatorLayout(@NonNull Context context);  CoordinatorLayout(@NonNull Context context, @Nullable AttributeSet attrs);  CoordinatorLayout(@NonNull Context context, @Nullable AttributeSet attrs,
            @AttrRes int defStyleAttr); @Override void setOnHierarchyChangeListener(OnHierarchyChangeListener onHierarchyChangeListener); @Override void onAttachedToWindow(); @Override void onDetachedFromWindow(); void setStatusBarBackground(@Nullable final Drawable bg); @Nullable Drawable getStatusBarBackground(); @Override void setVisibility(int visibility); void setStatusBarBackgroundResource(@DrawableRes int resId); void setStatusBarBackgroundColor(@ColorInt int color); @RestrictTo(LIBRARY_GROUP) final WindowInsetsCompat getLastWindowInsets(); @Override boolean onInterceptTouchEvent(MotionEvent ev); @Override boolean onTouchEvent(MotionEvent ev); @Override void requestDisallowInterceptTouchEvent(boolean disallowIntercept); void onMeasureChild(View child, int parentWidthMeasureSpec, int widthUsed,
            int parentHeightMeasureSpec, int heightUsed); void onLayoutChild(@NonNull View child, int layoutDirection); @Override void onDraw(Canvas c); @Override void setFitsSystemWindows(boolean fitSystemWindows); void dispatchDependentViewsChanged(@NonNull View view); @NonNull List<View> getDependencies(@NonNull View child); @NonNull List<View> getDependents(@NonNull View child); boolean isPointInChildBounds(@NonNull View child, int x, int y); boolean doViewsOverlap(@NonNull View first, @NonNull View second); @Override LayoutParams generateLayoutParams(AttributeSet attrs); @Override boolean onStartNestedScroll(View child, View target, int nestedScrollAxes); @Override boolean onStartNestedScroll(View child, View target, int axes, int type); @Override void onNestedScrollAccepted(View child, View target, int nestedScrollAxes); @Override void onNestedScrollAccepted(View child, View target, int nestedScrollAxes, int type); @Override void onStopNestedScroll(View target); @Override void onStopNestedScroll(View target, int type); @Override void onNestedScroll(View target, int dxConsumed, int dyConsumed,
            int dxUnconsumed, int dyUnconsumed); @Override void onNestedScroll(View target, int dxConsumed, int dyConsumed,
            int dxUnconsumed, int dyUnconsumed, int type); @Override void onNestedPreScroll(View target, int dx, int dy, int[] consumed); @Override void onNestedPreScroll(View target, int dx, int dy, int[] consumed, int  type); @Override boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed); @Override boolean onNestedPreFling(View target, float velocityX, float velocityY); @Override int getNestedScrollAxes(); @Override boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate); }
CoordinatorLayout extends ViewGroup implements NestedScrollingParent2 { @Override protected LayoutParams generateDefaultLayoutParams() { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } CoordinatorLayout(@NonNull Context context);  CoordinatorLayout(@NonNull Context context, @Nullable AttributeSet attrs);  CoordinatorLayout(@NonNull Context context, @Nullable AttributeSet attrs,
            @AttrRes int defStyleAttr); @Override void setOnHierarchyChangeListener(OnHierarchyChangeListener onHierarchyChangeListener); @Override void onAttachedToWindow(); @Override void onDetachedFromWindow(); void setStatusBarBackground(@Nullable final Drawable bg); @Nullable Drawable getStatusBarBackground(); @Override void setVisibility(int visibility); void setStatusBarBackgroundResource(@DrawableRes int resId); void setStatusBarBackgroundColor(@ColorInt int color); @RestrictTo(LIBRARY_GROUP) final WindowInsetsCompat getLastWindowInsets(); @Override boolean onInterceptTouchEvent(MotionEvent ev); @Override boolean onTouchEvent(MotionEvent ev); @Override void requestDisallowInterceptTouchEvent(boolean disallowIntercept); void onMeasureChild(View child, int parentWidthMeasureSpec, int widthUsed,
            int parentHeightMeasureSpec, int heightUsed); void onLayoutChild(@NonNull View child, int layoutDirection); @Override void onDraw(Canvas c); @Override void setFitsSystemWindows(boolean fitSystemWindows); void dispatchDependentViewsChanged(@NonNull View view); @NonNull List<View> getDependencies(@NonNull View child); @NonNull List<View> getDependents(@NonNull View child); boolean isPointInChildBounds(@NonNull View child, int x, int y); boolean doViewsOverlap(@NonNull View first, @NonNull View second); @Override LayoutParams generateLayoutParams(AttributeSet attrs); @Override boolean onStartNestedScroll(View child, View target, int nestedScrollAxes); @Override boolean onStartNestedScroll(View child, View target, int axes, int type); @Override void onNestedScrollAccepted(View child, View target, int nestedScrollAxes); @Override void onNestedScrollAccepted(View child, View target, int nestedScrollAxes, int type); @Override void onStopNestedScroll(View target); @Override void onStopNestedScroll(View target, int type); @Override void onNestedScroll(View target, int dxConsumed, int dyConsumed,
            int dxUnconsumed, int dyUnconsumed); @Override void onNestedScroll(View target, int dxConsumed, int dyConsumed,
            int dxUnconsumed, int dyUnconsumed, int type); @Override void onNestedPreScroll(View target, int dx, int dy, int[] consumed); @Override void onNestedPreScroll(View target, int dx, int dy, int[] consumed, int  type); @Override boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed); @Override boolean onNestedPreFling(View target, float velocityX, float velocityY); @Override int getNestedScrollAxes(); @Override boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate);  }