package com.smaato.sdk.demoapp.utils;

import android.support.annotation.NonNull;
import android.view.View;

public abstract class ClickListener implements View.OnClickListener {

    private boolean enabled;

    public ClickListener() {
        this.enabled = true;
    }

    @Override
    public void onClick(@NonNull View v) {
        if (enabled) {
            enabled = false;
            handleClick(v);
        }
    }

    public abstract void handleClick(@NonNull View v);

    public void reset() {
        enabled = true;
    }
}
