@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); }
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); }
@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; }
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); }
/** * 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(); } }
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; }
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; }
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); } }); }
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; }
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); }
@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); }
public ViewHolder setRating(int viewId, float rating, int max) { RatingBar view = getView(viewId); view.setMax(max); view.setRating(rating); return this; }
public ViewHolder setRating(int viewId, float rating) { RatingBar view = getView(viewId); view.setRating(rating); return this; }
@Override public MartianViewHolder setRating(int viewId, float rating, int max) { RatingBar view = getView(viewId); view.setMax(max); view.setRating(rating); return this; }
@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(); }
@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; }
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); }
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); }
@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")); }
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); }
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); }
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); }
/** * 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; }
@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; }
@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)); } }); }
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(); }
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); }
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); }
public BaseViewHolder setRating(int viewId, float rating) { RatingBar view = getView(viewId); view.setRating(rating); return this; }
public BaseViewHolder setRating(int viewId, float rating, int max) { RatingBar view = getView(viewId); view.setMax(max); view.setRating(rating); return this; }