@@ -0,0 +1,1821 @@
+package com.akexorcist.sleepingforless.widget;%0A%0Aimport android.content.Context;%0Aimport android.support.design.widget.CoordinatorLayout;%0Aimport android.support.design.widget.FloatingActionButton;%0Aimport android.support.v4.view.ViewCompat;%0Aimport android.util.AttributeSet;%0Aimport android.view.View;%0A%0A/**%0A * Created by Akexorcist on 3/10/2016 AD.%0A */%0Apublic class FloatingActionButtonBehavior extends FloatingActionButton.Behavior %7B%0A    public FloatingActionButtonBehavior(Context context, AttributeSet attrs) %7B%0A        super();%0A    %7D%0A%0A    @Override%0A    public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,%0A                                       final View directTargetChild, final View target, final int nestedScrollAxes) %7B%0A        // Ensure we react to vertical scrolling%0A        return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL%0A                %7C%7C super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);%0A    %7D%0A%0A    @Override%0A    public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,%0A                               final View target, final int dxConsumed, final int dyConsumed,%0A                               final int dxUnconsumed, final int dyUnconsumed) %7B%0A        super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);%0A        if (dyConsumed %3E 0 && child.getVisibility() == View.VISIBLE) %7B%0A            // User scrolled down and the FAB is currently visible -%3E hide the FAB%0A            child.hide();%0A        %7D else if (dyConsumed %3C 0 && child.getVisibility() != View.VISIBLE) %7B%0A            // User scrolled up and the FAB is currently not visible -%3E show the FAB%0A            child.show();%0A        %7D%0A    %7D%0A%7D

Add custom behavior