Search in sources :

Example 16 with RatingBar

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();
}
Also used : AlertDialog(android.app.AlertDialog) TextView(android.widget.TextView) View(android.view.View) RatingBar(android.widget.RatingBar)

Example 17 with RatingBar

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);
}
Also used : RatingBar(android.widget.RatingBar)

Example 18 with 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;
}
Also used : RatingBar(android.widget.RatingBar)

Example 19 with RatingBar

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;
}
Also used : ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) RatingBar(android.widget.RatingBar)

Example 20 with RatingBar

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);
}
Also used : RatingBar(android.widget.RatingBar) Test(org.junit.Test)

Aggregations

RatingBar (android.widget.RatingBar)24 TextView (android.widget.TextView)10 View (android.view.View)8 ImageView (android.widget.ImageView)3 OnRatingBarChangeListener (android.widget.RatingBar.OnRatingBarChangeListener)3 AlertDialog (android.app.AlertDialog)2 Intent (android.content.Intent)2 CompoundButton (android.widget.CompoundButton)2 Before (org.junit.Before)2 ContentValues (android.content.ContentValues)1 Paint (android.graphics.Paint)1 MediaMetadataRetriever (android.media.MediaMetadataRetriever)1 NonNull (android.support.annotation.NonNull)1 KeyEvent (android.view.KeyEvent)1 LayoutInflater (android.view.LayoutInflater)1 OnClickListener (android.view.View.OnClickListener)1 OnKeyListener (android.view.View.OnKeyListener)1 OnLongClickListener (android.view.View.OnLongClickListener)1 ViewGroup (android.view.ViewGroup)1 AdapterView (android.widget.AdapterView)1