2 Комити 451aa918e9 ... 82f951130c

Аутор SHA1 Порука Датум
  liuxiaolong 82f951130c PDFTool(Android) - 移除 MediaPlayService, 适配 Android14 пре 1 месец
  liuxiaolong 7ffc2c9662 PDFTool(Android) - 首页新增压缩功能 пре 1 месец
33 измењених фајлова са 1289 додато и 163 уклоњено
  1. 0 13
      ComPDFKit_Tools/src/main/AndroidManifest.xml
  2. 29 0
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfshape/CShapeStyleFragment.java
  3. 105 0
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfshape/adapter/CShapeStyleSpinnerAdapter.java
  4. 21 49
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfsound/CPlayVoicePopupWindow.java
  5. 39 11
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/basic/fragment/CBasicPDFFragment.java
  6. 0 5
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/pdf/CPDFApplyConfigUtil.java
  7. 0 3
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/pdf/CPDFDocumentFragment.java
  8. 35 57
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/voice/CMediaPlayService.java
  9. 307 0
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/compress/CPDFCompressDialog.java
  10. 16 2
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/contenteditor/pdfproperties/CEditTextProperFragment.java
  11. 7 0
      ComPDFKit_Tools/src/main/res/drawable/tools_compress_cancel_btn.xml
  12. 6 0
      ComPDFKit_Tools/src/main/res/drawable/tools_compress_confirm_btn.xml
  13. 10 0
      ComPDFKit_Tools/src/main/res/drawable/tools_edit_text_style_strike_line.xml
  14. 10 0
      ComPDFKit_Tools/src/main/res/drawable/tools_edit_text_style_underline.xml
  15. 59 0
      ComPDFKit_Tools/src/main/res/drawable/tools_ic_pdf.xml
  16. 9 0
      ComPDFKit_Tools/src/main/res/drawable/tools_line_type_squiggly.xml
  17. 9 0
      ComPDFKit_Tools/src/main/res/drawable/tools_line_type_straight_line.xml
  18. 18 0
      ComPDFKit_Tools/src/main/res/drawable/tools_swap.xml
  19. 302 0
      ComPDFKit_Tools/src/main/res/layout/tools_compress_dialog.xml
  20. 47 1
      ComPDFKit_Tools/src/main/res/layout/tools_edit_text_property_fragment.xml
  21. 64 1
      ComPDFKit_Tools/src/main/res/layout/tools_properties_shape_style_fragment.xml
  22. 21 0
      ComPDFKit_Tools/src/main/res/layout/tools_spinner_list_image_item.xml
  23. 16 0
      ComPDFKit_Tools/src/main/res/values/tools_strings.xml
  24. 4 0
      PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/CHomeFunListAdapter.java
  25. 18 0
      PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/HomeFunBean.java
  26. 14 1
      PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/HomeFunFragment.java
  27. 1 1
      PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/datas/FunDatas.java
  28. 81 0
      PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/samples/CompressSamplesImpl.java
  29. 4 0
      PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/samples/SamplesFactory.java
  30. 6 0
      PDFViewer/src/main/res/drawable/bg_fun_item_new.xml
  31. 25 14
      PDFViewer/src/main/res/layout/rv_item_home_fun_item_content.xml
  32. 1 0
      PDFViewer/src/main/res/values/strings.xml
  33. 5 5
      config.gradle

+ 0 - 13
ComPDFKit_Tools/src/main/AndroidManifest.xml

@@ -26,25 +26,12 @@
             android:exported="false"
             android:theme="@style/ComPDFKit.Theme.Dark" />
 
-        <service
-            android:name=".common.utils.voice.CMediaPlayService"
-            android:enabled="true"
-            android:exported="false" />
-
         <activity
             android:name=".common.pdf.CPDFDocumentActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:exported="true"
             android:theme="@style/ComPDFKit.Theme.Light"
             android:windowSoftInputMode="adjustPan">
-<!--            <intent-filter tools:ignore="AppLinkUrlError"-->
-<!--                android:scheme="http">-->
-<!--                <action android:name="android.intent.action.VIEW" />-->
-<!--                <action android:name="android.intent.action.SEND" />-->
-
-<!--                <category android:name="android.intent.category.DEFAULT" />-->
-<!--                <data android:mimeType="application/pdf" />-->
-<!--            </intent-filter>-->
         </activity>
 
     </application>

+ 29 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfshape/CShapeStyleFragment.java

@@ -15,14 +15,19 @@ import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.Spinner;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.appcompat.widget.AppCompatSpinner;
 import androidx.constraintlayout.widget.ConstraintLayout;
 
 import com.compdfkit.core.annotation.CPDFBorderStyle;
 import com.compdfkit.core.annotation.CPDFLineAnnotation;
 import com.compdfkit.tools.R;
+import com.compdfkit.tools.annotation.pdfproperties.pdfshape.adapter.CShapeStyleSpinnerAdapter;
+import com.compdfkit.tools.common.utils.CToastUtil;
 import com.compdfkit.tools.common.utils.view.colorpicker.CColorPickerFragment;
 import com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
@@ -55,6 +60,11 @@ public class CShapeStyleFragment extends CBasicPropertiesFragment {
 
     private CAnnotLineTypePreviewView tailLinePreview;
 
+    private ConstraintLayout clShapeStyle;
+
+    private AppCompatSpinner shapeStyleSpinner;
+
+    private CShapeStyleSpinnerAdapter shapeStyleSpinnerAdapter;
 
     public static CShapeStyleFragment newInstance() {
         return new CShapeStyleFragment();
@@ -74,6 +84,8 @@ public class CShapeStyleFragment extends CBasicPropertiesFragment {
         clTailLineType = rootView.findViewById(R.id.cl_tail_line_type);
         startLinePreview = rootView.findViewById(R.id.preview_start_line);
         tailLinePreview = rootView.findViewById(R.id.preview_tail_line);
+        clShapeStyle = rootView.findViewById(R.id.cl_shape_style);
+        shapeStyleSpinner = rootView.findViewById(R.id.spinner_shape_style);
         return rootView;
     }
 
@@ -104,6 +116,8 @@ public class CShapeStyleFragment extends CBasicPropertiesFragment {
                 borderColorListView.setTitle(R.string.tools_color);
                 clStartLineType.setVisibility(View.VISIBLE);
                 clTailLineType.setVisibility(View.VISIBLE);
+            }else {
+                clShapeStyle.setVisibility(View.VISIBLE);
             }
         }
         viewModel.addStyleChangeListener(this);
@@ -169,6 +183,21 @@ public class CShapeStyleFragment extends CBasicPropertiesFragment {
                 lineTypeFragment.setLineTypeListener(style::setTailLineType);
             });
         });
