Bladeren bron

临时方案 - 全部替换,不支持 undo\redo.
右下角按钮状态修正

luozhipeng 1 jaar geleden
bovenliggende
commit
7b6fde45af

+ 12 - 5
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/viewer/pdfsearch/CSearchResultDialogFragment.java

@@ -126,11 +126,18 @@ public class CSearchResultDialogFragment extends CBasicBottomSheetDialogFragment
                     searchReplace.findSelections();
                     searchReplace.replaceAll(content);
                     CThreadPoolUtils.getInstance().executeMain(() -> {
-                        if (replaceListener != null) {
-                            replaceListener.onReplaceEnd();
+                        try {
+                            if (replaceListener != null) {
+                                pdfView.getCPdfReaderView().reloadPages();
+                                replaceListener.onReplaceEnd();
+                                readerView.getEditManager().onUndoRedoCallback(readerView.getPageNum(), false, false);
+                            }
+                        } catch (Exception e) {
+                            //e.printStackTrace();
+                        } finally {
+                            loadingDialog.dismiss();
+                            dismiss();
                         }
-                        loadingDialog.dismiss();
-                        dismiss();
                     });
                 }
             });
@@ -152,7 +159,7 @@ public class CSearchResultDialogFragment extends CBasicBottomSheetDialogFragment
             int resultCount = 0;
             for (CSearchTextInfo searchTextInfo : searchTextInfos) {
                 if (!searchTextInfo.isHeader) {
-                    resultCount +=1;
+                    resultCount += 1;
                 }
             }
             tvResultInfo.setText(getContext().getString(R.string.tools_search_result_found, resultCount));