pull/35/head^2
kunfei 5 years ago
parent 7d2b47f930
commit c5c5aa0213
  1. 5
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt
  2. 45
      app/src/main/res/layout/item_rss_article.xml

@ -13,8 +13,9 @@ import io.legado.app.data.entities.RssArticle
import io.legado.app.model.rss.RssParser import io.legado.app.model.rss.RssParser
import io.legado.app.ui.rss.read.ReadRssActivity import io.legado.app.ui.rss.read.ReadRssActivity
import kotlinx.android.synthetic.main.item_rss.view.* import kotlinx.android.synthetic.main.item_rss.view.*
import org.jetbrains.anko.* import org.jetbrains.anko.listView
import org.jetbrains.anko.sdk27.listeners.onItemClick import org.jetbrains.anko.sdk27.listeners.onItemClick
import org.jetbrains.anko.startActivity
import java.net.URL import java.net.URL
class RssArticlesActivity : AppCompatActivity() { class RssArticlesActivity : AppCompatActivity() {
@ -48,7 +49,7 @@ class RssArticlesActivity : AppCompatActivity() {
class ArticleAdapter(var articles: MutableList<RssArticle>, var context: Context) : BaseAdapter() { class ArticleAdapter(var articles: MutableList<RssArticle>, var context: Context) : BaseAdapter() {
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View { override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
val item_rss = LayoutInflater.from(context).inflate(R.layout.item_rss, null) val item_rss = LayoutInflater.from(context).inflate(R.layout.item_rss_article, null)
val article = articles[position] val article = articles[position]
item_rss.title.text = article.title item_rss.title.text = article.title
item_rss.pub_date.text = article.pubDate item_rss.pub_date.text = article.pubDate

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="2dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_margin="8dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title"
android:textSize="18sp"
android:text="Title"
android:layout_gravity="center"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/pub_date"
android:textSize="12sp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:text="2019-10-01 13:48:00"
android:layout_gravity="center"
android:textStyle="italic"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/author"
android:textSize="16sp"
android:text="author"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</androidx.cardview.widget.CardView>
Loading…
Cancel
Save