Explorar o código

Add function ReaderActivity::removeAdPages()

cooperku_kdanmobile %!s(int64=5) %!d(string=hai) anos
pai
achega
6dc69c34c5
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  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 {