package com.gh.gamecenter.common.callback;

import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;

/**
 * Created by khy on 25/04/18.
 */

public abstract class OnDoubleTapListener implements View.OnTouchListener {
    private GestureDetector mGestureDetector;

    protected OnDoubleTapListener(Context context) {
        mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
            @Override
            public boolean onDoubleTap(MotionEvent e) {
                OnDoubleTapListener.this.onDoubleTap();
                return true;
            }
        });
    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        mGestureDetector.onTouchEvent(event);
        return false;
    }

    public abstract void onDoubleTap();
}
