Java Code Examples for android.widget.RatingBar

The following are top voted examples for showing how to use android.widget.RatingBar. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: 72GGames_Demo   File: GameFragment.java   View source code 6 votes vote down vote up
@Override
protected void init() {
    list = new ArrayList<>();

    adapter = new CommonAdapter<GameInfo>(getActivity(),list,R.layout.layout_game_listview) {
        @Override
        public void convert(ViewHolder helper, int position, GameInfo item) {
            //TODO 控件设置内容
            helper.setText(R.id.tv_name_gameList,item.getName());
            helper.setText(R.id.tv_count_gameList,"下载总数:"+item.getCount());
            helper.setImageByUrl(R.id.iv_icon_gameList,item.getIcon());
            RatingBar ratingBar = helper.getView(R.id.rating_bar_gameList);
            //设置进度,四舍五入
            ratingBar.setProgress( Math.round(item.getScore()));
        }
    };
    lv.setAdapter(adapter);

}
 
Example 2
Project: Open-Quran-Radio   File: PlayerActivityFragment.java   View source code 6 votes vote down vote up
private void findViewsAndAssign() {
    // find views for station name and image and playback indicator
    mStationNameView = (TextView) mRootView.findViewById(R.id.player_textview_stationname);
    mtxtDescriptionView = (TextView) mRootView.findViewById(R.id.txtDescription);
    mtxtMarkdownDescriptionView = (TextView) mRootView.findViewById(R.id.txtMarkdownDescription);
    mRatingBarView = (RatingBar) mRootView.findViewById(R.id.ratingBar);

    mStationMetadataView = (TextView) mRootView.findViewById(R.id.player_textview_station_metadata);
    mPlaybackIndicator = (ImageView) mRootView.findViewById(R.id.player_playback_indicator);
    mPlaybackButton = (ImageButton) mRootView.findViewById(R.id.player_playback_button);
    mPlayerFavoritButton = (ImageButton) mRootView.findViewById(R.id.player_item_favorit_button);

    mStationImageView = (SimpleDraweeView) mRootView.findViewById(R.id.player_imageview_station_icon);
    mStationMenuView = (ImageButton) mRootView.findViewById(R.id.player_item_more_button);
    mCrdMarkdownDescriptionView = (CardView) mRootView.findViewById(R.id.crdMarkdownDescription);
    mRelLayLargeButtonPlayView = (RelativeLayout) mRootView.findViewById(R.id.relLayLargeButtonPlay);
}
 
Example 3
Project: GitHub   File: CommonFragment.java   View source code 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_common, null);
    DragLayout dragLayout = (DragLayout) rootView.findViewById(R.id.drag_layout);
    imageView = (ImageView) dragLayout.findViewById(R.id.image);
    ImageLoader.getInstance().displayImage(imageUrl, imageView);
    address1 = dragLayout.findViewById(R.id.address1);
    address2 = dragLayout.findViewById(R.id.address2);
    address3 = dragLayout.findViewById(R.id.address3);
    address4 = dragLayout.findViewById(R.id.address4);
    address5 = dragLayout.findViewById(R.id.address5);
    ratingBar = (RatingBar) dragLayout.findViewById(R.id.rating);

    head1 = dragLayout.findViewById(R.id.head1);
    head2 = dragLayout.findViewById(R.id.head2);
    head3 = dragLayout.findViewById(R.id.head3);
    head4 = dragLayout.findViewById(R.id.head4);

    dragLayout.setGotoDetailListener(this);
    return rootView;
}
 
