com.jess.arms.http.imageloader.glide.ImageConfigImpl Java Examples
The following examples show how to use
com.jess.arms.http.imageloader.glide.ImageConfigImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReplyAdapter.java From Aurora with Apache License 2.0 | 6 votes |
@Override protected void convert(BaseViewHolder helper, ReplySection item) { ImageView img = helper.getView(R.id.iv_pic); AppComponent mAppComponent = ((App)img.getContext().getApplicationContext()) .getAppComponent(); if (item.t.getData().getUser()!=null){ mAppComponent.imageLoader().loadImage(img.getContext(), ImageConfigImpl .builder() .transformation(new GlideCircleTransform()) .url(item.t.getData().getUser().getAvatar()) .imageView(img) .build()); } DateFormat df = new SimpleDateFormat("yyyy/MM/dd"); if (item.t.getData().getUser()!=null){ helper.setText(R.id.tv_nickname,item.t.getData().getUser().getNickname()); } helper.setText(R.id.tv_comment,item.t.getData().getMessage()) .setText(R.id.tv_good_num,item.t.getData().getLikeCount()+"") .setText(R.id.tv_reply_time,df.format(item.t.getData().getCreateTime())); }
Example #2
Source File: LivePresenter.java From LQRBiliBlili with MIT License | 6 votes |
public void setBanner() { mBannerAdapter = (banner, itemView, model, position) -> mImageLoader.loadImage(getContext(), ImageConfigImpl .builder() .url(model) .imageView(itemView) .build()); List<String> banners = new ArrayList<>(); if (mBanner != null) { for (int i = 0; i < mBanner.size(); i++) { banners.add(mBanner.get(i).getImg()); } } mRootView.setBanner(mBannerAdapter, banners); }
Example #3
Source File: AurhorListAdapter.java From Aurora with Apache License 2.0 | 6 votes |
@Override protected void convert(BaseViewHolder helper, MyAttentionEntity item) { ImageView imgAutor = helper.getView(R.id.img_icon); Context context = imgAutor.getContext(); AppComponent mAppComponent = ((App)context.getApplicationContext()) .getAppComponent(); mAppComponent.imageLoader().loadImage(context, ImageConfigImpl .builder() .transformation(new GlideCircleTransform()) .url(item.getIcon()) .imageView(imgAutor) .build()); helper.setText(R.id.tv_name,item.getTitle()) .setText(R.id.tv_desc,item.getDescription()); FollowButton button = helper.getView(R.id.btn_attention); button.setState(FollowButton.FOLLOWED); button.setCanClick(false); }
Example #4
Source File: SummaryFragment.java From LQRBiliBlili with MIT License | 6 votes |
private void initOtherInfo(Summary.DataBean data) { List<Summary.DataBean.RelatesBean> relates = data.getRelates(); if (relates != null) { mRvRelates.setLayoutManager(new LinearLayoutManager(_mActivity)); mRvRelates.setAdapter(new BaseQuickAdapter<Summary.DataBean.RelatesBean, BaseViewHolder>(R.layout.item_relate_video_detail, relates) { @Override protected void convert(BaseViewHolder helper, Summary.DataBean.RelatesBean item) { ArmsUtils.obtainAppComponentFromContext(_mActivity).imageLoader().loadImage(_mActivity, ImageConfigImpl.builder().url(item.getPic()).imageView(helper.getView(R.id.iv_pic)).build()); helper.setText(R.id.tv_title, item.getTitle()) .setText(R.id.tv_owner_name, item.getOwner() == null ? "" : item.getOwner().getName()) .setText(R.id.tv_view, item.getStat() == null ? "0" : TextHandleUtil.handleCount2TenThousand(item.getStat().getView())) .setText(R.id.tv_danmaku, item.getStat() == null ? "0" : TextHandleUtil.handleCount2TenThousand(item.getStat().getDanmaku())); } }); } }
Example #5
Source File: BannerAdapter.java From Aurora with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(final ViewHolder holder, final int position) { int fakePosition = position % mList.size(); mCardAdapterHelper.onBindViewHolder(holder.itemView, position, getItemCount()); AppComponent mAppComponent = ((App)holder.mImageView.getContext().getApplicationContext()) .getAppComponent(); Context context = holder.mImageView.getContext(); try { ((App)context.getApplicationContext()) .getAppComponent().imageLoader().loadImage(mAppComponent.appManager().getCurrentActivity() == null ? mAppComponent.application() : mAppComponent.appManager().getCurrentActivity(), ImageConfigImpl .builder() .url(StringUtils.replaceNull(mList.get(fakePosition).getData().getCover().getFeed())) .imageView(holder.mImageView) .build()); }catch (NullPointerException e){ } }
Example #6
Source File: MineFragment.java From Aurora with Apache License 2.0 | 5 votes |
@Subscriber(tag = EventBusTags.SET_USER_INFO) public void setUserInfo(User user) { mTvName.setText(User.getCurrentUser().getUsername()); if (user.getIcon() != null){ BmobFile file = user.getIcon(); appComponent.imageLoader().loadImage(getActivity(), ImageConfigImpl .builder() .url(file.getFileUrl()) .imageView(mCivFace) .dontAnimate(true) .placeholder(R.drawable.ic_noface) .errorPic(R.drawable.ic_noface) .build()); } }
Example #7
Source File: UserItemHolder.java From MVPArms with Apache License 2.0 | 5 votes |
/** * 在 Activity 的 onDestroy 中使用 {@link DefaultAdapter#releaseAllHolder(RecyclerView)} 方法 (super.onDestroy() 之前) * {@link BaseHolder#onRelease()} 才会被调用, 可以在此方法中释放一些资源 */ @Override protected void onRelease() { //只要传入的 Context 为 Activity, Glide 就会自己做好生命周期的管理, 其实在上面的代码中传入的 Context 就是 Activity //所以在 onRelease 方法中不做 clear 也是可以的, 但是在这里想展示一下 clear 的用法 mImageLoader.clear(mAppComponent.application(), ImageConfigImpl.builder() .imageViews(mAvatar) .build()); this.mAvatar = null; this.mName = null; this.mAppComponent = null; this.mImageLoader = null; }
Example #8
Source File: UserItemHolder.java From MVPArms with Apache License 2.0 | 5 votes |
@Override public void setData(@NonNull User data, int position) { mName.setText(data.getLogin()); //itemView 的 Context 就是 Activity, Glide 会自动处理并和该 Activity 的生命周期绑定 mImageLoader.loadImage(itemView.getContext(), ImageConfigImpl .builder() .url(data.getAvatarUrl()) .imageView(mAvatar) .build()); }
Example #9
Source File: VideoDetailPresenter.java From LQRBiliBlili with MIT License | 5 votes |
private void setVideoDetail(VideoDetail videoDetail) { if (videoDetail == null) { return; } // 填充视频详情界面信息 Summary summary = videoDetail.getSummary(); if (summary == null || summary.getData() == null) return; Summary.DataBean data = summary.getData(); mRootView.setTvAvStr(data.getStat() == null ? "" : String.valueOf(data.getStat().getAid())); mImageLoader.loadImage(mAppManager.getCurrentActivity(), ImageConfigImpl.builder().url(data.getPic()).imageView(mRootView.getIvCover()).build()); // 填充简介、评论Fragment界面信息 mRootView.initViewPager(videoDetail); }
Example #10
Source File: RecommendMultiItemAdapter.java From LQRBiliBlili with MIT License | 5 votes |
private void setItemPaddingAndImage(BaseViewHolder helper, RecommendMultiItem item, IndexData.DataBean itemBean) { int leftPadding = item.isOdd() ? ArmsUtils.dip2px(mContext, ConstantUtil.MAIN_HOME_ITEM_PADDING) : 0; int rightPadding = item.isOdd() ? 0 : ArmsUtils.dip2px(mContext, ConstantUtil.MAIN_HOME_ITEM_PADDING); helper.getView(R.id.fl_item).setPadding(leftPadding, 0, rightPadding, 0); mAppComponent.imageLoader().loadImage(mContext, ImageConfigImpl.builder() .imageView(helper.getView(R.id.iv_cover)) .url(itemBean.getCover()) .build()); }
Example #11
Source File: MainActivity.java From Aurora with Apache License 2.0 | 5 votes |
@Subscriber(tag = EventBusTags.SET_USER_INFO) public void setUserInfo(User user) { CircleImageView img = (CircleImageView) mNvMainNavigation.getHeaderView(0).findViewById(R.id.im_face); TextView name = (TextView) mNvMainNavigation.getHeaderView(0).findViewById(R.id.tv_name); name.setText(User.getCurrentUser().getUsername()); if (user.getIcon() != null) { appComponent.imageLoader().loadImage(this, ImageConfigImpl .builder() .transformation(new GlideCircleTransform()) .url(user.getIcon().getFileUrl()) .errorPic(R.drawable.ic_noface) .dontAnimate(true) .imageView(img) .build()); } BmobQuery<MyAttentionEntity> query = new BmobQuery<MyAttentionEntity>(); query.addWhereEqualTo("userId", BmobUser.getCurrentUser().getObjectId()); query.order("-createdAt"); query.findObjects(new FindListener<MyAttentionEntity>() { @Override public void done(List<MyAttentionEntity> list, BmobException e) { appComponent.extras().put(Constants.CACHE_FOLLOWED_INFO,list); } }); }
Example #12
Source File: CategoryAdapter.java From Aurora with Apache License 2.0 | 5 votes |
@Override protected void convert(BaseViewHolder helper, Category item) { AppComponent mAppComponent = ((App)helper.getView(R.id.iv_bg).getContext().getApplicationContext()) .getAppComponent(); ImageView bg = helper.getView(R.id.iv_bg); helper.setText(R.id.tv_name,item.getName()); mAppComponent.imageLoader().loadImage(bg.getContext(), ImageConfigImpl .builder() .url(item.getBgPicture()) .imageView(bg) .build()); }
Example #13
Source File: SearchAdapter.java From Aurora with Apache License 2.0 | 5 votes |
@Override protected void convert(BaseViewHolder helper, VideoListInfo.Video item) { AppComponent mAppComponent = ((App)helper.getView(R.id.iv_bg).getContext().getApplicationContext()) .getAppComponent(); ImageView imgbg = helper.getView(R.id.iv_bg); Context context = imgbg.getContext(); mAppComponent.imageLoader().loadImage(context, ImageConfigImpl .builder() .url(item.getData().getCover().getFeed()) .imageView(imgbg) .build()); helper.setText(R.id.tv_name,item.getData().getTitle()) .setText(R.id.tv_desc,getDetailStr(item)); }
Example #14
Source File: RelateVideoAdapter.java From Aurora with Apache License 2.0 | 5 votes |
@Override protected void convert(BaseViewHolder helper, RelateVideoSection item) { helper.setText(R.id.tv_title,item.t.getData().getTitle()) .setText(R.id.tv_type,getDetailStr(item.t)); ImageView img = helper.getView(R.id.iv_left); AppComponent mAppComponent = ((App)img.getContext().getApplicationContext()) .getAppComponent(); Context context = img.getContext(); mAppComponent.imageLoader().loadImage(context, ImageConfigImpl .builder() .url(item.t.getData().getCover().getFeed()) .imageView(img) .build()); }
Example #15
Source File: VideoAdapter.java From Aurora with Apache License 2.0 | 5 votes |
@Override protected void convert(BaseViewHolder helper, VideoListInfo.Video item) { AppComponent mAppComponent = ((App)helper.getView(R.id.img_main).getContext().getApplicationContext()) .getAppComponent(); ImageView imgMian = helper.getView(R.id.img_main); ImageView imgAutor = helper.getView(R.id.img_author); Context context = imgMian.getContext(); Glide.with(context).load(item.getData().getCover().getFeed()) .into(imgMian); mAppComponent.imageLoader().loadImage(context, ImageConfigImpl .builder() .url(item.getData().getCover().getFeed()) .imageView(imgMian) .build()); try { ((App)context.getApplicationContext()) .getAppComponent().imageLoader().loadImage(context, ImageConfigImpl .builder() .transformation(new GlideCircleTransform()) .url(StringUtils.replaceNull(item.getData().getAuthor().getIcon())) .imageView(helper.getView(R.id.img_author)) .build()); }catch (NullPointerException e){ } helper.setText(R.id.title,item.getData().getTitle()) .setText(R.id.detail,getDetailStr(item)); if (item.getData().getAuthor()!=null){ helper.getView(R.id.img_author).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { gotoAuthorDetail(view,helper.getLayoutPosition()); } }); } }
Example #16
Source File: AuthorVideosAdapter.java From Aurora with Apache License 2.0 | 5 votes |
@Override protected void convert(BaseViewHolder helper, VideoListInfo.Video item) { helper.setText(R.id.tv_title,item.getData().getTitle()) .setText(R.id.tv_type,getDetailStr(item)); ImageView img = helper.getView(R.id.iv_left); AppComponent mAppComponent = ((App)img.getContext().getApplicationContext()) .getAppComponent(); Context context = img.getContext(); mAppComponent.imageLoader().loadImage(context, ImageConfigImpl .builder() .url(item.getData().getCover().getFeed()) .imageView(img) .build()); }
Example #17
Source File: AttentionInsideAdapter.java From Aurora with Apache License 2.0 | 5 votes |
@Override protected void convert(BaseViewHolder helper, VideoListInfo.Video item) { AppComponent mAppComponent = ((App)helper.getView(R.id.iv_bg).getContext().getApplicationContext()) .getAppComponent(); ImageView imgBg = helper.getView(R.id.iv_bg); helper.setText(R.id.tv_title,item.getData().getTitle()) .setText(R.id.tv_detail,getDetailStr(item)); mAppComponent.imageLoader().loadImage(imgBg.getContext(), ImageConfigImpl .builder() .url(item.getData().getCover().getFeed()) .imageView(imgBg) .build()); }
Example #18
Source File: AuthorDynamicAdapter.java From Aurora with Apache License 2.0 | 4 votes |
@Override protected void convert(BaseViewHolder helper, AuthorDynamicInfo.Dynamic item) { Context context = helper.itemView.getContext(); AppComponent mAppComponent = ((App)context.getApplicationContext()) .getAppComponent(); helper.setText(R.id.tv_author,item.getData().getUser().getNickname()); helper.setText(R.id.tv_operation,item.getData().getText()); helper.setText(R.id.tv_date, DateUtils.DateToString(new Date(item.getData().getCreateDate()),DateUtils.DATE_TO_STRING_SHORT_PATTERN)); ImageView face = helper.getView(R.id.iv_face); mAppComponent.imageLoader().loadImage(context, ImageConfigImpl .builder() .url(item.getData().getUser().getAvatar()) .imageView(face) .build()); if ("video".equals(item.getData().getDynamicType())){ helper.setText(R.id.tv_video_name,item.getData().getSimpleVideo().getTitle()); helper.setText(R.id.tv_video_detail,getDetailStr(item.getData().getSimpleVideo().getDuration()+"",item.getData().getSimpleVideo().getCategory())); helper.getView(R.id.ctl_video).setVisibility(View.VISIBLE); helper.getView(R.id.ctl_follow).setVisibility(View.GONE); ImageView iv6 = helper.getView(R.id.imageView6); mAppComponent.imageLoader().loadImage(context, ImageConfigImpl .builder() .url(item.getData().getSimpleVideo().getCover().getFeed()) .imageView(iv6) .build()); } if ("follow".equals(item.getData().getDynamicType())){ helper.setText(R.id.tv_follow_name,item.getData().getBriefCard().getTitle()); helper.setText(R.id.tv_follow_detail,item.getData().getBriefCard().getDescription()); helper.getView(R.id.ctl_video).setVisibility(View.GONE); helper.getView(R.id.ctl_follow).setVisibility(View.VISIBLE); ImageView iv7 = helper.getView(R.id.imageView7); mAppComponent.imageLoader().loadImage(context, ImageConfigImpl .builder() .transformation(new GlideCircleTransform()) .url(item.getData().getBriefCard().getIcon()) .imageView(iv7) .build()); } }
Example #19
Source File: SummaryFragment.java From LQRBiliBlili with MIT License | 4 votes |
private void initUpperInfo(Summary.DataBean data) { Summary.DataBean.OwnerBean owner = data.getOwner(); if (owner != null) { ArmsUtils.obtainAppComponentFromContext(_mActivity).imageLoader().loadImage(_mActivity, ImageConfigImpl.builder().url(owner.getFace()).imageView(mIvHeader).transformation(new CircleCrop()).build()); mTvUpperName.setText(owner.getName()); } Summary.DataBean.OwnerExtBean owner_ext = data.getOwner_ext(); if (owner_ext != null) { mTvFans.setText(TextHandleUtil.handleCount2TenThousand(owner_ext.getFans()) + "人关注"); } // 得到视频相关tag tags = data.getTag(); if (tags != null) { // 如果tag数量超过4个,就缩减 if (tags.size() > 4) { newTags = new ArrayList<>(); Collections.sort(tags); for (int i = 0; i < 4; i++) { newTags.add(tags.get(i)); } adapter = new MyTagAdapter(newTags); isTagShrink = true; } else { adapter = new MyTagAdapter(tags); } mTagFlow.setAdapter(adapter); // 箭头的点击事件 changeArrowDown(); mIvTagShrink.setOnClickListener(v -> { if (isTagShrink) { // 切换成多的 if (newTags != null) { adapter = new MyTagAdapter(tags); } changeArrowUp(); } else { // 切换成少的 if (newTags != null) { adapter = new MyTagAdapter(newTags); } changeArrowDown(); } isTagShrink = !isTagShrink; if (newTags != null) { mTagFlow.setAdapter(adapter); } }); } }
Example #20
Source File: RecommendMultiItemAdapter.java From LQRBiliBlili with MIT License | 4 votes |
@Override public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) { mAppComponent.imageLoader().loadImage(mContext, ImageConfigImpl.builder().imageView(itemView).url(model).build()); }
Example #21
Source File: RecommendMultiItemAdapter.java From LQRBiliBlili with MIT License | 4 votes |
@Override protected void convert(BaseViewHolder helper, RecommendMultiItem item) { if (mAppComponent == null) { mAppComponent = ArmsUtils.obtainAppComponentFromContext(mContext); } IndexData.DataBean itemBean = item.getIndexDataBean(); switch (item.getItemType()) { case RecommendMultiItem.BANNER: BGABanner banner = helper.getView(R.id.banner); List<IndexData.DataBean.BannerItemBean> banners = itemBean.getBanner_item(); List<String> images = new ArrayList<>(); if (banners != null && banners.size() > 0) { for (int i = 0; i < banners.size(); i++) { IndexData.DataBean.BannerItemBean bannerItem = banners.get(i); images.add(bannerItem.getImage()); } } banner.setAdapter(mBannerAdapter); banner.setData(images, images); break; case RecommendMultiItem.STREAMER: mAppComponent.imageLoader().loadImage(mContext, ImageConfigImpl.builder().imageView(helper.getView(R.id.iv_streamer)).url(itemBean.getCover()).build()); helper.setText(R.id.tv_item_title, itemBean.getTitle()) .setText(R.id.tv_badge, TextUtils.isEmpty(itemBean.getBadge()) ? ("topic".equals(itemBean.getGotoX()) ? "话题" : "") : itemBean.getBadge()) .setText(R.id.tv_desc, itemBean.getDesc()); break; case RecommendMultiItem.ITEM_AV: setItemPaddingAndImage(helper, item, itemBean); helper.setText(R.id.tv_play, TextHandleUtil.handleCount2TenThousand(itemBean.getPlay())) .setText(R.id.tv_danmaku, TextHandleUtil.handleCount2TenThousand(itemBean.getDanmaku())) .setText(R.id.tv_duration, TextHandleUtil.handleDurationSecond(itemBean.getDuration())) .setText(R.id.tv_title, itemBean.getTitle()) .setText(R.id.tv_tname_tag_name, itemBean.getTname() + "‧" + (itemBean.getTag() == null ? "" : itemBean.getTag().getTag_name())); break; case RecommendMultiItem.ITEM_AV_RCMD_REASON: setItemPaddingAndImage(helper, item, itemBean); helper.setText(R.id.tv_play, TextHandleUtil.handleCount2TenThousand(itemBean.getPlay())) .setText(R.id.tv_danmaku, TextHandleUtil.handleCount2TenThousand(itemBean.getDanmaku())) .setText(R.id.tv_duration, TextHandleUtil.handleDurationSecond(itemBean.getDuration())) .setText(R.id.tv_title, itemBean.getTitle()) .setText(R.id.tv_rcmd_reason, itemBean.getRcmd_reason().getContent()); break; case RecommendMultiItem.ITEM_BANGUMI: setItemPaddingAndImage(helper, item, itemBean); helper.setText(R.id.tv_play, TextHandleUtil.handleCount2TenThousand(itemBean.getPlay())) .setText(R.id.tv_favorite, itemBean.getFavorite() + "") .setText(R.id.tv_title, itemBean.getTitle()) .setText(R.id.tv_last_index, mContext.getResources().getString(R.string.recommend_home_update_to_last_index, itemBean.getLast_index())) .setText(R.id.tv_badge, itemBean.getBadge()); break; case RecommendMultiItem.ITEM_LOGIN: break; case RecommendMultiItem.ITEM_AD_WEB_S: setItemPaddingAndImage(helper, item, itemBean); helper.setText(R.id.tv_title, itemBean.getTitle()) .setText(R.id.tv_desc, itemBean.getDesc()); break; case RecommendMultiItem.ITEM_ARTICLE_S: setItemPaddingAndImage(helper, item, itemBean); helper.setText(R.id.tv_play, TextHandleUtil.handleCount2TenThousand(itemBean.getPlay())) .setText(R.id.tv_favorite, itemBean.getFavorite() + "") .setText(R.id.tv_title, itemBean.getTitle()) .setText(R.id.tv_desc, itemBean.getDesc()); break; case RecommendMultiItem.PRE_HERE_CLICK_TO_REFRESH: break; } }
Example #22
Source File: LiveMultiItemAdapter.java From LQRBiliBlili with MIT License | 4 votes |
@Override protected void convert(BaseViewHolder helper, LiveMultiItem item) { if (mAppComponent == null) { mAppComponent = ArmsUtils.obtainAppComponentFromContext(mContext); } switch (item.getItemType()) { case LiveMultiItem.TITLE: mAppComponent .imageLoader() .loadImage(mContext, ImageConfigImpl .builder() .imageView(helper.getView(R.id.iv_title_icon_src)) .url(item.getTitleIconSrc()) .build()); helper.setText(R.id.tv_title_name, item.getTitleName()) .setText(R.id.tv_title_count, item.getTitleCount() + ""); break; case LiveMultiItem.ITEM: mAppComponent .imageLoader() .loadImage(mContext, ImageConfigImpl .builder() .imageView(helper.getView(R.id.iv_item_cover_src)) .url(item.getItemCoverSrc()) .build()); int leftPadding = item.isOdd() ? ArmsUtils.dip2px(mContext, ConstantUtil.MAIN_HOME_ITEM_PADDING) : 0; int rightPadding = item.isOdd() ? 0 : ArmsUtils.dip2px(mContext, ConstantUtil.MAIN_HOME_ITEM_PADDING); helper.getView(R.id.fl_item).setPadding(leftPadding, 0, rightPadding, 0); helper.setText(R.id.tv_item_owner_name, item.getItemOwnerName()) .setText(R.id.tv_item_title, item.getItemTitle()) .setText(R.id.tv_item_sub_title, item.getItemSubTitle()) .setText(R.id.tv_item_online, TextHandleUtil.handleCount2TenThousand(item.getItemOnline())); break; case LiveMultiItem.BANNER: mAppComponent .imageLoader() .loadImage(mContext, ImageConfigImpl .builder() .imageView(helper.getView(R.id.iv_banner_cover_src)) .url(item.getBannerCoverSrc()) .build()); helper.setText(R.id.tv_banner_title, item.getBannerTitle()); break; case LiveMultiItem.BOTTOM: break; } }
Example #23
Source File: CacheAdapter.java From Aurora with Apache License 2.0 | 4 votes |
@Override protected void convert(BaseViewHolder helper, VideoDownLoadInfo item) { AppComponent mAppComponent = ((App)helper.getView(R.id.iv_bg).getContext().getApplicationContext()) .getAppComponent(); ImageView imgMian = helper.getView(R.id.iv_bg); Context context = imgMian.getContext(); helper.setText(R.id.tv_title,item.getVideo().getTitle()); if (item.getVideo().getAuthor()!=null){ helper.setText(R.id.tv_author,item.getVideo().getAuthor().getName()); } helper.setText(R.id.tv_size, StringUtils.getPrintSize(item.getContentLength() == null ?0:item.getContentLength(),true)); helper.addOnClickListener(R.id.iv_more); helper.addOnClickListener(R.id.ll_detail); helper.addOnClickListener(R.id.ll_progress); helper.addOnClickListener(R.id.ctl_layout); if (!type.contains("正在")){ helper.getView(R.id.ll_detail).setVisibility(View.VISIBLE); }else { helper.getView(R.id.ll_detail).setVisibility(View.GONE); } if (item.getFinish()){ helper.getView(R.id.ll_progress).setVisibility(View.GONE); helper.getView(R.id.tv_size).setVisibility(View.VISIBLE); }else { helper.getView(R.id.tv_size).setVisibility(View.GONE); // if (downPosition == helper.getLayoutPosition()){ // helper.getView(R.id.ll_progress).setVisibility(View.VISIBLE); // helper.getView(R.id.sb_progress).setVisibility(View.VISIBLE); // ((SeekBar)helper.getView(R.id.sb_progress)).setProgress(item.getPercent()); // String size = StringUtils.getPrintSize(item.getCurrentBytes() == null ?0:item.getContentLength(),false) + "/" + StringUtils.getPrintSize(item.getContentLength() == null ?0:item.getContentLength(),true); // helper.setText(R.id.tv_pause,size); // }else { if (item.isPending()){ helper.setText(R.id.tv_pause,"正在连接中..."); ((ProgressBar)helper.getView(R.id.sb_progress)).setIndeterminate(true); helper.getView(R.id.ll_progress).setVisibility(View.VISIBLE); helper.getView(R.id.sb_progress).setVisibility(View.VISIBLE); }else { if (item.isLineUp()){ helper.setText(R.id.tv_pause,"排队中"); }else { helper.setText(R.id.tv_pause,"已暂停"); } helper.getView(R.id.ll_progress).setVisibility(View.VISIBLE); helper.getView(R.id.sb_progress).setVisibility(View.GONE); } // } } mAppComponent.imageLoader().loadImage(context, ImageConfigImpl .builder() .url(item.getVideo().getCover().getFeed()) .imageView(imgMian) .build()); }
Example #24
Source File: AuthorIndexFragment.java From Aurora with Apache License 2.0 | 4 votes |
private void initHeadView(AuthorTabsInfo info) { headView = getActivity().getLayoutInflater().inflate(R.layout.view_head_author_detail, mRecyclerView, false); MyAttentionEntity attention = new MyAttentionEntity(); attention.setId(info.getPgcInfo().getId()); attention.setTitle((info.getPgcInfo().getName())); attention.setDescription((info.getPgcInfo().getDescription())); attention.setIcon((info.getPgcInfo().getIcon())); FollowButton button = headView.findViewById(R.id.btn_attention); button.setState(CommonUtils.checkFollowed(headView.getContext(),id) ? FollowButton.FOLLOWED:FollowButton.UNFOLLOWED); button.setOnFollowClickListener(new FollowButton.onFollowClickListener() { @Override public void onFollowed() { } @Override public void onUnFollowed() { } },attention); ImageView bg = headView.findViewById(R.id.iv_bg); ImageView face = headView.findViewById(R.id.civ_face); TextView name = headView.findViewById(R.id.tv_author_name); TextView follow = headView.findViewById(R.id.num_folowed); TextView desc = headView.findViewById(R.id.tv_desc); TextView videoNum = headView.findViewById(R.id.tv_video_num); TextView collectNum = headView.findViewById(R.id.tv_collect_num); TextView shareNum = headView.findViewById(R.id.tv_share_num); follow.setText(info.getPgcInfo().getFollowCount()+" 被关注"); name.setText(info.getPgcInfo().getName()); desc.setText(info.getPgcInfo().getDescription()); videoNum.setText(info.getPgcInfo().getVideoCount()+""); collectNum.setText(info.getPgcInfo().getCollectCount()+""); shareNum.setText(info.getPgcInfo().getShareCount()+""); if (info.getPgcInfo().getIcon()!=null){ appComponent.imageLoader().loadImage(getActivity(), ImageConfigImpl .builder() .url(info.getPgcInfo().getIcon()) .imageView(face) .dontAnimate(true) .build()); } if (info.getPgcInfo().getCover()!=null){ appComponent.imageLoader().loadImage(getActivity(), ImageConfigImpl .builder() .url(info.getPgcInfo().getCover()) .imageView(bg) .build()); }else { bg.setImageResource(R.drawable.profile_cover); } adapter.setHeaderView(headView); }