@Override public void onBindViewHolder(GankHolder holder, int position) { Android android = mAndroidWrappers.get(position).getAndroid(); String author = android.getWho() == null ? "无名好汉" : android.getWho(); holder.author.setText(author); holder.title.setText(android.getDesc()); setOnClickListener(holder.itemView, android.getUrl()); // 给每篇干货 设置标签 setTag(holder.tagGroup, android.getDesc(), android.getUrl()); // 作者的头像 setAvatar(holder, mAndroidWrappers.get(position)); }
private void setAvatarUrlAndShow(AndroidData mAndroidData) { List<Android> androidList = mAndroidData.getData(); final int size = androidList.size(); final List<AndroidWrapper> wrapperList = new ArrayList<AndroidWrapper>(size); for (int i = 0; i < size; i++) { final Android android = androidList.get(i); String url = android.getUrl(); if (url.contains("https://github.com/")) { setGitHubAvatar(url, android, wrapperList, size); } else if (url.contains("http://www.jianshu.com")) { setJianShuAvatar(url, android, wrapperList, size); } else if (url.contains("http://android.jobbole.com")) { setJobboleAvatar(url, android, wrapperList, size); } else { AndroidWrapper wrapper = new AndroidWrapper(android, null); wrapperList.add(wrapper); } } }