diff --git a/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt b/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt index 6bef664c6..a5efbf379 100644 --- a/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt @@ -5,15 +5,24 @@ import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.data.entities.RssSource +import io.legado.app.help.ImageLoader +import kotlinx.android.synthetic.main.item_rss.view.* +import org.jetbrains.anko.sdk27.listeners.onClick class RssAdapter(context: Context, val callBack: CallBack) : SimpleRecyclerAdapter(context, R.layout.item_rss) { override fun convert(holder: ItemViewHolder, item: RssSource, payloads: MutableList) { - + with(holder.itemView) { + tv_name.text = item.sourceName + ImageLoader.load(context, item.sourceIcon) + .centerCrop() + .setAsBitmap(iv_icon) + onClick { callBack.openRss(item) } + } } interface CallBack { - fun openRss() + fun openRss(rssSource: RssSource) } } \ No newline at end of file diff --git a/app/src/main/res/layout/item_rss.xml b/app/src/main/res/layout/item_rss.xml index 532f166b7..1b55a8ed1 100644 --- a/app/src/main/res/layout/item_rss.xml +++ b/app/src/main/res/layout/item_rss.xml @@ -9,6 +9,8 @@ android:id="@+id/iv_icon" android:layout_width="60dp" android:layout_height="60dp" + android:src="@drawable/ic_image" + android:scaleType="centerCrop" app:layout_constraintTop_toTopOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> @@ -17,6 +19,7 @@ android:id="@+id/tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="16dp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toBottomOf="@+id/iv_icon" />