mirror of
https://github.com/gedoor/legado.git
synced 2025-01-07 03:06:58 +08:00
parent
612227502a
commit
407c6a964c
@ -41,5 +41,10 @@ interface RssArticleDao {
|
||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||
fun insertRecord(vararg rssReadRecord: RssReadRecord)
|
||||
|
||||
@get:Query("select count(1) from rssReadRecords")
|
||||
val countRead: Int
|
||||
|
||||
@Query("delete from rssReadRecords")
|
||||
fun deleteRecord()
|
||||
|
||||
}
|
@ -14,6 +14,7 @@ import io.legado.app.R
|
||||
import io.legado.app.base.VMBaseActivity
|
||||
import io.legado.app.databinding.ActivityRssArtivlesBinding
|
||||
import io.legado.app.help.source.sortUrls
|
||||
import io.legado.app.lib.dialogs.alert
|
||||
import io.legado.app.lib.theme.accentColor
|
||||
import io.legado.app.ui.login.SourceLoginActivity
|
||||
import io.legado.app.ui.rss.source.edit.RssSourceEditActivity
|
||||
@ -90,6 +91,10 @@ class RssSortActivity : VMBaseActivity<ActivityRssArtivlesBinding, RssSortViewMo
|
||||
viewModel.switchLayout()
|
||||
upFragments()
|
||||
}
|
||||
|
||||
R.id.menu_del_read_record -> {
|
||||
delReadRecord()
|
||||
}
|
||||
}
|
||||
return super.onCompatOptionsItemSelected(item)
|
||||
}
|
||||
@ -109,6 +114,17 @@ class RssSortActivity : VMBaseActivity<ActivityRssArtivlesBinding, RssSortViewMo
|
||||
}
|
||||
}
|
||||
|
||||
private fun delReadRecord() {
|
||||
alert(R.string.draw) {
|
||||
val countRead = viewModel.countRead()
|
||||
setMessage(getString(R.string.sure_del) + "\n" + countRead + " " + getString(R.string.read_record))
|
||||
noButton()
|
||||
yesButton(){
|
||||
viewModel.delReadRecord()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setSourceVariable() {
|
||||
lifecycleScope.launch {
|
||||
val source = viewModel.rssSource
|
||||
|
@ -72,4 +72,14 @@ class RssSortViewModel(application: Application) : BaseViewModel(application) {
|
||||
}
|
||||
}
|
||||
|
||||
fun countRead() : Int{
|
||||
return appDb.rssArticleDao.countRead
|
||||
}
|
||||
|
||||
fun delReadRecord() {
|
||||
execute {
|
||||
appDb.rssArticleDao.deleteRecord()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -9,7 +9,6 @@ import android.view.SubMenu
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.BaseActivity
|
||||
import io.legado.app.constant.AppLog
|
||||
@ -35,7 +34,6 @@ class RssFavoritesActivity : BaseActivity<ActivityRssFavoritesBinding>() {
|
||||
private val adapter by lazy { TabFragmentPageAdapter() }
|
||||
private var groupList = mutableListOf<String>()
|
||||
private var groupsMenu: SubMenu? = null
|
||||
private var currentGroup = ""
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
initView()
|
||||
@ -44,21 +42,6 @@ class RssFavoritesActivity : BaseActivity<ActivityRssFavoritesBinding>() {
|
||||
|
||||
private fun initView() {
|
||||
binding.viewPager.adapter = adapter
|
||||
binding.viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
|
||||
override fun onPageScrolled(
|
||||
position: Int,
|
||||
positionOffset: Float,
|
||||
positionOffsetPixels: Int
|
||||
) {
|
||||
}
|
||||
|
||||
override fun onPageSelected(position: Int) {
|
||||
currentGroup = groupList[position]
|
||||
}
|
||||
|
||||
override fun onPageScrollStateChanged(state: Int) {}
|
||||
|
||||
})
|
||||
binding.tabLayout.setupWithViewPager(binding.viewPager)
|
||||
binding.tabLayout.setSelectedTabIndicatorColor(accentColor)
|
||||
}
|
||||
@ -105,12 +88,6 @@ class RssFavoritesActivity : BaseActivity<ActivityRssFavoritesBinding>() {
|
||||
upGroupsMenu()
|
||||
}
|
||||
adapter.notifyDataSetChanged()
|
||||
val item = groupList.indexOf(currentGroup)
|
||||
if (item > -1) {
|
||||
binding.viewPager.setCurrentItem(item)
|
||||
} else if (groupList.isNotEmpty()) {
|
||||
currentGroup = groupList[binding.viewPager.currentItem]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,7 +96,7 @@ class RssFavoritesActivity : BaseActivity<ActivityRssFavoritesBinding>() {
|
||||
alert(R.string.draw) {
|
||||
val item = binding.viewPager.currentItem
|
||||
val group = groupList[item]
|
||||
setMessage(getString(R.string.sure_del) + "\n" + group + " 分组的收藏")
|
||||
setMessage(getString(R.string.sure_del) + "\n<" + group + ">" + getString(R.string.group))
|
||||
noButton()
|
||||
yesButton {
|
||||
appDb.rssStarDao.deleteByGroup(group)
|
||||
@ -129,7 +106,7 @@ class RssFavoritesActivity : BaseActivity<ActivityRssFavoritesBinding>() {
|
||||
|
||||
private fun deleteAll() {
|
||||
alert(R.string.draw) {
|
||||
setMessage(getString(R.string.sure_del) + "\n" + "所有收藏")
|
||||
setMessage(getString(R.string.sure_del) + "\n<" + getString(R.string.all) + ">" + getString(R.string.favorite))
|
||||
noButton()
|
||||
yesButton {
|
||||
appDb.rssStarDao.deleteAll()
|
||||
|
@ -32,4 +32,9 @@
|
||||
android:title="@string/clear"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_del_read_record"
|
||||
android:title="@string/del_read_record"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</menu>
|
@ -30,7 +30,7 @@
|
||||
<string name="draw">Advertencia</string>
|
||||
<string name="edit">Editar</string>
|
||||
<string name="delete">Borrar</string>
|
||||
<string name="delete_select_group">Delete Select Group</string>
|
||||
<string name="delete_select_group">Eliminar grupo seleccionado</string>
|
||||
<string name="delete_all">Borrar todo</string>
|
||||
<string name="replace">Reemplazar</string>
|
||||
<string name="replace_purify">Reemplazo</string>
|
||||
@ -769,6 +769,7 @@
|
||||
<string name="donate_summary">Su donación mejora esta aplicación</string>
|
||||
<string name="about_summary">Cuenta oficial de Wechat [开源阅读软件]</string>
|
||||
<string name="read_record">Leer historial</string>
|
||||
<string name="del_read_record">Eliminar historial de lectura</string>
|
||||
<string name="read_record_summary">Leer resumen del historial</string>
|
||||
<string name="local_tts">TTS local</string>
|
||||
<string name="thread_count">Recuento de subprocesos</string>
|
||||
|
@ -772,6 +772,7 @@
|
||||
<string name="donate_summary">Your donation makes this app better</string>
|
||||
<string name="about_summary">Wechat official account [开源阅读软件]</string>
|
||||
<string name="read_record">Read record</string>
|
||||
<string name="del_read_record">Delete Read record</string>
|
||||
<string name="read_record_summary">Read record summary</string>
|
||||
<string name="local_tts">Local TTS</string>
|
||||
<string name="thread_count">Thread count</string>
|
||||
|
@ -30,7 +30,7 @@
|
||||
<string name="draw">Aviso</string>
|
||||
<string name="edit">Editar</string>
|
||||
<string name="delete">Excluir</string>
|
||||
<string name="delete_select_group">Delete Select Group</string>
|
||||
<string name="delete_select_group">Excluir grupo selecionado</string>
|
||||
<string name="delete_all">Excluir tudo</string>
|
||||
<string name="replace">Substituir</string>
|
||||
<string name="replace_purify">Substituição</string>
|
||||
@ -770,6 +770,7 @@
|
||||
<string name="donate_summary">Sua doação tornará este App ainda melhor</string>
|
||||
<string name="about_summary">Conta oficial de Wechat [开源阅读软件]</string>
|
||||
<string name="read_record">Histórico de leitura</string>
|
||||
<string name="del_read_record">Excluir histórico de leitura</string>
|
||||
<string name="read_record_summary">Leia o resumo do histórico</string>
|
||||
<string name="local_tts">TTS local</string>
|
||||
<string name="thread_count">Contagem de tópicos</string>
|
||||
|
@ -770,6 +770,7 @@ Còn </string>
|
||||
<string name="donate_summary">Đóng góp của bạn làm cho ứng dụng này tốt hơn</string>
|
||||
<string name="about_summary">Tài khoản chính thức của WeChat [开源阅读软件]</string>
|
||||
<string name="read_record">Đọc bản ghi</string>
|
||||
<string name="del_read_record">Xóa lịch sử đọc</string>
|
||||
<string name="read_record_summary">Đọc tóm tắt bản ghi</string>
|
||||
<string name="local_tts">TTS địa phương</string>
|
||||
<string name="thread_count">Số lượng chủ đề</string>
|
||||
|
@ -766,6 +766,7 @@
|
||||
<string name="donate_summary">您嘅支援喺我更新嘅動力</string>
|
||||
<string name="about_summary">公眾號[开源阅读软件]</string>
|
||||
<string name="read_record">閲讀記錄</string>
|
||||
<string name="del_read_record">刪除閲讀記錄</string>
|
||||
<string name="read_record_summary">閱讀時間記錄</string>
|
||||
<string name="local_tts">本地TTS</string>
|
||||
<string name="thread_count">線程數</string>
|
||||
|
@ -771,6 +771,7 @@
|
||||
<string name="donate_summary">您的支援是我更新的動力</string>
|
||||
<string name="about_summary">公眾號[开源阅读软件]</string>
|
||||
<string name="read_record">閱讀記錄</string>
|
||||
<string name="del_read_record">刪除閲讀記錄</string>
|
||||
<string name="read_record_summary">閱讀時間記錄</string>
|
||||
<string name="local_tts">本機TTS</string>
|
||||
<string name="thread_count">執行緒數</string>
|
||||
|
@ -772,6 +772,7 @@
|
||||
<string name="donate_summary">您的支持是我更新的动力</string>
|
||||
<string name="about_summary">公众号【开源阅读软件】</string>
|
||||
<string name="read_record">阅读记录</string>
|
||||
<string name="del_read_record">删除阅读记录</string>
|
||||
<string name="read_record_summary">阅读时间记录</string>
|
||||
<string name="local_tts">本地 TTS</string>
|
||||
<string name="thread_count">线程数</string>
|
||||
|
@ -774,6 +774,7 @@
|
||||
<string name="donate_summary">Your donation makes this app better</string>
|
||||
<string name="about_summary">Wechat official account [开源阅读软件]</string>
|
||||
<string name="read_record">Read record</string>
|
||||
<string name="del_read_record">Delete Read record</string>
|
||||
<string name="read_record_summary">Read record summary</string>
|
||||
<string name="local_tts">Local TTS</string>
|
||||
<string name="thread_count">Thread count</string>
|
||||
|
Loading…
Reference in New Issue
Block a user