2 Ревизии 42b4d88ef9 ... 9642446c95

Автор SHA1 Съобщение Дата
  Wayne Hunag 9642446c95 Merge branch '145-AddOnFileCopyCompleteCallback' into 'master' преди 4 години
  cooperku_kdanmobile aea1a8e9eb Add CopyFileActivity::onFileCopyComplete(() -> Unit) преди 4 години
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      src/main/java/com/kdanmobile/reader/copyfile/CopyFileActivity.kt

+ 4 - 1
src/main/java/com/kdanmobile/reader/copyfile/CopyFileActivity.kt

@@ -17,6 +17,7 @@ abstract class CopyFileActivity : KdanBaseActivity(), ReadModuleKoinComponent {
     abstract fun getKdanPdfReaderFolder(): File
     abstract fun provideReaderActivityIntent(filePath: String?): Intent
     open fun hasPermissionToAccessExternalStorage(): Boolean = true
+    open fun onFileCopyComplete(callback: () -> Unit) = callback.invoke()
 
     companion object {
         const val KEY_FILE_ABSOLUTE_PATH = "file_absolute_path"
@@ -47,7 +48,9 @@ abstract class CopyFileActivity : KdanBaseActivity(), ReadModuleKoinComponent {
         if (null == event) return
         when (event) {
             is CopyFileViewModel.Event.Success -> {
-                startReaderActivity(event.filePath)
+                onFileCopyComplete {
+                    startReaderActivity(event.filePath)
+                }
             }
             is CopyFileViewModel.Event.Failed -> {
                 event.e.printStackTrace()