use of android.widget.RatingBar in project BaseRecyclerViewAdapterHelper by CymChad.
the class BaseViewHolder 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 BaseViewHolder for chaining.
*/
public BaseViewHolder setRating(int viewId, float rating, int max) {
RatingBar view = getView(viewId);
view.setMax(max);
view.setRating(rating);
return this;
}
use of android.widget.RatingBar in project coursera-android by aporter.
the class RatingsBarActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final TextView tv = (TextView) findViewById(R.id.textView);
final RatingBar bar = (RatingBar) findViewById(R.id.ratingbar);
bar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
// Called when the user swipes the RatingBar
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
tv.setText("Rating:" + rating);
}
});
}
use of android.widget.RatingBar in project cw-advandroid by commonsguy.
the class RateableWrapper method getView.
public View getView(int position, View convertView, ViewGroup parent) {
ViewWrapper wrap = null;
View row = convertView;
if (convertView == null) {
LinearLayout layout = new LinearLayout(ctxt);
RatingBar rate = new RatingBar(ctxt);
rate.setNumStars(3);
rate.setStepSize(1.0f);
View guts = delegate.getView(position, null, parent);
layout.setOrientation(LinearLayout.HORIZONTAL);
rate.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.FILL_PARENT));
guts.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));
RatingBar.OnRatingBarChangeListener l = new RatingBar.OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromTouch) {
rates[(Integer) ratingBar.getTag()] = rating;
}
};
rate.setOnRatingBarChangeListener(l);
layout.addView(rate);
layout.addView(guts);
wrap = new ViewWrapper(layout);
wrap.setGuts(guts);
layout.setTag(wrap);
rate.setTag(new Integer(position));
rate.setRating(rates[position]);
row = layout;
} else {
wrap = (ViewWrapper) convertView.getTag();
wrap.setGuts(delegate.getView(position, wrap.getGuts(), parent));
wrap.getRatingBar().setTag(new Integer(position));
wrap.getRatingBar().setRating(rates[position]);
}
return (row);
}
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);
}
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);
}
Aggregations