Browse Source

PDFTools(Android) - 1.修复第一次点击颜色列表回到表头问题 2.矩形注释交互 3.优化代码

liuxiaolong 1 year ago
parent
commit
d03e9d8944
42 changed files with 1133 additions and 416 deletions
  1. 2 3
      annotation-ctrl-demo/src/main/AndroidManifest.xml
  2. 27 14
      annotation-ctrl-demo/src/main/java/com/compdfkit/demo/annotation/MainActivity.java
  3. BIN
      compdfkit-repo/compdfkit-ui/ComPDFKit-UI.aar
  4. BIN
      compdfkit-repo/compdfkit/ComPDFKit.aar
  5. 10 2
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/CAnnotStyleDialogFragment.java
  6. 86 64
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfannotstyle/CAnnotStyle.java
  7. 27 0
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfannotstyle/CBasicOnStyleChangeListener.java
  8. 12 0
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfannotstyle/data/CPropertiesFragmentDatas.java
  9. 57 9
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfannotstyle/manager/CAnnotStyleManager.java
  10. 20 6
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdflnk/CInkCtrlView.java
  11. 39 19
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdflnk/CInkStyleFragment.java
  12. 0 160
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdflnk/CPDFFakeInkAnnotAttachHelper.java
  13. 38 15
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfmarkup/CMarkupStyleFragment.java
  14. 45 8
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfnote/CNoteStyleFragment.java
  15. 12 5
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfnote/CPDFtextAnnotAttachHelper.java
  16. 3 3
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfnote/CPDFtextAnnotImpl.java
  17. 233 0
      compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfshape/CShapeStyleFragment.java
  18. 1 1
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/interfaces/COnColorChangeListener.java
  19. 7 3
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/utils/CWrapHeightPageChangeCallback.java
  20. 34 8
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/utils/animation/CFillScreenManager.java
  21. 23 2
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfannotationbar/CAnnotationToolbar.java
  22. 35 8
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/basic/CBasicPropertiesFragment.java
  23. 8 8
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorlist/CColorListView.java
  24. 22 33
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorpicker/CColorPickerFragment.java
  25. 1 2
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorpicker/widget/ColorPickerView.java
  26. 3 3
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorpicker/widget/ColorRectView.java
  27. 6 7
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorpicker/widget/ColorSliderView.java
  28. 5 4
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotInkPreviewView.java
  29. 2 2
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotMarkupPreviewView.java
  30. 4 4
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotNotePreviewView.java
  31. 238 0
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotShapePreviewView.java
  32. 8 4
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CBasicAnnotPreviewView.java
  33. 21 0
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CStylePreviewView.java
  34. 3 1
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/sliderbar/CBorderWidthSliderBar.java
  35. 8 1
      compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/sliderbar/CSliderBar.java
  36. 3 3
      compdfkit-tools/src/main/res/color/tools_annotation_fun_status_color.xml
  37. 2 2
      compdfkit-tools/src/main/res/layout/tools_annot_properties_ink_ctrl_layout.xml
  38. 0 1
      compdfkit-tools/src/main/res/layout/tools_annot_style_dialog_fragment.xml
  39. 4 1
      compdfkit-tools/src/main/res/layout/tools_properties_markup_style_fragment.xml
  40. 67 0
      compdfkit-tools/src/main/res/layout/tools_properties_shape_style_fragment.xml
  41. 15 8
      compdfkit-tools/src/main/res/values/tools_strings.xml
  42. 2 2
      viewer-ctrl-demo/src/main/AndroidManifest.xml

File diff suppressed because it is too large
+ 2 - 3
annotation-ctrl-demo/src/main/AndroidManifest.xml


+ 27 - 14
annotation-ctrl-demo/src/main/java/com/compdfkit/demo/annotation/MainActivity.java

@@ -1,5 +1,6 @@
 package com.compdfkit.demo.annotation;
 
+import android.graphics.Color;
 import android.os.Bundle;
 import android.view.View;
 
@@ -7,10 +8,8 @@ import androidx.appcompat.app.AppCompatActivity;
 import androidx.core.content.ContextCompat;
 
 import com.compdfkit.core.annotation.CPDFAnnotation;
-import com.compdfkit.core.annotation.CPDFInkAnnotation;
 import com.compdfkit.core.annotation.CPDFTextAnnotation;
 import com.compdfkit.demo.annotation.databinding.ActivityMainBinding;
-import com.compdfkit.tools.annotation.pdfproperties.pdflnk.CPDFFakeInkAnnotAttachHelper;
 import com.compdfkit.tools.annotation.pdfproperties.pdfnote.CPDFtextAnnotAttachHelper;
 import com.compdfkit.tools.annotation.pdfproperties.pdfnote.CPDFtextAnnotImpl;
 import com.compdfkit.tools.common.utils.animation.CFillScreenManager;
