Parcourir la source

PDFTool(Android) - 更新aar, 增加path edit area菜单

libai il y a 3 semaines
Parent
commit
12e9dc0e56

BIN
ComPDFKit_Repo/compdfkit-ui/ComPDFKit-UI.aar


BIN
ComPDFKit_Repo/compdfkit/ComPDFKit.aar


+ 2 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/basic/activity/CBasicPDFActivity.java

@@ -35,6 +35,7 @@ import com.compdfkit.tools.annotation.pdfproperties.pdfnote.CPDFtextAnnotAttachH
 import com.compdfkit.tools.annotation.pdfproperties.pdfnote.CPDFtextAnnotImpl;
 import com.compdfkit.tools.common.contextmenu.CPDFContextMenuHelper;
 import com.compdfkit.tools.common.contextmenu.impl.CEditImageContextMenuView;
+import com.compdfkit.tools.common.contextmenu.impl.CEditPathContextMenuView;
 import com.compdfkit.tools.common.contextmenu.impl.CEditTextContextMenuView;
 import com.compdfkit.tools.common.contextmenu.impl.CSearchReplaceContextMenuView;
 import com.compdfkit.tools.common.contextmenu.impl.CSignatureContextMenuView;
@@ -77,6 +78,7 @@ public class CBasicPDFActivity extends CPermissionActivity {
                                 .setEditTextContentMenu(new CEditTextContextMenuView())
                                 .setEditImageContentMenu(new CEditImageContextMenuView())
                                 .setSearchReplaceContextMenu(new CSearchReplaceContextMenuView())
+                                .setEditPathContentMenu(new CEditPathContextMenuView())
                                 .create(pdfView));
                 break;
             case Form:

+ 2 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/basic/fragment/CBasicPDFFragment.java

@@ -30,6 +30,7 @@ import com.compdfkit.tools.annotation.pdfproperties.pdfnote.CPDFtextAnnotAttachH
 import com.compdfkit.tools.annotation.pdfproperties.pdfnote.CPDFtextAnnotImpl;
 import com.compdfkit.tools.common.contextmenu.CPDFContextMenuHelper;
 import com.compdfkit.tools.common.contextmenu.impl.CEditImageContextMenuView;
+import com.compdfkit.tools.common.contextmenu.impl.CEditPathContextMenuView;
 import com.compdfkit.tools.common.contextmenu.impl.CEditTextContextMenuView;
 import com.compdfkit.tools.common.contextmenu.impl.CScreenShotContextMenuView;
 import com.compdfkit.tools.common.contextmenu.impl.CSearchReplaceContextMenuView;
@@ -79,6 +80,7 @@ public class CBasicPDFFragment extends CPermissionFragment {
                                 .setEditImageContentMenu(new CEditImageContextMenuView())
                                 .setSearchReplaceContextMenu(new CSearchReplaceContextMenuView())
                                 .setScreenShotContextMenu(new CScreenShotContextMenuView())
+                                .setEditPathContentMenu(new CEditPathContextMenuView())
                                 .create(pdfView));
                 break;
             case Form:

+ 15 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/contextmenu/CPDFContextMenuHelper.java

@@ -44,6 +44,7 @@ import com.compdfkit.tools.common.contextmenu.impl.ComboBoxContextMenuView;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuCheckBoxProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuComboBoxProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuEditImageProvider;
+import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuEditPathProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuEditTextProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuFormSignProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuFreeTextProvider;
@@ -214,6 +215,15 @@ public class CPDFContextMenuHelper extends CPDFContextMenuShowHelper {
         return super.getEditImageAreaContentView(pageView, layoutInflater, area);
     }
 
