// 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.content.Context;
import android.os.Build;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import io.apptik.multiview.common.Log;
        public InteractionListener(RecyclerView recyclerView) {
            this.recyclerView = recyclerView;
            this.context = this.recyclerView.getContext();
            init();
        }


        private void init() {
            gestureDetector = new GestureDetectorCompat(context, this);
            gestureDetector.setOnDoubleTapListener(this);
            scaleGestureDetector = new ScaleGestureDetector(context, this);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                scaleGestureDetector.setQuickScaleEnabled(false);
            }
        }

        public boolean onTouchEvent(MotionEvent ev) {
            scaleGestureDetector.onTouchEvent(ev);
            //if were in scale ignore the rest
            if (scaleGestureDetector.isInProgress()) {
                return true;
            } else {
                //return false;
                return gestureDetector.onTouchEvent(ev);
            }

        }

        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
// 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: scalablerecyclerview/src/main/java/io/apptik/multiview/scalablerecyclerview/BaseGridScaler.java
import android.content.Context;
import android.os.Build;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import io.apptik.multiview.common.Log;

        public InteractionListener(RecyclerView recyclerView) {
            this.recyclerView = recyclerView;
            this.context = this.recyclerView.getContext();
            init();
        }


        private void init() {
            gestureDetector = new GestureDetectorCompat(context, this);
            gestureDetector.setOnDoubleTapListener(this);
            scaleGestureDetector = new ScaleGestureDetector(context, this);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                scaleGestureDetector.setQuickScaleEnabled(false);
            }
        }

        public boolean onTouchEvent(MotionEvent ev) {
            scaleGestureDetector.onTouchEvent(ev);
            //if were in scale ignore the rest
            if (scaleGestureDetector.isInProgress()) {
                return true;
            } else {
                //return false;
                return gestureDetector.onTouchEvent(ev);
            }

        }

        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            Log.d("onSingleTapConfirmed: " + (e == null ? "e==null" : e.getX() + "/" + e.getY()));