Example 4
Project: Open-Quran-Radio   File: CollectionAdapterViewHolder.java   View source code 6 votes vote down vote up
public CollectionAdapterViewHolder(View itemView) {
    super(itemView);
    itemView.setOnClickListener(this);
    itemView.setOnLongClickListener(this);
    itemView.setClickable(true);
    mListItemLayout = itemView;
    mStationImageView = (SimpleDraweeView) itemView.findViewById(R.id.list_item_station_icon);
    mStationNameView = (TextView) itemView.findViewById(R.id.list_item_textview);
    mLayoutCategoryView = (LinearLayout) itemView.findViewById(R.id.layoutFavorit);
    mTxtCategoryView = (TextView) itemView.findViewById(R.id.txtFavorit);
    mRatingBarView = (RatingBar) itemView.findViewById(R.id.ratingBar);
    mFavoritButton = (ImageButton) itemView.findViewById(R.id.player_item_favorit_button);
    mStationDesciptionView = (TextView) itemView.findViewById(R.id.list_item_description);
    mPlaybackIndicator = (ImageView) itemView.findViewById(R.id.list_item_playback_indicator);
    mStationMenuView = (ImageView) itemView.findViewById(R.id.list_item_more_button);
    mFabPlayButton = (FloatingActionButton) itemView.findViewById(R.id.fabPlayButton);
}
 
Example 5
Project: wisebite_android   File: ReviewActivity.java   View source code 6 votes vote down vote up
/**
 * Save review
 * @param view view where the button will be shown
 */
private void save(final View view) {
    LinearLayout ratingRestaurant = (LinearLayout) findViewById(R.id.rating_restaurant);

    RatingBar ratingBar = (RatingBar) ratingRestaurant.findViewById(R.id.rating_bar);
    EditText comment = (EditText) ratingRestaurant.findViewById(R.id.form_comment);
    if (ratingBar.getRating() == 0 || !isComplete()) {
        Snackbar.make(view, getResources().getString(R.string.no_review), Snackbar.LENGTH_LONG).show();
    } else {
        reviewService.addDishesReview(reviews);
        reviewService.addRestaurantReview(orderService.getRestaurantId(order.getId()),
                ratingBar.getRating(), comment.getText().toString());
        reviewService.deleteOrderToReview(order.getId());
        finish();
    }
}
 
Example 6
Project: ChewSnap   File: MealDishAdapter.java   View source code 6 votes vote down vote up
public View getView(int position, View convertView, ViewGroup parent){
    Dish dish = dishList.get(position);

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(MainActivity.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.meal_dish_row, null);

    TextView title = (TextView) view.findViewById(R.id.mealDishTitle);
    TextView description = (TextView) view.findViewById(R.id.mealDishDescription);
    ImageView image = (ImageView) view.findViewById(R.id.mealDishImage);
    RatingBar rating = (RatingBar) view.findViewById(R.id.mealDishRating);

    title.setText(dish.getTitle());
    description.setText(dish.getDescription());
    image.setImageBitmap(dish.getBitmap());
    rating.setRating(dish.getRating());

    return view;
}
 
Example 7
Project: ChewSnap   File: MealAdapter.java   View source code 6 votes vote down vote up
public View getView(int position, View convertView, ViewGroup parent){
    Meal meal = mealList.get(position);

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(MainActivity.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.meal_row, null);

    TextView title = (TextView) view.findViewById(R.id.mealTitle);
    TextView description = (TextView) view.findViewById(R.id.mealDescription);
    TextView location = (TextView) view.findViewById(R.id.mealLocation);
    RatingBar rating = (RatingBar) view.findViewById(R.id.mealRating);
    ImageView image = (ImageView) view.findViewById(R.id.mealImage);

    title.setText(meal.getTitle());
    description.setText(meal.getDescription());
    location.setText(meal.getLocation());
    rating.setRating(meal.getNumStars());
    image.setImageBitmap(meal.getBitmap());

    return view;
}
 
Example 8
Project: wisebite_android   File: RestaurantAdapter.java   View source code 6 votes vote down vote up
OrderHolder(View itemView) {
    super(itemView);
    this.view = itemView;
    this.name = (TextView) itemView.findViewById(R.id.name);
    this.ratingBar = (RatingBar) itemView.findViewById(R.id.rating_bar);
    this.description = (TextView) itemView.findViewById(R.id.description);
    this.daysOpen = (TextView) itemView.findViewById(R.id.days_open);
    this.dishesCount = (TextView) itemView.findViewById(R.id.dishes_count);
    this.menusCount = (TextView) itemView.findViewById(R.id.menus_count);

    this.view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), GetRestaurantActivity.class);
            intent.putExtra(GetRestaurantActivity.RESTAURANT_ID, item.getId());
            v.getContext().startActivity(intent);
        }
    });
}
 
