소스 검색

Save modifying annotation before activity destroy

cooperku_kdanmobile 5 년 전
부모
커밋
2a54ea39fe
2개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      reader/src/main/java/com/kdanmobile/reader/ReaderActivity.kt
  2. 4 0
      reader/src/main/java/com/kdanmobile/reader/ReaderViewModel.kt

+ 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
     }