Search in sources :

Example 51 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 52 with RatingBar

use of android.widget.RatingBar in project collect by opendatakit.

the class FieldListUpdateTest method setRating.

public static ViewAction setRating(final float rating) {
    return new ViewAction() {

        @Override
        public Matcher<View> getConstraints() {
            return ViewMatchers.isAssignableFrom(RatingBar.class);
        }

        @Override
        public String getDescription() {
            return "Custom view action to set rating on RatingBar";
        }

        @Override
        public void perform(UiController uiController, View view) {
            RatingBar ratingBar = (RatingBar) view;
            ratingBar.setRating(rating);
        }
    };
}
Also used : ViewAction(androidx.test.espresso.ViewAction) UiController(androidx.test.espresso.UiController) View(android.view.View) Espresso.onView(androidx.test.espresso.Espresso.onView) RatingBar(android.widget.RatingBar)

Example 53 with RatingBar

use of android.widget.RatingBar in project YalpStore by yeriomin.

the class Review method initUserReviewControls.

private void initUserReviewControls(final App app) {
    ((RatingBar) activity.findViewById(R.id.user_stars)).setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {

        @Override
        public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
            if (!fromUser) {
                return;
            }
            new UserReviewDialogBuilder(activity, Review.this, app.getPackageName()).show(getUpdatedUserReview(app.getUserReview(), (int) rating));
        }
    });
    activity.findViewById(R.id.user_review_edit).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new UserReviewDialogBuilder(activity, Review.this, app.getPackageName()).show(app.getUserReview());
        }
    });
    activity.findViewById(R.id.user_review_delete).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ReviewDeleteTask task = new ReviewDeleteTask();
            task.setFragment(Review.this);
            task.setContext(v.getContext());
            task.execute(app.getPackageName());
        }
    });
}
Also used : UserReviewDialogBuilder(com.github.yeriomin.yalpstore.view.UserReviewDialogBuilder) RatingBar(android.widget.RatingBar) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) ReviewDeleteTask(com.github.yeriomin.yalpstore.task.playstore.ReviewDeleteTask)

Example 54 with RatingBar

use of android.widget.RatingBar in project cardslib by gabrielemariotti.

the class GplayCardCustomSource method setupInnerViewElements.

@Override
public void setupInnerViewElements(ViewGroup parent, View view) {
    TextView title = (TextView) view.findViewById(R.id.carddemo_gplay_main_inner_title);
    title.setText("FREE");
    TextView subtitle = (TextView) view.findViewById(R.id.carddemo_gplay_main_inner_subtitle);
    subtitle.setText("Very popular with...");
    RatingBar mRatingBar = (RatingBar) parent.findViewById(R.id.carddemo_gplay_main_inner_ratingBar);
    mRatingBar.setNumStars(5);
    mRatingBar.setMax(5);
    mRatingBar.setStepSize(0.5f);
    mRatingBar.setRating(4.7f);
}
Also used : TextView(android.widget.TextView) RatingBar(android.widget.RatingBar)

Example 55 with RatingBar

use of android.widget.RatingBar in project cardslib by gabrielemariotti.

the class GplayCard method setupInnerViewElements.

@Override
public void setupInnerViewElements(ViewGroup parent, View view) {
    TextView title = (TextView) view.findViewById(R.id.carddemo_gplay_main_inner_title);
    title.setText("FREE");
    TextView subtitle = (TextView) view.findViewById(R.id.carddemo_gplay_main_inner_subtitle);
    subtitle.setText("Very popular with...");
    RatingBar mRatingBar = (RatingBar) parent.findViewById(R.id.carddemo_gplay_main_inner_ratingBar);
    mRatingBar.setNumStars(5);
    mRatingBar.setMax(5);
    mRatingBar.setStepSize(0.5f);
    mRatingBar.setRating(4.7f);
}
Also used : TextView(android.widget.TextView) RatingBar(android.widget.RatingBar)

Aggregations

RatingBar (android.widget.RatingBar)58 View (android.view.View)35 TextView (android.widget.TextView)34 ImageView (android.widget.ImageView)27 LinearLayout (android.widget.LinearLayout)24 NavigationView (android.support.design.widget.NavigationView)23 ScrollView (android.widget.ScrollView)23 Intent (android.content.Intent)13 MotionEvent (android.view.MotionEvent)12 Bundle (android.os.Bundle)11 AlertDialog (android.app.AlertDialog)4 SuppressLint (android.annotation.SuppressLint)3 LayoutInflater (android.view.LayoutInflater)3 OnRatingBarChangeListener (android.widget.RatingBar.OnRatingBarChangeListener)3 Activity (android.app.Activity)2 DialogInterface (android.content.DialogInterface)2 CompoundButton (android.widget.CompoundButton)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Before (org.junit.Before)2