Pārlūkot izejas kodu

PDFTool(Android) - 优化混淆,不混淆方法参数名,删除无效文件、引用

liuxiaolong 2 mēneši atpakaļ
vecāks
revīzija
efe3216a0a
19 mainītis faili ar 6 papildinājumiem un 235 dzēšanām
  1. 1 0
      ComPDFKit_Tools/build.gradle
  2. 1 14
      ComPDFKit_Tools/proguard-rules.pro
  3. 0 3
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/pdf/CPDFDocumentFragment.java
  4. 0 2
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/annotation/CPDFAnnotationManager.java
  5. 0 1
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/glide/CPDFFether.java
  6. 0 1
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/glide/CPDFModelLoader.java
  7. 0 1
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfview/CPDFViewCtrl.java
  8. 0 1
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/forms/pdfformbar/CFormToolbar.java
  9. 0 7
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/viewer/pdfthumbnail/adpater/CPDFEditThumbnailListAdapter.java
  10. 0 15
      ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_highlight_default_bg.xml
  11. 0 14
      ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_ink_default_bg.xml
  12. 0 14
      ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_squiggly_default_bg.xml
  13. 0 14
      ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_strikeout_default_bg.xml
  14. 0 14
      ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_underline_default_bg.xml
  15. 0 106
      ComPDFKit_Tools/src/main/res/layout/tools_annot_reply_details_annot_content.xml
  16. 4 2
      ComPDFKit_Tools/src/main/res/layout/tools_color_list_item.xml
  17. 0 1
      ComPDFKit_Tools/src/main/res/layout/tools_properties_stamp_text_stamp_list_item.xml
  18. 0 20
      ComPDFKit_Tools/src/main/res/menu/tools_bota_dialog_annotation_list_menu.xml
  19. 0 5
      PDFViewer/src/main/java/com/compdfkit/pdfviewer/home/HomeActivity.java

+ 1 - 0
ComPDFKit_Tools/build.gradle

