package com.rv.home.rv.module.ui.login.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;


public class VerifyImageView extends android.support.v7.widget.AppCompatImageView {
    private TouchVerifyListenter verifyListenter;

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

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

    public void setVerifyListenter(TouchVerifyListenter listenter) {
        this.verifyListenter = listenter;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        super.onTouchEvent(event);

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                int x = (int) event.getX();
                int y = (int) event.getY();
                if (verifyListenter != null) {
                    verifyListenter.verify(x, y);
                }
                break;
        }
        return true;
    }

    public interface TouchVerifyListenter {
        void verify(int x, int y);
    }
}
