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

The following examples show how to use com.google.android.material.appbar.AppBarLayout#setBottom() . 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 6 votes vote down vote up
private void recovery(final AppBarLayout abl) {
    if (mTotalDy > 0) {
        mTotalDy = 0;
        if (isAnimate) {
            ValueAnimator anim = ValueAnimator.ofFloat(mLastScale, 1f).setDuration(200);
            anim.addUpdateListener(animation -> {
                float value = (float) animation.getAnimatedValue();
                mTargetView.setScaleX(value);
                mTargetView.setScaleY(value);
                abl.setBottom((int) (mLastBottom - (mLastBottom - mParentHeight) * animation.getAnimatedFraction()));
            });
            anim.start();
        } else {
            mTargetView.setScaleX(1f);
            mTargetView.setScaleY(1f);
            abl.setBottom(mParentHeight);
        }
    }
}
 
Example 2
Source File: AppBarLayoutOverScrollViewBehavior.java    From MultiTypeRecyclerViewAdapter with Apache License 2.0 6 votes vote down vote up
private void recovery(final AppBarLayout abl) {
    if (mTotalDy > 0) {
        mTotalDy = 0;
        if (isAnimate) {
            ValueAnimator anim = ValueAnimator.ofFloat(mLastScale, 1f).setDuration(200);
            anim.addUpdateListener(animation -> {
                float value = (float) animation.getAnimatedValue();
                mTargetView.setScaleX(value);
                mTargetView.setScaleY(value);
                abl.setBottom((int) (mLastBottom - (mLastBottom - mParentHeight) * animation.getAnimatedFraction()));
            });
            anim.start();
        } else {
            mTargetView.setScaleX(1f);
            mTargetView.setScaleY(1f);
            abl.setBottom(mParentHeight);
        }
    }
}
 
Example 3
Source File: AppBarLayoutOverScrollViewBehavior.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
private void scale(AppBarLayout abl, View target, int dy) {
    mTotalDy += -dy;
    mTotalDy = Math.min(mTotalDy, TARGET_HEIGHT);
    mLastScale = Math.max(1f, 1f + mTotalDy / TARGET_HEIGHT);
    mTargetView.setScaleX(mLastScale);
    mTargetView.setScaleY(mLastScale);
    mLastBottom = mParentHeight + (int) (mTargetViewHeight / 2 * (mLastScale - 1));
    abl.setBottom(mLastBottom);
    target.setScrollY(0);
}
 
Example 4
Source File: AppBarLayoutOverScrollViewBehavior.java    From MultiTypeRecyclerViewAdapter with Apache License 2.0 5 votes vote down vote up
private void scale(AppBarLayout abl, View target, int dy) {
    mTotalDy += -dy;
    mTotalDy = Math.min(mTotalDy, TARGET_HEIGHT);
    mLastScale = Math.max(1f, 1f + mTotalDy / TARGET_HEIGHT);
    mTargetView.setScaleX(mLastScale);
    mTargetView.setScaleY(mLastScale);
    mLastBottom = mParentHeight + (int) (mTargetViewHeight / 2 * (mLastScale - 1));
    abl.setBottom(mLastBottom);
    target.setScrollY(0);
}