+    @Override
+    public View getEditPathAreaContentView(final CPDFPageView pageView, LayoutInflater layoutInflater) {
+        this.pageView = pageView;
+        if (helperParams.editPathProvider != null) {
+            return helperParams.editPathProvider.createEditPathAreaContentView(this, pageView, null);
+        }
+        return super.getEditImageAreaContentView(pageView, layoutInflater, null);
+    }
+
     @Override
     public View getCropImageAreaContentView(final CPDFPageView pageView, LayoutInflater layoutInflater) {
         this.pageView = pageView;
@@ -435,6 +445,11 @@ public class CPDFContextMenuHelper extends CPDFContextMenuShowHelper {
             return this;
         }
 
+        public Builder setEditPathContentMenu(ContextMenuEditPathProvider editPathProvider){
+            this.params.editPathProvider = editPathProvider;
+            return this;
+        }
+
         public Builder setTextFieldsContentMenu(ContextMenuTextFieldProvider textFieldProvider){
             this.params.textFieldProvider = textFieldProvider;
             return this;

+ 2 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/contextmenu/ContextMenuProviderParams.java

@@ -14,6 +14,7 @@ package com.compdfkit.tools.common.contextmenu;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuCheckBoxProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuComboBoxProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuEditImageProvider;
+import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuEditPathProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuEditTextProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuFormSignProvider;
 import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuFreeTextProvider;
@@ -55,6 +56,7 @@ class ContextMenuProviderParams {
     public ContextMenuLinkProvider linkProvider;
 
     public ContextMenuEditImageProvider editImageProvider;
+    public ContextMenuEditPathProvider editPathProvider;
 
     public ContextMenuTextFieldProvider textFieldProvider;
 

+ 22 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/contextmenu/impl/CEditPathContextMenuView.java

@@ -0,0 +1,22 @@
+package com.compdfkit.tools.common.contextmenu.impl;
+
+import android.graphics.RectF;
+import android.view.View;
+
+import com.compdfkit.tools.R;
+import com.compdfkit.tools.common.contextmenu.CPDFContextMenuHelper;
+import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuEditPathProvider;
+import com.compdfkit.tools.common.contextmenu.provider.ContextMenuView;
+import com.compdfkit.ui.reader.CPDFPageView;
+
+public class CEditPathContextMenuView implements ContextMenuEditPathProvider {
+    @Override
+    public View createEditPathAreaContentView(CPDFContextMenuHelper helper, CPDFPageView pageView, RectF area) {
+        ContextMenuView menuView = new ContextMenuView(pageView.getContext());
+        menuView.addItem(R.string.tools_delete, v -> {
+            pageView.operateEditPathArea(CPDFPageView.EditPathFuncType.DELETE);
+            helper.dismissContextMenu();
+        });
+        return menuView;
+    }
+}

+ 11 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/contextmenu/interfaces/ContextMenuEditPathProvider.java

@@ -0,0 +1,11 @@
+package com.compdfkit.tools.common.contextmenu.interfaces;
+
+import android.graphics.RectF;
+import android.view.View;
+
+import com.compdfkit.tools.common.contextmenu.CPDFContextMenuHelper;
+import com.compdfkit.ui.reader.CPDFPageView;
+
+public interface ContextMenuEditPathProvider {
+    View createEditPathAreaContentView(CPDFContextMenuHelper helper, CPDFPageView pageView, RectF area);
+}

+ 1 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/contenteditor/CEditToolbar.java

@@ -133,7 +133,7 @@ public class CEditToolbar extends RelativeLayout implements View.OnClickListener
         } else if (!ivEditText.isSelected() && ivEditImage.isSelected()) {
             pdfView.getCPdfReaderView().getEditManager().changeEditType(CPDFEditPage.LoadImage);
         } else if (!ivEditText.isSelected() && !ivEditImage.isSelected()) {
-            pdfView.getCPdfReaderView().getEditManager().changeEditType(CPDFEditPage.LoadTextImage);
+            pdfView.getCPdfReaderView().getEditManager().changeEditType(CPDFEditPage.LoadTextImage | CPDFEditPage.LoadPath);
         }
     }