package com.xtremelabs.droidsugar.fakes;

import android.widget.Checkable;
import android.widget.CompoundButton;
import com.xtremelabs.droidsugar.util.Implements;

@SuppressWarnings({"UnusedDeclaration"})
@Implements(CompoundButton.class)
public class FakeCompoundButton extends FakeTextView implements Checkable {
    private boolean mmmmmChecked;
    private CompoundButton.OnCheckedChangeListener mOnCheckedChangeListener;

    public FakeCompoundButton(CompoundButton view) {
        super(view);
    }

    @Override public void toggle() {
        setChecked(!mmmmmChecked);
    }

    @Override public boolean performClick() {
        toggle();
        return super.performClick();
    }

    @Override public boolean isChecked() {
        return mmmmmChecked;
    }

    @Override public void setChecked(boolean checked) {
        if (mmmmmChecked != checked) {
            mmmmmChecked = checked;

            if (mOnCheckedChangeListener != null) {
                mOnCheckedChangeListener.onCheckedChanged((CompoundButton) realView, mmmmmChecked);
            }
        }
    }

    public void setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener) {
        mOnCheckedChangeListener = listener;
    }
}

@@ -328,19 +328,16 @@
 boolean 
-mmm
 mmChecke
@@ -555,19 +555,16 @@
 hecked(!
-mmm
 mmChecke
@@ -740,19 +740,16 @@
  return 
-mmm
 mmChecke
@@ -826,19 +826,16 @@
     if (
-mmm
 mmChecke
@@ -862,19 +862,16 @@
         
-mmm
 mmChecke
@@ -1021,19 +1021,16 @@
 alView, 
-mmm
 mmChecke

test run by Chee