@@ -59,16 +58,19 @@ public class MainActivity extends AppCompatActivity {
         screenManager.bindLeftToolViewList(binding.pdfView.indicatorView);
         screenManager.bindRightToolViewList(binding.pdfView.slideBar);
 
-        binding.pdfView.setOnTapMainDocAreaCallback(() -> {
-            screenManager.fillScreenChange(binding.flTool.getVisibility() == View.VISIBLE);
-        });
         binding.pdfView.addOnPDFFocusedTypeChangeListener(type -> {
-            if (type == CPDFAnnotation.Type.INK){
-                screenManager.showFromTop(binding.inkCtrlView, 200);
-            }else {
-                screenManager.hideFromTop(binding.inkCtrlView, 200);
+            if (type != CPDFAnnotation.Type.INK){
+                if (binding.inkCtrlView.getVisibility() == View.VISIBLE){
+                    screenManager.removeAndHideToolView(binding.inkCtrlView);
+                    screenManager.showFromBottom(binding.annotationToolBar, 200);
+                    screenManager.bindBottomToolViewList(binding.annotationToolBar);
+                }
             }
         });
+        binding.pdfView.setOnTapMainDocAreaCallback(() -> {
+            screenManager.fillScreenChange(binding.flTool.getVisibility() == View.VISIBLE);
+        });
+
 
         binding.pdfToolBar.addMode(CPDFToolbarPopupMenu.PreviewMode.Annotation);
         binding.pdfToolBar.setPreviewModeChangeListener((mode, title) -> {
@@ -99,7 +101,7 @@ public class MainActivity extends AppCompatActivity {
 
         binding.pdfToolBar.setBoTaBtnClickListener(v -> {
             ArrayList<CPDFBotaFragmentTabs> tabs = new ArrayList<>();
-            CPDFBotaFragmentTabs annotationTab = new CPDFBotaFragmentTabs(CPDFBOTA.ANNOTATION, getString(R.string.tools_annotations));
+            CPDFBotaFragmentTabs annotationTab = new CPDFBotaFragmentTabs(CPDFBOTA.ANNOTATION, getString(R.string.tools_menu_annotation));
             CPDFBotaFragmentTabs outlineTab = new CPDFBotaFragmentTabs(CPDFBOTA.OUTLINE, getString(R.string.tools_outline));
             CPDFBotaFragmentTabs bookmarkTab = new CPDFBotaFragmentTabs(CPDFBOTA.BOOKMARKS, getString(R.string.tools_bookmarks));
             if (binding.pdfToolBar.getMode() == CPDFToolbarPopupMenu.PreviewMode.PDFView) {
@@ -131,6 +133,18 @@ public class MainActivity extends AppCompatActivity {
 
         binding.annotationToolBar.initWithPDFView(binding.pdfView);
         binding.annotationToolBar.setFragmentManager(getSupportFragmentManager());
+        binding.annotationToolBar.setAnnotationChangeListener(type -> {
+            if (type == CAnnotationType.INK){
+                screenManager.showFromTop(binding.inkCtrlView, 200);
+                screenManager.bindTopToolView(binding.inkCtrlView);
+                //
+                screenManager.removeAndHideToolView(binding.annotationToolBar);
+            }else {
+                screenManager.showFromBottom(binding.annotationToolBar, 200);
+                screenManager.bindBottomToolViewList(binding.annotationToolBar);
+                screenManager.removeAndHideToolView(binding.inkCtrlView);
+            }
+        });
 
         binding.inkCtrlView.initWithPDFView(binding.pdfView);
     }
@@ -167,13 +181,12 @@ public class MainActivity extends AppCompatActivity {
                 .setMarkup(CAnnotationType.UNDERLINE, defaultColor, 255)
                 .setMarkup(CAnnotationType.SQUIGGLY, defaultColor, 255)
                 .setMarkup(CAnnotationType.STRIKEOUT, defaultColor, 255)
-                .setShape(CAnnotationType.SQUARE, defaultColor, 255, defaultColor, 255, 5)
-                .setShape(CAnnotationType.CIRCLE, defaultColor, 255, defaultColor, 255, 5)
-                .setShape(CAnnotationType.LINE, defaultColor, 255, defaultColor, 255, 5)
+                .setShape(CAnnotationType.SQUARE, defaultColor, 255, Color.TRANSPARENT, 0, 10, null)
+                .setShape(CAnnotationType.CIRCLE, defaultColor, 255, defaultColor, 255, 5, null)
+                .setShape(CAnnotationType.LINE, defaultColor, 255, defaultColor, 255, 5, null)
                 .setInkAttribute(defaultColor, 255, 10)
                 .init();
         binding.pdfView.getCPdfReaderView().getAnnotImplRegistry().registAttachHelper(CPDFTextAnnotation.class, CPDFtextAnnotAttachHelper.class);
         binding.pdfView.getCPdfReaderView().getAnnotImplRegistry().registImpl(CPDFTextAnnotation.class, CPDFtextAnnotImpl.class);
-//        binding.pdfView.getCPdfReaderView().getAnnotImplRegistry().registAttachHelper(CPDFInkAnnotation.class, CPDFFakeInkAnnotAttachHelper.class);
     }
 }

BIN
compdfkit-repo/compdfkit-ui/ComPDFKit-UI.aar


BIN
compdfkit-repo/compdfkit/ComPDFKit.aar


+ 10 - 2
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/CAnnotStyleDialogFragment.java

@@ -19,6 +19,7 @@ import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.widget.AppCompatImageView;
 import androidx.appcompat.widget.AppCompatTextView;
+import androidx.fragment.app.Fragment;
 import androidx.lifecycle.ViewModelProvider;
 import androidx.viewpager2.widget.ViewPager2;
 
@@ -28,6 +29,9 @@ import com.compdfkit.tools.common.utils.CWrapHeightPageChangeCallback;
 import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.viewmodel.CAnnotStyleViewModel;
 import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
+import com.compdfkit.tools.common.views.pdfproperties.colorlist.CColorListView;
+import com.compdfkit.tools.common.views.pdfproperties.colorpicker.CColorPickerFragment;
+import com.compdfkit.tools.common.views.pdfproperties.colorpicker.widget.ColorPickerView;
 import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
 
 import java.util.ArrayList;
@@ -118,13 +122,17 @@ public class CAnnotStyleDialogFragment extends BottomSheetDialogFragment impleme
 
     @Override
     public void onSaveInstanceState(@NonNull Bundle outState) {
-        outState.putParcelable("extra_annot_style", style);
         super.onSaveInstanceState(outState);
     }
 
     @Override
-    public void nextFragment() {
+    public void colorPickerFragment(int color, int opacity, ColorPickerView.COnColorChangeListener colorChangeListener) {
         viewPager.setCurrentItem(1);
+        Fragment colorPickerFragment = getChildFragmentManager().findFragmentByTag("f" + 1);
+        if (colorPickerFragment != null && colorPickerFragment instanceof CColorPickerFragment) {
+            ((CColorPickerFragment) colorPickerFragment).initColor(color, opacity);
+            ((CColorPickerFragment) colorPickerFragment).setColorPickerClickListener(colorChangeListener);
+        }
     }
 
     @Override

+ 86 - 64
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfannotstyle/CAnnotStyle.java

@@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.core.content.ContextCompat;
 
+import com.compdfkit.core.annotation.CPDFBorderStyle;
 import com.compdfkit.core.annotation.CPDFLineAnnotation;
 import com.compdfkit.core.annotation.CPDFStampAnnotation;
 import com.compdfkit.core.annotation.CPDFTextAttribute;
@@ -33,7 +34,7 @@ import com.compdfkit.tools.common.views.pdfannotationbar.bean.CAnnotationType;
 import java.util.ArrayList;
 import java.util.List;
 
-public class CAnnotStyle implements Parcelable, Cloneable {
+public class CAnnotStyle {
 
     private CAnnotationType type;
 
@@ -53,6 +54,8 @@ public class CAnnotStyle implements Parcelable, Cloneable {
 
     private int fillColorOpacity = 255;
 
+    private CPDFBorderStyle borderStyle = new CPDFBorderStyle(CPDFBorderStyle.Style.Border_Solid, 10, new float[]{8.0F, 9F});
+
     private CPDFLineAnnotation.LineType startLineType;
 
     private CPDFLineAnnotation.LineType endLineType;
@@ -85,59 +88,6 @@ public class CAnnotStyle implements Parcelable, Cloneable {
         this.type = type;
     }
 
-    protected CAnnotStyle(Parcel in) {
-        color = in.readInt();
-        colorOpacity = in.readInt();
-        borderWidth = in.readFloat();
-        lineColor = in.readInt();
-        lineColorOpacity = in.readInt();
-        fillColor = in.readInt();
-        fillColorOpacity = in.readInt();
-        fontBold = in.readByte() != 0;
-        fontItalic = in.readByte() != 0;
-        textColor = in.readInt();
-        textColorOpacity = in.readInt();
-        fontSize = in.readInt();
-        imagePath = in.readString();
-        textStampContent = in.readString();
-        textStampDate = in.readString();
-    }
-
-    @Override
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeInt(color);
-        dest.writeInt(colorOpacity);
-        dest.writeFloat(borderWidth);
-        dest.writeInt(lineColor);
-        dest.writeInt(lineColorOpacity);
-        dest.writeInt(fillColor);
-        dest.writeInt(fillColorOpacity);
-        dest.writeByte((byte) (fontBold ? 1 : 0));
-        dest.writeByte((byte) (fontItalic ? 1 : 0));
-        dest.writeInt(textColor);
-        dest.writeInt(textColorOpacity);
-        dest.writeInt(fontSize);
-        dest.writeString(imagePath);
-        dest.writeString(textStampContent);
-        dest.writeString(textStampDate);
-    }
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    public static final Creator<CAnnotStyle> CREATOR = new Creator<CAnnotStyle>() {
-        @Override
-        public CAnnotStyle createFromParcel(Parcel in) {
-            return new CAnnotStyle(in);
-        }
-
-        @Override
-        public CAnnotStyle[] newArray(int size) {
-            return new CAnnotStyle[size];
-        }
-    };
 
     public CAnnotationType getType() {
         return type;
@@ -189,19 +139,21 @@ public class CAnnotStyle implements Parcelable, Cloneable {
     }
 
     public void setLineColor(@ColorInt int lineColor) {
+        boolean update = lineColor != this.lineColor;
         this.lineColor = lineColor;
-    }
-
-    public void setLineColor(Context context, @ColorRes int colorRes) {
-        this.lineColor = ContextCompat.getColor(context, colorRes);
+        Log.e("CAnnotStyle", "setLineColor(" + lineColor + ", update:" + update + ")");
+        updateLineColor(lineColor, update);
     }
 
     public int getLineColorOpacity() {
         return lineColorOpacity;
     }
 
-    public void setLineColorOpacity(@IntRange(from = 0, to = 255) int lineColorAlpha) {
-        this.lineColorOpacity = lineColorAlpha;
+    public void setLineColorOpacity(@IntRange(from = 0, to = 255) int lineColorOpacity) {
+        boolean update = lineColorOpacity != this.lineColorOpacity;
+        this.lineColorOpacity = lineColorOpacity;
+        Log.e("CAnnotStyle", "setLineColorOpacity(" + lineColorOpacity + ", update:" + update + ")");
+        updateLineColorOpacity(lineColorOpacity, update);
     }
 
     public int getFillColor() {
@@ -209,19 +161,33 @@ public class CAnnotStyle implements Parcelable, Cloneable {
     }
 
     public void setFillColor(@ColorInt int fillColor) {
+        boolean update = fillColor != this.fillColor;
         this.fillColor = fillColor;
+        Log.e("CAnnotStyle", "setFillColor(" + fillColor + ", update:" + update + ")");
+        updateFillColor(fillColor, update);
     }
 
-    public void setFillColor(Context context, @ColorRes int colorRes) {
-        this.fillColor = ContextCompat.getColor(context, colorRes);
-    }
 
     public int getFillColorOpacity() {
         return fillColorOpacity;
     }
 
     public void setFillColorOpacity(@IntRange(from = 0, to = 255) int fillColorOpacity) {
+        boolean update = fillColorOpacity != this.fillColorOpacity;
         this.fillColorOpacity = fillColorOpacity;
+        Log.e("CAnnotStyle", "setFillColorOpacity(" + fillColor + ", update:" + update + ")");
+        updateFillColorOpacity(fillColorOpacity, update);
+    }
+
+    public void setBorderStyle(CPDFBorderStyle borderStyle) {
+        boolean update = borderStyle.equals(this.borderStyle);
+        this.borderStyle = borderStyle;
+        Log.e("CAnnotStyle", "setBorderStyle(" + borderStyle + ", update:" + update + ")");
+        updateBorderStyle(borderStyle, update);
+    }
+
+    public CPDFBorderStyle getBorderStyle() {
+        return borderStyle;
     }
 
     public CPDFLineAnnotation.LineType getStartLineType() {
@@ -344,6 +310,7 @@ public class CAnnotStyle implements Parcelable, Cloneable {
                 "lineColorOpacity" + lineColorOpacity + "," +
                 "fillColor" + fillColor + "," +
                 "fillColorOpacity" + fillColorOpacity + "," +
+                "borderStyle" + (borderStyle != null ? borderStyle.toString() : "empty") + "," +
                 "startLineType" + (startLineType != null ? startLineType.name() : "empty") + "," +
                 "endLineType" + (endLineType != null ? endLineType.name() : "empty") + "," +
                 "fontBold" + fontBold + "," +
@@ -368,6 +335,7 @@ public class CAnnotStyle implements Parcelable, Cloneable {
         result = 31 * result + (this.lineColorOpacity != 0.0F ? Float.floatToIntBits(this.lineColorOpacity) : 0);
         result = 31 * result + this.fillColor;
         result = 31 * result + (this.fillColorOpacity != 0.0F ? Float.floatToIntBits(this.fillColorOpacity) : 0);
+        result = 31 * result + (this.borderStyle != null ? this.borderStyle.hashCode() : 0);
         result = 31 * result + (this.startLineType != null ? this.startLineType.hashCode() : 0);
         result = 31 * result + (this.endLineType != null ? this.endLineType.hashCode() : 0);
         result = 31 * result + this.textColor;
@@ -414,6 +382,9 @@ public class CAnnotStyle implements Parcelable, Cloneable {
             case INK:
                 titleResId = R.string.tools_annot_ink;
                 break;
+            case SQUARE:
+                titleResId = R.string.tools_annot_square;
+                break;
             default:
                 titleResId = R.string.tools_menu_pdfview;
                 break;
@@ -446,6 +417,46 @@ public class CAnnotStyle implements Parcelable, Cloneable {
         }
     }
 
+    private void updateLineColor(int color, boolean update) {
+        if (styleChangeListenerList != null && update) {
+            for (OnAnnotStyleChangeListener onAnnotStyleChangeListener : styleChangeListenerList) {
+                onAnnotStyleChangeListener.onChangeAnnotLineColor(color);
+            }
+        }
+    }
+
+    private void updateLineColorOpacity(int opacity, boolean update) {
+        if (styleChangeListenerList != null && update) {
+            for (OnAnnotStyleChangeListener onAnnotStyleChangeListener : styleChangeListenerList) {
+                onAnnotStyleChangeListener.onChangeAnnotLineColorOpacity(opacity);
+            }
+        }
+    }
+
+    private void updateFillColor(int color, boolean update) {
+        if (styleChangeListenerList != null && update) {
+            for (OnAnnotStyleChangeListener onAnnotStyleChangeListener : styleChangeListenerList) {
+                onAnnotStyleChangeListener.onChangeAnnotFillColor(color);
+            }
+        }
+    }
+
+    private void updateFillColorOpacity(int opacity, boolean update) {
+        if (styleChangeListenerList != null && update) {
+            for (OnAnnotStyleChangeListener onAnnotStyleChangeListener : styleChangeListenerList) {
+                onAnnotStyleChangeListener.onChangeAnnotFillColorOpacity(opacity);
+            }
+        }
+    }
+
+    private void updateBorderStyle(CPDFBorderStyle style, boolean update) {
+        if (styleChangeListenerList != null && update) {
+            for (OnAnnotStyleChangeListener onAnnotStyleChangeListener : styleChangeListenerList) {
+                onAnnotStyleChangeListener.onChangeAnnotBorderStyle(style);
+            }
+        }
+    }
+
     public void addStyleChangeListener(OnAnnotStyleChangeListener styleChangeListener) {
         this.styleChangeListenerList.add(styleChangeListener);
     }
@@ -458,13 +469,24 @@ public class CAnnotStyle implements Parcelable, Cloneable {
         this.styleChangeListenerList.remove(styleChangeListener);
     }
 
+
     public interface OnAnnotStyleChangeListener {
 
         void onChangeAnnotColor(@ColorInt int color);
 
-        void onChangeAnnotColorOpacity(@ColorInt int opacity);
+        void onChangeAnnotColorOpacity(int opacity);
 
         void onChangeAnnotBorderWidth(float borderWidth);
+
+        void onChangeAnnotLineColor(@ColorInt int color);
+
+        void onChangeAnnotLineColorOpacity(int opacity);
+
+        void onChangeAnnotFillColor(@ColorInt int color);
+
+        void onChangeAnnotFillColorOpacity(int opacity);
+
+        void onChangeAnnotBorderStyle(CPDFBorderStyle style);
     }
 
 }

+ 27 - 0
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfannotstyle/CBasicOnStyleChangeListener.java

@@ -10,6 +10,8 @@
 package com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle;
 
 
+import com.compdfkit.core.annotation.CPDFBorderStyle;
+
 public class CBasicOnStyleChangeListener  implements CAnnotStyle.OnAnnotStyleChangeListener {
     @Override
     public void onChangeAnnotColor(int color) {
@@ -25,4 +27,29 @@ public class CBasicOnStyleChangeListener  implements CAnnotStyle.OnAnnotStyleCha
     public void onChangeAnnotBorderWidth(float borderWidth) {
 
     }
+
+    @Override
+    public void onChangeAnnotLineColor(int color) {
+
+    }
+
+    @Override
+    public void onChangeAnnotLineColorOpacity(int opacity) {
+
+    }
+
+    @Override
+    public void onChangeAnnotFillColor(int color) {
+
+    }
+
+    @Override
+    public void onChangeAnnotFillColorOpacity(int opacity) {
+
+    }
+
+    @Override
+    public void onChangeAnnotBorderStyle(CPDFBorderStyle style) {
+
+    }
 }

+ 12 - 0
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfannotstyle/data/CPropertiesFragmentDatas.java

@@ -16,6 +16,7 @@ import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.CAnnotStyle;
 import com.compdfkit.tools.annotation.pdfproperties.pdflnk.CInkStyleFragment;
 import com.compdfkit.tools.annotation.pdfproperties.pdfmarkup.CMarkupStyleFragment;
 import com.compdfkit.tools.annotation.pdfproperties.pdfnote.CNoteStyleFragment;
+import com.compdfkit.tools.annotation.pdfproperties.pdfshape.CShapeStyleFragment;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorpicker.CColorPickerFragment;
 
@@ -39,6 +40,10 @@ public class CPropertiesFragmentDatas {
                 break;
             case INK:
                 list.addAll(inkFragments(style));
+                break;
+            case SQUARE:
+                list.addAll(squareFragments(style));
+
                 break;
             default:
                break;
@@ -75,6 +80,13 @@ public class CPropertiesFragmentDatas {
         return list;
     }
 
+    private static List<CPropertiesFragmentBean> squareFragments(CAnnotStyle style){
+        List<CPropertiesFragmentBean> list = new ArrayList<>();
+        list.add(new CPropertiesFragmentBean(style.getAnnotTypeTitleResId(), CShapeStyleFragment.class));
+        list.add(new CPropertiesFragmentBean(R.string.tools_custom_color, CColorPickerFragment.class));
+        return list;
+    }
+
     public static class CPropertiesFragmentBean{
 
         private Class<? extends CBasicPropertiesFragment> fragmentClass;

+ 57 - 9
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfannotstyle/manager/CAnnotStyleManager.java

@@ -12,7 +12,7 @@ package com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.manager;
 import androidx.annotation.ColorInt;
 import androidx.annotation.IntRange;
 
-import com.compdfkit.core.annotation.CPDFInkAnnotation;
+import com.compdfkit.core.annotation.CPDFBorderStyle;
 import com.compdfkit.tools.annotation.pdfproperties.CAnnotStyleDialogFragment;
 import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfannotationbar.bean.CAnnotationType;
@@ -20,6 +20,7 @@ import com.compdfkit.tools.common.views.pdfview.CPDFViewCtrl;
 import com.compdfkit.ui.attribute.CPDFAnnotAttribute;
 import com.compdfkit.ui.attribute.CPDFHighlightAttr;
 import com.compdfkit.ui.attribute.CPDFInkAttr;
+import com.compdfkit.ui.attribute.CPDFSquareAttr;
 import com.compdfkit.ui.attribute.CPDFSquigglyAttr;
 import com.compdfkit.ui.attribute.CPDFStrikeoutAttr;
 import com.compdfkit.ui.attribute.CPDFUnderlineAttr;
@@ -85,6 +86,15 @@ public class CAnnotStyleManager implements CAnnotStyle.OnAnnotStyleChangeListene
                     inkAttr.setBorderWidth(params.getBorderWidth());
                     inkAttr.setEraseWidth(params.getEraserWidth());
                     break;
+                case SQUARE:
+                    CPDFSquareAttr squareAttr = attribute.getSquareAttr();
+                    squareAttr.setBgColor(params.getFillColor());
+                    squareAttr.setBgAlpha(params.getFillColorOpacity());
+                    squareAttr.setLineColor(params.getLineColor());
+                    squareAttr.setLineAlpha(params.getLineColorOpacity());
+                    squareAttr.setBorderWidth(params.getBorderWidth());
+                    squareAttr.setBorderStyle(params.getBorderStyle());
+                    break;
                 default:
                     break;
             }
@@ -96,11 +106,6 @@ public class CAnnotStyleManager implements CAnnotStyle.OnAnnotStyleChangeListene
         }
     }
 
-    public void changeAnnotStyle() {
-
-
-    }
-
     private CAnnotStyleDialogFragment annotStyleDialogFragment;
 
     private CPDFViewCtrl pdfView;
@@ -126,6 +131,31 @@ public class CAnnotStyleManager implements CAnnotStyle.OnAnnotStyleChangeListene
         updateAnnot();
     }
 
+    @Override
+    public void onChangeAnnotLineColor(int color) {
+        updateAnnot();
+    }
+
+    @Override
+    public void onChangeAnnotLineColorOpacity(int opacity) {
+        updateAnnot();
+    }
+
+    @Override
+    public void onChangeAnnotFillColor(int color) {
+        updateAnnot();
+    }
+
+    @Override
+    public void onChangeAnnotFillColorOpacity(int opacity) {
+        updateAnnot();
+    }
+
+    @Override
+    public void onChangeAnnotBorderStyle(CPDFBorderStyle style) {
+        updateAnnot();
+    }
+
     private void updateAnnot() {
         if (pdfView != null && annotStyleDialogFragment != null) {
             CAnnotStyle style = annotStyleDialogFragment.getStyle();
@@ -169,6 +199,15 @@ public class CAnnotStyleManager implements CAnnotStyle.OnAnnotStyleChangeListene
                 style.setColor(inkAttr.getColor());
                 style.setColorOpacity(inkAttr.getAlpha());
                 style.setBorderWidth(inkAttr.getBorderWidth());
+            case SQUARE:
+                CPDFSquareAttr squareAttr = attribute.getSquareAttr();
+                style.setFillColor(squareAttr.getBgColor());
+                style.setFillColorOpacity(squareAttr.getBgAlpha());
+                style.setLineColor(squareAttr.getLineColor());
+                style.setLineColorOpacity(squareAttr.getLineAlpha());
+                style.setBorderWidth(squareAttr.getBorderWidth());
+                style.setBorderStyle(squareAttr.getBorderStyle());
+                break;
             default:
                 break;
         }
@@ -210,7 +249,7 @@ public class CAnnotStyleManager implements CAnnotStyle.OnAnnotStyleChangeListene
             return this;
         }
 
-        public Builder setEraserWidth(int borderWidth){
+        public Builder setEraserWidth(int borderWidth) {
             CAnnotStyle style = new CAnnotStyle(CAnnotationType.INK);
             style.setEraserWidth(borderWidth);
             attrSet.add(style);
@@ -222,17 +261,26 @@ public class CAnnotStyleManager implements CAnnotStyle.OnAnnotStyleChangeListene
                                 @IntRange(from = 0, to = 255) int lineColorOpacity,
                                 @ColorInt int fillColor,
                                 @IntRange(from = 0, to = 255) int fillColorAlpha,
-                                float borderWidth) {
+                                float borderWidth,
+                                CPDFBorderStyle borderStyle) {
             CAnnotStyle style = new CAnnotStyle(type);
             style.setLineColor(lineColor);
             style.setLineColorOpacity(lineColorOpacity);
             style.setFillColor(fillColor);
-            style.setFillColor(fillColorAlpha);
+            style.setFillColorOpacity(fillColorAlpha);
             style.setBorderWidth(borderWidth);
+            if (borderStyle == null) {
+                borderStyle = new CPDFBorderStyle();
+                borderStyle.setBorderWidth(borderWidth);
+                borderStyle.setDashArr(new float[]{8.0F, 0F});
+            }
+
+            style.setBorderStyle(borderStyle);
             attrSet.add(style);
             return this;
         }
 
+
         private CAnnotStyleManager create() {
             return new CAnnotStyleManager();
         }

+ 20 - 6
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdflnk/CInkCtrlView.java

@@ -23,8 +23,16 @@ import androidx.appcompat.widget.AppCompatImageView;
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.common.views.pdfview.CPDFViewCtrl;
 import com.compdfkit.ui.proxy.attach.IInkDrawCallback;
+import com.compdfkit.ui.reader.CPDFReaderView;
+import com.compdfkit.ui.reader.InkUndoRedoCallback;
+import com.compdfkit.ui.reader.玖;
 
-
+/**
+ * Create a PDF Ink Control View that allows for controlling ink annotations with options for switching between erase,
+ * undo, redo, delete, and confirm operations.
+ *
+ *
+ */
 public class CInkCtrlView extends FrameLayout implements View.OnClickListener {
 
     private AppCompatImageView ivEraser;
@@ -64,20 +72,28 @@ public class CInkCtrlView extends FrameLayout implements View.OnClickListener {
         ivRedo.setOnClickListener(this);
         ivDelete.setOnClickListener(this);
         ivConfirm.setOnClickListener(this);
+
     }
 
     public void initWithPDFView(CPDFViewCtrl pdfView) {
         this.pdfView = pdfView;
+        CPDFReaderView.TInkDrawHelper helper = pdfView.getCPdfReaderView().getInkDrawHelper();
+        helper.setInkUndoRedoCallback((b, b1) -> {
+            ivUndo.setEnabled(b);
+            ivRedo.setEnabled(b1);
+        });
+        ivUndo.setEnabled(helper.canUndo());
+        ivRedo.setEnabled(helper.canRedo());
     }
 
     @Override
     public void onClick(View v) {
         if (v.getId() == R.id.iv_ink_eraser) {
             if (pdfView != null) {
-                if (ivEraser.isSelected()){
+                if (ivEraser.isSelected()) {
                     ivEraser.setSelected(false);
                     pdfView.getCPdfReaderView().getInkDrawHelper().setMode(IInkDrawCallback.Mode.DRAW);
-                }else {
+                } else {
                     ivEraser.setSelected(true);
                     pdfView.getCPdfReaderView().getInkDrawHelper().setMode(IInkDrawCallback.Mode.ERASE);
                 }
@@ -97,6 +113,7 @@ public class CInkCtrlView extends FrameLayout implements View.OnClickListener {
             }
         } else if (v.getId() == R.id.iv_ink_done) {
             if (pdfView != null) {
+                ivEraser.setSelected(false);
                 pdfView.getCPdfReaderView().getInkDrawHelper().setMode(IInkDrawCallback.Mode.DRAW);
                 pdfView.getCPdfReaderView().getInkDrawHelper().onSave();
                 pdfView.resetAnnotationType();
@@ -104,8 +121,5 @@ public class CInkCtrlView extends FrameLayout implements View.OnClickListener {
         } else {
 
         }
-
     }
-
-
 }

+ 39 - 19
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdflnk/CInkStyleFragment.java

@@ -11,7 +11,6 @@ package com.compdfkit.tools.annotation.pdfproperties.pdflnk;
 
 
 import android.os.Bundle;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -23,15 +22,16 @@ import com.compdfkit.tools.R;
 import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.CColorListView;
+import com.compdfkit.tools.common.views.pdfproperties.colorpicker.widget.ColorPickerView;
 import com.compdfkit.tools.common.views.pdfproperties.preview.CStylePreviewView;
 import com.compdfkit.tools.common.views.pdfproperties.sliderbar.CBorderWidthSliderBar;
 import com.compdfkit.tools.common.views.pdfproperties.sliderbar.CSliderBar;
 
-public class CInkStyleFragment extends CBasicPropertiesFragment {
+public class CInkStyleFragment extends CBasicPropertiesFragment implements ColorPickerView.COnColorChangeListener {
 
     private CColorListView colorListView;
 
-    private CSliderBar opacitySliderBar;
+    private CSliderBar colorOpacitySliderBar;
 
     private CStylePreviewView stylePreviewView;
 
@@ -47,7 +47,7 @@ public class CInkStyleFragment extends CBasicPropertiesFragment {
         View rootView = inflater.inflate(R.layout.tools_properties_ink_style_fragment, container, false);
         colorListView = rootView.findViewById(R.id.color_list_view);
         stylePreviewView = rootView.findViewById(R.id.style_preview);
-        opacitySliderBar = rootView.findViewById(R.id.slider_bar);
+        colorOpacitySliderBar = rootView.findViewById(R.id.slider_bar);
         borderWidthSliderBar = rootView.findViewById(R.id.slider_bar_border_width);
         return rootView;
     }
@@ -55,37 +55,51 @@ public class CInkStyleFragment extends CBasicPropertiesFragment {
     @Override
     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
-        colorListView.setColorPickerClickListener(this::nextFragment);
         CAnnotStyle cAnnotStyle = viewModel.getStyle();
         if (cAnnotStyle != null) {
+            //Initialize the preview attributes for a style.
             stylePreviewView.setColor(cAnnotStyle.getColor());
             stylePreviewView.setColorOpacity(cAnnotStyle.getColorOpacity());
             stylePreviewView.setBorderWidth((int) cAnnotStyle.getBorderWidth());
             borderWidthSliderBar.setProgress((int) cAnnotStyle.getBorderWidth());
             colorListView.setSelectColor(cAnnotStyle.getColor());
-            opacitySliderBar.setProgress(cAnnotStyle.getColorOpacity());
+            colorOpacitySliderBar.setProgress(cAnnotStyle.getColorOpacity());
         }
-        opacitySliderBar.setChangeListener((progress, percentageValue) -> {
-            if (viewModel != null) {
-                viewModel.getStyle().setColorOpacity(progress);
-            }
-        });
-        colorListView.setColorChangeListener(color -> {
-            if (viewModel != null) {
-                viewModel.getStyle().setColor(color);
-            }
+        //Add a listener for clicks on the color picker item, which will display the color picker fragment
+        colorListView.setColorPickerClickListener(() -> {
+            //display the color picker fragment
+            showColorPickerFragment(viewModel.getStyle().getColor(), viewModel.getStyle().getColorOpacity(), this);
         });
-        borderWidthSliderBar.setChangeListener((progress, percentageValue) -> {
+        //Add a listener for color opacity changes
+        colorOpacitySliderBar.setChangeListener((opacity, percentageValue) -> opacity(opacity));
+        //Add a listener for color list
+        colorListView.setOnColorSelectListener(this::color);
+        //Add a listener for the border width progress bar changes
+        borderWidthSliderBar.setChangeListener((borderWidth, percentageValue) -> {
             if (viewModel != null) {
-                viewModel.getStyle().setBorderWidth(progress);
+                viewModel.getStyle().setBorderWidth(borderWidth);
             }
         });
         viewModel.addStyleChangeListener(this);
     }
 
+    @Override
+    public void color(int color) {
+        if (viewModel != null) {
+            viewModel.getStyle().setColor(color);
+        }
+    }
+
+    @Override
+    public void opacity(int opacity) {
+        if (viewModel != null) {
+            viewModel.getStyle().setColorOpacity(opacity);
+        }
+    }
+
     @Override
     public void onChangeAnnotColor(int color) {
-        super.onChangeAnnotColor(color);
+        //Update the preview color of the note annotation
         if (stylePreviewView != null) {
             stylePreviewView.setColor(color);
         }
@@ -93,14 +107,20 @@ public class CInkStyleFragment extends CBasicPropertiesFragment {
 
     @Override
     public void onChangeAnnotColorOpacity(int opacity) {
-        super.onChangeAnnotColorOpacity(opacity);
+        //Update the preview color of the note annotation
         if (stylePreviewView != null) {
             stylePreviewView.setColorOpacity(opacity);
         }
+        if (!isOnResume) {
+            if (colorOpacitySliderBar != null) {
+                colorOpacitySliderBar.setProgress(opacity);
+            }
+        }
     }
 
     @Override
     public void onChangeAnnotBorderWidth(float borderWidth) {
+        //Update the preview color of the note annotation
         if (stylePreviewView != null) {
             stylePreviewView.setBorderWidth((int) borderWidth);
         }

+ 0 - 160
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdflnk/CPDFFakeInkAnnotAttachHelper.java

@@ -1,160 +0,0 @@
-package com.compdfkit.tools.annotation.pdfproperties.pdflnk;
-
-
-import android.graphics.Bitmap;
-import android.graphics.Path;
-import android.graphics.RectF;
-
-import com.compdfkit.ui.proxy.attach.IInkDrawCallback;
-import com.kdanmobile.handwriting.KMHandwritingHelper;
-
-public class CPDFFakeInkAnnotAttachHelper extends com.compdfkit.ui.proxy.attach.CPDFFakeInkAnnotAttachHelper {
-
-
-    public CPDFFakeInkAnnotAttachHelper(){
-        setHandwritingHelper(new CPDFHandwritingHelper(new KMHandwritingHelper()));
-    }
-
-
-    static class CPDFHandwritingHelper implements HandwritingHelper {
-
-        private KMHandwritingHelper kmHandwritingHelper;
-
-        public CPDFHandwritingHelper(KMHandwritingHelper handwritingHelper){
-            this.kmHandwritingHelper = handwritingHelper;
-        }
-
-        @Override
-        public boolean isInited() {
-            return kmHandwritingHelper != null && kmHandwritingHelper.isInited();
-        }
-
-        @Override
-        public void initCanvas(int i, int i1) {
-            if (kmHandwritingHelper != null) {
-                kmHandwritingHelper.initCanvas(i, i1);
-            }
-        }
-
-        @Override
-        public void setPenWidth(float v) {
-            if (kmHandwritingHelper != null) {
-                kmHandwritingHelper.setPenWidth(v);
-            }
-        }
-
-        @Override
-        public void setEraseWidth(float v) {
-            if (kmHandwritingHelper != null) {
-                kmHandwritingHelper.setEraseWidth(v);
-            }
-        }
-
-        @Override
-        public void setMode(Mode mode) {
-            if (kmHandwritingHelper != null) {
-                if (mode == Mode.DRAW){
-                    kmHandwritingHelper.setDrawMode(KMHandwritingHelper.DrawMode.DRAW);
-                }else {
-                    kmHandwritingHelper.setDrawMode(KMHandwritingHelper.DrawMode.ERASE);
-                }
-            }
-        }
-
-        @Override
-        public void setEffect(Effect effect) {
-            if (kmHandwritingHelper != null) {
-                if (effect == IInkDrawCallback.Effect.NORMAL) {
-                    kmHandwritingHelper.setDrawEffect(KMHandwritingHelper.DrawEffect.NORMAL);
-                } else {
-                    kmHandwritingHelper.setDrawEffect(KMHandwritingHelper.DrawEffect.PENSTROKE);
-                }
-            }
-        }
-
-        @Override
-        public void setColor(int i) {
-            if (kmHandwritingHelper != null) {
-                kmHandwritingHelper.setColor(i);
-            }
-        }
-
-        @Override
-        public void setAlpha(int i) {
-            if (kmHandwritingHelper != null) {
-                kmHandwritingHelper.setAlpha(i);
-            }
-        }
-
-        @Override
-        public void clean() {
-            if (kmHandwritingHelper != null) {
-                kmHandwritingHelper.clean();
-            }
-        }
-
-        @Override
-        public boolean onDown(float v, float v1, float v2, float v3) {
-            if (kmHandwritingHelper != null){
-                return kmHandwritingHelper.onDown(v, v1, v2, v3);
-            }
-            return false;
-        }
-
-        @Override
-        public boolean onMove(float v, float v1, float v2, float v3) {
-            if (kmHandwritingHelper != null){
-                return kmHandwritingHelper.onMove(v, v1, v2, v3);
-            }
-            return true;
-        }
-
-        @Override
-        public boolean onUp(float v, float v1, float v2, float v3) {
-            if (kmHandwritingHelper != null){
-                return kmHandwritingHelper.onUp(v, v1, v2, v3);
-            }
-            return true;
-        }
-
-        @Override
-        public void onMisTouch() {
-            if (kmHandwritingHelper != null){
-                 kmHandwritingHelper.onMisTouch();
-            }
-        }
-
-        @Override
-        public void onUndo() {
-            if (kmHandwritingHelper != null) {
-                kmHandwritingHelper.onUndo();
-            }
-        }
-
-        @Override
-        public void onRedo() {
-            if (kmHandwritingHelper != null) {
-                kmHandwritingHelper.onRedo();
-            }
-        }
-
-        @Override
-        public Path getErasePath() {
-            return kmHandwritingHelper != null ? kmHandwritingHelper.getErasePath() : null;
-        }
-
-        @Override
-        public RectF getArea() {
-            return kmHandwritingHelper != null ? kmHandwritingHelper.getArea() : null;
-
-        }
-
-        @Override
-        public Bitmap getBitmap() {
-            return kmHandwritingHelper != null ? kmHandwritingHelper.getBitmap() : null;
-
-        }
-    }
-
-
-}

+ 38 - 15
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfmarkup/CMarkupStyleFragment.java

@@ -19,16 +19,18 @@ import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 
 import com.compdfkit.tools.R;
+import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.CColorListView;
+import com.compdfkit.tools.common.views.pdfproperties.colorpicker.widget.ColorPickerView;
 import com.compdfkit.tools.common.views.pdfproperties.preview.CStylePreviewView;
 import com.compdfkit.tools.common.views.pdfproperties.sliderbar.CSliderBar;
 
-public class CMarkupStyleFragment extends CBasicPropertiesFragment {
+public class CMarkupStyleFragment extends CBasicPropertiesFragment implements ColorPickerView.COnColorChangeListener {
 
     private CColorListView colorListView;
 
-    private CSliderBar sliderBar;
+    private CSliderBar colorOpacitySliderBar;
 
     private CStylePreviewView previewView;
 
@@ -41,7 +43,7 @@ public class CMarkupStyleFragment extends CBasicPropertiesFragment {
     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
         View rootView = inflater.inflate(R.layout.tools_properties_markup_style_fragment, container, false);
         colorListView = rootView.findViewById(R.id.color_list_view);
-        sliderBar = rootView.findViewById(R.id.slider_bar);
+        colorOpacitySliderBar = rootView.findViewById(R.id.slider_bar);
         previewView = rootView.findViewById(R.id.style_preview);
         return rootView;
     }
@@ -49,32 +51,52 @@ public class CMarkupStyleFragment extends CBasicPropertiesFragment {
     @Override
     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
+        //Initialize the preview attributes for a style.
         previewView.setAnnotType(viewModel.getStyle().getType());
         previewView.setColor(viewModel.getStyle().getColor());
         previewView.setColorOpacity(viewModel.getStyle().getColorOpacity());
-        colorListView.setColorChangeListener(color -> {
-            if (viewModel != null) {
-                viewModel.getStyle().setColor(color);
-            }
+        //Set the current color opacity to the slider bar
+        colorOpacitySliderBar.setProgress(viewModel.getStyle().getColorOpacity());
+        //Add a listener for color list
+        colorListView.setOnColorSelectListener(this::color);
+        //Add a click listener for the color picker button
+        colorListView.setColorPickerClickListener(()->{
+            //show color picker fragment and set color change listener
+            CAnnotStyle style = viewModel.getStyle();
+            showColorPickerFragment(style.getColor(), style.getColorOpacity(), this);
         });
-        sliderBar.setProgress(viewModel.getStyle().getColorOpacity());
-        colorListView.setColorPickerClickListener(this::nextFragment);
-        sliderBar.setChangeListener((opacity, percentageValue) ->{
-            if (viewModel != null) {
-                viewModel.getStyle().setColorOpacity(opacity);
-            }
+        //Add a listener for color opacity changes
+        colorOpacitySliderBar.setChangeListener((opacity, percentageValue) ->{
+            opacity(opacity);
         });
         colorListView.showColorPicker(true);
         viewModel.addStyleChangeListener(this);
     }
 
+    @Override
+    public void color(int color) {
+        //Get the selected color from the ColorPickerFragment
+        if (viewModel != null) {
+            viewModel.getStyle().setColor(color);
+        }
+    }
+
+    @Override
+    public void opacity(int opacity) {
+        if (viewModel != null) {
+            viewModel.getStyle().setColorOpacity(opacity);
+        }
+    }
+
     @Override
     public void onChangeAnnotColor(int color) {
         if (!isOnResume){
+            //When the selected color changes are detected, update the selected color in the list
             if (colorListView != null) {
                 colorListView.setSelectColor(color);
             }
         }
+        //Update the preview color of the note annotation
         if (previewView != null) {
             previewView.setColor(color);
         }
@@ -84,10 +106,11 @@ public class CMarkupStyleFragment extends CBasicPropertiesFragment {
     public void onChangeAnnotColorOpacity(int opacity) {
         super.onChangeAnnotColorOpacity(opacity);
         if (!isOnResume){
-            if (sliderBar != null) {
-                sliderBar.setProgress(opacity);
+            if (colorOpacitySliderBar != null) {
+                colorOpacitySliderBar.setProgress(opacity);
             }
         }
+        //Update the preview color opacity of the note annotation
         if (previewView != null) {
             previewView.setColorOpacity(opacity);
         }

+ 45 - 8
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfnote/CNoteStyleFragment.java

@@ -19,12 +19,21 @@ import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 
 import com.compdfkit.tools.R;
+import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfannotationbar.bean.CAnnotationType;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.CColorListView;
+import com.compdfkit.tools.common.views.pdfproperties.colorpicker.widget.ColorPickerView;
 import com.compdfkit.tools.common.views.pdfproperties.preview.CStylePreviewView;
 
-public class CNoteStyleFragment extends CBasicPropertiesFragment {
+/**
+ * Create a fragment for modifying the attributes of a note annotation in a PDF,
+ * specifically for changing the color of the annotation icon.
+ * This fragment should be used for annotations of type {@link CAnnotationType#TEXT}
+ *
+ * @see CAnnotationType#TEXT
+ */
+public class CNoteStyleFragment extends CBasicPropertiesFragment implements ColorPickerView.COnColorChangeListener {
 
     private CColorListView colorListView;
 
@@ -34,12 +43,11 @@ public class CNoteStyleFragment extends CBasicPropertiesFragment {
         return new CNoteStyleFragment();
     }
 
-    private View rootView;
 
     @Nullable
     @Override
     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
-        rootView = inflater.inflate(R.layout.tools_properties_note_style_fragment, container, false);
+        View rootView = inflater.inflate(R.layout.tools_properties_note_style_fragment, container, false);
         colorListView = rootView.findViewById(R.id.color_list_view);
         stylePreviewView = rootView.findViewById(R.id.style_preview);
         stylePreviewView.setAnnotType(CAnnotationType.TEXT);
@@ -50,24 +58,53 @@ public class CNoteStyleFragment extends CBasicPropertiesFragment {
     @Override
     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
-        colorListView.setColorChangeListener(color -> {
-            if (viewModel != null) {
-                viewModel.getStyle().setColor(color);
-            }
+        //Add a listener to the color list that responds to color selection.
+        colorListView.setOnColorSelectListener(this::color);
+        //Add a listener for clicks on the color picker item, which will display the color picker fragment
+        colorListView.setColorPickerClickListener(()->{
+            //display the color picker fragment
+            CAnnotStyle style = viewModel.getStyle();
+            showColorPickerFragment(style.getColor(), style.getColorOpacity(), this);
         });
-        colorListView.setColorPickerClickListener(this::nextFragment);
         viewModel.addStyleChangeListener(this);
     }
 
+    @Override
+    public void color(int color) {
+        //Get the selected color from the ColorPickerFragment
+        if (viewModel != null) {
+            //Set the color attribute for the icon of a note annotation.
+            viewModel.getStyle().setColor(color);
+        }
+    }
+
+    @Override
+    public void opacity(int opacity) {
+        if (viewModel != null){
+            viewModel.getStyle().setColorOpacity(opacity);
+        }
+    }
+
     @Override
     public void onChangeAnnotColor(int color) {
         if (!isOnResume) {
+            //When the selected color changes are detected, update the selected color in the list
             if (colorListView != null) {
                 colorListView.setSelectColor(color);
             }
         }
+        //Update the preview color of the note annotation
         if (stylePreviewView != null) {
             stylePreviewView.setColor(color);
         }
     }
+
+    @Override
+    public void onChangeAnnotColorOpacity(int opacity) {
+        super.onChangeAnnotColorOpacity(opacity);
+        //Update the preview color opacity of the note annotation
+        if (stylePreviewView != null) {
+            stylePreviewView.setColorOpacity(opacity);
+        }
+    }
 }

+ 12 - 5
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfnote/CPDFtextAnnotAttachHelper.java

@@ -1,15 +1,22 @@
 package com.compdfkit.tools.annotation.pdfproperties.pdfnote;
 
-import android.app.Activity;
-
-import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentActivity;
 
-import com.compdfkit.tools.common.utils.dialog.CGotoPageDialog;
 import com.compdfkit.ui.proxy.CPDFTextAnnotImpl;
 import com.compdfkit.ui.proxy.attach.CPDFTextAnnotAttachHelper;
+import com.compdfkit.ui.reader.CPDFReaderView;
 
 
+/**
+ * Create a helper class for text annotations that displays a pop-up window for adding text content
+ * when a text (note) annotation is added and the screen is tapped
+ * <p/>
+ * pdfView.getCPdfReaderView().getAnnotImplRegistry()
+ * .registAttachHelper(CPDFTextAnnotation.class, CPDFtextAnnotAttachHelper.class);
+ * <p/>
+ * @see CPDFReaderView#getAnnotImplRegistry()
+ *
+ */
 public class CPDFtextAnnotAttachHelper extends CPDFTextAnnotAttachHelper {
     @Override
     protected void onAddTextAnnot(CPDFTextAnnotImpl cpdfTextAnnot) {
@@ -23,7 +30,7 @@ public class CPDFtextAnnotAttachHelper extends CPDFTextAnnotAttachHelper {
             pageView.deleteAnnotation(cpdfTextAnnot);
             editDialog.dismiss();
         });
-        if (readerView.getContext() instanceof FragmentActivity){
+        if (readerView.getContext() instanceof FragmentActivity) {
             editDialog.show(((FragmentActivity) readerView.getContext()).getSupportFragmentManager(), "noteEditDialog");
         }
     }

+ 3 - 3
compdfkit-tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfnote/CPDFtextAnnotImpl.java

@@ -10,8 +10,8 @@ public class CPDFtextAnnotImpl extends CPDFTextAnnotImpl {
 
     @Override
     protected void onTouchTextAnnot(CPDFTextAnnotation cpdfTextAnnotation) {
-            CGotoPageDialog dialog = new CGotoPageDialog(readerView.getContext());
-            dialog.show();
-        }
+        CGotoPageDialog dialog = new CGotoPageDialog(readerView.getContext());
+        dialog.show();
     }
+}
 

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

@@ -0,0 +1,233 @@
+/**
+ * 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;
+
+
+import android.graphics.Color;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import com.compdfkit.core.annotation.CPDFBorderStyle;
+import com.compdfkit.tools.R;
+import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.CAnnotStyle;
+import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
+import com.compdfkit.tools.common.views.pdfproperties.colorlist.CColorListView;
+import com.compdfkit.tools.common.views.pdfproperties.colorpicker.widget.ColorPickerView;
+import com.compdfkit.tools.common.views.pdfproperties.preview.CStylePreviewView;
+import com.compdfkit.tools.common.views.pdfproperties.sliderbar.CBorderWidthSliderBar;
+import com.compdfkit.tools.common.views.pdfproperties.sliderbar.CSliderBar;
+
+public class CShapeStyleFragment extends CBasicPropertiesFragment {
+
+    private CColorListView borderColorListView;
+
+    private CColorListView fillColorListView;
+
+    private CSliderBar opacitySliderBar;
+
+    private CStylePreviewView stylePreviewView;
+
+    private CBorderWidthSliderBar borderWidthSliderBar;
+
+    private CSliderBar dashedSliderBar;
+
+    public static CShapeStyleFragment newInstance() {
+        return new CShapeStyleFragment();
+    }
+
+    @Nullable
+    @Override
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+        View rootView = inflater.inflate(R.layout.tools_properties_shape_style_fragment, container, false);
+        borderColorListView = rootView.findViewById(R.id.border_color_list_view);
+        fillColorListView = rootView.findViewById(R.id.fill_color_list_view);
+        stylePreviewView = rootView.findViewById(R.id.style_preview);
+        opacitySliderBar = rootView.findViewById(R.id.slider_bar);
+        borderWidthSliderBar = rootView.findViewById(R.id.slider_bar_border_width);
+        dashedSliderBar = rootView.findViewById(R.id.dashed_slider_bar);
+        return rootView;
+    }
+
+    @Override
+    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+        CAnnotStyle cAnnotStyle = viewModel.getStyle();
+        if (cAnnotStyle != null) {
+            stylePreviewView.setColor(cAnnotStyle.getFillColor());
+            stylePreviewView.setColorOpacity(cAnnotStyle.getFillColorOpacity());
+            stylePreviewView.setBorderWidth((int) cAnnotStyle.getBorderWidth());
+            stylePreviewView.setBorderColor(cAnnotStyle.getLineColor());
+            stylePreviewView.setBorderColorOpacity(cAnnotStyle.getLineColorOpacity());
+            stylePreviewView.setDashedSpaceWidth((int) cAnnotStyle.getBorderStyle().getDashArr()[1]);
+
+            borderColorListView.setSelectColor(cAnnotStyle.getLineColor());
+            fillColorListView.setSelectColor(cAnnotStyle.getFillColor());
+            borderWidthSliderBar.setProgress((int) cAnnotStyle.getBorderWidth());
+
+            opacitySliderBar.setProgress(cAnnotStyle.getLineColorOpacity());
+            dashedSliderBar.setProgress((int) cAnnotStyle.getBorderStyle().getDashArr()[1]);
+        }
+        viewModel.addStyleChangeListener(this);
+
+        opacitySliderBar.setChangeListener((opacity, percentageValue) -> updateColorOpacity(opacity));
+        borderColorListView.setOnColorSelectListener(this::updateBorderColor);
+        fillColorListView.setOnColorSelectListener(this::updateFillColor);
+        borderWidthSliderBar.setChangeListener((progress, percentageValue) -> {
+            if (viewModel != null) {
+                viewModel.getStyle().setBorderWidth(progress);
+            }
+        });
+        dashedSliderBar.setChangeListener((progress, percentageValue) -> {
+            if (viewModel != null) {
+                CPDFBorderStyle style = viewModel.getStyle().getBorderStyle();
+                if (style == null) {
+                    style = new CPDFBorderStyle();
+                }
+                if (progress == 0) {
+                    style.setStyle(CPDFBorderStyle.Style.Border_Solid);
+                    style.setDashArr(new float[]{8.0F, progress});
+                } else {
+                    style.setStyle(CPDFBorderStyle.Style.Border_Dashed);
+                    style.setDashArr(new float[]{8.0F, progress});
+                }
+                viewModel.getStyle().setBorderStyle(style);
+            }
+        });
+
+        borderColorListView.setColorPickerClickListener(() -> {
+            CAnnotStyle style = viewModel.getStyle();
+            showColorPickerFragment(style.getLineColor(), style.getLineColorOpacity(), new ColorPickerView.COnColorChangeListener() {
+                @Override
+                public void color(int color) {
+                    updateBorderColor(color);
+                }
+
+                @Override
+                public void opacity(int opacity) {
+                    updateColorOpacity(opacity);
+                }
+            });
+        });
+        fillColorListView.setColorPickerClickListener(() -> {
+            CAnnotStyle style = viewModel.getStyle();
+            showColorPickerFragment(style.getFillColor(), style.getFillColorOpacity(), new ColorPickerView.COnColorChangeListener() {
+                @Override
+                public void color(int color) {
+                    updateFillColor(color);
+                }
+
+                @Override
+                public void opacity(int opacity) {
+                    updateColorOpacity(opacity);
+                }
+            });
+        });
+    }
+
+    private void updateBorderColor(int color) {
+        if (viewModel != null) {
+            CAnnotStyle style = viewModel.getStyle();
+            if (style.getLineColor() == Color.TRANSPARENT) {
+                style.setLineColorOpacity(opacitySliderBar.getProgress());
+            }
+            viewModel.getStyle().setLineColor(color);
+        }
+    }
+
+    private void updateFillColor(int fillColor) {
+        if (viewModel != null) {
+            CAnnotStyle style = viewModel.getStyle();
+            if (style.getFillColor() == Color.TRANSPARENT) {
+                style.setFillColorOpacity(opacitySliderBar.getProgress());
+            }
+            style.setFillColor(fillColor);
+        }
+    }
+
+    private void updateColorOpacity(int opacity) {
+        if (viewModel != null) {
+            CAnnotStyle style = viewModel.getStyle();
+            if (style.getFillColor() != Color.TRANSPARENT) {
+                style.setFillColorOpacity(opacity);
+            }
+            if (style.getLineColor() != Color.TRANSPARENT) {
+                style.setLineColorOpacity(opacity);
+            }
+        }
+    }
+
+    @Override
+    public void onChangeAnnotFillColor(int color) {
+        if (stylePreviewView != null) {
+            stylePreviewView.setColor(color);
+        }
+        if (!isOnResume) {
+            if (fillColorListView != null) {
+                fillColorListView.setSelectColor(color);
+            }
+        }
+    }
+
+    @Override
+    public void onChangeAnnotFillColorOpacity(int opacity) {
+        if (stylePreviewView != null) {
+            stylePreviewView.setColorOpacity(opacity);
+        }
+        if (!isOnResume) {
+            if (opacitySliderBar != null) {
+                opacitySliderBar.setProgress(opacity);
+            }
+        }
+    }
+
+    @Override
+    public void onChangeAnnotBorderWidth(float borderWidth) {
+        if (stylePreviewView != null) {
+            stylePreviewView.setBorderWidth((int) borderWidth);
+        }
+    }
+
+    @Override
+    public void onChangeAnnotLineColor(int color) {
+        if (stylePreviewView != null) {
+            stylePreviewView.setBorderColor(color);
+        }
+        if (!isOnResume) {
+            if (borderColorListView != null) {
+                borderColorListView.setSelectColor(color);
+            }
+        }
+    }
+
+    @Override
+    public void onChangeAnnotLineColorOpacity(int opacity) {
+        if (stylePreviewView != null) {
+            stylePreviewView.setBorderColorOpacity(opacity);
+        }
+        if (!isOnResume) {
+            if (opacitySliderBar != null) {
+                opacitySliderBar.setProgress(opacity);
+            }
+        }
+    }
+
+    @Override
+    public void onChangeAnnotBorderStyle(CPDFBorderStyle style) {
+        super.onChangeAnnotBorderStyle(style);
+        if (stylePreviewView != null) {
+            stylePreviewView.setDashedSpaceWidth((int) style.getDashArr()[1]);
+        }
+    }
+}

+ 1 - 1
compdfkit-tools/src/main/java/com/compdfkit/tools/common/interfaces/COnColorChangeListener.java

@@ -11,7 +11,7 @@ package com.compdfkit.tools.common.interfaces;
 
 import androidx.annotation.ColorInt;
 
-public interface COnColorChangeListener {
+public interface COnColorSelectListener {
 
     void color(@ColorInt int color);
 

+ 7 - 3
compdfkit-tools/src/main/java/com/compdfkit/tools/common/utils/CWrapHeightPageChangeCallback.java

@@ -9,9 +9,12 @@
 
 package com.compdfkit.tools.common.utils;
 
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
 import android.animation.ObjectAnimator;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.animation.AccelerateDecelerateInterpolator;
 import android.view.animation.LinearInterpolator;
 
 import androidx.fragment.app.Fragment;
@@ -48,9 +51,10 @@ public class CWrapHeightPageChangeCallback extends ViewPager2.OnPageChangeCallba
                     View.MeasureSpec.makeMeasureSpec(view.getWidth(), View.MeasureSpec.EXACTLY);
             int hMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
             view.measure(wMeasureSpec, hMeasureSpec);
+            view.requestLayout();
             int measuredHeight = view.getMeasuredHeight();
             int layoutParamsHeight = viewPager2.getLayoutParams().height;
-            if (layoutParamsHeight != measuredHeight) {
+            if (layoutParamsHeight != measuredHeight ) {
                 if (layoutParamsHeight > 0 && measuredHeight > 0) {
                     requestHeightAnimation(viewPager2, layoutParamsHeight, measuredHeight);
                 }else {
@@ -62,11 +66,11 @@ public class CWrapHeightPageChangeCallback extends ViewPager2.OnPageChangeCallba
         });
     }
 
-    private void requestHeightAnimation(View view, int startHeight, int endHeight) {
+    public static void requestHeightAnimation(ViewPager2 view, int startHeight, int endHeight) {
         ViewWrapper viewWrapper = new ViewWrapper(view);
         ObjectAnimator objectAnimator = ObjectAnimator.ofInt(viewWrapper, "height", startHeight, endHeight);
         objectAnimator.setDuration(200);
-        objectAnimator.setInterpolator(new LinearInterpolator());
+        objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
         objectAnimator.start();
     }
 

+ 34 - 8
compdfkit-tools/src/main/java/com/compdfkit/tools/common/utils/animation/CFillScreenManager.java

@@ -14,6 +14,7 @@ import android.animation.AnimatorListenerAdapter;
 import android.animation.ObjectAnimator;
 import android.animation.PropertyValuesHolder;
 import android.view.View;
+import android.view.animation.AccelerateDecelerateInterpolator;
 import android.view.animation.AccelerateInterpolator;
 import android.view.animation.LinearInterpolator;
 
@@ -22,6 +23,7 @@ import com.compdfkit.tools.common.views.pdfview.CPDFViewCtrl;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.LinkedHashSet;
 import java.util.List;
 
 
@@ -29,12 +31,12 @@ public class CFillScreenManager {
 
     public static final long CONFIG_SHORT_ANIM_TIME = 300L;
 
-    private List<View> topToolViewList = new ArrayList<>();
-    private List<View> bottomToolViewList = new ArrayList<>();
+    private LinkedHashSet<View> topToolViewList = new LinkedHashSet<>();
+    private LinkedHashSet<View> bottomToolViewList = new LinkedHashSet<>();
 
-    private List<View> leftToolViewList = new ArrayList<>();
+    private LinkedHashSet<View> leftToolViewList = new LinkedHashSet<>();
 
-    private List<View> rightToolViewList = new ArrayList<>();
+    private LinkedHashSet<View> rightToolViewList = new LinkedHashSet<>();
 
     public void showFromTop(View view, long duration) {
         if (view.getVisibility() == android.view.View.VISIBLE) {
@@ -149,7 +151,7 @@ public class CFillScreenManager {
         view.animate()
                 .alpha(1f)
                 .translationX(0f)
-                .setInterpolator(new AccelerateInterpolator())
+                .setInterpolator(new AccelerateDecelerateInterpolator())
                 .setDuration(duration)
                 .setListener(new AnimatorListenerAdapter() {
                     @Override
@@ -172,7 +174,7 @@ public class CFillScreenManager {
         view.animate()
                 .alpha(0.0f)
                 .translationXBy(-1.0f * view.getWidth())
-                .setInterpolator(new AccelerateInterpolator())
+                .setInterpolator(new AccelerateDecelerateInterpolator())
                 .setDuration(duration)
                 .setListener(new AnimatorListenerAdapter() {
                     @Override
@@ -199,7 +201,7 @@ public class CFillScreenManager {
         view.animate()
                 .alpha(1f)
                 .translationX(0.0f)
-                .setInterpolator(new AccelerateInterpolator())
+                .setInterpolator(new AccelerateDecelerateInterpolator())
                 .setDuration(duration)
                 .setListener(new AnimatorListenerAdapter() {
                     @Override
@@ -222,7 +224,7 @@ public class CFillScreenManager {
         view.animate()
                 .alpha(0.0f)
                 .translationX((float)view.getWidth())
-                .setInterpolator(new AccelerateInterpolator())
+                .setInterpolator(new AccelerateDecelerateInterpolator())
                 .setDuration(duration)
                 .setListener(new AnimatorListenerAdapter() {
                     @Override
@@ -288,4 +290,28 @@ public class CFillScreenManager {
         leftToolViewList.remove(view);
         rightToolViewList.remove(view);
     }
+
+
+    public void removeAndHideToolView(View view){
+        if (topToolViewList.contains(view)) {
+            hideFromTop(view, 200);
+            topToolViewList.remove(view);
+            return;
+        }
+        if (leftToolViewList.contains(view)) {
+            hideFromLeft(view, 200);
+            leftToolViewList.remove(view);
+            return;
+        }
+        if (rightToolViewList.contains(view)) {
+            hideFromRight(view, 200);
+            rightToolViewList.remove(view);
+            return;
+        }
+        if (bottomToolViewList.contains(view)) {
+            hideFromBottom(view, 200);
+            bottomToolViewList.remove(view);
+        }
+    }
+
 }

+ 23 - 2
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfannotationbar/CAnnotationToolbar.java

@@ -50,6 +50,8 @@ public class CAnnotationToolbar extends FrameLayout {
 
     private FragmentManager fragmentManager;
 
+    private OnAnnotationChangeListener annotationChangeListener;
+
     public CAnnotationToolbar(@NonNull Context context) {
         this(context, null);
     }
@@ -110,8 +112,12 @@ public class CAnnotationToolbar extends FrameLayout {
         this.pdfView = pdfView;
         toolListAdapter.setList(CAnnotationToolDatas.getAnnotationList(pdfView));
         this.pdfView.addOnPDFFocusedTypeChangeListener(type -> {
-            toolListAdapter.selectByType(CAnnotationType.getType(type));
-            ivSetting.setEnabled(toolListAdapter.hasSelectAnnotType());
+            if (type == CPDFAnnotation.Type.UNKNOWN) {
+                if (toolListAdapter.hasSelectAnnotType()) {
+                    toolListAdapter.selectByType(CAnnotationType.UNKNOWN);
+                    ivSetting.setEnabled(toolListAdapter.hasSelectAnnotType());
+                }
+            }
         });
     }
 
@@ -120,9 +126,13 @@ public class CAnnotationToolbar extends FrameLayout {
     }
 
     private void switchAnnotationType(CAnnotToolBean bean) {
+        ivSetting.setEnabled(toolListAdapter.hasSelectAnnotType());
         if (!bean.isSelect()) {
             pdfView.resetAnnotationType();
             pdfView.getCPdfReaderView().getInkDrawHelper().onClean();
+            if (annotationChangeListener != null) {
+                annotationChangeListener.change(CAnnotationType.UNKNOWN);
+            }
             return;
         }
         if (bean.getType() != CAnnotationType.INK) {
@@ -149,6 +159,9 @@ public class CAnnotationToolbar extends FrameLayout {
                 pdfView.changeAnnotationType(CPDFAnnotation.Type.valueOf(bean.getType().name()));
                 break;
         }
+        if (annotationChangeListener != null) {
+            annotationChangeListener.change(bean.getType());
+        }
     }
 
     private void undo() {
@@ -174,4 +187,12 @@ public class CAnnotationToolbar extends FrameLayout {
                 break;
         }
     }
+
+    public void setAnnotationChangeListener(OnAnnotationChangeListener annotationChangeListener) {
+        this.annotationChangeListener = annotationChangeListener;
+    }
+
+    public interface OnAnnotationChangeListener {
+        void change(CAnnotationType type);
+    }
 }

+ 35 - 8
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/basic/CBasicPropertiesFragment.java

@@ -15,8 +15,10 @@ import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
 import androidx.lifecycle.ViewModelProvider;
 
+import com.compdfkit.core.annotation.CPDFBorderStyle;
 import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.CAnnotStyle;
 import com.compdfkit.tools.annotation.pdfproperties.pdfannotstyle.viewmodel.CAnnotStyleViewModel;
+import com.compdfkit.tools.common.views.pdfproperties.colorpicker.widget.ColorPickerView;
 
 
 public abstract class CBasicPropertiesFragment extends Fragment implements CAnnotStyle.OnAnnotStyleChangeListener {
@@ -45,13 +47,9 @@ public abstract class CBasicPropertiesFragment extends Fragment implements CAnno
         isOnResume = false;
     }
 
-    public void setSwitchFragmentListener(OnSwitchFragmentListener switchFragmentListener) {
-        this.switchFragmentListener = switchFragmentListener;
-    }
-
-    protected void nextFragment() {
+    protected void showColorPickerFragment(int color, int opacity, ColorPickerView.COnColorChangeListener listener) {
         if (switchFragmentListener != null) {
-            switchFragmentListener.nextFragment();
+            switchFragmentListener.colorPickerFragment(color, opacity, listener);
         }
     }
 
@@ -76,11 +74,40 @@ public abstract class CBasicPropertiesFragment extends Fragment implements CAnno
 
     }
 
+    @Override
+    public void onChangeAnnotLineColor(int color) {
+
+    }
+
+    @Override
+    public void onChangeAnnotLineColorOpacity(int opacity) {
+
+    }
+
+    @Override
+    public void onChangeAnnotFillColor(int color) {
+
+    }
+
+    @Override
+    public void onChangeAnnotFillColorOpacity(int opacity) {
+
+    }
+
+
+    @Override
+    public void onChangeAnnotBorderStyle(CPDFBorderStyle style) {
+
+    }
+
+    public void setSwitchFragmentListener(OnSwitchFragmentListener switchFragmentListener) {
+        this.switchFragmentListener = switchFragmentListener;
+    }
+
     public interface OnSwitchFragmentListener {
 
-        void nextFragment();
+        void colorPickerFragment(int color, int opacity, ColorPickerView.COnColorChangeListener colorChangeListener);
 
         void previousFragment();
     }
-
 }

+ 8 - 8
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorlist/CColorListView.java

@@ -23,7 +23,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.compdfkit.tools.R;
-import com.compdfkit.tools.common.interfaces.COnColorChangeListener;
+import com.compdfkit.tools.common.interfaces.COnColorSelectListener;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -42,7 +42,7 @@ public class CColorListView extends LinearLayout {
 
     private CColorListAdapter colorListAdapter;
 
-    private COnColorChangeListener colorChangeListener;
+    private COnColorSelectListener onColorSelectListener;
 
     private OnColorPickerClickListener colorPickerClickListener;
 
@@ -90,12 +90,12 @@ public class CColorListView extends LinearLayout {
             CColorItemBean bean = adapter.list.get(position);
             if (bean.isColorPicker()){
                 if (colorPickerClickListener != null) {
-                    colorPickerClickListener.colorPicker();
+                    colorPickerClickListener.click();
                 }
             }else {
                 colorListAdapter.selectItem(position);
-                if (colorChangeListener != null) {
-                    colorChangeListener.color(bean.getColor());
+                if (onColorSelectListener != null) {
+                    onColorSelectListener.color(bean.getColor());
                 }
             }
         });
@@ -134,8 +134,8 @@ public class CColorListView extends LinearLayout {
         }
     }
 
-    public void setColorChangeListener(COnColorChangeListener colorChangeListener) {
-        this.colorChangeListener = colorChangeListener;
+    public void setOnColorSelectListener(COnColorSelectListener onColorSelectListener) {
+        this.onColorSelectListener = onColorSelectListener;
     }
 
     public void setColorPickerClickListener(OnColorPickerClickListener colorPickerClickListener) {
@@ -143,7 +143,7 @@ public class CColorListView extends LinearLayout {
     }
 
     public interface OnColorPickerClickListener{
-        void colorPicker();
+        void click();
     }
 
 }

+ 22 - 33
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorpicker/CColorPickerFragment.java

@@ -9,6 +9,7 @@
 
 package com.compdfkit.tools.common.views.pdfproperties.colorpicker;
 
+import android.graphics.Color;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -19,6 +20,7 @@ import androidx.annotation.Nullable;
 
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
+import com.compdfkit.tools.common.views.pdfproperties.colorlist.CColorListView;
 import com.compdfkit.tools.common.views.pdfproperties.colorpicker.widget.ColorPickerView;
 
 
@@ -30,53 +32,36 @@ public class CColorPickerFragment extends CBasicPropertiesFragment {
 
     private ColorPickerView colorPickerView;
 
+    private int mSetColor = Color.BLACK;
+
+    private int mSetColorOpacity = 255;
+
+    private ColorPickerView.COnColorChangeListener colorChangeListener;
+
     @Nullable
     @Override
     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
         View rootView = inflater.inflate(R.layout.tools_color_pick_fragment, container, false);
         colorPickerView = rootView.findViewById(R.id.color_picker_view);
-        int color = viewModel.getStyle().getColor();
-        int alpha = viewModel.getStyle().getColorOpacity();
-        colorPickerView.initColor(color, alpha);
+        colorPickerView.initColor(mSetColor, mSetColorOpacity);
         colorPickerView.setColorPickerListener(new ColorPickerView.COnColorChangeListener() {
             @Override
             public void color(int color) {
-                if (viewModel != null) {
-                    viewModel.getStyle().setColor(color);
+                if (colorChangeListener != null) {
+                    colorChangeListener.color(color);
                 }
             }
 
             @Override
             public void opacity(int opacity) {
-                if (viewModel != null) {
-                    viewModel.getStyle().setColorOpacity(opacity);
+                if (colorChangeListener != null) {
+                    colorChangeListener.opacity(opacity);
                 }
             }
         });
-        viewModel.addStyleChangeListener(this);
         return rootView;
     }
 
-    @Override
-    public void onChangeAnnotColor(int color) {
-        super.onChangeAnnotColor(color);
-        if (!isOnResume) {
-            if (colorPickerView != null) {
-                colorPickerView.initColor(color);
-            }
-        }
-    }
-
-    @Override
-    public void onChangeAnnotColorOpacity(int opacity) {
-        super.onChangeAnnotColorOpacity(opacity);
-        if (!isOnResume) {
-            if (colorPickerView != null) {
-                colorPickerView.initColor(opacity);
-            }
-        }
-    }
-
     @Override
     public void onPause() {
         super.onPause();
@@ -87,11 +72,15 @@ public class CColorPickerFragment extends CBasicPropertiesFragment {
         }
     }
 
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-        if (viewModel != null) {
-            viewModel.removeStyleChangeListener(this);
+    public void initColor(int color, int opacity){
+        this.mSetColor = color;
+        this.mSetColorOpacity = opacity;
+        if (colorPickerView != null) {
+            colorPickerView.initColor(mSetColor, mSetColorOpacity);
         }
     }
+
+    public void setColorPickerClickListener(ColorPickerView.COnColorChangeListener colorChangeListener) {
+        this.colorChangeListener = colorChangeListener;
+    }
 }

+ 1 - 2
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorpicker/widget/ColorPickerView.java

@@ -72,7 +72,7 @@ public class ColorPickerView extends FrameLayout implements View.OnTouchListener
             colorOpacitySliderView.setBaseColor(color1);
         });
 
-        colorSliderView.setOnColorLightChange(color1 -> {
+        colorSliderView.setOnColorSelectListener(color1 -> {
             mCurrentIndicatorColorView.changeColor(color1);
         });
 
@@ -144,5 +144,4 @@ public class ColorPickerView extends FrameLayout implements View.OnTouchListener
 
         void opacity(int opacity);
     }
-
 }

+ 3 - 3
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorpicker/widget/ColorRectView.java

@@ -21,7 +21,7 @@ import android.widget.FrameLayout;
 
 import androidx.annotation.Nullable;
 
-import com.compdfkit.tools.common.interfaces.COnColorChangeListener;
+import com.compdfkit.tools.common.interfaces.COnColorSelectListener;
 import com.compdfkit.tools.common.utils.viewutils.CDimensUtils;
 import com.compdfkit.tools.common.views.pdfproperties.colorpicker.interfaces.CMotionEventUpdatable;
 
@@ -33,7 +33,7 @@ public class ColorRectView extends FrameLayout implements CMotionEventUpdatable
 
     private boolean onlyUpdateOnTouchEventUp = false;
 
-    private COnColorChangeListener colorSelectListener;
+    private COnColorSelectListener colorSelectListener;
 
     private ColorRectSelector selector;
 
@@ -191,7 +191,7 @@ public class ColorRectView extends FrameLayout implements CMotionEventUpdatable
         this.onlyUpdateOnTouchEventUp = onlyUpdateOnTouchEventUp;
     }
 
-    public void setColorSelectListener(COnColorChangeListener colorSelectListener) {
+    public void setColorSelectListener(COnColorSelectListener colorSelectListener) {
         this.colorSelectListener = colorSelectListener;
     }
 }

+ 6 - 7
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/colorpicker/widget/ColorSliderView.java

@@ -25,7 +25,7 @@ import android.view.View;
 
 import androidx.annotation.Nullable;
 
-import com.compdfkit.tools.common.interfaces.COnColorChangeListener;
+import com.compdfkit.tools.common.interfaces.COnColorSelectListener;
 import com.compdfkit.tools.common.utils.viewutils.CDimensUtils;
 import com.compdfkit.tools.common.views.pdfproperties.colorpicker.interfaces.CMotionEventUpdatable;
 
@@ -53,11 +53,10 @@ class ColorSliderView extends View implements CMotionEventUpdatable {
 
     private PointF currentPoint;
 
-    private COnColorChangeListener onColorLightChange;
+    private COnColorSelectListener onColorSelectListener;
 
     private RectF roundRect = new RectF();
 
-
     public ColorSliderView(Context context) {
         this(context, null);
     }
@@ -190,14 +189,14 @@ class ColorSliderView extends View implements CMotionEventUpdatable {
         updateValue(event.getX());
         boolean isTouchUpEvent = event.getActionMasked() == MotionEvent.ACTION_UP;
         if (!onlyUpdateOnTouchEventUp || isTouchUpEvent) {
-            if (onColorLightChange != null) {
-                onColorLightChange.color(assembleColor());
+            if (onColorSelectListener != null) {
+                onColorSelectListener.color(assembleColor());
             }
         }
     }
 
-    public void setOnColorLightChange(COnColorChangeListener onColorLightChange) {
-        this.onColorLightChange = onColorLightChange;
+    public void setOnColorSelectListener(COnColorSelectListener onColorSelectListener) {
+        this.onColorSelectListener = onColorSelectListener;
     }
 
     public void setOnlyUpdateOnTouchEventUp(boolean onlyUpdateOnTouchEventUp) {

+ 5 - 4
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotInkPreviewView.java

@@ -35,14 +35,15 @@ public class CAnnotInkPreviewView extends CBasicAnnotPreviewView{
     }
 
     @Override
-    protected int layoutResId() {
-        return 0;
+    protected void bindView() {
+        sineCurveView = new CSineCurveView(getContext());
+        addView(sineCurveView);
     }
 
+
     @Override
     protected void initView() {
-        sineCurveView = new CSineCurveView(getContext());
-        addView(sineCurveView);
+
     }
 
     @Override

+ 2 - 2
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotMarkupPreviewView.java

@@ -36,8 +36,8 @@ class CAnnotMarkupPreviewView extends CBasicAnnotPreviewView {
     }
 
     @Override
-    protected int layoutResId() {
-        return R.layout.tools_annot_preview_markup;
+    protected void bindView() {
+        inflate(getContext(), R.layout.tools_annot_preview_markup, this);
     }
 
     @Override

+ 4 - 4
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotNotePreviewView.java

@@ -26,10 +26,10 @@ import com.compdfkit.tools.R;
         super(context);
     }
 
-    @Override
-    protected int layoutResId() {
-        return R.layout.tools_annot_preview_note;
-    }
+     @Override
+     protected void bindView() {
+         inflate(getContext(), R.layout.tools_annot_preview_note, this);
+     }
 
     @Override
     protected void initView() {

+ 238 - 0
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotShapePreviewView.java

@@ -0,0 +1,238 @@
+package com.compdfkit.tools.common.views.pdfproperties.preview;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.DashPathEffect;
+import android.graphics.Paint;
+import android.graphics.Path;
+import android.graphics.Rect;
+import android.util.AttributeSet;
+import android.view.View;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.IntRange;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+/**
+ * @classname:
+ * @author: LiuXiaoLong
+ * @date: 2023/4/27
+ * description:
+ */
+public class CAnnotShapePreviewView extends CBasicAnnotPreviewView {
+
+    private CShapeView shapeView;
+
+    public CAnnotShapePreviewView(@NonNull Context context) {
+        super(context);
+    }
+
+    public CAnnotShapePreviewView(@NonNull Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public CAnnotShapePreviewView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    @Override
+    protected void bindView() {
+        shapeView = new CShapeView(getContext());
+        addView(shapeView);
+    }
+
+    @Override
+    protected void initView() {
+
+    }
+
+    @Override
+    public void setColor(int color) {
+        super.setColor(color);
+        if (shapeView != null) {
+            shapeView.setFillColor(color);
+        }
+    }
+
+    @Override
+    public void setColorOpacity(int opacity) {
+        super.setColorOpacity(opacity);
+        if (shapeView != null) {
+            shapeView.setFillColorOpacity(opacity);
+        }
+    }
+
+    @Override
+    public void setBorderColor(int color) {
+        super.setBorderColor(color);
+        if (shapeView != null) {
+            shapeView.setBorderColor(color);
+        }
+    }
+
+    @Override
+    public void setBorderColorOpacity(int opacity) {
+        super.setBorderColorOpacity(opacity);
+        if (shapeView != null) {
+            shapeView.setBorderColorOpacity(opacity);
+        }
+    }
+
+    @Override
+    public void setBorderWidth(int borderWidth) {
+        super.setBorderWidth(borderWidth);
+        if (shapeView != null) {
+            shapeView.setBorderWidth(borderWidth);
+        }
+    }
+
+    @Override
+    public void setDashedSpace(int dashedSpace) {
+        if (shapeView != null) {
+            shapeView.setDashGap(dashedSpace);
+        }
+    }
+
+    static class CShapeView extends View {
+
+        enum ShapeType {
+            SQUARE,
+            OVAL,
+            LINE,
+            ARROW,
+        }
+
+        public static final float SQUARE_RATIO = 16F / 9F;
+        private Paint borderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+
+        private Paint fillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+
+        private ShapeType shapeType = ShapeType.SQUARE;
+
+        private int borderColor = Color.BLACK;
+
+        private int fillColor = Color.GRAY;
+
+        private int borderColorOpacity = 255;
+
+        private int fillColorOpacity = 255;
+
+        private int borderWidth = 0;
+
+        private Rect squareRect = new Rect();
+
+        private Rect fillSquareRect = new Rect();
+
+        private int mDashWidth = 8;
+
+        private int mDashGap = 0;
+
+        public CShapeView(Context context) {
+            this(context, null);
+        }
+
+        public CShapeView(Context context, @Nullable AttributeSet attrs) {
+            this(context, attrs, 0);
+        }
+
+        public CShapeView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+            super(context, attrs, defStyleAttr);
+            init(context);
+        }
+
+        private void init(Context context) {
+
+            borderPaint.setColor(borderColor);
+            borderPaint.setAlpha(borderColorOpacity);
+            borderPaint.setStyle(Paint.Style.STROKE);
+            borderPaint.setStrokeWidth(borderWidth);
+            borderPaint.setStrokeCap(Paint.Cap.SQUARE);
+            if (mDashGap != 0){
+                borderPaint.setPathEffect(new DashPathEffect(new float[]{mDashWidth, mDashGap + borderWidth}, 0));
+            }
+
+            fillPaint.setColor(fillColor);
+            fillPaint.setAlpha(fillColorOpacity);
+            fillPaint.setStyle(Paint.Style.FILL_AND_STROKE);
+        }
+
+        public void setBorderColor(@ColorInt int color) {
+            this.borderColor = color;
+            borderPaint.setColor(color);
+            borderPaint.setAlpha(borderColorOpacity);
+            invalidate();
+        }
+
+        public void setBorderColorOpacity(@IntRange(from = 0, to = 255) int opacity) {
+            this.borderColorOpacity = opacity;
+            borderPaint.setAlpha(borderColorOpacity);
+            invalidate();
+        }
+
+        public void setFillColor(@ColorInt int color) {
+            this.fillColor = color;
+            fillPaint.setColor(fillColor);
+            fillPaint.setAlpha(fillColorOpacity);
+            invalidate();
+        }
+
+        public void setFillColorOpacity(@IntRange(from = 0, to = 255) int opacity) {
+            this.fillColorOpacity = opacity;
+            fillPaint.setAlpha(fillColorOpacity);
+            invalidate();
+        }
+
+        public void setDashGap(@IntRange(from = 0, to = 8) int dashGap) {
+            this.mDashGap = dashGap;
+            if (dashGap == 0) {
+                borderPaint.setStyle(Paint.Style.STROKE);
+                borderPaint.setPathEffect(null);
+            } else {
+                borderPaint.setPathEffect(new DashPathEffect(new float[]{mDashWidth, mDashGap + borderWidth}, 0));
+            }
+            invalidate();
+        }
+
+        public void setBorderWidth(int borderWidth) {
+            this.borderWidth = borderWidth;
+            borderPaint.setStrokeWidth(borderWidth);
+            if (mDashGap == 0){
+                borderPaint.setPathEffect(null);
+            }else {
+                borderPaint.setPathEffect(new DashPathEffect(new float[]{mDashWidth, mDashGap + borderWidth}, 0));
+            }
+            invalidate();
+        }
+
+        private Rect sizeRect = new Rect();
+
+        @Override
+        protected void onDraw(Canvas canvas) {
+            super.onDraw(canvas);
+            switch (shapeType) {
+                case SQUARE:
+                    float width = getHeight() * SQUARE_RATIO;
+                    float left = (float) getWidth() / 2F - (width / 2);
+
+                    sizeRect.set((int) left,
+                            0,
+                            (int) (left + width),
+                            getHeight());
+
+                    fillSquareRect.set(sizeRect.left + borderWidth, sizeRect.top + borderWidth, sizeRect.right - borderWidth, sizeRect.bottom - borderWidth);
+                    canvas.drawRect(fillSquareRect, fillPaint);
+
+                    squareRect.set(fillSquareRect.left - (borderWidth / 2),
+                            fillSquareRect.top - (borderWidth / 2),
+                            fillSquareRect.right + (borderWidth / 2),
+                            fillSquareRect.bottom + (borderWidth / 2));
+                    canvas.drawRect(squareRect, borderPaint);
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+}

+ 8 - 4
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CBasicAnnotPreviewView.java

@@ -22,13 +22,12 @@ import androidx.annotation.Nullable;
 
     public CBasicAnnotPreviewView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
-        if (layoutResId() != 0) {
-            inflate(context, layoutResId(), this);
-        }
+        bindView();
         initView();
     }
 
-    protected abstract int layoutResId();
+    protected abstract void bindView();
+
 
     protected abstract void initView();
 
@@ -40,4 +39,9 @@ import androidx.annotation.Nullable;
 
     }
 
+     public void setBorderColor(@ColorInt int color){}
+
+     public void setBorderColorOpacity(@IntRange(from = 0, to = 255) int colorOpacity){}
+
+     public void setDashedSpace(int dashedSpace){}
 }

+ 21 - 0
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CStylePreviewView.java

@@ -74,6 +74,24 @@ public class CStylePreviewView extends FrameLayout {
         }
     }
 
+    public void setBorderColor(@ColorInt int color){
+        if (previewView != null) {
+            previewView.setBorderColor(color);
+        }
+    }
+
+    public void setBorderColorOpacity(int opacity){
+        if (previewView != null) {
+            previewView.setBorderColorOpacity(opacity);
+        }
+    }
+
+    public void setDashedSpaceWidth(int dashedSpace){
+        if(previewView != null){
+            previewView.setDashedSpace(dashedSpace);
+        }
+    }
+
     private void updatePreview() {
         removeAllViews();
         previewView = null;
@@ -92,6 +110,9 @@ public class CStylePreviewView extends FrameLayout {
             case INK:
                 previewView = new CAnnotInkPreviewView(getContext());
                 break;
+            case SQUARE:
+                previewView = new CAnnotShapePreviewView(getContext());
+                break;
             default:
                 break;
         }

+ 3 - 1
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/sliderbar/CBorderWidthSliderBar.java

@@ -119,7 +119,9 @@ public class CBorderWidthSliderBar extends FrameLayout implements SeekBar.OnSeek
 
     @Override
     public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
-        updateSeekBarValue(progress);
+        if (fromUser){
+            updateSeekBarValue(progress);
+        }
     }
 
     @Override

+ 8 - 1
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/sliderbar/CSliderBar.java

@@ -104,6 +104,7 @@ public class CSliderBar extends FrameLayout implements SeekBar.OnSeekBarChangeLi
             progress = sliderBarMaxValue;
         }
         this.seekBar.setProgress(progress);
+        updateSeekBarValue(progress);
     }
 
     public void setShowType(ValueShowType type){
@@ -140,13 +141,19 @@ public class CSliderBar extends FrameLayout implements SeekBar.OnSeekBarChangeLi
         }
     }
 
+    public int getProgress(){
+      return seekBar.getProgress();
+    }
+
     public void setChangeListener(OnProgressChangeListener changeListener) {
         this.changeListener = changeListener;
     }
 
     @Override
     public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
-        updateSeekBarValue(progress);
+        if (fromUser){
+            updateSeekBarValue(progress);
+        }
     }
 
     @Override

+ 3 - 3
compdfkit-tools/src/main/res/color/tools_annotation_fun_status_color.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:color="?android:attr/textColorSecondary" android:state_enabled="false"/>
-    <item android:color="#CC000000" android:state_enabled="true"/>
-    <item android:color="#CC000000"/>
+    <item android:color="#99BCBCBC" android:state_enabled="false"/>
+    <item android:color="?android:attr/colorAccent" android:state_enabled="true"/>
+    <item android:color="?android:attr/colorAccent"/>
 </selector>

+ 2 - 2
compdfkit-tools/src/main/res/layout/tools_annot_properties_ink_ctrl_layout.xml

@@ -42,7 +42,7 @@
             app:layout_constraintStart_toEndOf="@id/iv_ink_eraser"
             app:layout_constraintTop_toTopOf="parent"
             app:srcCompat="@drawable/tools_ic_annotation_undo"
-            app:tint="?android:attr/colorAccent" />
+             />
 
         <androidx.appcompat.widget.AppCompatImageView
             android:id="@+id/iv_ink_redo"
@@ -55,7 +55,7 @@
             app:layout_constraintStart_toEndOf="@id/iv_ink_undo"
             app:layout_constraintTop_toTopOf="parent"
             app:srcCompat="@drawable/tools_ic_annotation_redo"
-            app:tint="?android:attr/colorAccent" />
+            />
 
         <androidx.appcompat.widget.AppCompatImageView
             android:id="@+id/iv_ink_clean"

+ 0 - 1
compdfkit-tools/src/main/res/layout/tools_annot_style_dialog_fragment.xml

@@ -5,7 +5,6 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_gravity="bottom"
-    android:animateLayoutChanges="true"
     android:background="@drawable/tools_annot_style_dialog_window_bg">
 
     <androidx.constraintlayout.widget.ConstraintLayout

+ 4 - 1
compdfkit-tools/src/main/res/layout/tools_properties_markup_style_fragment.xml

@@ -2,7 +2,9 @@
 <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="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:paddingBottom="16dp"
+    >
 
 
     <com.compdfkit.tools.common.views.pdfproperties.preview.CStylePreviewView
@@ -28,6 +30,7 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:max="255"
+        android:layout_marginTop="8dp"
         app:layout_constraintTop_toBottomOf="@id/color_list_view"
         app:tools_slider_bar_value_show_type="percentage" />
 

+ 67 - 0
compdfkit-tools/src/main/res/layout/tools_properties_shape_style_fragment.xml

@@ -0,0 +1,67 @@
+<?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"
+    android:id="@+id/cl_rootView"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:animateLayoutChanges="true">
+
+    <com.compdfkit.tools.common.views.pdfproperties.preview.CStylePreviewView
+        android:id="@+id/style_preview"
+        android:layout_width="match_parent"
+        android:layout_height="80dp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:tools_annot_type="square" />
+
+    <com.compdfkit.tools.common.views.pdfproperties.colorlist.CColorListView
+        android:id="@+id/border_color_list_view"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/style_preview"
+        app:tools_title="@string/tools_border_color" />
+
+    <com.compdfkit.tools.common.views.pdfproperties.colorlist.CColorListView
+        android:id="@+id/fill_color_list_view"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/border_color_list_view"
+        app:tools_title="@string/tools_fill_color" />
+
+    <com.compdfkit.tools.common.views.pdfproperties.sliderbar.CSliderBar
+        android:id="@+id/slider_bar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="8dp"
+        android:max="255"
+        android:progress="255"
+        app:layout_constraintTop_toBottomOf="@id/fill_color_list_view"
+        app:tools_slider_bar_value_show_type="percentage" />
+
+    <com.compdfkit.tools.common.views.pdfproperties.sliderbar.CBorderWidthSliderBar
+        android:id="@+id/slider_bar_border_width"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:max="10"
+        android:progress="0"
+        app:layout_constraintTop_toBottomOf="@id/slider_bar"
+        app:tools_title="@string/tools_size" />
+
+    <com.compdfkit.tools.common.views.pdfproperties.sliderbar.CSliderBar
+        android:id="@+id/dashed_slider_bar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="8dp"
+        android:max="8"
+        android:paddingBottom="16dp"
+        android:progress="0"
+        app:layout_constraintTop_toBottomOf="@id/slider_bar_border_width"
+        app:tools_slider_bar_value_show_type="source"
+        app:tools_title="@string/tools_dashed_setting" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 15 - 8
compdfkit-tools/src/main/res/values/tools_strings.xml

@@ -10,10 +10,17 @@
     <string name="tools_search_result">Search Results</string>
     <string name="tools_search_hint">search</string>
 
+    <string name="tools_menu_pdfview">PDFView</string>
+    <string name="tools_menu_annotation">Annotation</string>
+    <string name="tools_menu_edit">Edit</string>
+    <string name="tools_menu_form">Form</string>
+    <string name="tools_menu_page_edit">PageEdit</string>
+    <string name="tools_custom_color">Custom Color</string>
+
     <string name="tools_thumbnail">Thumbnail</string>
     <string name="tools_outline">Outline</string>
     <string name="tools_bookmarks">Bookmarks</string>
-    <string name="tools_annotations">Annotations</string>
+
     <string name="tools_more">More</string>
     <string name="tools_document_info">Document Info</string>
     <string name="tools_reader_settings">Reader Settings</string>
@@ -67,18 +74,18 @@
     <string name="tools_color">Color:</string>
     <string name="tools_opacity">Opacity:</string>
     <string name="tools_size">Size:</string>
+    <string name="tools_dashed_setting">Dashed Setting:</string>
+    <string name="tools_border_color">Border Color:</string>
+    <string name="tools_fill_color">Fill Color:</string>
+
+    <string name="tools_annot_note">Note</string>
     <string name="tools_annot_highlight">Highlight</string>
     <string name="tools_annot_underline">Underline</string>
     <string name="tools_annot_strikeout">StrikeOut</string>
     <string name="tools_annot_squiggly">Squiggly</string>
-    <string name="tools_annot_note">Note</string>
     <string name="tools_annot_ink">Ink</string>
+    <string name="tools_annot_square">Square</string>
+
 
-    <string name="tools_menu_pdfview">PDFView</string>
-    <string name="tools_menu_annotation">Annotation</string>
-    <string name="tools_menu_edit">Edit</string>
-    <string name="tools_menu_form">Form</string>
-    <string name="tools_menu_page_edit">PageEdit</string>
-    <string name="tools_custom_color">Custom Color</string>
 
 </resources>

File diff suppressed because it is too large
+ 2 - 2
viewer-ctrl-demo/src/main/AndroidManifest.xml