File tree Expand file tree Collapse file tree
java/com/cxz/wanandroid/adapter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,12 +15,18 @@ import com.cxz.wanandroid.utils.ImageLoader
1515 */
1616class CollectAdapter (private val context : Context ? , datas : MutableList <CollectionArticle >)
1717 : BaseQuickAdapter <CollectionArticle , BaseViewHolder >(R .layout.item_collect_list, datas) {
18- override fun convert (helper : BaseViewHolder ? , item : CollectionArticle ? ) {
1918
19+ override fun convert (helper : BaseViewHolder ? , item : CollectionArticle ? ) {
2020 helper ? : return
2121 item ? : return
22+
23+ val authorStr = when {
24+ item.author.isNotEmpty() -> item.author
25+ else -> mContext.getString(R .string.anonymous)
26+ }
27+
2228 helper.setText(R .id.tv_article_title, Html .fromHtml(item.title))
23- .setText(R .id.tv_article_author, item.author )
29+ .setText(R .id.tv_article_author, authorStr )
2430 .setText(R .id.tv_article_date, item.niceDate)
2531 .setImageResource(R .id.iv_like, R .drawable.ic_like)
2632 .addOnClickListener(R .id.iv_like)
Original file line number Diff line number Diff line change 7777
7878 <!-- Collect -->
7979 <string name =" collect" >Collect</string >
80+ <string name =" anonymous" >anonymous</string >
8081
8182 <!-- Search -->
8283 <string name =" search_tint" >Find more dry goods</string >
Original file line number Diff line number Diff line change 7777
7878 <!-- Collect -->
7979 <string name =" collect" >收藏</string >
80+ <string name =" anonymous" >匿名</string >
8081
8182 <!-- Search -->
8283 <string name =" search_tint" >发现更多干货</string >
You can’t perform that action at this time.
0 commit comments