@@ -31,6 +31,7 @@ android {
 
         consumerProguardFiles "proguard-rules.pro"
         setProperty("archivesBaseName", "ComPDFKit_Tools")
+        vectorDrawables.useSupportLibrary = true
     }
 
     buildTypes {

+ 1 - 14
ComPDFKit_Tools/proguard-rules.pro

@@ -22,8 +22,6 @@
 -keepattributes InnerClasses
 # 指定代码的压缩级别 0 - 7(指定代码进行迭代优化的次数,在Android里面默认是5,这条指令也只有在可以优化时起作用。)
 -optimizationpasses 5
-# 混淆时不会产生形形色色的类名(混淆时不使用大小写混合类名)
-#-dontusemixedcaseclassnames
 # 指定不去忽略非公共的库类(不跳过library中的非public的类)
 -dontskipnonpubliclibraryclasses
 # 指定不去忽略包可见的库类的成员
@@ -56,13 +54,7 @@
 -verbose
 
 -keepattributes InnerClasses
-
-# 枚举类不能被混淆
-#-keepclassmembers enum * {
-#    public static **[] values();
-#    public static ** valueOf(java.lang.String);
-#}
-
+-keepparameternames
 
 -keepattributes Signature #泛型
 #native方法不混淆
@@ -100,11 +92,6 @@
 -keep enum com.compdfkit.ui.proxy.**{*;}
 -keep interface com.compdfkit.ui.proxy.**{*;}
 
-#不能除去混淆,所有内部逻辑全在里面,防止外部浏览后能知道我们的逻辑和做法
-#-keep class com.compdfkit.ui.internal.**{*;}
-#-keep enum com.compdfkit.ui.internal.**{*;}
-#-keep interface com.compdfkit.ui.internal.**{*;}
-
 -keep class com.compdfkit.ui.edit.**{*;}
 -keep enum com.compdfkit.ui.edit.**{*;}
 -keep interface com.compdfkit.ui.edit.**{*;}

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

@@ -36,13 +36,10 @@ import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.constraintlayout.widget.ConstraintLayout;
 import androidx.core.content.ContextCompat;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentActivity;
 
 import com.compdfkit.core.annotation.CPDFAnnotation;
 import com.compdfkit.core.annotation.form.CPDFSignatureWidget;
 import com.compdfkit.core.document.CPDFDocument;
-import com.compdfkit.core.document.CPDFSdk;
 import com.compdfkit.core.edit.CPDFEditConfig;
 import com.compdfkit.core.edit.CPDFEditManager;
 import com.compdfkit.core.edit.CPDFEditPage;

+ 0 - 2
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/annotation/CPDFAnnotationManager.java

@@ -16,7 +16,6 @@ import android.graphics.BitmapFactory;
 import android.graphics.Matrix;
 import android.graphics.PointF;
 import android.graphics.RectF;
-import android.media.ExifInterface;
 
 import androidx.fragment.app.FragmentActivity;
 import androidx.fragment.app.FragmentManager;
@@ -42,7 +41,6 @@ import com.compdfkit.tools.annotation.pdfannotationlist.dialog.CPDFReplyDetailsD
 import com.compdfkit.tools.annotation.pdfproperties.pdfnote.CNoteEditDialog;
 import com.compdfkit.tools.common.contextmenu.CPDFContextMenuHelper;
 import com.compdfkit.tools.common.utils.CUriUtil;
-import com.compdfkit.tools.common.utils.image.CBitmapUtil;
 import com.compdfkit.tools.common.views.pdfproperties.action.CActionEditDialogFragment;
 import com.compdfkit.tools.forms.pdfproperties.option.edit.CFormOptionEditFragment;
 import com.compdfkit.ui.attribute.CPDFFreetextAttr;

+ 0 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/glide/CPDFFether.java

@@ -21,7 +21,6 @@ import com.bumptech.glide.load.DataSource;
 import com.bumptech.glide.load.data.DataFetcher;
 import com.bumptech.glide.request.target.Target;
 import com.compdfkit.core.document.CPDFDocument;
-import com.compdfkit.tools.common.utils.CLog;
 import com.compdfkit.tools.common.utils.glide.wrapper.impl.CPDFDocumentPageWrapper;
 
 class CPDFFether implements DataFetcher<Bitmap> {

+ 0 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/glide/CPDFModelLoader.java

@@ -2,7 +2,6 @@ package com.compdfkit.tools.common.utils.glide;
 
 import android.content.Context;
 import android.graphics.Bitmap;
-import android.util.Log;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;

+ 0 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfview/CPDFViewCtrl.java

@@ -16,7 +16,6 @@ import android.net.Uri;
 import android.os.Handler;
 import android.os.Looper;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;

+ 0 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/forms/pdfformbar/CFormToolbar.java

@@ -14,7 +14,6 @@ import android.content.Context;
 import android.os.Handler;
 import android.os.Looper;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.widget.FrameLayout;
 import android.widget.LinearLayout;

+ 0 - 7
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/viewer/pdfthumbnail/adpater/CPDFEditThumbnailListAdapter.java

@@ -8,29 +8,22 @@
  */
 package com.compdfkit.tools.viewer.pdfthumbnail.adpater;
 
-import android.content.Context;
 import android.content.res.Configuration;
 import android.graphics.RectF;
-import android.graphics.drawable.Drawable;
 import android.os.AsyncTask;
-import android.util.Log;
 import android.util.SparseIntArray;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
 import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
 import androidx.appcompat.widget.AppCompatImageView;
 import androidx.appcompat.widget.AppCompatTextView;
 import androidx.constraintlayout.widget.ConstraintLayout;
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.bumptech.glide.Glide;
-import com.bumptech.glide.RequestBuilder;
 import com.bumptech.glide.load.engine.DiskCacheStrategy;
-import com.bumptech.glide.request.target.CustomTarget;
-import com.bumptech.glide.request.transition.Transition;
 import com.compdfkit.core.document.CPDFDocument;
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.common.interfaces.COnSetPDFDisplayPageIndexListener;

+ 0 - 15
ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_highlight_default_bg.xml

@@ -1,15 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24"
-    android:viewportHeight="24">
-
-    <path
-        android:pathData="M24,0H0V24H24V0ZM22,4H4L2,20H20L22,4Z"
-        android:fillColor="#FFFFFF"
-        android:fillType="evenOdd"/>
-    <path
-        android:pathData="M17.6078,17.5L12.6964,5.2215H11.3036L6.3922,17.5H5V18.5H9V17.5H8.0078L9.1077,14.75H14.8923L15.9922,17.5H15V18.5H19V17.5H17.6078ZM14.4923,13.75L12,7.519L9.5077,13.75H14.4923Z"
-        android:fillColor="#43474D"
-        android:fillType="evenOdd"/>
-</vector>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 14
ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_ink_default_bg.xml


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 14
ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_squiggly_default_bg.xml


+ 0 - 14
ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_strikeout_default_bg.xml

@@ -1,14 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24"
-    android:viewportHeight="24">
-    <path
-        android:pathData="M24,0H0V24H24V0ZM22,12.5H2V14H22V12.5Z"
-        android:fillColor="#FFFFFF"
-        android:fillType="evenOdd"/>
-    <path
-        android:pathData="M15.2143,17.3929H16.3494L14.9923,14H16.6078L17.9649,17.3929H19.5V18.3929H15.2143V17.3929ZM16.0078,12.5H14.3923L12,6.519L9.6077,12.5H7.9922L11.3036,4.2215H12.6964L16.0078,12.5ZM7.3922,14L6.0351,17.3929H4.5V18.3929H8.7857V17.3929H7.6506L9.0077,14H7.3922Z"
-        android:fillColor="#43474D"
-        android:fillType="evenOdd"/>
-</vector>

+ 0 - 14
ComPDFKit_Tools/src/main/res/drawable/tools_ic_annotation_underline_default_bg.xml

@@ -1,14 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24"
-    android:viewportHeight="24">
-    <path
-        android:pathData="M24,0H0V24H24V0ZM22,19H2V20.5H22V19Z"
-        android:fillColor="#FFFFFF"
-        android:fillType="evenOdd"/>
-    <path
-        android:pathData="M15,16H15.9922L14.8923,13.25H9.1077L8.0078,16H9V17H5V16H6.3922L11.3036,3.7215H12.6964L17.6078,16H19V17H15V16ZM9.5077,12.25H14.4923L12,6.019L9.5077,12.25Z"
-        android:fillColor="#43474D"
-        android:fillType="evenOdd"/>
-</vector>

+ 0 - 106
ComPDFKit_Tools/src/main/res/layout/tools_annot_reply_details_annot_content.xml

@@ -1,106 +0,0 @@
-<?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:id="@+id/cl_root"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="@drawable/tools_common_btn_rectangle_ripple"
-    android:paddingHorizontal="16dp"
-    android:paddingVertical="24dp">
-
-    <FrameLayout
-        android:id="@+id/fl_annot_icon"
-        android:layout_width="24dp"
-        android:layout_height="24dp"
-        app:layout_constraintBottom_toBottomOf="@id/tv_annot_date"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="@id/tv_author">
-
-        <View
-            android:id="@+id/view_icon_bg"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:background="@color/tools_color_background" />
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_annot_icon"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            app:srcCompat="@drawable/tools_ic_annotation_highlight_normal" />
-
-    </FrameLayout>
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_author"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        android:ellipsize="end"
-        android:maxLines="1"
-        android:textColor="?android:attr/textColorPrimary"
-        app:layout_constrainedWidth="true"
-        app:layout_constraintBottom_toTopOf="@id/tv_annot_date"
-        app:layout_constraintEnd_toStartOf="@id/iv_review_status"
-        app:layout_constraintHorizontal_bias="0"
-        app:layout_constraintStart_toEndOf="@id/fl_annot_icon"
-        app:layout_constraintTop_toTopOf="parent"
-        tools:text="@tools:sample/full_names" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_annot_date"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textColor="?android:attr/textColorSecondary"
-        android:textSize="11sp"
-        app:layout_constraintBottom_toBottomOf="@id/fl_annot_icon"
-        app:layout_constraintStart_toStartOf="@id/tv_author"
-        app:layout_constraintTop_toBottomOf="@id/tv_author"
-        tools:text="@tools:sample/date/ddmmyy" />
-
-    <CheckBox
-        android:id="@+id/cb_marked_status"
-        android:layout_width="24dp"
-        android:layout_height="24dp"
-        android:layout_marginEnd="8dp"
-        android:button="@drawable/tools_annot_replies_checkbox_btn"
-        android:buttonTint="?attr/colorOnPrimary"
-        app:layout_constraintBottom_toBottomOf="@id/iv_more"
-        app:layout_constraintEnd_toEndOf="parent"
-        tools:checked="false" />
-
-    <androidx.appcompat.widget.AppCompatImageView
-        android:id="@+id/iv_review_status"
-        android:layout_width="24dp"
-        android:layout_height="24dp"
-        android:layout_marginEnd="8dp"
-        android:background="@drawable/tools_common_btn_corner_ripple"
-        app:layout_constraintBottom_toBottomOf="@id/iv_more"
-        app:layout_constraintEnd_toStartOf="@id/cb_marked_status"
-        app:srcCompat="@drawable/tools_annot_review_status_none"
-        app:tint="@color/tools_icon_status_color" />
-
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_annot_content"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="4dp"
-        android:ellipsize="end"
-        android:maxLines="3"
-        android:textColor="?android:attr/textColorSecondary"
-        android:textSize="14sp"
-        android:visibility="visible"
-        app:layout_constrainedWidth="true"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/tv_annot_date"
-        tools:text="@tools:sample/lorem/random" />
-
-
-</androidx.constraintlayout.widget.ConstraintLayout>
-
-
-

+ 4 - 2
ComPDFKit_Tools/src/main/res/layout/tools_color_list_item.xml

@@ -2,7 +2,8 @@
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="40dp"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    xmlns:tools="http://schemas.android.com/tools">
 
 
     <androidx.appcompat.widget.AppCompatImageView
@@ -11,7 +12,6 @@
         android:layout_height="28dp"
         android:layout_marginVertical="8dp"
         android:background="@drawable/tools_color_item_color_picker"
-        android:visibility="gone"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
@@ -22,6 +22,7 @@
         android:layout_width="32dp"
         android:layout_height="32dp"
         android:layout_marginVertical="8dp"
+        tools:visibility="gone"
         android:background="@drawable/tools_color_item_select"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
@@ -33,6 +34,7 @@
         android:layout_width="28dp"
         android:layout_height="28dp"
         android:layout_marginVertical="8dp"
+        tools:visibility="gone"
         android:background="@drawable/tools_color_item_color"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"

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

@@ -3,7 +3,6 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="80dp"
-    xmlns:tools="http://schemas.android.com/tools"
     android:layout_marginHorizontal="16dp"
     android:layout_marginTop="8dp"
     android:layout_marginBottom="8dp"

+ 0 - 20
ComPDFKit_Tools/src/main/res/menu/tools_bota_dialog_annotation_list_menu.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <item
-        android:id="@+id/menu_import_annotations"
-        android:title="@string/tools_import_annotations"/>
-
-    <item
-        android:id="@+id/menu_export_annotations"
-        android:title="@string/tools_export_annotations"/>
-
-    <item
-        android:id="@+id/menu_delete_all_annotations"
-        android:title="@string/tools_delete_all_annotations"/>
-
-    <item
-        android:id="@+id/menu_delete_all_replies"
-        android:title="@string/tools_delete_all_replies"/>
-
-</menu>

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

@@ -15,13 +15,8 @@ import android.os.Bundle;
 import androidx.annotation.Nullable;
 import androidx.appcompat.app.AppCompatActivity;
 
-import com.compdfkit.core.document.CPDFSdk;
-import com.compdfkit.core.utils.TFileUtils;
 import com.compdfkit.pdfviewer.R;
 import com.compdfkit.pdfviewer.databinding.ActivityHomeBinding;
-import com.compdfkit.tools.common.utils.CFileUtils;
-
-import java.io.File;
 
 
 public class HomeActivity extends AppCompatActivity {