package epson.print.widgets;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.Switch;

public class SwichClickable extends Switch implements CompoundButton.OnCheckedChangeListener {
    private static final String TAG = "SwichClickable";
    View.OnClickListener onClicklistener = null;

    public SwichClickable(Context context) {
        super(context);
        setOnCheckedChangeListener(this);
    }

    public SwichClickable(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        setOnCheckedChangeListener(this);
    }

    public SwichClickable(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        setOnCheckedChangeListener(this);
    }

    public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
        View.OnClickListener onClickListener = onClicklistener;
        if (onClickListener != null) {
            onClickListener.onClick(compoundButton);
        }
    }

    public void setOnClickListener(View.OnClickListener onClickListener) {
        onClicklistener = onClickListener;
    }
}
