// Path: common/src/main/java/io/apptik/multiview/common/Log.java
// public class Log {
// 
//     private static final int CALL_STACK_INDEX = 5;
//     private static final Pattern ANONYMOUS_CLASS = Pattern.compile("(\\$\\d+)+$");
//     private static boolean DEBUG = false;
// 
//     public static void on() {
//         DEBUG = true;
//     }
//     public static void off() {
//         DEBUG = false;
//     }
//     public static void v(String msg) {
//         if(DEBUG) {
//             android.util.Log.v(getTag(), msg);
//         }
//     }
// 
//     public static void d(String msg) {
//         if(DEBUG) {
//             android.util.Log.d(getTag(), msg);
//         }
//     }
// 
//     public static void i(String msg) {
//         if(DEBUG) {
//             android.util.Log.i(getTag(), msg);
//         }
//     }
// 
//     public static void w(String msg) {
//         if(DEBUG) {
//             android.util.Log.w(getTag(), msg);
//         }
//     }
// 
//     public static void e(String msg) {
//         if(DEBUG) {
//             android.util.Log.e(getTag(), msg);
//         }
//     }
// 
//     public static void wtf(String msg) {
//         if(DEBUG) {
//             android.util.Log.wtf(getTag(), msg);
//         }
//     }
// 
//     private static String getTag() {
//         StackTraceElement[] stackTrace = new Throwable().getStackTrace();
//         if (stackTrace.length <= CALL_STACK_INDEX) {
//             throw new IllegalStateException(
//                     "Synthetic stacktrace didn't have enough elements: are you using proguard?");
//         }
//         return createStackElementTag(stackTrace[CALL_STACK_INDEX]);
//     }
// 
//     protected static String createStackElementTag(StackTraceElement element) {
//         String tag = element.getClassName();
//         Matcher m = ANONYMOUS_CLASS.matcher(tag);
//         if (m.find()) {
//             tag = m.replaceAll("");
//         }
//         return tag.substring(tag.lastIndexOf('.') + 1);
//     }
// }


import android.os.Build;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.OnItemTouchListener;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import io.apptik.multiview.common.Log;
                        new ItemClickGestureListener(hostView));
    }

    private boolean isAttachedToWindow(RecyclerView hostView) {
        if (Build.VERSION.SDK_INT >= 19) {
            return hostView.isAttachedToWindow();
        } else {
            return (hostView.getHandler() != null);
        }
    }

    private boolean hasAdapter(RecyclerView hostView) {
        return (hostView.getAdapter() != null);
    }

    @Override
    public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent event) {
        if (!isAttachedToWindow(recyclerView) || !hasAdapter(recyclerView)) {
            return false;
        }
        mGestureDetector.onTouchEvent(event);
        return false;
    }

    @Override
    public void onTouchEvent(RecyclerView recyclerView, MotionEvent event) {
    }

    @Override
    public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
// Path: common/src/main/java/io/apptik/multiview/common/Log.java
// public class Log {
// 
//     private static final int CALL_STACK_INDEX = 5;
//     private static final Pattern ANONYMOUS_CLASS = Pattern.compile("(\\$\\d+)+$");
//     private static boolean DEBUG = false;
// 
//     public static void on() {
//         DEBUG = true;
//     }
//     public static void off() {
//         DEBUG = false;
//     }
//     public static void v(String msg) {
//         if(DEBUG) {
//             android.util.Log.v(getTag(), msg);
//         }
//     }
// 
//     public static void d(String msg) {
//         if(DEBUG) {
//             android.util.Log.d(getTag(), msg);
//         }
//     }
// 
//     public static void i(String msg) {
//         if(DEBUG) {
//             android.util.Log.i(getTag(), msg);
//         }
//     }
// 
//     public static void w(String msg) {
//         if(DEBUG) {
//             android.util.Log.w(getTag(), msg);
//         }
//     }
// 
//     public static void e(String msg) {
//         if(DEBUG) {
//             android.util.Log.e(getTag(), msg);
//         }
//     }
// 
//     public static void wtf(String msg) {
//         if(DEBUG) {
//             android.util.Log.wtf(getTag(), msg);
//         }
//     }
// 
//     private static String getTag() {
//         StackTraceElement[] stackTrace = new Throwable().getStackTrace();
//         if (stackTrace.length <= CALL_STACK_INDEX) {
//             throw new IllegalStateException(
//                     "Synthetic stacktrace didn't have enough elements: are you using proguard?");
//         }
//         return createStackElementTag(stackTrace[CALL_STACK_INDEX]);
//     }
// 
//     protected static String createStackElementTag(StackTraceElement element) {
//         String tag = element.getClassName();
//         Matcher m = ANONYMOUS_CLASS.matcher(tag);
//         if (m.find()) {
//             tag = m.replaceAll("");
//         }
//         return tag.substring(tag.lastIndexOf('.') + 1);
//     }
// }


// Path: extras/src/main/java/io/apptik/multiview/extras/ClickItemTouchListener.java
import android.os.Build;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.OnItemTouchListener;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import io.apptik.multiview.common.Log;

                        new ItemClickGestureListener(hostView));
    }

    private boolean isAttachedToWindow(RecyclerView hostView) {
        if (Build.VERSION.SDK_INT >= 19) {
            return hostView.isAttachedToWindow();
        } else {
            return (hostView.getHandler() != null);
        }
    }

    private boolean hasAdapter(RecyclerView hostView) {
        return (hostView.getAdapter() != null);
    }

    @Override
    public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent event) {
        if (!isAttachedToWindow(recyclerView) || !hasAdapter(recyclerView)) {
            return false;
        }
        mGestureDetector.onTouchEvent(event);
        return false;
    }

    @Override
    public void onTouchEvent(RecyclerView recyclerView, MotionEvent event) {
    }

    @Override
    public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
        Log.d("onRequestDisallowInterceptTouchEvent: " + disallowIntercept);