Created
August 31, 2010 11:49
-
-
Save loganj/558907 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.joelapenna.foursquared.widget; | |
import android.widget.CheckBox; | |
import android.widget.Checkable; | |
import android.widget.ProgressBar; | |
import android.widget.ViewSwitcher; | |
final public class BusyCheckBox extends ViewSwitcher implements Checkable { | |
final private CheckBox checkBox; | |
final private ProgressBar progressBar; | |
public BusyCheckBox(CheckBox checkBox) { | |
super(checkBox.getContext()); | |
this.checkBox = checkBox; | |
progressBar = new ProgressBar(checkBox.getContext()); | |
addView(checkBox); | |
addView(progressBar); | |
} | |
@Override | |
public void setChecked(boolean b) { | |
checkBox.setChecked(b); | |
} | |
@Override | |
public boolean isChecked() { | |
return checkBox.isChecked(); | |
} | |
@Override | |
public void toggle() { | |
checkBox.toggle(); | |
} | |
@Override | |
public void setEnabled(boolean enabled) { | |
if ((enabled && getCurrentView() == progressBar) || (!enabled && getCurrentView() == checkBox)) { | |
this.showNext(); | |
} | |
super.setEnabled(enabled); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment