Explorar el Código

PDFTool(Android) - 1.调整暗黑模式UI 2.优化home页部分逻辑

liuxiaolong hace 1 año
padre
commit
bbcd871c6d

+ 0 - 15
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/CFileUtils.java

@@ -306,21 +306,6 @@ public class CFileUtils {
         }
     }
 
-    public static void openFolder(Context context, File file){
-        try{
-            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
-            intent.addCategory(Intent.CATEGORY_OPENABLE);
-            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            intent.setDataAndType(getUriBySystem(context, file), "*/*");
-            context.startActivity(intent);
-        }catch (Exception e){
-            e.printStackTrace();
-
-        }
-
-    }
-
-
     public static String getFilePathFromUri(Context context, Uri uri) {
         String filePath = null;
 

+ 13 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/CVerifyPasswordDialogFragment.java

@@ -64,6 +64,15 @@ public class CVerifyPasswordDialogFragment extends CBasicBottomSheetDialogFragme
         return fragment;
     }
 
+    public static CVerifyPasswordDialogFragment newInstance(CPDFDocument document, String pdfFilePath, Uri uri) {
+        Bundle args = new Bundle();
+        CVerifyPasswordDialogFragment fragment = new CVerifyPasswordDialogFragment();
+        fragment.setPDFDocument(document, pdfFilePath);
+        fragment.setPDFDocument(document, uri);
+        fragment.setArguments(args);
+        return fragment;
+    }
+
     public void setPDFDocument(CPDFDocument document, String pdfFilePath) {
         this.document = document;
         this.pdfFilePath = pdfFilePath;
@@ -129,7 +138,6 @@ public class CVerifyPasswordDialogFragment extends CBasicBottomSheetDialogFragme
         });
         btnConfirm.setOnClickListener(v -> {
             verifyPassword();
-
         });
     }
 
@@ -166,6 +174,10 @@ public class CVerifyPasswordDialogFragment extends CBasicBottomSheetDialogFragme
         }
     }
 
+    public String getPassword(){
+        return etPassword.getText().toString();
+    }
+
     public void setVerifyCompleteListener(CVerifyCompleteListener completeListener) {
         this.completeListener = completeListener;
     }

+ 6 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/security/encryption/CDocumentEncryptionDialog.java

@@ -111,6 +111,12 @@ public class CDocumentEncryptionDialog extends CBasicBottomSheetDialogFragment i
         this.document = document;
     }
 
+
+    @Override
+    protected int getStyle() {
+        return R.style.Tools_Base_Theme_BasicBottomSheetDialogStyle_FillScreen;
+    }
+
     @Override
     protected boolean fullScreen() {
         return true;

+ 49 - 2
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/security/watermark/CWatermarkEditDialog.java

@@ -10,11 +10,14 @@
 package com.compdfkit.tools.security.watermark;
 
 import android.Manifest;
+import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Environment;
+import android.text.TextUtils;
 import android.view.View;
 
+import androidx.annotation.Nullable;
 import androidx.appcompat.widget.AppCompatButton;
 import androidx.fragment.app.Fragment;
 import androidx.viewpager2.widget.ViewPager2;
@@ -28,6 +31,7 @@ import com.compdfkit.tools.common.utils.activitycontracts.CMultiplePermissionRes
 import com.compdfkit.tools.common.utils.threadpools.SimpleBackgroundTask;
 import com.compdfkit.tools.common.utils.viewutils.CViewUtils;
 import com.compdfkit.tools.common.views.CToolBar;
+import com.compdfkit.tools.common.views.CVerifyPasswordDialogFragment;
 import com.compdfkit.tools.common.views.directory.CFileDirectoryDialog;
 import com.google.android.material.tabs.TabLayout;
 import com.google.android.material.tabs.TabLayoutMediator;
@@ -66,6 +70,12 @@ public class CWatermarkEditDialog extends CBasicBottomSheetDialogFragment implem
 
     private int pageIndex = 0;
 
+    private String pdfFilePath;
+
+    private Uri pdfUri;
+
+    private String password;
+
     protected CMultiplePermissionResultLauncher multiplePermissionResultLauncher = new CMultiplePermissionResultLauncher(this);
 
     public static CWatermarkEditDialog newInstance() {
@@ -79,6 +89,11 @@ public class CWatermarkEditDialog extends CBasicBottomSheetDialogFragment implem
         this.document = document;
     }
 
+    public void setDocument(@Nullable  String pdfFilePath,@Nullable Uri uri){
+        this.pdfFilePath = pdfFilePath;
+        this.pdfUri = uri;
+    }
+
     public void setPageIndex(int pageIndex) {
         this.pageIndex = pageIndex;
     }
@@ -93,6 +108,11 @@ public class CWatermarkEditDialog extends CBasicBottomSheetDialogFragment implem
         return true;
     }
 
+    @Override
+    protected int getStyle() {
+        return R.style.Tools_Base_Theme_BasicBottomSheetDialogStyle_FillScreen;
+    }
+
     @Override
     protected float dimAmount() {
         return CViewUtils.isLandScape(getContext()) ? 0.2F : 0F;
@@ -116,7 +136,11 @@ public class CWatermarkEditDialog extends CBasicBottomSheetDialogFragment implem
     protected void onViewCreate() {
         toolBar.setBackBtnClickListener(this::onClick);
         btnDone.setOnClickListener(this::onClick);
-        initWatermarkToolbar();
+        if (document != null){
+            initWatermarkContent();
+        } else if (!TextUtils.isEmpty(pdfFilePath) || pdfUri != null) {
+            initDocument(pdfFilePath, pdfUri);
+        }
     }
 
 
@@ -159,7 +183,7 @@ public class CWatermarkEditDialog extends CBasicBottomSheetDialogFragment implem
         }
     }
 
-    private void initWatermarkToolbar() {
+    private void initWatermarkContent() {
         int[] tabs = new int[]{R.string.tools_custom_stamp_text, R.string.tools_image};
         watermarkPageFragmentAdapter = new CWatermarkPageFragmentAdapter(this, document, pageIndex);
         viewPager2.setAdapter(watermarkPageFragmentAdapter);
@@ -220,7 +244,30 @@ public class CWatermarkEditDialog extends CBasicBottomSheetDialogFragment implem
             }
         });
         directoryDialog.show(getChildFragmentManager(), "dirDialog");
+    }
 