Example 9
Project: ChewSnap   File: DishAdapter.java   View source code 6 votes vote down vote up
public View getView(int position, View convertView, ViewGroup parent){
    Dish dish = dishList.get(position);

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(MainActivity.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.dish_row, null);

    TextView title = (TextView) view.findViewById(R.id.dishRowName);
    TextView description = (TextView) view.findViewById(R.id.dishRowDescription);
    ImageView image = (ImageView) view.findViewById(R.id.dishRowImage);
    RatingBar rating = (RatingBar) view.findViewById(R.id.dishRowRating);

    title.setText(dish.getTitle());
    description.setText(dish.getDescription());
    image.setImageBitmap(dish.getBitmap());
    rating.setRating(dish.getRating());

    return view;
}
 
Example 10
Project: anitrend-app   File: SeriesReviewAdapter.java   View source code 6 votes vote down vote up
CardViewHolder(View view) {
    super(view);
    mUpFlipper = (ViewFlipper) view.findViewById(R.id.mUpFlipper);
    mDownFlipper = (ViewFlipper) view.findViewById(R.id.mDownFlipper);
    user_name = (TextView) view.findViewById(R.id.review_user_name);
    review_date = (TextView) view.findViewById(R.id.review_date);
    review_summary = (TextView) view.findViewById(R.id.review_summary);
    review_up_score = (TextView) view.findViewById(R.id.review_up_score);
    review_down_score = (TextView) view.findViewById(R.id.review_down_score);
    review_rating = (RatingBar) view.findViewById(R.id.review_rating);
    user_image = (CircleImageView) view.findViewById(R.id.review_user_image);
    review_card = (CardView) view.findViewById(R.id.card_review);
    review_read_more = (TextView) view.findViewById(R.id.review_read_more);
    /*onClickListeners*/
    user_image.setOnClickListener(this);
    review_read_more.setOnClickListener(this);
    review_card.setOnClickListener(this);
    mUpFlipper.setOnClickListener(this);
    mDownFlipper.setOnClickListener(this);
}
 
Example 11
Project: MyDemo   File: MovieCommentFragment.java   View source code 6 votes vote down vote up
@Override
protected void initView() {
    mPresenter = new MovieCommentPresenterImpl(this, id);
    mAdapter = new BaseQuickAdapter<MovieComment,BaseViewHolder>(R.layout.item_comment_list) {
        @Override
        protected void convert(BaseViewHolder helper, MovieComment item) {
            ImageLoadUtil.displayCircle((ImageView) helper.getView(R.id.iv_author_icon),item.getAuthor().getAvatar());
            helper.setText(R.id.tv_author_name,item.getAuthor().getName());
            ((RatingBar)helper.getView(R.id.rb_movie_rating)).setRating((float) item.getRating().getValue());
            helper.setText(R.id.tv_useful_count, item.getUseful_count()+"");
            helper.setText(R.id.tv_comment_content, item.getContent());
            helper.setText(R.id.tv_comment_date, item.getCreated_at());
        }
    };
    mAdapter.setEnableLoadMore(true);
    mAdapter.setOnLoadMoreListener(this,mRvComments);
    mAdapter.openLoadAnimation();
    mRvComments.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRvComments.setAdapter(mAdapter);
}
 
Example 12
Project: BaseAdapterRel   File: ViewHolder.java   View source code 6 votes vote down vote up
public ViewHolder setRating(int viewId, float rating, int max)
{
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}
 
Example 13
Project: GitHub   File: ViewHolder.java   View source code 5 votes vote down vote up
public ViewHolder setRating(int viewId, float rating, int max)
{
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}
 
Example 14
Project: GitHub   File: ViewHolder.java   View source code 5 votes vote down vote up
public ViewHolder setRating(int viewId, float rating)
{
    RatingBar view = getView(viewId);
    view.setRating(rating);
    return this;
}
 
Example 15
Project: GitHub   File: ViewHolder.java   View source code 5 votes vote down vote up
public ViewHolder setRating(int viewId, float rating, int max)
{
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}
 
