All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robobinding.widget.ratingbar.OnRatingBarChangeAttribute Maven / Gradle / Ivy

The newest version!
package org.robobinding.widget.ratingbar;

import org.robobinding.attribute.Command;
import org.robobinding.viewattribute.event.EventViewAttribute;
import org.robobinding.widgetaddon.ratingbar.RatingBarAddOn;

import android.widget.RatingBar;
import android.widget.RatingBar.OnRatingBarChangeListener;

/**
 * 
 * @since 1.0
 * @version $Revision: 1.0 $
 * @author Robert Taylor
 */
public class OnRatingBarChangeAttribute implements EventViewAttribute {
	@Override
	public void bind(RatingBarAddOn viewAddOn, final Command command, RatingBar view) {
		viewAddOn.addOnRatingBarChangeListener(new OnRatingBarChangeListener() {
			@Override
			public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
				RatingBarChangeEvent ratingBarEvent = new RatingBarChangeEvent(ratingBar, rating, fromUser);
				command.invoke(ratingBarEvent);
			}
		});
	}

	@Override
	public Class getEventType() {
		return RatingBarChangeEvent.class;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy