Forráskód Böngészése

ComPDFKit(flutter) - android bug修复,release note更新

liuxiaolong 2 hónapja
szülő
commit
5b5a28a953

+ 7 - 4
CHANGELOG.md

@@ -1,10 +1,13 @@
 ## 2.2.0
-* Added the features support for ComPDFKit PDF SDK for iOS V2.2.0.
-* Added the features support for ComPDFKit PDF SDK for Android V2.2.0.
-* 
+* Added the features support for ComPDFKit PDF SDK for iOS [iOS V2.2.0](https://www.compdf.com/pdf-sdk/changelog-ios#v2-2-0).
+* Added the features support for ComPDFKit PDF SDK for Android  [Android V2.2.0](https://www.compdf.com/pdf-sdk/changelog-android#v2-2-0).
+* Added import and export annotation interfaces.
+* Added delete all annotations interface.
+* Added get page number interface and page number listener callback.
+* Added save document callback.
+* For more details on the newly added APIs, please refer to `cpdf_reader_widget_controller.dart` and `cpdf_document.dart`.
 
 ## 2.1.3
-
 * Added the features support for ComPDFKit PDF SDK for iOS V2.1.3.
 * Added the features support for ComPDFKit PDF SDK for Android V2.1.3.
 * Android:

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/platformview/CPDFViewCtrlFlutter.java

@@ -89,7 +89,7 @@ public class CPDFViewCtrlFlutter implements PlatformView {
                             .beginTransaction()
                             .add(fragmentContainerView.getId(), documentFragment)
                             .setReorderingAllowed(true)
-                            .commitNow();
+                            .commit();
                 }
             }
 

+ 14 - 13
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/CPDFDocumentPlugin.java

@@ -34,6 +34,7 @@ import com.compdfkit.core.document.CPDFDocument.PDFDocumentError;
 import com.compdfkit.flutter.compdfkit_flutter.utils.FileUtils;
 import com.compdfkit.tools.common.utils.CFileUtils;
 import com.compdfkit.tools.common.utils.threadpools.CThreadPoolUtils;
+import com.compdfkit.tools.common.views.pdfview.CPDFViewCtrl;
 import com.compdfkit.ui.reader.CPDFReaderView;
 import io.flutter.plugin.common.BinaryMessenger;
 import io.flutter.plugin.common.MethodCall;
@@ -44,7 +45,7 @@ public class CPDFDocumentPlugin extends BaseMethodChannelPlugin {
 
   private String documentUid;
 
-  private CPDFReaderView readerView;
+  private CPDFViewCtrl pdfView;
 
   public CPDFDocumentPlugin(Context context,
       BinaryMessenger binaryMessenger, String documentUid) {
@@ -52,8 +53,8 @@ public class CPDFDocumentPlugin extends BaseMethodChannelPlugin {
     this.documentUid = documentUid;
   }
 
-  public void setReaderView(CPDFReaderView readerView) {
-    this.readerView = readerView;
+  public void setReaderView(CPDFViewCtrl pdfView) {
+    this.pdfView = pdfView;
   }
 
 
@@ -64,26 +65,26 @@ public class CPDFDocumentPlugin extends BaseMethodChannelPlugin {
 
   @Override
   public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
-    if (readerView == null || readerView.getPDFDocument() == null) {
+    if (pdfView == null || pdfView.getCPdfReaderView().getPDFDocument() == null) {
       result.error("-1", "CPDFReaderView isnull or CPDFDocument is null", null);
       return;
     }
+    CPDFReaderView readerView = pdfView.getCPdfReaderView();
     CPDFDocument document = readerView.getPDFDocument();
     switch (call.method) {
       case OPEN_DOCUMENT:
         String filePath = call.argument("filePath");
-        String fileUri = call.argument("fileUri");
         String openPwd = call.argument("password");
         PDFDocumentError error;
-        if (!TextUtils.isEmpty(filePath)) {
-          error = document.open(filePath, openPwd);
-        } else {
-          error = document.open(Uri.parse(fileUri), openPwd);
+        if (filePath.startsWith(FileUtils.CONTENT_SCHEME) || filePath.startsWith(FileUtils.FILE_SCHEME)){
+          pdfView.openPDF(Uri.parse(filePath), openPwd, ()->{
+            result.success(true);
+          });
+        }else {
+          pdfView.openPDF(filePath,openPwd, ()->{
+            result.success(true);
+          });
         }
-        if (error == PDFDocumentError.PDFDocumentErrorSuccess) {
-          readerView.setPDFDocument(document);
-        }
-        result.success(error.ordinal());
         break;
       case GET_FILE_NAME:
         result.success(document.getFileName());

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/CPDFViewCtrlPlugin.java

@@ -79,7 +79,7 @@ public class CPDFViewCtrlPlugin extends BaseMethodChannelPlugin {
   public void setDocumentFragment(CPDFDocumentFragment documentFragment) {
     this.documentFragment = documentFragment;
     this.documentFragment.setInitListener((pdfView)->{
-      documentPlugin.setReaderView(pdfView.getCPdfReaderView());
+      documentPlugin.setReaderView(pdfView);
       pdfView.addReaderViewCallback(new CPDFIReaderViewCallback() {
         @Override
         public void onMoveToChild(int pageIndex) {

+ 0 - 1
example/lib/cpdf_reader_widget_controller_example.dart

@@ -15,7 +15,6 @@ import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart';
 import 'package:compdfkit_flutter/widgets/cpdf_reader_widget.dart';
 import 'package:compdfkit_flutter/widgets/cpdf_reader_widget_controller.dart';
 import 'package:compdfkit_flutter_example/utils/file_util.dart';
-import 'package:file_picker/file_picker.dart';
 import 'package:flutter/material.dart';
 
 class CPDFReaderWidgetControllerExample extends StatefulWidget {

+ 0 - 1
example/lib/examples.dart

@@ -16,7 +16,6 @@ import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart';
 import 'package:compdfkit_flutter_example/cpdf_reader_widget_controller_example.dart';
 import 'package:compdfkit_flutter_example/cpdf_reader_widget_dark_theme_example.dart';
 import 'package:compdfkit_flutter_example/utils/file_util.dart';
-import 'package:file_picker/file_picker.dart';
 import 'package:flutter/material.dart';
 import 'cpdf_reader_widget_example.dart';
 import 'widgets/cpdf_fun_item.dart';