// Path: app/src/main/java/io/github/marktony/espresso/interfaze/OnFastScrollStateChangeListener.java
// public interface OnFastScrollStateChangeListener {
// 
//     /**
//      * Called when fast scrolling begins
//      */
//     void onFastScrollStart();
// 
//     /**
//      * Called when fast scrolling ends
//      */
//     void onFastScrollStop();
// 
// 
// }


import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Typeface;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import io.github.marktony.espresso.interfaze.OnFastScrollStateChangeListener;
/*
 *  Copyright(c) 2017 lizhaotailang
 *
 * 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 io.github.marktony.espresso.component;



/**
 * Created by lizhaotailang on 2017/3/24.
 */

public class FastScrollRecyclerView extends RecyclerView
        implements RecyclerView.OnItemTouchListener {

    private FastScroller mScrollbar;

    /**
     * The current scroll state of the recycler view.  We use this in onUpdateScrollbar()
     * and scrollToPositionAtProgress() to determine the scroll position of the recycler view so
     * that we can calculate what the scroll bar looks like, and where to jump to from the fast
     * scroller.
     */
    public static class ScrollPositionState {
        // The index of the first visible row
        public int rowIndex;
        // The offset of the first visible row
        public int rowTopOffset;
        // The height of a given row (they are currently all the same height)
        public int rowHeight;
    }

    private ScrollPositionState mScrollPosState = new ScrollPositionState();

    private int mDownX;
    private int mDownY;
    private int mLastY;

// Path: app/src/main/java/io/github/marktony/espresso/interfaze/OnFastScrollStateChangeListener.java
// public interface OnFastScrollStateChangeListener {
// 
//     /**
//      * Called when fast scrolling begins
//      */
//     void onFastScrollStart();
// 
//     /**
//      * Called when fast scrolling ends
//      */
//     void onFastScrollStop();
// 
// 
// }


// Path: app/src/main/java/io/github/marktony/espresso/component/FastScrollRecyclerView.java
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Typeface;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import io.github.marktony.espresso.interfaze.OnFastScrollStateChangeListener;

/*
 *  Copyright(c) 2017 lizhaotailang
 *
 * 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 io.github.marktony.espresso.component;



/**
 * Created by lizhaotailang on 2017/3/24.
 */

public class FastScrollRecyclerView extends RecyclerView
        implements RecyclerView.OnItemTouchListener {

    private FastScroller mScrollbar;

    /**
     * The current scroll state of the recycler view.  We use this in onUpdateScrollbar()
     * and scrollToPositionAtProgress() to determine the scroll position of the recycler view so
     * that we can calculate what the scroll bar looks like, and where to jump to from the fast
     * scroller.
     */
    public static class ScrollPositionState {
        // The index of the first visible row
        public int rowIndex;
        // The offset of the first visible row
        public int rowTopOffset;
        // The height of a given row (they are currently all the same height)
        public int rowHeight;
    }

    private ScrollPositionState mScrollPosState = new ScrollPositionState();

    private int mDownX;
    private int mDownY;
    private int mLastY;

    private OnFastScrollStateChangeListener mStateChangeListener;