+
+    private void initDocument(String filePath, Uri uri) {
+        CPDFDocument document = new CPDFDocument(getContext());
+        CPDFDocument.PDFDocumentError error;
+        if (!TextUtils.isEmpty(filePath)) {
+            error = document.open(filePath, password);
+        } else {
+            error = document.open(uri, password);
+        }
+        if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess){
+            this.document = document;
+            initWatermarkContent();
+        } else if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorPassword) {
+            CVerifyPasswordDialogFragment verifyPasswordDialogFragment;
+            verifyPasswordDialogFragment = CVerifyPasswordDialogFragment.newInstance(document, filePath, uri);
+            verifyPasswordDialogFragment.setVerifyCompleteListener(document1 -> {
+                this.document = document1;
+                this.password = verifyPasswordDialogFragment.getPassword();
+                initWatermarkContent();
+            });
+            verifyPasswordDialogFragment.show(getChildFragmentManager(), "verifyPasswordDialog");
+        }
     }
 
     public void setCompleteListener(CEditCompleteListener completeListener) {

+ 2 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/security/watermark/CWatermarkPageFragment.java

@@ -9,7 +9,9 @@
 
 package com.compdfkit.tools.security.watermark;
 
+import android.content.res.Configuration;
 import android.graphics.Bitmap;
+import android.graphics.PointF;
 import android.net.Uri;
 import android.os.Bundle;
 import android.text.TextUtils;

+ 2 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/security/watermark/view/CWatermarkPageView.java

@@ -170,6 +170,7 @@ public class CWatermarkPageView extends FrameLayout {
         super.onSizeChanged(w, h, oldw, oldh);
         if (document != null) {
             initPageSize(w, h);
+
         }
     }
 
@@ -317,7 +318,7 @@ public class CWatermarkPageView extends FrameLayout {
         RectF pageSize = document.pageAtIndex(pageIndex).getSize();
         float pw = pageSize.width();
         float ph = pageSize.height();
-        float mScale = 1F;
+        float mScale;
         if (pw <= currentPageWidth && ph >= currentPageHeight) {
             mScale = currentPageHeight / ph;
         } else {

+ 1 - 0
ComPDFKit_Tools/src/main/res/layout/tools_cpdf_security_watermark_edit_dialog.xml

@@ -45,6 +45,7 @@
                 android:layout_marginEnd="16dp"
                 android:background="@drawable/tools_common_btn_corner_ripple"
                 android:padding="4dp"
+                app:tint="@color/tools_text_color_primary"
                 app:layout_constraintBottom_toBottomOf="parent"
                 app:layout_constraintEnd_toStartOf="@id/btn_done"
                 app:layout_constraintTop_toTopOf="parent"

+ 1 - 0
PDFViewer/src/main/AndroidManifest.xml

@@ -14,6 +14,7 @@
         >
         <activity android:name=".home.HomeActivity"
             android:exported="true"
+            android:configChanges="keyboardHidden|orientation|screenSize"
             >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />

+ 1 - 1
PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/HomeActivity.java

@@ -40,7 +40,7 @@ public class HomeActivity extends AppCompatActivity {
 
         getSupportFragmentManager()
                 .beginTransaction()
-                .add(R.id.fragment_content, new HomeFunFragment(), "homeFunFragment")
+                .replace(R.id.fragment_content, new HomeFunFragment(), "homeFunFragment")
                 .commit();
     }
 

+ 2 - 0
PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/HomeFunFragment.java

@@ -10,7 +10,9 @@
 package com.compdfkit.pdfviewer.home;
 
 import android.content.Intent;
+import android.net.Uri;
 import android.os.Bundle;
+import android.provider.DocumentsContract;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;

+ 41 - 30
PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/samples/DocumentEncryptionSamplesImpl.java

@@ -19,7 +19,9 @@ import com.compdfkit.core.document.CPDFDocument;
 import com.compdfkit.pdfviewer.R;
 import com.compdfkit.pdfviewer.home.HomeFunBean;
 import com.compdfkit.tools.common.utils.CFileUtils;
+import com.compdfkit.tools.common.utils.CToastUtil;
 import com.compdfkit.tools.common.utils.dialog.CAlertDialog;
+import com.compdfkit.tools.common.views.CVerifyPasswordDialogFragment;
 import com.compdfkit.tools.security.encryption.CDocumentEncryptionDialog;
 import com.compdfkit.tools.security.encryption.CInputOwnerPwdDialog;
 
@@ -43,29 +45,14 @@ public class DocumentEncryptionSamplesImpl extends OpenPDFSamplesImpl {
      * @param uri
      */
     private void security(String filePath, Uri uri){
-        // Check if password exists in pdf file
-        CPDFDocument document = new CPDFDocument(fragment.getContext());
-        CPDFDocument.PDFDocumentError error;
-        if (!TextUtils.isEmpty(filePath)){
-            error = document.open(filePath);
-        } else {
-            error = document.open(uri);
-        }
-        if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess){
-            // If there is no owner permission or the document does not have permission,
-            // you will be prompted to enter the owner password.
+        verifyDocument(filePath, uri, document -> {
             if (document.getPermissions() == CPDFDocument.PDFDocumentPermissions.PDFDocumentPermissionsUser) {
                 showInputOwnerPasswordDialog(document);
                 return;
             }
-        } else if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorPassword) {
-            // The password is incorrect, indicating that the document has been encrypted and
-            // a pop-up window for entering the password is displayed.
-            showInputOwnerPasswordDialog(document);
-            return;
-        }
-        // Display the dialog for setting the document encryption function
-        showDocumentEncryptionDialog(document);
+            // Display the dialog for setting the document encryption function
+            showDocumentEncryptionDialog(document);
+        });
     }
 
     /**
@@ -84,8 +71,12 @@ public class DocumentEncryptionSamplesImpl extends OpenPDFSamplesImpl {
             }else {
                 tipsResId = result ? R.string.tools_set_password_successfully : R.string.tools_set_password_failures;
             }
-            String msg = fragment.getContext().getString(R.string.tools_already_saved_as) + file;
-            showResultDialog(fragment.getActivity().getString(tipsResId), msg, file, password);
+            if (!result){
+                showResultDialog(fragment.getActivity().getString(tipsResId));
+            }else {
+                startPDFActivity(file, null, null);
+                CToastUtil.showLongToast(fragment.getContext(), tipsResId);
+            }
         });
         encryptionDialog.show(fragment.getChildFragmentManager(), "documentEncryptionDialog");
     }
@@ -104,22 +95,42 @@ public class DocumentEncryptionSamplesImpl extends OpenPDFSamplesImpl {
         ownerPwdDialog.show(fragment.getChildFragmentManager(), "inputOwnerPwdDialog");
     }
 
-    private void showResultDialog(String title, String msg, String filePath, String password){
-        Bundle bundle = new Bundle();
-        bundle.putString(CAlertDialog.EXTRA_TITLE, title);
-        bundle.putString(CAlertDialog.EXTRA_MESSAGE, msg);
-        bundle.putString(CAlertDialog.EXTRA_CONFIRM_BUTTON_TEXT, fragment.getString(R.string.tools_check));
-        bundle.putString(CAlertDialog.EXTRA_CANCEL_BUTTON_TEXT, fragment.getString(R.string.tools_open_folder));
-        CAlertDialog alertDialog = CAlertDialog.newInstance(bundle);
+    private void showResultDialog(String title){
+        CAlertDialog alertDialog = CAlertDialog.newInstance("", title);
         alertDialog.setCancelClickListener(v -> {
-            CFileUtils.openFolder(fragment.getContext(), new File(filePath).getParentFile());
             alertDialog.dismiss();
         });
         alertDialog.setConfirmClickListener(v -> {
-            startPDFActivity(filePath, null, password);
             alertDialog.dismiss();
         });
         alertDialog.show(fragment.getParentFragmentManager(), "tips");
     }
 
+    private void verifyDocument(String filePath, Uri uri, CVerifyPasswordDialogFragment.CVerifyCompleteListener listener) {
+        CPDFDocument document = new CPDFDocument(fragment.getContext());
+        CPDFDocument.PDFDocumentError error;
+        if (!TextUtils.isEmpty(filePath)) {
+            error = document.open(filePath);
+        } else {
+            error = document.open(uri);
+        }
+        if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess) {
+            if (listener != null) {
+                listener.complete(document);
+            }
+        } else if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorPassword) {
+            showVerifyPasswordDialog(document, listener);
+        }
+    }
+
+    private void showVerifyPasswordDialog(CPDFDocument document, CVerifyPasswordDialogFragment.CVerifyCompleteListener documentListener) {
+        CVerifyPasswordDialogFragment verifyPasswordDialogFragment;
+        verifyPasswordDialogFragment = CVerifyPasswordDialogFragment.newInstance(document, filePath, uri);
+        verifyPasswordDialogFragment.setVerifyCompleteListener(document1 -> {
+            if (documentListener != null) {
+                documentListener.complete(document1);
+            }
+        });
+        verifyPasswordDialogFragment.show(fragment.getChildFragmentManager(), "verifyPasswordDialog");
+    }
 }

+ 58 - 57
PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/samples/WatermarkSamplesImpl.java

@@ -22,7 +22,9 @@ import com.compdfkit.pdfviewer.R;
 import com.compdfkit.pdfviewer.home.HomeFunBean;
 import com.compdfkit.pdfviewer.home.SelectWatermarkFunFragment;
 import com.compdfkit.tools.common.utils.CFileUtils;
+import com.compdfkit.tools.common.utils.CToastUtil;
 import com.compdfkit.tools.common.utils.dialog.CAlertDialog;
+import com.compdfkit.tools.common.views.CVerifyPasswordDialogFragment;
 import com.compdfkit.tools.common.views.directory.CFileDirectoryDialog;
 import com.compdfkit.tools.security.watermark.CWatermarkEditDialog;
 
@@ -40,7 +42,7 @@ public class WatermarkSamplesImpl extends OpenPDFSamplesImpl {
         watermark(filePath, uri);
     }
 
-    private CPDFDocument getDocument(String filePath, Uri uri) {
+    private void verifyDocument(String filePath, Uri uri, CVerifyPasswordDialogFragment.CVerifyCompleteListener listener) {
         CPDFDocument document = new CPDFDocument(fragment.getContext());
         CPDFDocument.PDFDocumentError error;
         if (!TextUtils.isEmpty(filePath)) {
@@ -48,88 +50,87 @@ public class WatermarkSamplesImpl extends OpenPDFSamplesImpl {
         } else {
             error = document.open(uri);
         }
-        return error == CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess ? document : null;
+        if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess) {
+            if (listener != null) {
+                listener.complete(document);
+            }
+        } else if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorPassword) {
+            showVerifyPasswordDialog(document, listener);
+        }
     }
 
     /**
      * Demonstrate watermark function
+     *
      * @param filePath
      * @param uri
      */
     private void watermark(String filePath, Uri uri) {
         SelectWatermarkFunFragment watermarkFunFragment = SelectWatermarkFunFragment.newInstance();
         watermarkFunFragment.setAddWatermarkClickListener(v -> {
-            CPDFDocument document = getDocument(filePath, uri);
-            if (document != null) {
+            verifyDocument(filePath, uri, document -> {
                 CWatermarkEditDialog watermarkEditDialog = CWatermarkEditDialog.newInstance();
                 watermarkEditDialog.setDocument(document);
                 watermarkEditDialog.setPageIndex(0);
                 watermarkEditDialog.setCompleteListener(pdfFile -> {
                     watermarkEditDialog.dismiss();
-                    showResultDialog(fragment.getString(R.string.tools_watermark_add_success),
-                            fragment.getString(R.string.tools_already_saved_as) + pdfFile,
-                            pdfFile, null);
+                    CToastUtil.showLongToast(fragment.getContext(), R.string.tools_watermark_add_success);
+                    startPDFActivity(pdfFile, null, password);
                 });
                 watermarkEditDialog.show(fragment.getChildFragmentManager(), "watermarkEditDialog");
-            }
-            watermarkFunFragment.dismiss();
+                watermarkFunFragment.dismiss();
+            });
+
         });
         watermarkFunFragment.setRemoveWatermarkClickListener(v -> {
             watermarkFunFragment.dismiss();
-            CPDFDocument document = getDocument(filePath, uri);
-            if (document != null) {
-                // Display the secondary confirmation pop-up window to remove the watermark
-                CAlertDialog alertDialog = CAlertDialog.newInstance(fragment.getString(R.string.tools_remove_watermark),
-                        fragment.getString(R.string.tools_remove_watermark_info));
-                alertDialog.setCancelClickListener(v1 -> {
-                    alertDialog.dismiss();
-                });
-                alertDialog.setConfirmClickListener(v1 -> {
-                    alertDialog.dismiss();
-                    String dir = Environment.getExternalStorageDirectory().getAbsolutePath();
-                    CFileDirectoryDialog directoryDialog = CFileDirectoryDialog.newInstance(dir,
-                            fragment.getString(R.string.tools_save_location), fragment.getString(R.string.tools_save_to_this_directory));
-                    directoryDialog.setSelectFolderListener(dir1 -> {
-                        try {
-                            // remove all watermark
-                            for (int i = 0; i < document.getWatermarkCount(); i++) {
-                                document.getWatermark(i).clear();
+            verifyDocument(filePath, uri, document -> {
+                if (document != null) {
+                    // Display the secondary confirmation pop-up window to remove the watermark
+                    CAlertDialog alertDialog = CAlertDialog.newInstance(fragment.getString(R.string.tools_remove_watermark),
+                            fragment.getString(R.string.tools_remove_watermark_info));
+                    alertDialog.setCancelClickListener(v1 -> {
+                        alertDialog.dismiss();
+                    });
+                    alertDialog.setConfirmClickListener(v1 -> {
+                        alertDialog.dismiss();
+                        String dir = Environment.getExternalStorageDirectory().getAbsolutePath();
+                        CFileDirectoryDialog directoryDialog = CFileDirectoryDialog.newInstance(dir,
+                                fragment.getString(R.string.tools_save_location), fragment.getString(R.string.tools_save_to_this_directory));
+                        directoryDialog.setSelectFolderListener(dir1 -> {
+                            try {
+                                // remove all watermark
+                                for (int i = 0; i < document.getWatermarkCount(); i++) {
+                                    document.getWatermark(i).clear();
+                                }
+                                File file = new File(dir1, document.getFileName());
+                                file = CFileUtils.renameNameSuffix(file);
+                                document.saveAs(file.getAbsolutePath(), false);
+                                document.close();
+                                CToastUtil.showLongToast(fragment.getContext(), R.string.tools_watermark_removed_success);
+                                startPDFActivity(file.getAbsolutePath(), null, password);
+                            } catch (CPDFDocumentException e) {
+                                throw new RuntimeException(e);
                             }
-                            File file = new File(dir1, document.getFileName());
-                            file = CFileUtils.renameNameSuffix(file);
-                            document.saveAs(file.getAbsolutePath(), false);
-                            document.close();
-                            showResultDialog(fragment.getString(R.string.tools_watermark_removed_success),
-                                    fragment.getString(R.string.tools_already_saved_as) + file.getAbsolutePath(),
-                                    file.getAbsolutePath(), null);
-
-                        } catch (CPDFDocumentException e) {
-                            throw new RuntimeException(e);
-                        }
+                        });
+                        directoryDialog.show(fragment.getChildFragmentManager(), "dirDialog");
                     });
-                    directoryDialog.show(fragment.getChildFragmentManager(), "dirDialog");
-                });
-                alertDialog.show(fragment.getChildFragmentManager(), "removeWatermarkAlertDialog");
-            }
+                    alertDialog.show(fragment.getChildFragmentManager(), "removeWatermarkAlertDialog");
+                }
+            });
         });
         watermarkFunFragment.show(fragment.getChildFragmentManager(), "selectFunDialog");
     }
 
-    private void showResultDialog(String title, String msg, String filePath, String password) {
-        Bundle bundle = new Bundle();
-        bundle.putString(CAlertDialog.EXTRA_TITLE, title);
-        bundle.putString(CAlertDialog.EXTRA_MESSAGE, msg);
-        bundle.putString(CAlertDialog.EXTRA_CONFIRM_BUTTON_TEXT, fragment.getString(R.string.tools_check));
-        bundle.putString(CAlertDialog.EXTRA_CANCEL_BUTTON_TEXT, fragment.getString(R.string.tools_open_folder));
-        CAlertDialog alertDialog = CAlertDialog.newInstance(bundle);
-        alertDialog.setCancelClickListener(v -> {
-            CFileUtils.openFolder(fragment.getContext(), new File(filePath).getParentFile());
-            alertDialog.dismiss();
-        });
-        alertDialog.setConfirmClickListener(v -> {
-            startPDFActivity(filePath, null, password);
-            alertDialog.dismiss();
+    private void showVerifyPasswordDialog(CPDFDocument document, CVerifyPasswordDialogFragment.CVerifyCompleteListener documentListener) {
+        CVerifyPasswordDialogFragment verifyPasswordDialogFragment;
+        verifyPasswordDialogFragment = CVerifyPasswordDialogFragment.newInstance(document, filePath, uri);
+        verifyPasswordDialogFragment.setVerifyCompleteListener(document1 -> {
+            if (documentListener != null) {
+                documentListener.complete(document1);
+            }
         });
-        alertDialog.show(fragment.getParentFragmentManager(), "tips");
+        verifyPasswordDialogFragment.show(fragment.getChildFragmentManager(), "verifyPasswordDialog");
     }
+
 }

+ 0 - 1
PDFViewer/src/main/res/layout/fragment_document_list.xml

@@ -3,7 +3,6 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:background="@color/tools_color_background"
     xmlns:tools="http://schemas.android.com/tools">
 
     <androidx.recyclerview.widget.RecyclerView

+ 1 - 0
PDFViewer/src/main/res/menu/menu_activity_home.xml

@@ -7,6 +7,7 @@
         android:id="@+id/home_setting"
         android:icon="@drawable/ic_pdfviewer_home_setting"
         android:visible="true"
+        app:iconTint="@color/tools_text_color_primary"
         app:showAsAction="always" />
 
 </menu>