Browse Source

Merge branch '127-removeAdPage' into '124-implementAdBetweenPages'

Resolve "實作關閉頁間廣告功能"

See merge request kdanandroid/pdf/pdfreaderreadermodule!59
Cooper Ku 5 years ago
parent
commit
1a0597f84f
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()
     }
 
+    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() {
         viewModel.setTextBoxContextMenuActions(object : TextBoxContextMenuActionListener {
             override fun onDelete(): Boolean {