use of android.widget.RatingBar in project philm by chrisbanes.
the class RateMovieFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View layout = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_rate_movie, null);
mMarkMovieWatchedCheckbox = (CheckBox) layout.findViewById(R.id.checkbox_mark_watched);
mRatingDescriptionTextView = (TextView) layout.findViewById(R.id.textview_rating_desc);
mRatingBar = (RatingBar) layout.findViewById(R.id.ratingbar_rating);
mRatingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
updateRatingDescriptionText();
}
});
mRatingBar.setEnabled(mMovie != null);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(layout);
builder.setPositiveButton(R.string.movie_detail_rate, this);
builder.setNegativeButton(android.R.string.cancel, this);
return builder.create();
}
use of android.widget.RatingBar in project RxBinding by JakeWharton.
the class RxRatingBarTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ratingBar = new RatingBar(this);
ratingBar.setMax(10);
ratingBar.setStepSize(1f);
setContentView(ratingBar);
}
use of android.widget.RatingBar in project QuickAndroid by ImKarl.
the class BaseAdapterHelper method setRating.
/**
* Sets the rating (the number of stars filled) and max of a RatingBar.
* @param viewId The view id.
* @param rating The rating.
* @param max The range of the RatingBar to 0...max.
* @return The BaseAdapterHelper for chaining.
*/
@SuppressWarnings("unchecked")
public H setRating(int viewId, float rating, int max) {
RatingBar view = retrieveView(viewId);
view.setMax(max);
view.setRating(rating);
return (H) this;
}
use of android.widget.RatingBar in project AndroidChromium by JackyAndroid.
the class InfoBarControlLayout method addRatingBar.
/**
* Creates and adds a control that shows a review rating score.
*
* @param rating Fractional rating out of 5 stars.
*/
public View addRatingBar(float rating) {
View ratingLayout = LayoutInflater.from(getContext()).inflate(R.layout.infobar_control_rating, this, false);
addView(ratingLayout, new ControlLayoutParams());
RatingBar ratingView = (RatingBar) ratingLayout.findViewById(R.id.control_rating);
ratingView.setRating(rating);
return ratingView;
}
use of android.widget.RatingBar in project RoboBinding by RoboBinding.
the class RatingBarAddOnTest method shouldSupportMultipleOnRatingBarChangeListenersInRatingBar.
@Test
public void shouldSupportMultipleOnRatingBarChangeListenersInRatingBar() {
RatingBar ratingBar = new RatingBar(RuntimeEnvironment.application);
RatingBarAddOn ratingBarAddOn = new RatingBarAddOn(ratingBar);
MockOnRatingBarChangeListener listener1 = new MockOnRatingBarChangeListener();
MockOnRatingBarChangeListener listener2 = new MockOnRatingBarChangeListener();
ratingBarAddOn.addOnRatingBarChangeListener(listener1);
ratingBarAddOn.addOnRatingBarChangeListener(listener2);
ratingBar.setRating(RandomValues.anyFloat());
assertTrue(listener1.ratingBarEventFired);
assertTrue(listener2.ratingBarEventFired);
}
Aggregations