/*
 * Copyright (C) 2017 Hazuki
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package jp.hazuki.yuzubrowser.utils.view;

import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class CustomCoordinatorLayout extends CoordinatorLayout {

    private int toolbarHeight = 0;

    public CustomCoordinatorLayout(Context context) {
        super(context);
    }

    public CustomCoordinatorLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomCoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setToolbarHeight(int toolbarHeight) {
        this.toolbarHeight = toolbarHeight;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (toolbarHeight > 0) {
            return ev.getY() > toolbarHeight && super.onTouchEvent(ev);
        }
        return super.onTouchEvent(ev);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (toolbarHeight > 0) {
            return ev.getY() > toolbarHeight && super.onInterceptTouchEvent(ev);
        }
        return super.onInterceptTouchEvent(ev);
    }
}

@@ -1645,139 +1645,8 @@
     
-if (toolbarHeight %3E 0) %7B%0A            return ev.getY() %3E toolbarHeight && super.onInterceptTouchEvent(ev);%0A        %7D%0A        return 
 supe
@@ -1664,26 +1664,48 @@
 ptTouchEvent(ev)
+;%0A        return false
 ;%0A    %7D%0A%7D%0A

fix toolbar swipe bug