ソースを参照

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

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

See merge request kdanandroid/pdf/pdfreaderreadermodule!59
Cooper Ku 5 年 前
コミット
1a0597f84f
1 ファイル変更9 行追加0 行削除
  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 {