mirror of
https://github.com/gedoor/legado.git
synced 2025-01-07 03:06:58 +08:00
rss收藏增加批量删除 (#4444)
This commit is contained in:
parent
5f392d4a7e
commit
fc7e0d3619
@ -36,4 +36,10 @@ interface RssStarDao {
|
||||
|
||||
@Query("delete from rssStars where origin = :origin and link = :link")
|
||||
fun delete(origin: String, link: String)
|
||||
|
||||
@Query("delete from rssStars where `group` = :group")
|
||||
fun deleteByGroup(group: String)
|
||||
|
||||
@Query("delete from rssStars")
|
||||
fun deleteAll()
|
||||
}
|
@ -14,6 +14,7 @@ import io.legado.app.base.BaseActivity
|
||||
import io.legado.app.constant.AppLog
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.databinding.ActivityRssFavoritesBinding
|
||||
import io.legado.app.lib.dialogs.alert
|
||||
import io.legado.app.lib.theme.accentColor
|
||||
import io.legado.app.utils.gone
|
||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||
@ -53,16 +54,20 @@ class RssFavoritesActivity : BaseActivity<ActivityRssFavoritesBinding>() {
|
||||
}
|
||||
|
||||
private fun upGroupsMenu() = groupsMenu?.let { subMenu ->
|
||||
subMenu.removeGroup(R.id.menu_group_text)
|
||||
subMenu.removeGroup(R.id.menu_group)
|
||||
groupList.forEachIndexed { index, it ->
|
||||
subMenu.add(R.id.menu_group_text, Menu.NONE, index, it)
|
||||
subMenu.add(R.id.menu_group, Menu.NONE, index, it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
|
||||
super.onCompatOptionsItemSelected(item)
|
||||
if (item.groupId == R.id.menu_group_text) {
|
||||
if (item.groupId == R.id.menu_group) {
|
||||
binding.viewPager.setCurrentItem(item.order)
|
||||
}else{
|
||||
when (item.itemId) {
|
||||
R.id.menu_del_group -> deleteGroup()
|
||||
R.id.menu_del_all -> deleteAll()
|
||||
}
|
||||
}
|
||||
return super.onCompatOptionsItemSelected(item)
|
||||
}
|
||||
@ -87,6 +92,28 @@ class RssFavoritesActivity : BaseActivity<ActivityRssFavoritesBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteGroup() {
|
||||
alert(R.string.draw) {
|
||||
val item = binding.viewPager.currentItem
|
||||
val group = groupList[item]
|
||||
setMessage(getString(R.string.sure_del) + "\n" + group + " 分组的收藏")
|
||||
noButton()
|
||||
yesButton {
|
||||
appDb.rssStarDao.deleteByGroup(group)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteAll() {
|
||||
alert(R.string.draw) {
|
||||
setMessage(getString(R.string.sure_del) + "\n" + "所有收藏")
|
||||
noButton()
|
||||
yesButton {
|
||||
appDb.rssStarDao.deleteAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inner class TabFragmentPageAdapter :
|
||||
FragmentStatePagerAdapter(supportFragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="AlwaysShowAction">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_group"
|
||||
@ -11,5 +13,14 @@
|
||||
<menu />
|
||||
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_del_group"
|
||||
android:title="@string/delete_select_group"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_del_all"
|
||||
android:title="@string/delete_all"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</menu>
|
||||
|
@ -30,6 +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_all">Borrar todo</string>
|
||||
<string name="replace">Reemplazar</string>
|
||||
<string name="replace_purify">Reemplazo</string>
|
||||
|
@ -30,6 +30,7 @@
|
||||
<string name="draw">Warning</string>
|
||||
<string name="edit">Edit</string>
|
||||
<string name="delete">Delete</string>
|
||||
<string name="delete_select_group">Delete Select Group</string>
|
||||
<string name="delete_all">Delete all</string>
|
||||
<string name="replace">Replace</string>
|
||||
<string name="replace_purify">Replacement</string>
|
||||
|
@ -30,6 +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_all">Excluir tudo</string>
|
||||
<string name="replace">Substituir</string>
|
||||
<string name="replace_purify">Substituição</string>
|
||||
|
@ -29,6 +29,7 @@
|
||||
<string name="draw">Cảnh báo</string>
|
||||
<string name="edit">Sửa đổi</string>
|
||||
<string name="delete">Xóa</string>
|
||||
<string name="delete_select_group">Xóa nhóm hiện tại</string>
|
||||
<string name="delete_all">Xóa tất cả</string>
|
||||
<string name="custom_export_section">Chương xuất tùy chỉnh của epub</string>
|
||||
<string name="replace">Thay thế</string>
|
||||
|
@ -28,6 +28,7 @@
|
||||
<string name="draw">提醒</string>
|
||||
<string name="edit">編輯</string>
|
||||
<string name="delete">刪除</string>
|
||||
<string name="delete_select_group">刪除當前分組</string>
|
||||
<string name="replace">替換</string>
|
||||
<string name="replace_purify">替換淨化</string>
|
||||
<string name="replace_purify_desc">配置替換淨化規則</string>
|
||||
|
@ -29,6 +29,7 @@
|
||||
<string name="draw">提醒</string>
|
||||
<string name="edit">編輯</string>
|
||||
<string name="delete">刪除</string>
|
||||
<string name="delete_select_group">刪除當前分組</string>
|
||||
<string name="delete_all">刪除所有</string>
|
||||
<string name="replace">取代</string>
|
||||
<string name="replace_purify">取代淨化</string>
|
||||
|
@ -29,6 +29,7 @@
|
||||
<string name="draw">提醒</string>
|
||||
<string name="edit">编辑</string>
|
||||
<string name="delete">删除</string>
|
||||
<string name="delete_select_group">删除当前分组</string>
|
||||
<string name="delete_all">删除所有</string>
|
||||
<string name="replace">替换</string>
|
||||
<string name="replace_purify">替换净化</string>
|
||||
|
@ -30,6 +30,7 @@
|
||||
<string name="draw">Warning</string>
|
||||
<string name="edit">Edit</string>
|
||||
<string name="delete">Delete</string>
|
||||
<string name="delete_select_group">Delete Select Group</string>
|
||||
<string name="delete_all">Delete all</string>
|
||||
<string name="custom_export_section">Custom export chapter of epub</string>
|
||||
<string name="replace">Replace</string>
|
||||
|
Loading…
Reference in New Issue
Block a user