org.robobinding.widget.compoundbutton.CheckedAttribute Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robobinding Show documentation
Show all versions of robobinding Show documentation
A Presentation Model(MVVM) framework for the Android platform
package org.robobinding.widget.compoundbutton;
import org.robobinding.property.ValueModel;
import org.robobinding.viewattribute.property.TwoWayPropertyViewAttribute;
import org.robobinding.widgetaddon.compoundbutton.CompoundButtonAddOn;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
/**
*
* @since 1.0
* @version $Revision: 1.0 $
* @author Robert Taylor
* @author Cheng Wei
*/
public class CheckedAttribute implements TwoWayPropertyViewAttribute {
@Override
public void updateView(CompoundButton view, Boolean newValue, CompoundButtonAddOn viewAddOn) {
view.setChecked(newValue);
}
@Override
public void observeChangesOnTheView(CompoundButtonAddOn viewAddOn, final ValueModel valueModel, CompoundButton view) {
viewAddOn.addOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
valueModel.setValue(isChecked);
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy