|
|
|
@ -1,6 +1,8 @@ |
|
|
|
|
package io.legado.app.ui.replacerule |
|
|
|
|
|
|
|
|
|
import android.os.Bundle |
|
|
|
|
import android.view.Menu |
|
|
|
|
import android.view.MenuItem |
|
|
|
|
import androidx.core.content.ContextCompat |
|
|
|
|
import androidx.lifecycle.LiveData |
|
|
|
|
import androidx.lifecycle.Observer |
|
|
|
@ -34,6 +36,18 @@ class ReplaceRuleActivity : VMBaseActivity<ReplaceRuleViewModel>(R.layout.activi |
|
|
|
|
initSwipeToDelete() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean { |
|
|
|
|
menuInflater.inflate(R.menu.replace_rule, menu) |
|
|
|
|
return super.onCompatCreateOptionsMenu(menu) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { |
|
|
|
|
when (item.itemId) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return super.onCompatOptionsItemSelected(item) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun initRecyclerView() { |
|
|
|
|
ATH.applyEdgeEffectColor(rv_replace_rule) |
|
|
|
|
rv_replace_rule.layoutManager = LinearLayoutManager(this) |
|
|
|
@ -71,6 +85,7 @@ class ReplaceRuleActivity : VMBaseActivity<ReplaceRuleViewModel>(R.layout.activi |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun initDataObservers() { |
|
|
|
|
rulesLiveData?.removeObservers(this) |
|
|
|
|
rulesLiveData = LivePagedListBuilder(App.db.replaceRuleDao().observeAll(), 30).build() |
|
|
|
|