Browse Source

Add function ReaderActivity::removeAdPages()

cooperku_kdanmobile 5 years ago
parent
commit
6dc69c34c5
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/main/java/com/kdanmobile/reader/ReaderActivity.kt

+ 9 - 0
src/main/java/com/kdanmobile/reader/ReaderActivity.kt

@@ -538,6 +538,15 @@ abstract class ReaderActivity :
         onOpenedFile()
         onOpenedFile()
     }
     }
 
 
+    fun removeAdPages() {
+        if (adPageHelper.displayStrategy == AdPageHelper.DisplayStrategy.HIDE) return
+        val handler = viewModel.pdfInfoHandler
+        val pageIndex = currentPageIndex
+        adPageHelper.displayStrategy = AdPageHelper.DisplayStrategy.HIDE
+        viewModel.getReaderView()?.refresh(true)
+        handler.goToCurrentPage(pageIndex)
+    }
+
     private fun initTextBoxContextMenuActions() {
     private fun initTextBoxContextMenuActions() {
         viewModel.setTextBoxContextMenuActions(object : TextBoxContextMenuActionListener {
         viewModel.setTextBoxContextMenuActions(object : TextBoxContextMenuActionListener {
             override fun onDelete(): Boolean {
             override fun onDelete(): Boolean {