Example 16
Project: GitHub   File: ViewHolder.java   View source code 5 votes vote down vote up
public ViewHolder setRating(int viewId, float rating, int max)
{
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}
 
Example 17
Project: RxJava2RetrofitDemo   File: MartianViewHolder.java   View source code 5 votes vote down vote up
@Override
public MartianViewHolder setRating(int viewId, float rating, int max) {
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}
 
Example 18
Project: GitHub   File: DetailActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    imageView = (ImageView) findViewById(R.id.image);
    address1 = findViewById(R.id.address1);
    address2 = findViewById(R.id.address2);
    address3 = findViewById(R.id.address3);
    address4 = findViewById(R.id.address4);
    address5 = findViewById(R.id.address5);
    ratingBar = (RatingBar) findViewById(R.id.rating);
    listContainer = (LinearLayout) findViewById(R.id.detail_list_container);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window window = getWindow();
        window.setFlags(
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    String imageUrl = getIntent().getStringExtra(EXTRA_IMAGE_URL);
    ImageLoader.getInstance().displayImage(imageUrl, imageView);

    ViewCompat.setTransitionName(imageView, IMAGE_TRANSITION_NAME);
    ViewCompat.setTransitionName(address1, ADDRESS1_TRANSITION_NAME);
    ViewCompat.setTransitionName(address2, ADDRESS2_TRANSITION_NAME);
    ViewCompat.setTransitionName(address3, ADDRESS3_TRANSITION_NAME);
    ViewCompat.setTransitionName(address4, ADDRESS4_TRANSITION_NAME);
    ViewCompat.setTransitionName(address5, ADDRESS5_TRANSITION_NAME);
    ViewCompat.setTransitionName(ratingBar, RATINGBAR_TRANSITION_NAME);

    dealListView();
}
 
Example 19
Project: TrackIt-Android   File: EpisodeDetailFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_episode_detail, container, false);

    tvOverView = (ExpandableTextView) v.findViewById(R.id.tv_overview)
            .findViewById(R.id.expand_text_view);
    tvTitle = (TextView) v.findViewById(R.id.title);
    tvDetails = (TextView) v.findViewById(R.id.details);
    ratingBar = (RatingBar) v.findViewById(R.id.rating);
    tvVoters = (TextView) v.findViewById(R.id.voters);
    tvRating = (TextView) v.findViewById(R.id.tv_rating);
    tvAirDate = (TextView) v.findViewById(R.id.aired);
    seenButton = (Button) v.findViewById(R.id.button_seen);
    collectionButton = (Button) v.findViewById(R.id.button_collection);
    buttonLayout = (LinearLayout) v.findViewById(R.id.button_layout);
    mainLinearLayout = (LinearLayout) v.findViewById(R.id.episode_linear_layout);
    tvEpisodeError = (TextView) v.findViewById(R.id.tv_episode_error);

    episodeID = getArguments().getInt("episode_id", -1);
    showID = getArguments().getInt("showID", -1);

    LayerDrawable stars = (LayerDrawable) ratingBar.getProgressDrawable();
    stars.getDrawable(2).setColorFilter(Color.parseColor("#FF5252"), PorterDuff.Mode.SRC_ATOP); // for filled stars
    stars.getDrawable(1).setColorFilter(Color.parseColor("#616161"), PorterDuff.Mode.SRC_ATOP); // for half filled stars
    stars.getDrawable(0).setColorFilter(Color.parseColor("#616161"), PorterDuff.Mode.SRC_ATOP); // for empty stars
    return v;
}
 
Example 20
Project: cniao5   File: ViewHolder.java   View source code 5 votes vote down vote up
public ViewHolder setRating(int viewId, float rating, int max)
{
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}
 
Example 21
Project: snu-artoon   File: ChapterListRecyclerAdapter.java   View source code 5 votes vote down vote up
public ViewHolder(View itemView) {
    super(itemView);
    chapterThumbnailImage = (ImageView)itemView.findViewById(R.id.chapter_thumbnail_image);
    chapterTitleText = (TextView)itemView.findViewById(R.id.chapter_title_text);
    chapterUploadedDateText = (TextView)itemView.findViewById(R.id.chapter_uploaded_date_text);
    chapterRatingBar = (RatingBar)itemView.findViewById(R.id.chapter_rating_bar);
    chapterRatingText = (TextView)itemView.findViewById(R.id.chapter_rating_text);
}
 
