Jelajahi Sumber

Save modifying annotation before activity destroy

cooperku_kdanmobile 5 tahun lalu
induk
melakukan
2a54ea39fe

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

@@ -301,6 +301,11 @@ abstract class ReaderActivity : AppCompatActivity() {
         container.addView(readerView)
     }
 
+    override fun onDestroy() {
+        viewModel.saveModifyingAnnotationBeforeDestroy()
+        super.onDestroy()
+    }
+
     private fun onPageIndexChanged(pageIndex: Int?) {
         pageIndex?.let {
             viewModel.setBookmarkDisplay(pageIndex)

+ 4 - 0
reader/src/main/java/com/kdanmobile/reader/ReaderViewModel.kt

@@ -290,6 +290,10 @@ class ReaderViewModel(private val pdfSdkLicense: String, private val pdfSdkRsaMs
         }
     }
 
+    fun saveModifyingAnnotationBeforeDestroy() {
+        stopAnnotationMode()
+    }
+
     fun setPageIndex(pageIndex: Int){
         mPageIndexLiveData.value = pageIndex
     }