+
+        shapeStyleSpinnerAdapter = new CShapeStyleSpinnerAdapter(getContext());
+        shapeStyleSpinner.setAdapter(shapeStyleSpinnerAdapter);
+        shapeStyleSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+            @Override
+            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+                CShapeStyleSpinnerAdapter.ShapeStyle shapeStyle = shapeStyleSpinnerAdapter.list.get(position);
+                CToastUtil.showLongToast(getContext(), shapeStyle == CShapeStyleSpinnerAdapter.ShapeStyle.Straight_Line ? "直线" : "曲线");
+            }
+
+            @Override
+            public void onNothingSelected(AdapterView<?> parent) {
+
+            }
+        });
     }
 
     private void updateBorderColor(int color) {

+ 105 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfshape/adapter/CShapeStyleSpinnerAdapter.java

@@ -0,0 +1,105 @@
+/**
+ * Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+ * <p>
+ * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+ * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+ * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ * This notice may not be removed from this file.
+ */
+
+package com.compdfkit.tools.annotation.pdfproperties.pdfshape.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.widget.AppCompatImageView;
+
+import com.compdfkit.tools.R;
+
+import java.util.Arrays;
+import java.util.List;
+
+
+public class CShapeStyleSpinnerAdapter extends BaseAdapter {
+
+    public enum ShapeStyle{
+        Straight_Line,
+
+        Squiggly_Line
+    }
+
+    public List<ShapeStyle> list;
+
+    private Context mContext;
+
+    private ShapeStyle selectStyleType;
+
+    public CShapeStyleSpinnerAdapter(@NonNull Context context) {
+        this.list = Arrays.asList(ShapeStyle.Straight_Line, ShapeStyle.Squiggly_Line);
+        mContext = context;
+    }
+
+    public void setSelectStyleType(ShapeStyle selectStyleType) {
+        this.selectStyleType = selectStyleType;
+    }
+
+    public int getSelectPosition(){
+        if (selectStyleType != null){
+            for (int i = 0; i < list.size(); i++) {
+                ShapeStyle item = list.get(i);
+                if (selectStyleType.equals(item)) {
+                    return i;
+                }
+            }
+        }
+        return 0;
+    }
+
+    public ShapeStyle getSelectShapeType(){
+        if (selectStyleType != null){
+            return selectStyleType;
+        }
+        return ShapeStyle.Straight_Line;
+    }
+
+    @Override
+    public int getCount() {
+        return list.size();
+    }
+
+    @Override
+    public Object getItem(int position) {
+        return list.get(position);
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        CShapeStyleViewHolder holder;
+
+        if (convertView == null){
+            LayoutInflater inflater = LayoutInflater.from(mContext);
+            convertView = inflater.inflate(R.layout.tools_spinner_list_image_item, null);
+            holder = new CShapeStyleViewHolder();
+            holder.ivShapeStyle = convertView.findViewById(R.id.iv_image_menu);
+            convertView.setTag(holder);
+        }else {
+            holder = (CShapeStyleViewHolder) convertView.getTag();
+        }
+        ShapeStyle shapeStyle = list.get(position);
+        holder.ivShapeStyle.setImageResource(shapeStyle == ShapeStyle.Straight_Line ? R.drawable.tools_line_type_straight_line : R.drawable.tools_line_type_squiggly);
+        return convertView;
+    }
+
+    static class CShapeStyleViewHolder{
+        AppCompatImageView ivShapeStyle;
+    }
+}

+ 21 - 49
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfsound/CPlayVoicePopupWindow.java

@@ -11,13 +11,9 @@ package com.compdfkit.tools.annotation.pdfproperties.pdfsound;
 
 import static java.lang.Thread.sleep;
 
-import android.content.ComponentName;
 import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
 import android.media.MediaPlayer;
 import android.os.AsyncTask;
-import android.os.IBinder;
 import android.text.TextUtils;
 import android.view.Gravity;
 import android.view.LayoutInflater;
@@ -31,12 +27,12 @@ import androidx.fragment.app.FragmentActivity;
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.common.utils.viewutils.CDimensUtils;
 import com.compdfkit.tools.common.utils.viewutils.CViewUtils;
-import com.compdfkit.tools.common.utils.voice.CMediaPlayService;
+import com.compdfkit.tools.common.utils.voice.CMediaPlayManager;
 import com.compdfkit.tools.common.utils.window.CBasePopupWindow;
 
 import java.io.File;
 
-public class CPlayVoicePopupWindow extends CBasePopupWindow implements CMediaPlayService.IMediaPlayConstants {
+public class CPlayVoicePopupWindow extends CBasePopupWindow implements CMediaPlayManager.IMediaPlayConstants {
 
     private Context context;
 
@@ -50,9 +46,7 @@ public class CPlayVoicePopupWindow extends CBasePopupWindow implements CMediaPla
 
     AsyncTask<Void, Void, Boolean> updateTask = null;
 
-    CMediaPlayService mediaPlayService = null;
-
-    boolean boundService = false;
+    private CMediaPlayManager mediaPlayManager;
 
     boolean isPlay = false;
 
@@ -61,41 +55,18 @@ public class CPlayVoicePopupWindow extends CBasePopupWindow implements CMediaPla
     private void setPlayState(boolean play) {
         isPlay = play;
         if (isPlay == true) {
-            if (mediaPlayService != null) {
-                mediaPlayService.mediaStart();
+            if (mediaPlayManager != null) {
+                mediaPlayManager.mediaStart();
                 imageState.setImageResource(R.drawable.tools_ic_record_stop);
             }
         } else {
-            if (mediaPlayService != null) {
-                mediaPlayService.mediaPause();
+            if (mediaPlayManager != null) {
+                mediaPlayManager.mediaPause();
                 imageState.setImageResource(R.drawable.tools_ic_play_arrow);
             }
         }
     }
 
-    private ServiceConnection serviceConnection = new ServiceConnection() {
-        @Override
-        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
-            boundService = true;
-            mediaPlayService = ((CMediaPlayService.MyBinder) iBinder).get();
-            if (mediaPlayService != null) {
-                mediaPlayService.setMediaPlayConstants(CPlayVoicePopupWindow.this);
-                mediaPlayService.getMediaPlayer().setOnErrorListener((mediaPlayer, i, i1) -> true);
-                mediaPlayService.setPlayFile(voicePath);
-                mediaPlayService.mediaStart();
-            }
-        }
-
-        @Override
-        public void onServiceDisconnected(ComponentName componentName) {
-            boundService = false;
-            if (mediaPlayService != null) {
-                mediaPlayService.stopSelf();
-            }
-            mediaPlayService = null;
-        }
-    };
-
     public CPlayVoicePopupWindow(Context context, View rootView) {
         super(context);
         setAnimationStyle(R.style.tools_popwindow_anim_style);
@@ -131,13 +102,13 @@ public class CPlayVoicePopupWindow extends CBasePopupWindow implements CMediaPla
     protected void onClickListener(View view) {
         int id = view.getId();
         if (id == R.id.id_voice_recording_iv_state) {
-            isPlay = !(mediaPlayService == null ? false : mediaPlayService.isPlaying());
-            if (mediaPlayService != null) {
+            isPlay = !(mediaPlayManager == null ? false : mediaPlayManager.isPlaying());
+            if (mediaPlayManager != null) {
                 if (isPlay) {
-                    mediaPlayService.mediaStart();
+                    mediaPlayManager.mediaStart();
                     imageState.setImageResource(R.drawable.tools_ic_record_stop);
                 } else {
-                    mediaPlayService.mediaPause();
+                    mediaPlayManager.mediaPause();
                     imageState.setImageResource(R.drawable.tools_ic_play_arrow);
                 }
             } else {
@@ -169,8 +140,8 @@ public class CPlayVoicePopupWindow extends CBasePopupWindow implements CMediaPla
                 while (true) {
                     if (mContext instanceof FragmentActivity) {
                         ((FragmentActivity) mContext).runOnUiThread(() -> {
-                            if (mediaPlayService != null && mediaPlayService.getMediaPlayer() != null) {
-                                tvTimeStart.setText(convert(mediaPlayService.getMediaPlayer().getCurrentPosition()) + "");
+                            if (mediaPlayManager != null && mediaPlayManager.getMediaPlayer() != null) {
+                                tvTimeStart.setText(convert(mediaPlayManager.getMediaPlayer().getCurrentPosition()) + "");
                             }
                         });
                     }
@@ -186,11 +157,12 @@ public class CPlayVoicePopupWindow extends CBasePopupWindow implements CMediaPla
     }
 
     public void show() {
-        if (!boundService) {
-            Intent intent = new Intent(mContext, CMediaPlayService.class);
-            mContext.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
-            startUpdateTask();
-        }
+        mediaPlayManager = new CMediaPlayManager();
+        mediaPlayManager.setMediaPlayConstants(this);
+        mediaPlayManager.getMediaPlayer().setOnErrorListener((mediaPlayer, i, i1) -> true);
+        mediaPlayManager.setPlayFile(voicePath);
+        mediaPlayManager.mediaStart();
+        startUpdateTask();
         if (mContext instanceof FragmentActivity) {
             ((FragmentActivity) mContext).runOnUiThread(() -> {
                 showAtLocation(rootView, Gravity.BOTTOM, 0, CViewUtils.getActionBarSize(rootView.getContext()) + CDimensUtils.dp2px(rootView.getContext(), 32));
@@ -209,8 +181,8 @@ public class CPlayVoicePopupWindow extends CBasePopupWindow implements CMediaPla
         if (!TextUtils.isEmpty(voicePath)) {
             new File(voicePath).delete();
         }
-        if (mediaPlayService != null) {
-            mediaPlayService.onDestroy();
+        if (mediaPlayManager != null) {
+            mediaPlayManager.onDestroy();
         }
         if (updateTask != null) {
             updateTask.cancel(true);

+ 39 - 11
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/basic/fragment/CBasicPDFFragment.java

@@ -11,7 +11,10 @@ package com.compdfkit.tools.common.basic.fragment;
 
 
 import android.net.Uri;
+import android.os.Environment;
+import android.text.TextUtils;
 
+import androidx.documentfile.provider.DocumentFile;
 import androidx.fragment.app.FragmentActivity;
 
 import com.compdfkit.core.annotation.CPDFLinkAnnotation;
@@ -19,6 +22,7 @@ import com.compdfkit.core.annotation.CPDFTextAnnotation;
 import com.compdfkit.core.annotation.form.CPDFComboboxWidget;
 import com.compdfkit.core.annotation.form.CPDFListboxWidget;
 import com.compdfkit.core.annotation.form.CPDFSignatureWidget;
+import com.compdfkit.core.document.CPDFDocument;
 import com.compdfkit.core.edit.CPDFEditPage;
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.annotation.pdfproperties.pdflink.CLinkAnnotAttachHelper;
@@ -32,6 +36,8 @@ import com.compdfkit.tools.common.contextmenu.impl.CSearchReplaceContextMenuView
 import com.compdfkit.tools.common.contextmenu.impl.CSignatureContextMenuView;
 import com.compdfkit.tools.common.pdf.config.CPDFConfiguration;
 import com.compdfkit.tools.common.utils.CFileUtils;
+import com.compdfkit.tools.common.utils.CLog;
+import com.compdfkit.tools.common.utils.CUriUtil;
 import com.compdfkit.tools.common.utils.dialog.CLoadingDialog;
 import com.compdfkit.tools.common.views.pdfview.CPDFViewCtrl;
 import com.compdfkit.tools.common.views.pdfview.CPreviewMode;
@@ -51,9 +57,6 @@ public class CBasicPDFFragment extends CPermissionFragment {
 
     public int curEditMode = CPDFEditPage.LoadNone;
 
-    protected Uri documentUri;
-
-    protected String documentPath;
 
     protected void resetContextMenu(CPDFViewCtrl pdfView, CPreviewMode mode) {
         switch (mode) {
@@ -128,16 +131,41 @@ public class CBasicPDFFragment extends CPermissionFragment {
 
     protected void sharePDF(CPDFViewCtrl pdfView) {
         pdfView.savePDF((filePath, pdfUri) -> {
-            if (null != documentUri) {
-                CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", documentUri);
-            } else {
-                CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", new File(documentPath));
+            if (pdfUri != null && pdfUri.toString().startsWith("content://")){
+                CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", pdfUri);
+                return;
+            }
+            String externalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath();
+            if (!TextUtils.isEmpty(filePath)) {
+                if (filePath.startsWith(getContext().getCacheDir().getAbsolutePath()) ||
+                filePath.startsWith(getContext().getFilesDir().getAbsolutePath())){
+                    CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", new File(filePath));
+                } else if (filePath.startsWith(externalStoragePath)) {
+                    Uri uri = CFileUtils.getUriBySystem(getContext(), new File(filePath));
+                    CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", uri);
+                }
             }
         }, e -> {
-            if (null != documentUri) {
-                CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", documentUri);
-            } else {
-                CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", new File(documentPath));
+
+            CPDFDocument document = pdfView.getCPdfReaderView().getPDFDocument();
+            if (document == null){
+                return;
+            }
+            Uri pdfUri = document.getUri();
+            String filePath = document.getAbsolutePath();
+            if (pdfUri != null && pdfUri.toString().startsWith("content://")){
+                CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", pdfUri);
+                return;
+            }
+            String externalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath();
+            if (!TextUtils.isEmpty(filePath)) {
+                if (filePath.startsWith(getContext().getCacheDir().getAbsolutePath()) ||
+                        filePath.startsWith(getContext().getFilesDir().getAbsolutePath())){
+                    CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", new File(filePath));
+                }else if (filePath.startsWith(externalStoragePath)) {
+                    Uri uri = CFileUtils.getUriBySystem(getContext(), new File(filePath));
+                    CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", uri);
+                }
             }
         });
     }

+ 0 - 5
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/pdf/CPDFApplyConfigUtil.java

@@ -362,20 +362,15 @@ public class CPDFApplyConfigUtil {
         switch (configuration.globalConfig.themeMode) {
             case Light:
                 themeId = R.style.ComPDFKit_Theme_Light;
-                CLog.e("ComPDFKit_Tools", "Theme-getThemeId(Context context, CPDFConfiguration configuration) - Use Light Theme");
                 break;
             case Dark:
                 themeId = R.style.ComPDFKit_Theme_Dark;
-                CLog.e("ComPDFKit_Tools", "Theme-getThemeId(Context context, CPDFConfiguration configuration) - Use Dark Theme");
                 break;
             default:
                 if (CViewUtils.isDarkMode(context)) {
                     themeId = R.style.ComPDFKit_Theme_Dark;
-                    CLog.e("ComPDFKit_Tools", "Theme-getThemeId(Context context, CPDFConfiguration configuration) - Follow the system and use the Dark theme");
-
                 } else {
                     themeId = R.style.ComPDFKit_Theme_Light;
-                    CLog.e("ComPDFKit_Tools", "Theme-getThemeId(Context context, CPDFConfiguration configuration) - Follow the system and use the Light theme");
                 }
                 break;
         }

+ 0 - 3
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/pdf/CPDFDocumentFragment.java

@@ -172,7 +172,6 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
             if (readerView != null && readerView.getContextMenuShowListener() != null) {
                 readerView.getContextMenuShowListener().dismissContextMenu();
             }
-            this.documentUri = uri;
             CFileUtils.takeUriPermission(getContext(), uri);
             pdfView.resetAnnotationType();
             formToolBar.reset();
@@ -270,12 +269,10 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
             String password = getArguments().getString(EXTRA_FILE_PASSWORD);
             if (!TextUtils.isEmpty(getArguments().getString(EXTRA_FILE_PATH))) {
                 String path = getArguments().getString(EXTRA_FILE_PATH);
-                documentPath = path;
                 pdfView.openPDF(path, password, callback);
             } else if (getArguments().getParcelable(EXTRA_FILE_URI) != null) {
                 Uri uri = getArguments().getParcelable(EXTRA_FILE_URI);
                 CFileUtils.takeUriPermission(getContext(), uri);
-                documentUri = uri;
                 pdfView.openPDF(uri, password, callback);
             }
         }

+ 35 - 57
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/voice/CMediaPlayService.java

@@ -6,40 +6,18 @@
  * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  * This notice may not be removed from this file.
  */
-
 package com.compdfkit.tools.common.utils.voice;
 
-import android.app.Service;
-import android.content.Intent;
+
 import android.media.MediaPlayer;
-import android.os.Binder;
-import android.os.IBinder;
 import android.text.TextUtils;
 
-import androidx.annotation.Nullable;
-
-public class CMediaPlayService extends Service implements MediaPlayer.OnCompletionListener {
+public class CMediaPlayManager implements MediaPlayer.OnCompletionListener {
     private IMediaPlayConstants iMediaPlayConstants = null;
-    MyBinder mybinder = new MyBinder();
-
-    static MediaPlayer mMediaPlayer = null;
-
-     public class MyBinder extends Binder {
-        public CMediaPlayService service;
-        public CMediaPlayService get() {
-            return CMediaPlayService.this;
-        }
-    }
 
-    @Nullable
-    @Override
-    public IBinder onBind(Intent intent) {
-        return mybinder;
-    }
+    MediaPlayer mMediaPlayer = null;
 
-    @Override
-    public void onCreate() {
-        super.onCreate();
+    public CMediaPlayManager(){
         createPlayer();
     }
 
@@ -50,25 +28,26 @@ public class CMediaPlayService extends Service implements MediaPlayer.OnCompleti
         return mMediaPlayer;
     }
 
-    private void createPlayer() {
-         try {
-             if (mMediaPlayer != null) {
-                 mMediaPlayer.reset();
-                 mMediaPlayer.release();
-                 mMediaPlayer = null;
-             }
-             mMediaPlayer = new MediaPlayer();
-             mMediaPlayer.setOnCompletionListener(this);
-         } catch (Exception e) {
+    private void createPlayer(){
+        try {
+            if (mMediaPlayer != null) {
+                mMediaPlayer.reset();
+                mMediaPlayer.release();
+                mMediaPlayer = null;
+            }
+            mMediaPlayer = new MediaPlayer();
+            mMediaPlayer.setOnCompletionListener(this);
+        } catch (Exception e) {
             e.printStackTrace();
-         }
+        }
     }
 
+
     public boolean isPlaying() {
-         if (mMediaPlayer == null) {
-             return false;
-         }
-         return mMediaPlayer.isPlaying();
+        if (mMediaPlayer == null) {
+            return false;
+        }
+        return mMediaPlayer.isPlaying();
     }
 
     public void setMediaPlayConstants(IMediaPlayConstants iMediaPlayConstants) {
@@ -76,21 +55,21 @@ public class CMediaPlayService extends Service implements MediaPlayer.OnCompleti
     }
 
     public void setPlayFile(String path) {
-         try {
-             if(mMediaPlayer != null && !TextUtils.isEmpty(path)) {
-                 mMediaPlayer.reset();
-                 mMediaPlayer.setDataSource(path);
-                 mMediaPlayer.prepare();
-             }
+        try {
+            if(mMediaPlayer != null && !TextUtils.isEmpty(path)) {
+                mMediaPlayer.reset();
+                mMediaPlayer.setDataSource(path);
+                mMediaPlayer.prepare();
+            }
         } catch (Exception e) {
 
-         }
+        }
     }
 
     public void mediaStart() {
-         if (mMediaPlayer != null && !isPlaying()) {
-             mMediaPlayer.start();
-         }
+        if (mMediaPlayer != null && !isPlaying()) {
+            mMediaPlayer.start();
+        }
     }
 
     public void mediaPause() {
@@ -107,14 +86,12 @@ public class CMediaPlayService extends Service implements MediaPlayer.OnCompleti
 
     @Override
     public void onCompletion(MediaPlayer mediaPlayer) {
-         if (iMediaPlayConstants != null) {
-             iMediaPlayConstants.onCompletion(mediaPlayer);
-         }
+        if (iMediaPlayConstants != null) {
+            iMediaPlayConstants.onCompletion(mediaPlayer);
+        }
     }
 
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
+    public void onDestroy(){
         if (mMediaPlayer != null) {
             mMediaPlayer.stop();
             mMediaPlayer.release();
@@ -123,6 +100,7 @@ public class CMediaPlayService extends Service implements MediaPlayer.OnCompleti
         iMediaPlayConstants = null;
     }
 
+
     public interface IMediaPlayConstants {
         void onCompletion(MediaPlayer mp);
     }

+ 307 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/compress/CPDFCompressDialog.java

@@ -0,0 +1,307 @@
+/**
+ * Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+ * <p>
+ * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+ * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+ * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ * This notice may not be removed from this file.
+ */
+
+package com.compdfkit.tools.compress;
+
+import android.net.Uri;
+import android.os.Environment;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.CompoundButton;
+import android.widget.RadioGroup;
+
+import androidx.activity.result.ActivityResultLauncher;
+import androidx.appcompat.widget.AppCompatButton;
+import androidx.appcompat.widget.AppCompatEditText;
+import androidx.appcompat.widget.AppCompatRadioButton;
+import androidx.appcompat.widget.AppCompatTextView;
+
+import com.compdfkit.core.document.CPDFDocument;
+import com.compdfkit.tools.R;
+import com.compdfkit.tools.common.basic.fragment.CBasicBottomSheetDialogFragment;
+import com.compdfkit.tools.common.utils.CFileUtils;
+import com.compdfkit.tools.common.utils.CToastUtil;
+import com.compdfkit.tools.common.utils.CUriUtil;
+import com.compdfkit.tools.common.utils.activitycontracts.CSelectPDFDocumentResultContract;
+import com.compdfkit.tools.common.utils.threadpools.CThreadPoolUtils;
+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.compdfkit.ui.reader.CPDFReaderView;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+
+public class CPDFCompressDialog extends CBasicBottomSheetDialogFragment implements View.OnClickListener,
+        CompoundButton.OnCheckedChangeListener {
+
+    private AppCompatTextView tvFileName;
+
+    private AppCompatTextView tvFilePath;
+
+    private CToolBar toolBar;
+
+    private AppCompatTextView tvSwap;
+
+    private AppCompatRadioButton rbQualityLow;
+
+    private AppCompatRadioButton rbQualityStandard;
+
+    private AppCompatRadioButton rbQualityHigh;
+
+    private AppCompatRadioButton rbQualityCustom;
+
+    private AppCompatEditText etCustomQuality;
+
+    private View savePathView;
+
+    private AppCompatButton btnCancel;
+
+    private AppCompatButton btnCompress;
+
+    private AppCompatTextView tvSavePath;
+
+    private CPDFDocument document;
+
+    private List<AppCompatRadioButton> radioButtons = new ArrayList<>();
+
+    private String savePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
+
+    private COnCompressDocumentListener compressDocumentListener;
+
+    private ActivityResultLauncher<Void> selectDocumentLauncher = registerForActivityResult(new CSelectPDFDocumentResultContract(), uri -> {
+        if (uri != null) {
+            verifyDocument(uri, document -> {
+                this.document = document;
+                setDocumentInfo();
+            });
+        }
+    });
+
+    public void setDocument(CPDFDocument document) {
+        this.document = document;
+    }
+
+    @Override
+    protected int getStyle() {
+        int styleId = CViewUtils.getThemeAttrResourceId(getContext().getTheme(), R.attr.compdfkit_BottomSheetDialog_Theme);
+        if (styleId == 0) {
+            styleId = R.style.ComPDFKit_Theme_BottomSheetDialog_Light_Transparent;
+        }
+        return styleId;
+    }
+
+    @Override
+    protected float dimAmount() {
+        return CViewUtils.isLandScape(getContext()) ? 0.2F : 0F;
+    }
+
+    @Override
+    protected boolean draggable() {
+        return false;
+    }
+
+    @Override
+    protected boolean fullScreen() {
+        return true;
+    }
+
+
+    @Override
+    protected int layoutId() {
+        return R.layout.tools_compress_dialog;
+    }
+
+    @Override
+    protected void onCreateView(View rootView) {
+        toolBar = rootView.findViewById(R.id.tool_bar);
+        tvSwap = rootView.findViewById(R.id.tv_swap);
+        tvFileName = rootView.findViewById(R.id.tv_title);
+        tvFilePath = rootView.findViewById(R.id.tv_desc);
+        rbQualityLow = rootView.findViewById(R.id.rb_quality_low);
+        rbQualityStandard = rootView.findViewById(R.id.rb_quality_standard);
+        rbQualityHigh = rootView.findViewById(R.id.rb_quality_high);
+        rbQualityCustom = rootView.findViewById(R.id.rb_quality_custom);
+        etCustomQuality = rootView.findViewById(R.id.et_custom_quality);
+        savePathView = rootView.findViewById(R.id.view_save_path);
+        btnCancel = rootView.findViewById(R.id.btn_cancel);
+        btnCompress = rootView.findViewById(R.id.btn_compress);
+        tvSavePath = rootView.findViewById(R.id.tv_save_path);
+        tvSwap.setOnClickListener(this);
+        btnCompress.setOnClickListener(this);
+        btnCancel.setOnClickListener(this);
+        savePathView.setOnClickListener(this);
+        toolBar.setBackBtnClickListener(v -> {
+            dismiss();
+        });
+        rbQualityLow.setOnCheckedChangeListener(this);
+        rbQualityStandard.setOnCheckedChangeListener(this);
+        rbQualityHigh.setOnCheckedChangeListener(this);
+        rbQualityCustom.setOnCheckedChangeListener(this);
+        radioButtons.addAll(Arrays.asList(rbQualityLow, rbQualityStandard, rbQualityHigh, rbQualityCustom));
+    }
+
+    @Override
+    protected void onViewCreate() {
+        setDocumentInfo();
+        setSavePath(savePath);
+    }
+
+    @Override
+    public void onClick(View v) {
+        if (v.getId() == R.id.tv_swap) {
+            selectDocumentLauncher.launch(null);
+        } else if (v.getId() == R.id.btn_cancel) {
+            dismiss();
+        } else if (v.getId() == R.id.btn_compress) {
+            CThreadPoolUtils.getInstance().executeIO(()->{
+                compressPDF((result, path) -> {
+                    CThreadPoolUtils.getInstance().executeMain(()->{
+                        if (compressDocumentListener != null) {
+                            compressDocumentListener.compress(result, path);
+                        }
+                    });
+                });
+            });
+        } else if (v.getId() == R.id.view_save_path) {
+            String rootDir = Environment.getExternalStorageDirectory().getAbsolutePath();
+            CFileDirectoryDialog dialog = CFileDirectoryDialog.newInstance(rootDir,
+                    getContext().getString(R.string.tools_select_folder),
+                    getContext().getString(R.string.tools_save_to_this_directory));
+            dialog.setSelectFolderListener(this::setSavePath);
+            dialog.show(getChildFragmentManager(), "fileDirectoryDialog");
+        }
+    }
+
+    @Override
+    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+        if (isChecked) {
+            updateRadioButtonStatus(buttonView);
+            if (buttonView.getId() == R.id.rb_quality_custom) {
+                etCustomQuality.setEnabled(true);
+                etCustomQuality.setFocusableInTouchMode(true);
+                etCustomQuality.requestFocus();
+                CViewUtils.showKeyboard(etCustomQuality);
+            } else {
+                etCustomQuality.setFocusableInTouchMode(false);
+                etCustomQuality.setEnabled(false);
+                etCustomQuality.setText("");
+            }
+        }
+    }
+
+    private void updateRadioButtonStatus(CompoundButton checkButton) {
+        checkButton.setChecked(true);
+        for (AppCompatRadioButton radioButton : radioButtons) {
+            if (radioButton.getId() != checkButton.getId()) {
+                radioButton.setChecked(false);
+            }
+        }
+    }
+
+    private void setDocumentInfo() {
+        if (document == null) {
+            return;
+        }
+        tvFileName.setText(document.getFileName());
+        String filePath = document.getAbsolutePath();
+        if (TextUtils.isEmpty(filePath)) {
+            if (document.getUri() != null) {
+                filePath = CUriUtil.getUriData(getContext(), document.getUri());
+            }
+        }
+        tvFilePath.setText(filePath);
+    }
+
+    private void setSavePath(String path) {
+        this.savePath = path;
+        tvSavePath.setText(savePath);
+    }
+
+    private void compressPDF(COnCompressDocumentListener listener) {
+            String newSavePath = CFileUtils.renameNameSuffix(new File(savePath + File.separator + document.getFileName()))
+                    .getAbsolutePath();
+
+            if (rbQualityCustom.isChecked()) {
+                if (TextUtils.isEmpty(etCustomQuality.getText())) {
+                    CToastUtil.showLongToast(getContext(), R.string.tools_please_enter_percentage);
+                    listener.compress(false, null);
+                    return;
+                }
+                int quality = Integer.parseInt(etCustomQuality.getText().toString());
+                try {
+                    boolean result = document.saveAsCompressOptimize(newSavePath, quality);
+                    listener.compress(result, newSavePath);
+                } catch (Exception e) {
+                    listener.compress(false, null);
+                }
+            } else {
+                CPDFDocument.PDFDocumentCompressLevel level;
+                if (rbQualityLow.isChecked()) {
+                    level = CPDFDocument.PDFDocumentCompressLevel.MICRO;
+                } else if (rbQualityStandard.isChecked()) {
+                    level = CPDFDocument.PDFDocumentCompressLevel.STANDARD;
+                } else if (rbQualityHigh.isChecked()) {
+                    level = CPDFDocument.PDFDocumentCompressLevel.HIGH;
+                } else {
+                    level = CPDFDocument.PDFDocumentCompressLevel.STANDARD;
+                }
+                try {
+                    boolean result = document.saveAsCompressOptimize(newSavePath, level);
+                    listener.compress(result, newSavePath);
+                } catch (Exception e) {
+                    listener.compress(false, null);
+                }
+            }
+    }
+
+
+    private void verifyDocument(Uri uri, CVerifyPasswordDialogFragment.CVerifyCompleteListener listener) {
+        CPDFDocument document = new CPDFDocument(getContext());
+        CPDFDocument.PDFDocumentError error = document.open(uri);
+        if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess) {
+            if (listener != null) {
+                listener.complete(document);
+            }
+        } else if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorPassword) {
+            showVerifyPasswordDialog(document, uri, listener);
+        }
+    }
+
+    private void showVerifyPasswordDialog(CPDFDocument document, Uri uri, CVerifyPasswordDialogFragment.CVerifyCompleteListener documentListener) {
+        CVerifyPasswordDialogFragment verifyPasswordDialogFragment;
+        verifyPasswordDialogFragment = CVerifyPasswordDialogFragment.newInstance(document, "", uri);
+        verifyPasswordDialogFragment.setVerifyCompleteListener(document1 -> {
+            if (documentListener != null) {
+                documentListener.complete(document1);
+            }
+        });
+        verifyPasswordDialogFragment.show(getChildFragmentManager(), "verifyPasswordDialog");
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        if (document != null) {
+            document.close();
+        }
+    }
+
+    public interface COnCompressDocumentListener {
+        void compress(boolean result, String path);
+    }
+
+    public void setCompressDocumentListener(COnCompressDocumentListener compressDocumentListener) {
+        this.compressDocumentListener = compressDocumentListener;
+    }
+}

+ 16 - 2
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/contenteditor/pdfproperties/CEditTextProperFragment.java

@@ -47,6 +47,10 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
 
     private CPDFFontView fontView;
 
+    private AppCompatImageView ivStyleUnderLine;
+
+    private AppCompatImageView ivStyleStrikeLine;
+
     private List<View> alignmentViews = new ArrayList<>();
 
     @Override
@@ -70,9 +74,13 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
         ivAlignmentRight = rootView.findViewById(R.id.iv_alignment_right);
         fontSizeSliderBar = rootView.findViewById(R.id.font_size_slider_bar);
         fontView = rootView.findViewById(R.id.font_view);
+        ivStyleUnderLine = rootView.findViewById(R.id.iv_style_underline);
+        ivStyleStrikeLine = rootView.findViewById(R.id.iv_style_strike_line);
         ivAlignmentLeft.setOnClickListener(this);
         ivAlignmentCenter.setOnClickListener(this);
         ivAlignmentRight.setOnClickListener(this);
+        ivStyleUnderLine.setOnClickListener(this);
+        ivStyleStrikeLine.setOnClickListener(this);
         alignmentViews.add(ivAlignmentLeft);
         alignmentViews.add(ivAlignmentCenter);
         alignmentViews.add(ivAlignmentRight);
@@ -149,7 +157,7 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
             if (viewModel != null) {
                 boolean isBold = CPDFTextAttribute.FontNameHelper.isBold(psName);
                 boolean isItalic = CPDFTextAttribute.FontNameHelper.isItalic(psName);
-                CLog.e("字体", "内容编辑:Font:" + psName + ", isBold:"+ isBold +", isItalic:" + isItalic);
+                CLog.e("字体", "内容编辑:Font:" + psName + ", isBold:" + isBold + ", isItalic:" + isItalic);
                 setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.FontType);
                 viewModel.getStyle().setBold(isBold);
                 viewModel.getStyle().setItalic(isItalic);
@@ -161,7 +169,7 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
 
     @Override
     public void onClick(View v) {
-         if (v.getId() == R.id.iv_alignment_left) {
+        if (v.getId() == R.id.iv_alignment_left) {
             selectAlignmentView(ivAlignmentLeft);
             setAlignment(CAnnotStyle.Alignment.LEFT);
         } else if (v.getId() == R.id.iv_alignment_center) {
@@ -170,6 +178,12 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
         } else if (v.getId() == R.id.iv_alignment_right) {
             selectAlignmentView(ivAlignmentRight);
             setAlignment(CAnnotStyle.Alignment.RIGHT);
+        } else if (v.getId() == R.id.iv_style_underline) {
+            ivStyleUnderLine.setSelected(!ivStyleUnderLine.isSelected());
+        } else if (v.getId() == R.id.iv_style_strike_line) {
+            ivStyleStrikeLine.setSelected(!ivStyleStrikeLine.isSelected());
+        } else {
+
         }
     }
 

+ 7 - 0
ComPDFKit_Tools/src/main/res/drawable/tools_compress_cancel_btn.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <solid android:color="?android:attr/colorBackground"/>
+    <stroke android:color="?android:attr/colorAccent" android:width="1dp"/>
+    <corners android:radius="4dp"/>
+</shape>

+ 6 - 0
ComPDFKit_Tools/src/main/res/drawable/tools_compress_confirm_btn.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <solid android:color="?android:attr/colorAccent"/>
+    <corners android:radius="4dp"/>
+</shape>

+ 10 - 0
ComPDFKit_Tools/src/main/res/drawable/tools_edit_text_style_strike_line.xml

@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="17dp"
+    android:height="16dp"
+    android:viewportWidth="17"
+    android:viewportHeight="16">
+  <path
+      android:pathData="M10.832,9.5V11C10.832,12.381 9.713,13.5 8.332,13.5C7.514,13.5 6.788,13.107 6.332,12.5H4.623C5.216,13.966 6.653,15 8.332,15C10.541,15 12.332,13.209 12.332,11V9.5H10.832ZM5.832,6.5V5C5.832,3.619 6.951,2.5 8.332,2.5C9.15,2.5 9.876,2.893 10.332,3.5H12.041C11.448,2.034 10.011,1 8.332,1C6.123,1 4.332,2.791 4.332,5V6.5H5.832ZM2.332,7.25V8.75H14.332V7.25H2.332Z"
+      android:fillColor="#43474D"
+      android:fillType="evenOdd"/>
+</vector>

+ 10 - 0
ComPDFKit_Tools/src/main/res/drawable/tools_edit_text_style_underline.xml

@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="17dp"
+    android:height="16dp"
+    android:viewportWidth="17"
+    android:viewportHeight="16">
+  <path
+      android:pathData="M5.416,7V1H3.916V7C3.916,9.623 6.043,11.75 8.666,11.75C11.289,11.75 13.416,9.623 13.416,7V1H11.916V7C11.916,8.795 10.461,10.25 8.666,10.25C6.871,10.25 5.416,8.795 5.416,7ZM3.666,13.25V14.75H13.666V13.25H3.666Z"
+      android:fillColor="#43474D"
+      android:fillType="evenOdd"/>
+</vector>

Разлика између датотеке није приказан због своје велике величине
+ 59 - 0
ComPDFKit_Tools/src/main/res/drawable/tools_ic_pdf.xml


Разлика између датотеке није приказан због своје велике величине
+ 9 - 0
ComPDFKit_Tools/src/main/res/drawable/tools_line_type_squiggly.xml


+ 9 - 0
ComPDFKit_Tools/src/main/res/drawable/tools_line_type_straight_line.xml

@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="20dp"
+    android:height="20dp"
+    android:viewportWidth="20"
+    android:viewportHeight="20">
+  <path
+      android:pathData="M2,9h17v1.5h-17z"
+      android:fillColor="#43474D"/>
+</vector>

+ 18 - 0
ComPDFKit_Tools/src/main/res/drawable/tools_swap.xml

@@ -0,0 +1,18 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="12dp"
+    android:height="12dp"
+    android:viewportWidth="12"
+    android:viewportHeight="12">
+  <group>
+    <clip-path
+        android:pathData="M0,0h12v12h-12z"/>
+    <path
+        android:pathData="M7.646,1.646C7.842,1.451 8.158,1.451 8.354,1.646L10.354,3.646C10.497,3.789 10.539,4.004 10.462,4.191C10.385,4.378 10.202,4.5 10,4.5H2C1.724,4.5 1.5,4.276 1.5,4C1.5,3.724 1.724,3.5 2,3.5H8.793L7.646,2.354C7.451,2.158 7.451,1.842 7.646,1.646Z"
+        android:fillColor="#1460F3"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M4.354,10.354C4.158,10.549 3.842,10.549 3.646,10.354L1.646,8.354C1.503,8.211 1.461,7.996 1.538,7.809C1.615,7.622 1.798,7.5 2,7.5H10C10.276,7.5 10.5,7.724 10.5,8C10.5,8.276 10.276,8.5 10,8.5H3.207L4.354,9.646C4.549,9.842 4.549,10.158 4.354,10.354Z"
+        android:fillColor="#1460F3"
+        android:fillType="evenOdd"/>
+  </group>
+</vector>

+ 302 - 0
ComPDFKit_Tools/src/main/res/layout/tools_compress_dialog.xml

@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:background="?android:attr/colorBackground"
+    android:layout_height="match_parent">
+
+    <com.compdfkit.tools.common.views.CToolBar
+        android:id="@+id/tool_bar"
+        android:layout_width="match_parent"
+        android:layout_height="56dp"
+        android:textSize="18sp"
+        android:title="@string/tools_compressed"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        app:layout_constraintTop_toBottomOf="@id/tool_bar"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:fillViewport="true">
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:id="@+id/tv_selected_file"
+                android:layout_width="match_parent"
+                android:layout_height="32dp"
+                android:background="?attr/compdfkit_HeadItem_BackgroundColor"
+                android:gravity="center_vertical"
+                android:paddingStart="16dp"
+                android:paddingEnd="16dp"
+                app:layout_constraintTop_toTopOf="parent"
+                android:text="@string/tools_selected_file"
+                android:textColor="?android:attr/textColorPrimary"
+                android:textSize="12sp"/>
+
+            <androidx.appcompat.widget.AppCompatImageView
+                android:layout_width="12dp"
+                android:layout_height="12dp"
+                android:layout_marginEnd="4dp"
+                app:tint="?android:attr/colorAccent"
+                app:layout_constraintBottom_toBottomOf="@id/tv_swap"
+                app:layout_constraintEnd_toStartOf="@id/tv_swap"
+                app:layout_constraintTop_toTopOf="@id/tv_swap"
+                app:srcCompat="@drawable/tools_swap" />
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:id="@+id/tv_swap"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginEnd="16dp"
+                android:background="@drawable/tools_common_btn_corner_ripple"
+                android:text="@string/tools_change"
+                android:textColor="?attr/colorAccent"
+                app:layout_constraintBottom_toBottomOf="@id/tv_selected_file"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintTop_toTopOf="@id/tv_selected_file" />
+
+
+            <androidx.appcompat.widget.AppCompatImageView
+                android:id="@+id/iv_pdf_sample_icon"
+                android:layout_width="30dp"
+                android:layout_height="30dp"
+                android:layout_marginStart="16dp"
+                android:layout_marginTop="18dp"
+                android:src="@drawable/tools_ic_pdf"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="@id/tv_selected_file" />
+
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:id="@+id/tv_title"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="16dp"
+                android:layout_marginEnd="40dp"
+                android:textColor="?android:attr/textColorPrimary"
+                android:textStyle="bold"
+                android:maxLines="2"
+                app:layout_constrainedWidth="true"
+                app:layout_constraintBottom_toTopOf="@id/tv_desc"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0"
+                app:layout_constraintStart_toEndOf="@id/iv_pdf_sample_icon"
+                app:layout_constraintTop_toTopOf="@id/iv_pdf_sample_icon"
+                app:layout_constraintVertical_chainStyle="packed"
+                tools:text="xxx.pdf" />
+
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:id="@+id/tv_desc"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="2dp"
+                android:layout_marginEnd="40dp"
+                android:textColor="@color/tools_text_color_disable"
+                android:textSize="11sp"
+                android:singleLine="true"
+                android:ellipsize="middle"
+                app:layout_constrainedWidth="true"
+                app:layout_constraintBottom_toBottomOf="@id/iv_pdf_sample_icon"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0"
+                app:layout_constraintStart_toStartOf="@id/tv_title"
+                app:layout_constraintTop_toBottomOf="@id/tv_title"
+                tools:text="sdcard/Downloads/compdfkit" />
+
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:id="@+id/tv_compress_quality"
+                android:layout_width="match_parent"
+                android:layout_height="32dp"
+                android:layout_marginTop="18dp"
+                android:background="?attr/compdfkit_HeadItem_BackgroundColor"
+                android:gravity="center_vertical"
+                android:paddingStart="16dp"
+                android:paddingEnd="16dp"
+                android:text="@string/tools_compress_quality"
+                android:textColor="?android:attr/textColorPrimary"
+                android:textSize="12sp"
+                app:layout_constraintTop_toBottomOf="@id/iv_pdf_sample_icon" />
+
+            <LinearLayout
+                android:id="@+id/ll_compress_quality"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingHorizontal="8dp"
+                android:orientation="vertical"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/tv_compress_quality">
+
+                <androidx.appcompat.widget.AppCompatRadioButton
+                    android:id="@+id/rb_quality_low"
+                    android:layout_width="match_parent"
+                    android:layout_height="50dp"
+                    android:checked="false"
+                    android:text="@string/tools_low_quality"
+                    android:textColor="@color/tools_radio_btn_text_status_color" />
+
+                <androidx.appcompat.widget.AppCompatRadioButton
+                    android:id="@+id/rb_quality_standard"
+                    android:layout_width="match_parent"
+                    android:layout_height="50dp"
+                    android:checked="true"
+                    android:text="@string/tools_standard_quality"
+                    android:textColor="@color/tools_radio_btn_text_status_color" />
+
+                <androidx.appcompat.widget.AppCompatRadioButton
+                    android:id="@+id/rb_quality_high"
+                    android:layout_width="match_parent"
+                    android:layout_height="50dp"
+                    android:checked="false"
+                    android:text="@string/tools_high_quality"
+                    android:textColor="@color/tools_radio_btn_text_status_color" />
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content">
+
+                    <androidx.appcompat.widget.AppCompatRadioButton
+                        android:id="@+id/rb_quality_custom"
+                        android:layout_width="wrap_content"
+                        android:layout_height="50dp"
+                        android:text="@string/tools_custom_quality"
+                        android:textColor="@color/tools_radio_btn_text_status_color"
+                         />
+
+                    <androidx.appcompat.widget.AppCompatEditText
+                        android:id="@+id/et_custom_quality"
+                        android:layout_width="wrap_content"
+                        android:layout_height="50dp"
+                        android:layout_marginStart="8dp"
+                        android:focusableInTouchMode="false"
+                        android:gravity="bottom|center_horizontal"
+                        android:hint="@string/tools_please_enter_percentage"
+                        android:inputType="number"
+                        android:paddingHorizontal="8dp"
+                        android:textColorHint="?attr/hintTextColor"
+                        android:textSize="14sp"
+                        app:layout_constraintBaseline_toBaselineOf="@id/rb_quality_custom"
+
+                        app:layout_constraintStart_toEndOf="@id/rb_quality_custom" />
+
+                    <androidx.appcompat.widget.AppCompatTextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="%"
+                        android:textStyle="bold"
+                        app:layout_constraintBaseline_toBaselineOf="@id/et_custom_quality"
+                        app:layout_constraintStart_toEndOf="@id/et_custom_quality" />
+
+                </LinearLayout>
+
+            </LinearLayout>
+
+
+            <View
+                android:id="@+id/line1"
+                android:layout_width="match_parent"
+                android:layout_height="20dp"
+                android:background="?attr/compdfkit_HeadItem_BackgroundColor"
+                app:layout_constraintTop_toBottomOf="@id/ll_compress_quality" />
+
+            <View
+                android:id="@+id/view_save_path"
+                android:layout_width="match_parent"
+                android:layout_height="52dp"
+                app:layout_constraintTop_toBottomOf="@id/line1"
+                android:foreground="@drawable/tools_common_btn_rectangle_ripple"
+                />
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:id="@+id/tv_save_path_title"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/tools_save_path"
+                app:layout_constraintTop_toBottomOf="@id/line1"
+                app:layout_constraintStart_toStartOf="parent"
+                android:layout_marginStart="16dp"
+                android:layout_marginTop="16dp"
+                android:textColor="?android:attr/textColorPrimary"
+                android:textSize="14sp"
+                />
+
+            <androidx.appcompat.widget.AppCompatImageView
+                android:id="@+id/iv_arrow"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                app:srcCompat="@drawable/tools_ic_pageedit_arrow_right"
+                app:layout_constraintEnd_toEndOf="parent"
+                android:layout_marginEnd="16dp"
+                app:layout_constraintTop_toTopOf="@id/tv_save_path_title"
+                app:layout_constraintBottom_toBottomOf="@id/tv_save_path_title"
+                />
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:id="@+id/tv_save_path"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="?android:attr/textColorPrimary"
+                tools:text="C:\\Users\\Downloads"
+                android:layout_marginStart="16dp"
+                android:ellipsize="start"
+                android:singleLine="true"
+                android:layout_marginEnd="8dp"
+                app:layout_constraintEnd_toStartOf="@id/iv_arrow"
+                app:layout_constraintBaseline_toBaselineOf="@id/tv_save_path_title"
+                app:layout_constraintStart_toEndOf="@id/tv_save_path_title"
+                app:layout_constraintHorizontal_bias="1"
+                app:layout_constrainedWidth="true"
+                android:textSize="13sp"
+                />
+            
+            <androidx.appcompat.widget.AppCompatButton
+                android:layout_width="0dp"
+                android:layout_height="0dp"
+                app:layout_constraintDimensionRatio="156:48"
+                app:layout_constraintTop_toBottomOf="@id/tv_save_path_title"
+                app:layout_constraintStart_toStartOf="parent"
+                android:layout_marginStart="16dp"
+                app:layout_constraintEnd_toStartOf="@id/btn_compress"
+                android:id="@+id/btn_cancel"
+                android:layout_marginTop="32dp"
+                android:text="@string/tools_cancel"
+                android:foreground="@drawable/tools_common_btn_corner_ripple"
+                android:textColor="?android:attr/colorAccent"
+                android:textAllCaps="false"
+                android:background="@drawable/tools_compress_cancel_btn"
+                />
+
+            <androidx.appcompat.widget.AppCompatButton
+                android:layout_width="0dp"
+                android:layout_height="0dp"
+                app:layout_constraintDimensionRatio="156:48"
+                app:layout_constraintTop_toTopOf="@id/btn_cancel"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toEndOf="@id/btn_cancel"
+                app:layout_constraintBottom_toBottomOf="@id/btn_cancel"
+                android:id="@+id/btn_compress"
+                android:layout_marginEnd="16dp"
+                android:layout_marginStart="16dp"
+                android:textAllCaps="false"
+                android:textColor="@android:color/white"
+                android:background="@drawable/tools_compress_confirm_btn"
+                android:text="@string/tools_compress"
+                />
+
+        </androidx.constraintlayout.widget.ConstraintLayout>
+    </ScrollView>
+
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 47 - 1
ComPDFKit_Tools/src/main/res/layout/tools_edit_text_property_fragment.xml

@@ -109,6 +109,52 @@
 
         </LinearLayout>
 
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tv_text_style"
+            style="@style/tools_style_fragment_sub_title_style"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="18dp"
+            android:text="@string/tools_style_title"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/ll_alignment_type" />
+
+        <LinearLayout
+            android:id="@+id/ll_style_type"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="16dp"
+            android:background="@drawable/tools_annotation_font_alignment_root_bg"
+            android:orientation="horizontal"
+            app:layout_constraintBottom_toBottomOf="@id/tv_text_style"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="@id/tv_text_style">
+
+
+            <androidx.appcompat.widget.AppCompatImageView
+                android:id="@+id/iv_style_underline"
+                android:layout_width="49dp"
+                android:layout_height="32dp"
+                android:background="@drawable/tools_annotation_font_alignment_bg"
+                android:button="@null"
+                android:padding="8dp"
+                android:textSize="0sp"
+                app:tint="@color/tools_font_style_iv_color"
+                app:srcCompat="@drawable/tools_edit_text_style_underline" />
+
+            <androidx.appcompat.widget.AppCompatImageView
+                android:id="@+id/iv_style_strike_line"
+                android:layout_width="49dp"
+                android:layout_height="32dp"
+                android:background="@drawable/tools_annotation_font_alignment_bg"
+                android:padding="8dp"
+                app:tint="@color/tools_font_style_iv_color"
+                app:srcCompat="@drawable/tools_edit_text_style_strike_line" />
+
+        </LinearLayout>
+
+
+
         <com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar
             android:id="@+id/font_size_slider_bar"
             android:layout_width="match_parent"
@@ -116,7 +162,7 @@
             android:layout_marginTop="16dp"
             android:max="100"
             android:progress="1"
-            app:layout_constraintTop_toBottomOf="@id/tv_align_type"
+            app:layout_constraintTop_toBottomOf="@id/tv_text_style"
             app:tools_slider_bar_value_show_type="source"
             android:title="@string/tools_annot_font_size" />
 

+ 64 - 1
ComPDFKit_Tools/src/main/res/layout/tools_properties_shape_style_fragment.xml

@@ -71,13 +71,76 @@
             app:tools_slider_bar_value_show_type="source"
            android:title="@string/tools_thickness" />
 
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/cl_shape_style"
+            android:layout_width="match_parent"
+            android:layout_height="56dp"
+            android:visibility="gone"
+            android:background="@drawable/tools_common_btn_rectangle_ripple"
+            app:layout_constraintTop_toBottomOf="@id/slider_bar_border_width"
+            tools:visibility="visible">
+
+            <androidx.appcompat.widget.AppCompatTextView
+                style="@style/tools_style_fragment_sub_title_style"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="0dp"
+                android:text="@string/tools_line_type"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent" />
+
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                app:layout_constraintBottom_toBottomOf="parent"
+                android:background="@drawable/tools_style_preview_bg"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                android:layout_marginEnd="16dp"
+                >
+
+                <androidx.appcompat.widget.AppCompatSpinner
+                    android:id="@+id/spinner_shape_style"
+                    android:layout_width="72dp"
+                    android:layout_height="28dp"
+                    android:spinnerMode="dropdown"
+                    android:background="@drawable/tools_style_preview_bg"
+                    android:dropDownSelector="?attr/colorPrimary"
+                    android:popupBackground="@drawable/tools_common_window_bg"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    />
+
+                <androidx.appcompat.widget.AppCompatImageView
+                    android:layout_width="16dp"
+                    android:layout_height="16dp"
+                    android:layout_marginEnd="8dp"
+                    app:layout_constraintVertical_bias="0.45"
+                    app:srcCompat="@drawable/tools_ic_pageedit_arrow_down"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintEnd_toEndOf="parent"
+
+                    />
+
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
+
+
+
+
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+
         <com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar
             android:id="@+id/dashed_slider_bar"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:max="10"
             android:progress="0"
-            app:layout_constraintTop_toBottomOf="@id/slider_bar_border_width"
+            app:layout_constraintTop_toBottomOf="@id/cl_shape_style"
             app:layout_goneMarginBottom="8dp"
             app:tools_value_unit="pt"
             app:tools_slider_bar_value_show_type="source"

+ 21 - 0
ComPDFKit_Tools/src/main/res/layout/tools_spinner_list_image_item.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/ll_root"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:foreground="@drawable/tools_common_btn_rectangle_ripple"
+    android:gravity="center_vertical">
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/iv_image_menu"
+        android:layout_width="match_parent"
+        android:layout_height="48dp"
+        android:gravity="center_vertical"
+        android:layout_marginEnd="16dp"
+        app:srcCompat="@drawable/tools_line_type_straight_line"
+        android:padding="8dp"
+        />
+
+</LinearLayout>
+

+ 16 - 0
ComPDFKit_Tools/src/main/res/values/tools_strings.xml

@@ -527,4 +527,20 @@
 
     <string name="tools_exit">Exit</string>
 
+<!--    v2.2.0 -->
+    <string name="tools_style_title">Style</string>
+    <string name="tools_line_type">Line Type</string>
+    <string name="tools_compressed">Compressed</string>
+    <string name="tools_compress">Compress</string>
+    <string name="tools_selected_file">Selected File</string>
+    <string name="tools_compress_quality">Compress Quality</string>
+    <string name="tools_change">Change</string>
+    <string name="tools_low_quality">Low Quality</string>
+    <string name="tools_standard_quality">Standard Quality</string>
+    <string name="tools_high_quality">High Quality</string>
+    <string name="tools_custom_quality">Custom</string>
+    <string name="tools_please_enter_percentage">Please enter percentage</string>
+    <string name="tools_save_path">Saving Path</string>
+    <string name="tools_compressed_successfully">Compressed successfully!</string>
+
 </resources>

+ 4 - 0
PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/CHomeFunListAdapter.java

@@ -53,11 +53,15 @@ public class CHomeFunListAdapter extends CBaseQuickAdapter<HomeFunBean, CBaseQui
                 holder.setText(R.id.tv_desc, lastModifyTime + "  " + fileSize);
                 holder.setVisible(R.id.iv_pdf_sample_icon, true);
                 holder.setVisible(R.id.iv_icon, false);
+                holder.setVisible(R.id.tv_new, false);
+
             }else {
                 holder.setText(R.id.tv_desc, item.getDescription());
                 holder.setImageResource(R.id.iv_icon, item.getIconResId());
                 holder.setVisible(R.id.iv_pdf_sample_icon, false);
                 holder.setVisible(R.id.iv_icon, true);
+                holder.setVisible(R.id.tv_new, item.isNew());
+
             }
         }
     }

+ 18 - 0
PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/HomeFunBean.java

@@ -63,6 +63,8 @@ public class HomeFunBean {
 
     private String filePath;
 
+    private boolean isNew;
+
     public HomeFunBean(Context context, FunType funType, @DrawableRes int icon, @StringRes int title, @StringRes int description) {
         this.type = funType;
         this.iconResId = icon;
@@ -70,6 +72,14 @@ public class HomeFunBean {
         this.description = context.getString(description);
     }
 
+    public HomeFunBean(Context context, FunType funType, @DrawableRes int icon, @StringRes int title, @StringRes int description, boolean isNew) {
+        this.type = funType;
+        this.iconResId = icon;
+        this.title = context.getString(title);
+        this.description = context.getString(description);
+        this.isNew = isNew;
+    }
+
     public HomeFunBean() {
 
     }
@@ -137,4 +147,12 @@ public class HomeFunBean {
     public String getFilePath() {
         return filePath;
     }
+
+    public boolean isNew() {
+        return isNew;
+    }
+
+    public void setNew(boolean aNew) {
+        isNew = aNew;
+    }
 }

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

@@ -14,6 +14,7 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.activity.result.ActivityResultLauncher;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
@@ -22,8 +23,13 @@ import androidx.recyclerview.widget.LinearLayoutManager;
 import com.compdfkit.pdfviewer.R;
 import com.compdfkit.pdfviewer.databinding.FragmentHomeBinding;
 import com.compdfkit.pdfviewer.home.datas.FunDatas;
+import com.compdfkit.pdfviewer.home.samples.SamplesFactory;
 import com.compdfkit.tools.common.pdf.CPDFDocumentActivity;
+import com.compdfkit.tools.common.utils.CFileUtils;
+import com.compdfkit.tools.common.utils.activitycontracts.CSelectPDFDocumentResultContract;
+import com.compdfkit.tools.common.views.CVerifyPasswordDialogFragment;
 import com.compdfkit.tools.common.views.pdfview.CPreviewMode;
+import com.compdfkit.ui.reader.CPDFReaderView;
 import com.compdfkit.ui.utils.CPDFCommomUtils;
 
 
@@ -33,6 +39,13 @@ public class HomeFunFragment extends Fragment {
 
     private FragmentHomeBinding binding;
 
+    private ActivityResultLauncher<Void> selectDocumentLauncher = registerForActivityResult(new CSelectPDFDocumentResultContract(), uri -> {
+        if (uri != null) {
+            SamplesFactory factory = new SamplesFactory(this, "", uri);
+            factory.getImpl(HomeFunBean.FunType.Compress).run();
+        }
+    });
+
     @Nullable
     @Override
     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -81,7 +94,7 @@ public class HomeFunFragment extends Fragment {
                     CPDFCommomUtils.gotoWebsite(getContext(), getString(R.string.tools_compdf_conversion_url), null);
                     break;
                 case Compress:
-                    CPDFCommomUtils.gotoWebsite(getContext(), getString(R.string.tools_contact_sales_url), null);
+                    selectDocumentLauncher.launch(null);
                     break;
                 case Measurement:
                     CPDFCommomUtils.gotoWebsite(getContext(), getString(R.string.tools_contact_sales_url), null);

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

@@ -41,7 +41,7 @@ public class FunDatas {
                 new HomeFunBean(context, HomeFunBean.FunType.Watermark, R.drawable.ic_fun_watermark, R.string.tools_fun_watermark, R.string.tools_fun_watermark_desc),
                 new HomeFunBean(context, HomeFunBean.FunType.CompareDocuments, R.drawable.ic_fun_compare_documents, R.string.tools_fun_compare_documents, R.string.tools_fun_compare_documents_desc),
                 new HomeFunBean(context, HomeFunBean.FunType.Conversion, R.drawable.ic_fun_conversion, R.string.tools_fun_conversion, R.string.tools_fun_conversion_desc),
-                new HomeFunBean(context, HomeFunBean.FunType.Compress, R.drawable.ic_fun_compress, R.string.tools_fun_compress, R.string.tools_fun_compress_desc),
+                new HomeFunBean(context, HomeFunBean.FunType.Compress, R.drawable.ic_fun_compress, R.string.tools_fun_compress, R.string.tools_fun_compress_desc, true),
                 new HomeFunBean(context, HomeFunBean.FunType.Measurement, R.drawable.ic_fun_mesurement, R.string.tools_fun_measurement, R.string.tools_fun_measurement_desc),
                 HomeFunBean.head(context, R.string.tools_click_to_open_process),
                 HomeFunBean.assetsFile(context, "ComPDFKit_Sample_File_Android.pdf", context.getString(R.string.tools_compdfkit_sample_file_android))

+ 81 - 0
PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/samples/CompressSamplesImpl.java

@@ -0,0 +1,81 @@
+/**
+ * Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+ * <p>
+ * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+ * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+ * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ * This notice may not be removed from this file.
+ */
+
+package com.compdfkit.pdfviewer.home.samples;
+
+
+import android.net.Uri;
+import android.text.TextUtils;
+
+import androidx.fragment.app.Fragment;
+
+import com.compdfkit.core.document.CPDFDocument;
+import com.compdfkit.pdfviewer.R;
+import com.compdfkit.pdfviewer.home.HomeFunBean;
+import com.compdfkit.pdfviewer.home.datas.FunDatas;
+import com.compdfkit.tools.common.pdf.CPDFDocumentActivity;
+import com.compdfkit.tools.common.utils.CToastUtil;
+import com.compdfkit.tools.common.views.CVerifyPasswordDialogFragment;
+import com.compdfkit.tools.common.views.pdfview.CPreviewMode;
+import com.compdfkit.tools.compress.CPDFCompressDialog;
+
+
+public class CompressSamplesImpl extends OpenPDFSamplesImpl {
+
+    public CompressSamplesImpl(Fragment fragment, HomeFunBean.FunType funType) {
+        super(fragment, funType);
+    }
+
+    @Override
+    public void run() {
+        verifyDocument(filePath, uri, document -> {
+            CPDFCompressDialog compressDialog = new CPDFCompressDialog();
+            compressDialog.setDocument(document);
+            compressDialog.setCompressDocumentListener((result, path) -> {
+                compressDialog.dismiss();
+                if (result && !TextUtils.isEmpty(path)){
+                    CPDFDocumentActivity.startActivity(fragment.getContext(), path, "",
+                            FunDatas.getConfiguration(fragment.getContext(), CPreviewMode.Viewer));
+                    CToastUtil.showLongToast(fragment.getContext(), R.string.tools_compressed_successfully);
+                }
+            });
+            compressDialog.show(fragment.getChildFragmentManager(), "compressedDialog");
+        });
+    }
+
+
+    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");
+    }
+
+}

+ 4 - 0
PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/samples/SamplesFactory.java

@@ -40,6 +40,10 @@ public class SamplesFactory {
                 WatermarkSamplesImpl watermarkSamples = new WatermarkSamplesImpl(fragment, funType);
                 watermarkSamples.setPDFFile(filePath, uri, null);
                 return watermarkSamples;
+            case Compress:
+                CompressSamplesImpl compressSamples = new CompressSamplesImpl(fragment, funType);
+                compressSamples.setPDFFile(filePath, uri, null);
+                return compressSamples;
             default:
                 // Viewer、Annotations、Forms、Signatures、DocumentEditor、ContentEditor
                 // open pdf activity show pdf file

+ 6 - 0
PDFViewer/src/main/res/drawable/bg_fun_item_new.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <solid android:color="#00CF85"/>
+    <corners android:radius="3dp"/>
+</shape>

+ 25 - 14
PDFViewer/src/main/res/layout/rv_item_home_fun_item_content.xml

@@ -11,21 +11,20 @@
         android:id="@+id/iv_pdf_sample_icon"
         android:layout_width="30dp"
         android:layout_height="30dp"
-        app:srcCompat="@drawable/ic_fun_samples_pdf"
+        android:layout_marginStart="16dp"
+        android:visibility="gone"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"
-        android:layout_marginStart="16dp"
-        android:visibility="gone"
-        />
+        app:srcCompat="@drawable/ic_fun_samples_pdf" />
 
     <androidx.appcompat.widget.AppCompatImageView
         android:id="@+id/iv_icon"
         android:layout_width="30dp"
         android:layout_height="30dp"
-        android:padding="4dp"
-        android:background="@drawable/bg_fun_icon"
         android:layout_marginStart="16dp"
+        android:background="@drawable/bg_fun_icon"
+        android:padding="4dp"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"
@@ -36,38 +35,51 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         app:barrierDirection="end"
-        app:constraint_referenced_ids="iv_icon,iv_pdf_sample_icon"
-        />
+        app:constraint_referenced_ids="iv_icon,iv_pdf_sample_icon" />
 
     <androidx.appcompat.widget.AppCompatTextView
         android:id="@+id/tv_title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginStart="16dp"
+        android:layout_marginEnd="40dp"
         android:textColor="?android:attr/textColorPrimary"
         android:textStyle="bold"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0"
-        android:layout_marginEnd="40dp"
         app:layout_constrainedWidth="true"
         app:layout_constraintBottom_toTopOf="@id/tv_desc"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0"
         app:layout_constraintStart_toEndOf="@id/barrier"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintVertical_chainStyle="packed"
         tools:text="Viewer" />
 
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_new"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="8dp"
+        android:background="@drawable/bg_fun_item_new"
+        android:paddingHorizontal="4dp"
+        android:text="@string/tools_new"
+        android:textColor="@android:color/white"
+        android:textSize="12sp"
+        app:layout_constraintTop_toTopOf="@id/tv_title"
+        app:layout_constraintBottom_toBottomOf="@id/tv_title"
+        app:layout_constraintStart_toEndOf="@id/tv_title" />
+
     <androidx.appcompat.widget.AppCompatTextView
         android:id="@+id/tv_desc"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginTop="4dp"
+        android:layout_marginEnd="40dp"
         android:textColor="@color/tools_text_color_disable"
         android:textSize="11sp"
         app:layout_constrainedWidth="true"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintHorizontal_bias="0"
-        android:layout_marginEnd="40dp"
         app:layout_constraintStart_toStartOf="@id/tv_title"
         app:layout_constraintTop_toBottomOf="@id/tv_title"
         tools:text="The viewer offers various display modes,PDF" />
@@ -80,7 +92,6 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toTopOf="parent"
-        app:tint="?attr/colorOnPrimary"
-         />
+        app:tint="?attr/colorOnPrimary" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 0
PDFViewer/src/main/res/values/strings.xml

@@ -69,4 +69,5 @@
     <string name="the_fonts_data_is_saved_with_the_file">The fonts data is saved with the file</string>
     <string name="tools_annotation_author">Annotation Author:</string>
     <string name="tools_default_annotation_author_name">Guest</string>
+    <string name="tools_new">New</string>
 </resources>

+ 5 - 5
config.gradle

@@ -1,12 +1,12 @@
 ext {
     android = [
-            COMPILESDK: 33,
+            COMPILESDK: 34,
             MINSDK: 21,
-            TARGETSDK: 33,
-            VERSIONCODE: 1015
+            TARGETSDK: 34,
+            VERSIONCODE: 1016
     ]
     sdk = [
-            COMPDFKIT_SDK_VERSION : "2.1.3",
-            COMPDFKIT_SDK_BUILD_TAG : "build_dev_2.1.2_32064baa5_202408091526"
+            COMPDFKIT_SDK_VERSION : "2.2.0",
+            COMPDFKIT_SDK_BUILD_TAG : "build_dev_2.2.0_32064baa5_202408091526"
     ]
 }