Example 22
Project: MoreApps   File: MoreAppAdapter.java   View source code 5 votes vote down vote up
public CustomAdapter(View itemView) {
    super(itemView);
    this.view = itemView;
    imageView = (ImageView) itemView.findViewById(R.id.movieThumbnail);
    ratingBar = (RatingBar) itemView.findViewById(R.id.movieAudienceScore);
    title = (TextView) itemView.findViewById(R.id.movieTitle);
    install = (Button) itemView.findViewById(R.id.button);
}
 
Example 23
Project: Idea-ChainSelector   File: ViewHolder.java   View source code 5 votes vote down vote up
public ViewHolder setRating(int viewId, float rating, int max)
{
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}
 
Example 24
Project: B4A_ViewsEx   File: RatingBarWrapper.java   View source code 5 votes vote down vote up
@Override
public void DesignerCreateView(PanelWrapper base, LabelWrapper lw, Map props) {
	RatingBar rb = getObject();
	CustomViewWrapper.replaceBaseWithView2(base, rb);
	LayoutParams lp = rb.getLayoutParams();
	lp.width = LayoutParams.WRAP_CONTENT;
	lp.height = LayoutParams.WRAP_CONTENT;
	rb.setIsIndicator((Boolean)props.Get("Indicator"));
	rb.setNumStars((Integer)props.Get("NumberOfStars"));
	rb.setRating((Float)props.Get("Rating"));
	rb.setStepSize((Float)props.Get("StepSize"));
}
 
Example 25
Project: Bailan   File: AppCommentController.java   View source code 5 votes vote down vote up
private void init() {
    contentView = UIUtils.inflate(R.layout.appdetail_comment_score);
    commentScore = (TextView) contentView.findViewById(R.id.app_comment_score_textview);
    commentStars = (RatingBar) contentView.findViewById(R.id.detail_comment_colligation_stars_ratingbar);
    commentCount = (TextView) contentView.findViewById(R.id.detail_comments_count_textview);
    fiveStarsProgressBar = (ProgressBar) contentView.findViewById(R.id.detail_comment_five_stars_proportion_progressbar);
    fourStarsProgressBar = (ProgressBar) contentView.findViewById(R.id.detail_comment_four_stars_proportion_progressbar);
    threeStarsProgressBar = (ProgressBar) contentView.findViewById(R.id.detail_comment_three_stars_proportion_progressbar);
    twoStarsProgressBar = (ProgressBar) contentView.findViewById(R.id.detail_comment_two_stars_proportion_progressbar);
    oneStarsProgressBar = (ProgressBar) contentView.findViewById(R.id.detail_comment_one_stars_proportion_progressbar);
}
 
Example 26
Project: Boookito-Capstone-Project   File: BookListViewHolder.java   View source code 5 votes vote down vote up
public BookListViewHolder(View itemView, BookListItemListener listItemListerner, Context context) {
  super(itemView);

  this.context = itemView.getContext();
  this.context = context;
  listener= listItemListerner;
  layout = itemView.findViewById(R.id.layout);
  title = (TextView) itemView.findViewById(R.id.txt_title);
  author = (TextView) itemView.findViewById(R.id.txt_author);
  rating = (RatingBar) itemView.findViewById(R.id.rating_stars);
  cover = (ImageView) itemView.findViewById(R.id.img_cover);
}
 
Example 27
Project: Cook-It-Android-XML-Template   File: RecipeAdapter.java   View source code 5 votes vote down vote up
public MyViewHolder(View view) {
    super(view);

    recipe = (TextView) view.findViewById(R.id.tv_recipe_name);
    time = (TextView) view.findViewById(R.id.tv_time);
    ratingBar = (RatingBar) view.findViewById(R.id.ratingBar);
    imageView = (ImageView) view.findViewById(R.id.iv_recipe);
}
 
