pull/35/head^2
kunfei 5 years ago
parent 4b42d172fe
commit 7bd457626e
  1. 8
      app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt
  2. 8
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt

@ -1,10 +1,7 @@
package io.legado.app.data.dao
import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.*
import io.legado.app.data.entities.RssArticle
@Dao
@ -15,4 +12,7 @@ interface RssArticleDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
fun insert(vararg rssArticle: RssArticle)
@Update
fun update(vararg rssArticle: RssArticle)
}

@ -4,6 +4,7 @@ import android.app.Application
import androidx.lifecycle.MutableLiveData
import io.legado.app.App
import io.legado.app.base.BaseViewModel
import io.legado.app.data.entities.RssArticle
import io.legado.app.data.entities.RssSource
import io.legado.app.model.Rss
import kotlinx.coroutines.Dispatchers.IO
@ -34,4 +35,11 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application
}
}
fun read(rssArticle: RssArticle) {
execute {
rssArticle.read = true
App.db.rssArtivleDao().update(rssArticle)
}
}
}
Loading…
Cancel
Save