Java Code Examples for com.google.android.material.appbar.AppBarLayout#getBottom()

The following examples show how to use com.google.android.material.appbar.AppBarLayout#getBottom() . 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: AppBarLayoutOverScrollViewBehavior.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target, int dx, int dy, int[] consumed, int type) {
    if (mTargetView != null && ((dy < 0 && child.getBottom() >= mParentHeight) || (dy > 0 && child.getBottom() > mParentHeight))) {
        scale(child, target, dy);
    } else {
        super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
    }
}
 
Example 2
Source File: AppBarLayoutOverScrollViewBehavior.java    From MultiTypeRecyclerViewAdapter with Apache License 2.0 5 votes vote down vote up
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target, int dx, int dy, int[] consumed, int type) {
    if (mTargetView != null && ((dy < 0 && child.getBottom() >= mParentHeight) || (dy > 0 && child.getBottom() > mParentHeight))) {
        scale(child, target, dy);
    } else {
        super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
    }
}
 
Example 3
Source File: AppBarLayoutOverScrollViewBehavior.java    From AndroidAnimationExercise with Apache License 2.0 5 votes vote down vote up
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target, int dx, int dy, int[] consumed, int type) {
    Log.e(TAG, "onNestedPreScroll: dy==" + dy);
    Log.e(TAG, "onNestedPreScroll: child.getBottom()==" + child.getBottom());

    if (!isRecovering) {
        if (mTargetView != null && ((dy < 0 && child.getBottom() >= mParentHeight)
                || (dy > 0 && child.getBottom() > mParentHeight))) {
            scale(child, target, dy);
            return;
        }
    }
    super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
}
 
Example 4
Source File: AppBarLayoutMatchers.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
/** Returns a matcher that matches AppBarLayouts which are collapsed. */
public static Matcher<View> isCollapsed() {
  return new BoundedMatcher<View, AppBarLayout>(AppBarLayout.class) {
    @Override
    public void describeTo(Description description) {
      description.appendText("AppBarLayout is collapsed");
    }

    @Override
    protected boolean matchesSafely(AppBarLayout item) {
      return item.getBottom() == (item.getHeight() - item.getTotalScrollRange());
    }
  };
}
 
Example 5
Source File: AppUtils.java    From materialistic with Apache License 2.0 5 votes vote down vote up
public static void navigate(int direction, AppBarLayout appBarLayout, Navigable navigable) {
    switch (direction) {
        case Navigable.DIRECTION_DOWN:
        case Navigable.DIRECTION_RIGHT:
            if (appBarLayout.getBottom() == 0) {
                navigable.onNavigate(direction);
            } else {
                appBarLayout.setExpanded(false, true);
            }
            break;
        default:
            navigable.onNavigate(direction);
            break;
    }
}