Example 28
Project: chromium-for-android-56-debug-video   File: InfoBarControlLayout.java   View source code 5 votes vote down vote up
/**
 * 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;
}
 
Example 29
Project: Quick-Tip-Consumer   File: RewardListAdapter.java   View source code 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder=null;
    if(convertView==null){
        holder=new ViewHolder();
        convertView=mInflater.inflate(R.layout.reward_item,null);
        holder.waitor_name= (TextView) convertView.findViewById(R.id.waitor_name);
        holder.money= (TextView) convertView.findViewById(R.id.money);
        holder.stars= (RatingBar) convertView.findViewById(R.id.stars);
        holder.date= (TextView) convertView.findViewById(R.id.date);
        holder.comment= (TextView) convertView.findViewById(R.id.comment);
        holder.restaurant= (TextView) convertView.findViewById(R.id.restaurant);
        convertView.setTag(holder);
    }
    else{
        holder= (ViewHolder) convertView.getTag();
    }

    RewardModel item=dataList.get(position);
    holder.waitor_name.setText(item.waitor_name);
    holder.money.setText(item.money+" $");
    holder.stars.setRating((float)item.stars);
    holder.date.setText(item.date);
    holder.comment.setText(item.comment);
    holder.restaurant.setText(item.restaurant);

    return convertView;
}
 
Example 30
Project: MyDemo   File: MovieReviewFragment.java   View source code 5 votes vote down vote up
@Override
protected void initView() {
    mPresenter = new MovieReviewPresenterImpl(this, id);
    mAdapter = new BaseQuickAdapter<MoviePopularReview, BaseViewHolder>(R.layout.item_review_list) {
        @Override
        protected void convert(BaseViewHolder helper, MoviePopularReview item) {
            ImageLoadUtil.displayCircle((ImageView) helper.getView(R.id.iv_author_icon),item.getAuthor().getAvatar());
            helper.setText(R.id.tv_review_title, item.getTitle());
            helper.setText(R.id.tv_author_name, item.getAuthor().getName());
            ((RatingBar)helper.getView(R.id.rb_movie_rating)).setRating((float) item.getRating().getValue());
            helper.setText(R.id.tv_review_content, item.getSummary());
            helper.setVisible(R.id.rl_review_bottom, true);
            helper.setText(R.id.tv_review_useful,item.getUseful_count()+"/"+(item.getUseful_count()+item.getUseless_count())+" 有用");
            helper.setText(R.id.tv_review_date, item.getCreated_at());
        }
    };
    mAdapter.setEnableLoadMore(true);
    mAdapter.setOnLoadMoreListener(this, mRvReviews);
    mAdapter.openLoadAnimation();
    mRvReviews.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRvReviews.setAdapter(mAdapter);

    mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            MovieReviewDetailActivity.launchActivity(getActivity(), (MoviePopularReview) mAdapter.getItem(position));
        }
    });
}
 
Example 31
Project: MyDemo   File: MovieDetailActivity.java   View source code 5 votes vote down vote up
private void showRateDetailDialog() {
    BottomSheetDialog dialog = new BottomSheetDialog(this);
    View view = getLayoutInflater().inflate(R.layout.dialog_rate_detail,null);
    ((TextView)view.findViewById(R.id.tv_rating)).setText(data.getRating().getAverage()+"");
    ((RatingBar)view.findViewById(R.id.rb_rating)).setRating((float) (data.getRating().getAverage()/2.0));
    ((TextView)view.findViewById(R.id.tv_rating_people)).setText(data.getRatings_count()+"人评分");

    DecimalFormat df = new DecimalFormat("#.0");

    int total = data.getRating().getDetails().getStar5()+data.getRating().getDetails().getStar4()+data.getRating().getDetails().getStar3()+data.getRating().getDetails().getStar2()+data.getRating().getDetails().getStar1();
    ((TextView)view.findViewById(R.id.tv_rate_5)).setText(df.format(data.getRating().getDetails().getStar5()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_5),Float.parseFloat(df.format(data.getRating().getDetails().getStar5()/(total*1.0)*100)));

    ((TextView)view.findViewById(R.id.tv_rate_4)).setText(df.format(data.getRating().getDetails().getStar4()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_4),Float.parseFloat(df.format(data.getRating().getDetails().getStar4()/(total*1.0)*100)));

    ((TextView)view.findViewById(R.id.tv_rate_3)).setText(df.format(data.getRating().getDetails().getStar3()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_3),Float.parseFloat(df.format(data.getRating().getDetails().getStar3()/(total*1.0)*100)));

    ((TextView)view.findViewById(R.id.tv_rate_2)).setText(df.format(data.getRating().getDetails().getStar2()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_2),Float.parseFloat(df.format(data.getRating().getDetails().getStar2()/(total*1.0)*100)));

    ((TextView)view.findViewById(R.id.tv_rate_1)).setText(df.format(data.getRating().getDetails().getStar1()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_1),Float.parseFloat(df.format(data.getRating().getDetails().getStar1()/(total*1.0)*100)));

    dialog.setContentView(view);
    dialog.show();
}
 
Example 32
Project: CustomShoppingCarDemo   File: ContentAdpater.java   View source code 5 votes vote down vote up
public ContentViewHolder(View itemView)
{
    super(itemView);

    mBuyImg = (ImageView) itemView.findViewById(R.id.item_menu_content_buy);
    mImageView = (ImageView) itemView.findViewById(R.id.item_menu_content_img);
    mImgSub = (ImageView) itemView.findViewById(R.id.item_menu_content_sub);
    mImgPlus = (ImageView) itemView.findViewById(R.id.item_menu_content_plus);
    mTitle = (TextView) itemView.findViewById(R.id.item_menu_content_title);
    mRatingBar = (RatingBar) itemView.findViewById(R.id.item_menu_content_star);
    mSale = (TextView) itemView.findViewById(R.id.item_menu_content_sale);
    mPrice = (TextView) itemView.findViewById(R.id.item_menu_content_price);
    mNumber = (TextView) itemView.findViewById(R.id.item_menu_content_number);
}
 
Example 33
Project: BaseAdapterRel   File: ViewHolder.java   View source code 5 votes vote down vote up
public ViewHolder setRating(int viewId, float rating, int max)
{
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}
 
Example 34
Project: 2017.1-Trezentos   File: EvaluationViewHolder.java   View source code 5 votes vote down vote up
public EvaluationViewHolder(View view) {
    super(view);
    className = (TextView) view.findViewById(R.id.student_class);
    examName = (TextView) view.findViewById(R.id.student_exam);
    userAccountName = (TextView) view.findViewById(R.id.student_name);
    ratingBar = (RatingBar) view.findViewById(R.id.ratingBar);
    ratingBar.setOnRatingBarChangeListener(this);
}
 
Example 35
Project: GitHub   File: ViewHolder.java   View source code 4 votes vote down vote up
public ViewHolder setRating(int viewId, float rating)
{
    RatingBar view = getView(viewId);
    view.setRating(rating);
    return this;
}
 
Example 36
Project: GitHub   File: ViewHolder.java   View source code 4 votes vote down vote up
public ViewHolder setRating(int viewId, float rating)
{
    RatingBar view = getView(viewId);
    view.setRating(rating);
    return this;
}
 
Example 37
Project: cniao5   File: ViewHolder.java   View source code 4 votes vote down vote up
public ViewHolder setRating(int viewId, float rating)
{
    RatingBar view = getView(viewId);
    view.setRating(rating);
    return this;
}
 
Example 38
Project: YCBaseAdapter   File: BaseViewHolder.java   View source code 4 votes vote down vote up
public BaseViewHolder setRating(int viewId, float rating) {
    RatingBar view = getView(viewId);
    view.setRating(rating);
    return this;
}
 
Example 39
Project: YCBaseAdapter   File: BaseViewHolder.java   View source code 4 votes vote down vote up
public BaseViewHolder setRating(int viewId, float rating) {
    RatingBar view = getView(viewId);
    view.setRating(rating);
    return this;
}
 
Example 40
Project: YCBaseAdapter   File: BaseViewHolder.java   View source code 4 votes vote down vote up
public BaseViewHolder setRating(int viewId, float rating, int max) {
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}