Sfoglia il codice sorgente

PDFTool(Android) - 修复bug

liuxiaolong 1 anno fa
parent
commit
9b98cde755

+ 3 - 9
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/dialog/CEditDialog.java

@@ -98,18 +98,12 @@ public class CEditDialog extends DialogFragment {
         CViewUtils.showKeyboard(editText);
         btnCancel.setOnClickListener(v -> dismiss());
         btnAdd.setOnClickListener(v -> {
-                String title = "";
-                if (editText.getText() != null) {
-                    title = editText.getText().toString().trim();
-                }
-//                if (TextUtils.isEmpty(title)) {
-//                    title = "";
-//                }
-
+            if (!TextUtils.isEmpty(editText.getText())) {
+                String title = editText.getText().toString().trim();
                 if (editListener != null) {
                     editListener.edit(title);
                 }
-
+            }
         });
     }
 

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

@@ -17,6 +17,7 @@ import android.widget.RelativeLayout;
 import com.compdfkit.core.edit.CPDFEditManager;
 import com.compdfkit.core.edit.OnEditStatusChangeListener;
 import com.compdfkit.tools.R;
+import com.compdfkit.tools.common.utils.threadpools.CThreadPoolUtils;
 import com.compdfkit.tools.common.utils.viewutils.CViewUtils;
 import com.compdfkit.tools.common.views.pdfview.CPDFViewCtrl;
 import com.compdfkit.ui.contextmenu.IContextMenuShowListener;
@@ -164,20 +165,22 @@ public class CEditToolbar extends RelativeLayout implements View.OnClickListener
         editManager.addEditStatusChangeListener(new OnEditStatusChangeListener() {
             @Override
             public void onBegin(int i) {
-                if (pdfView == null || pdfView.getCPdfReaderView() == null || pdfView.getCPdfReaderView().getEditManager() == null) {
-                    return;
-                }
-                int type = pdfView.getCPdfReaderView().getLoadType();
-                if (type == CPDFEditPage.LoadText) {
-                    ivEditText.setSelected(true);
-                    ivEditImage.setSelected(false);
-                } else if (type == CPDFEditPage.LoadImage) {
-                    ivEditText.setSelected(false);
-                    ivEditImage.setSelected(true);
-                } else if (type == CPDFEditPage.LoadTextImage) {
-                    ivEditText.setSelected(false);
-                    ivEditImage.setSelected(false);
-                }
+                CThreadPoolUtils.getInstance().executeMain(()->{
+                    if (pdfView == null || pdfView.getCPdfReaderView() == null || pdfView.getCPdfReaderView().getEditManager() == null) {
+                        return;
+                    }
+                    int type = pdfView.getCPdfReaderView().getLoadType();
+                    if (type == CPDFEditPage.LoadText) {
+                        ivEditText.setSelected(true);
+                        ivEditImage.setSelected(false);
+                    } else if (type == CPDFEditPage.LoadImage) {
+                        ivEditText.setSelected(false);
+                        ivEditImage.setSelected(true);
+                    } else if (type == CPDFEditPage.LoadTextImage) {
+                        ivEditText.setSelected(false);
+                        ivEditImage.setSelected(false);
+                    }
+                });
             }
 
             @Override
@@ -186,8 +189,10 @@ public class CEditToolbar extends RelativeLayout implements View.OnClickListener
                     return;
                 }
                 if (i == pdfView.getCPdfReaderView().getPageNum()) {
-                    updateUndo(b);
-                    updateRedo(b1);
+                    CThreadPoolUtils.getInstance().executeMain(()->{
+                        updateUndo(b);
+                        updateRedo(b1);
+                    });
                 }
             }
 

File diff suppressed because it is too large
+ 10 - 0
ComPDFKit_Tools/src/main/res/drawable-night/tools_mode_switch_digital_signature.xml


+ 1 - 1
ComPDFKit_Tools/src/main/res/values-zh-rCN/tools_strings.xml

@@ -307,7 +307,7 @@
     <string name="tools_verify_signatures">验证签名</string>
     <string name="tools_select_a_digital_id">选择数字身份证类型:</string>
     <string name="tools_use_a_digital_id_from_a_file">使用文件中的数字身份证</string>
-    <string name="tools_create_a_new_digital_id">创建新的数身份证</string>
+    <string name="tools_create_a_new_digital_id">创建新的数身份证</string>
     <string name="tools_continue">继续</string>
     <string name="tools_certificate_file">使用文件中的证书</string>
     <string name="tools_enter_the_password_of_the_cert_file">请输入证书密码</string>

+ 0 - 1
PDFViewer/src/main/java/com/compdfkit/pdfviewer/MainActivity.java

@@ -157,7 +157,6 @@ public class MainActivity extends CBasicPDFActivity {
 
     private void initPDFView() {
         initDocument();
-
         binding.pdfView.getCPdfReaderView().setMinScaleEnable(false);
         resetContextMenu(binding.pdfView, CPreviewMode.Viewer);
         initAnnotationAttr(binding.pdfView);