6 Achegas 73ebbc57ea ... 2dff2d9952

Autor SHA1 Mensaxe Data
  cooperku_kdanmobile 2dff2d9952 Merge branch 'encryptDecrypt' %!s(int64=4) %!d(string=hai) anos
  cooperku_kdanmobile dba346dcb1 Features: encrypt / decrypt %!s(int64=4) %!d(string=hai) anos
  cooperku_kdanmobile eb8f9d3e2d Merge branch 'implementAdBetweenPages' %!s(int64=4) %!d(string=hai) anos
  cooperku_kdanmobile ebc89a885f Refactor %!s(int64=4) %!d(string=hai) anos
  cooperku_kdanmobile 4520d35165 Refactor %!s(int64=5) %!d(string=hai) anos
  cooperku_kdanmobile 2ed00a59f6 Implement FAKE Ad %!s(int64=5) %!d(string=hai) anos

+ 1 - 1
PDFReaderReaderModule

@@ -1 +1 @@
-Subproject commit 65675f9354b56f0a8ddb6290ce59664760fc2113
+Subproject commit 1ff1f8147dce7e7c69a677293457e2c54c7924c3

+ 37 - 1
app/src/main/java/com/kdanmobile/pdfreaderviewapp/MyReaderActivity.kt

@@ -2,7 +2,14 @@ package com.kdanmobile.pdfreaderviewapp
 
 import android.content.Context
 import android.os.Bundle
+import android.widget.ImageView
+import android.widget.Toast
+import com.kdanmobile.kmpdfkit.manager.KMPDFFactory
+import com.kdanmobile.kmpdfkit.pdfcommon.FilePicker
+import com.kdanmobile.kmpdfkit.pdfcommon.KMPDFPageAdapter
 import com.kdanmobile.reader.ReaderActivity
+import com.kdanmobile.reader.additionalpage.AbstractAdditionalPageAdapter
+import com.kdanmobile.reader.additionalpage.AdditionalPageView
 import com.kdanmobile.reader.setting.ReaderSettingDialogFragment
 import com.kdanmobile.reader.thumb.PdfThumbDialogFragment
 
@@ -65,11 +72,40 @@ class MyReaderActivity : ReaderActivity() {
         return false
     }
 
+    override fun onClickEncrypt() {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun onClickDecrypt() {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
     companion object {
-        val KEY_FILE_ABSOLUTE = ReaderActivity.KEY_FILE_ABSOLUTE
+        const val KEY_FILE_ABSOLUTE = ReaderActivity.KEY_FILE_ABSOLUTE
     }
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
+        //  廣告已讀取完畢
+        additionalPageManager.isAdditionalPageLoaded = {
+            true
+        }
+    }
+
+    override fun providePdfPageAdapter(context: Context, filePickerSupport: FilePicker.FilePickerSupport, kmpdfFactory: KMPDFFactory): KMPDFPageAdapter {
+        return object : AbstractAdditionalPageAdapter(context, filePickerSupport, kmpdfFactory, additionalPageManager) {
+            override fun setupViewContent(position: Int, pageView: AdditionalPageView) {
+                //  建立假廣告頁面
+                val imageView = ImageView(context)
+                imageView.setBackgroundResource(R.drawable.pic_test_ad)
+                imageView.scaleType = ImageView.ScaleType.FIT_CENTER
+                pageView.layout.addView(imageView)
+
+                //  假廣告的點擊事件
+                imageView.setOnClickListener {
+                    Toast.makeText(context, "[$position][${pageView.page}] TEST", Toast.LENGTH_SHORT).show()
+                }
+            }
+        }
     }
 }

BIN=BIN
app/src/main/res/drawable/pic_test_ad.png