package com.gh4a.widget;

import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.view.MotionEvent;
import android.view.View;

public class ToggleableAppBarLayoutBehavior extends AppBarLayout.Behavior {
    private boolean mEnabled = true;

    public void setEnabled(boolean enabled) {
        mEnabled = enabled;
    }

    @Override
    public boolean onStartNestedScroll(CoordinatorLayout parent, AppBarLayout child,
            View directTargetChild, View target, int nestedScrollAxes) {
        return mEnabled && super.onStartNestedScroll(parent, child, directTargetChild, target,
                nestedScrollAxes);
    }

    @Override
    public void onNestedPreScroll(CoordinatorLayout coordinatorLayout,
            AppBarLayout child, View target, int dx, int dy, int[] consumed) {
        if (mEnabled) {
            super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed);
        }
    }

    @Override
    public void onStopNestedScroll(CoordinatorLayout coordinatorLayout,
            AppBarLayout child, View target) {
        if (mEnabled) {
            super.onStopNestedScroll(coordinatorLayout, child, target);
        }
    }

    @Override
    public boolean onInterceptTouchEvent(CoordinatorLayout parent,
            AppBarLayout child, MotionEvent ev) {
        return mEnabled && super.onInterceptTouchEvent(parent, child, ev);
    }
}

@@ -976,32 +976,410 @@
        %7D%0A    %7D%0A%0A
+    @Override%0A    public void onNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target,%0A            int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) %7B%0A        if (mEnabled) %7B%0A            super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,%0A                    dxUnconsumed, dyUnconsumed);%0A        %7D%0A    %7D%0A%0A
     @Override%0A  

Fix toolbar scrolling when scrolling basic comment editor