@ -35,6 +35,9 @@ interface ReplaceRuleDao {
@Query("update replace_rules set isEnabled = 1 where id in (:ids)")
fun enableSection(vararg ids: Long)
@Query("update replace_rules set isEnabled = 0 where id in (:ids)")
fun disableSection(vararg ids: Long)
@Query(
"""SELECT * FROM replace_rules WHERE isEnabled = 1
AND (scope LIKE '%' || :scope || '%' or scope = null or scope = '')"""
@ -63,6 +63,7 @@ class ReplaceRuleActivity : VMBaseActivity<ReplaceRuleViewModel>(R.layout.activi
R.id.menu_select_all -> adapter.selectAll()
R.id.menu_revert_selection -> adapter.revertSelection()
R.id.menu_enable_selection -> viewModel.enableSelection(adapter.selectedIds)
R.id.menu_disable_selection -> viewModel.disableSelection(adapter.selectedIds)
}
return super.onCompatOptionsItemSelected(item)
@ -45,6 +45,12 @@ class ReplaceRuleViewModel(application: Application) : BaseViewModel(application
fun disableSelection(ids: LinkedHashSet<Long>) {
execute {
App.db.replaceRuleDao().disableSection(*ids.toLongArray())
fun addGroup(group: String) {
val sources = App.db.replaceRuleDao().noGroup