Przeglądaj źródła

PDFTools(Android) - 1.优化全屏切换管理类 2.优化顶部Toolbar

liuxiaolong 1 rok temu
rodzic
commit
dd17283993

+ 0 - 127
compdfkit-tools/src/main/java/com/compdfkit/tools/common/utils/animation/AnimationUtils.java

@@ -1,127 +0,0 @@
-/**
- * Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
- *
- * 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.common.utils.animation;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.view.View;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.LinearInterpolator;
-
-
-public class AnimationUtils {
-
-    public static void hideViewFromTopToBottom(final View view, ObjectAnimator showBottomToTop) {
-        if ((showBottomToTop != null) && showBottomToTop.isRunning()) {
-            return;
-        }
-
-        if ((view != null) && (view.getVisibility() == View.VISIBLE)) {
-            PropertyValuesHolder pvhA = PropertyValuesHolder.ofFloat("alpha", 1.0f, 0f);
-            PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("Y", view.getTop(), view.getTop() + view.getHeight());
-            showBottomToTop = ObjectAnimator.ofPropertyValuesHolder(view, pvhA, pvhY);
-            showBottomToTop.setInterpolator(new AccelerateInterpolator());
-            showBottomToTop.addListener(new AnimatorListenerAdapter() {
-                @Override
-                public void onAnimationEnd(Animator animation) {
-                    super.onAnimationEnd(animation);
-                    if (null != view) {
-                        view.post(() -> view.setVisibility(View.INVISIBLE));
-                    }
-                }
-            });
-            showBottomToTop.setDuration(300).start();
-        }
-    }
-
-    public static void showViewFromBottomToTop(final View view, ObjectAnimator showBottomToTop) {
-        if ((showBottomToTop != null) && showBottomToTop.isRunning()) {
-            return;
-        }
-
-        if ((view != null) && (view.getVisibility() != View.VISIBLE)) {
-            PropertyValuesHolder pvhA = PropertyValuesHolder.ofFloat("alpha", 0f, 1.0f);
-            PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("Y", view.getTop() + view.getHeight(), view.getTop());
-            showBottomToTop = ObjectAnimator.ofPropertyValuesHolder(view, pvhA, pvhY);
-            showBottomToTop.setInterpolator(new AccelerateInterpolator());
-            showBottomToTop.addListener(new AnimatorListenerAdapter() {
-                @Override
-                public void onAnimationStart(Animator animation) {
-                    super.onAnimationStart(animation);
-                    if (null != view) {
-                        view.post(() -> view.setVisibility(View.VISIBLE));
-                    }
-                }
-            });
-            showBottomToTop.setDuration(300).start();
-        }
-    }
-
-    public static void hideViewFromBottomToTop(final View view, ObjectAnimator showTopToBottom) {
-        if ((showTopToBottom != null) && showTopToBottom.isRunning()) {
-            return;
-        }
-
-        if ((view != null) && (view.getVisibility() == View.VISIBLE)) {
-            PropertyValuesHolder pvhA = PropertyValuesHolder.ofFloat("alpha", 1.0f, 0f);
-            PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("Y", view.getTop(), view.getTop() - view.getHeight());
-            showTopToBottom = ObjectAnimator.ofPropertyValuesHolder(view, pvhA, pvhY);
-            showTopToBottom.setInterpolator(new AccelerateInterpolator());
-            showTopToBottom.addListener(new AnimatorListenerAdapter() {
-                @Override
-                public void onAnimationEnd(Animator animation) {
-                    super.onAnimationEnd(animation);
-                    if (null != view) {
-                        view.post(() -> view.setVisibility(View.INVISIBLE));
-                    }
-                }
-            });
-            showTopToBottom.setDuration(300).start();
-        }
-    }
-
-    public static void showViewFromTopToBottom(final View view, ObjectAnimator showTopToBottom) {
-        if ((showTopToBottom != null) && showTopToBottom.isRunning()) {
-            return;
-        }
-
-        if ((view != null) && (view.getVisibility() != View.VISIBLE)) {
-            PropertyValuesHolder pvhA = PropertyValuesHolder.ofFloat("alpha", 0f, 1.0f);
-            PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("Y", view.getTop() - view.getHeight(), view.getTop());
-            showTopToBottom = ObjectAnimator.ofPropertyValuesHolder(view, pvhA, pvhY);
-            showTopToBottom.setInterpolator(new AccelerateInterpolator());
-            showTopToBottom.addListener(new AnimatorListenerAdapter() {
-                @Override
-                public void onAnimationStart(Animator animation) {
-                    super.onAnimationStart(animation);
-                    if (null != view) {
-                        view.post(() -> view.setVisibility(View.VISIBLE));
-                    }
-                }
-            });
-            showTopToBottom.setDuration(300).start();
-        }
-    }
-
-    public static void rotateFloatingButton(boolean isMenuOpen, View view, ObjectAnimator showRotation) {
-        if ((showRotation != null) && showRotation.isRunning()) {
-            return;
-        }
-        if (view != null) {
-            showRotation = isMenuOpen ? ObjectAnimator.ofFloat(view
-                    , "rotation", 45F, 0f) : ObjectAnimator.ofFloat(view, "rotation", 0f, 45f);
-            showRotation.setDuration(150);
-            showRotation.setInterpolator(new LinearInterpolator());
-            showRotation.start();
-        }
-    }
-}

+ 158 - 0
compdfkit-tools/src/main/java/com/compdfkit/tools/common/utils/animation/CFillScreenManager.java

@@ -0,0 +1,158 @@
+/**
+ * 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.common.utils.animation;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
+import android.view.View;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.LinearInterpolator;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+
+public class CFillScreenManager {
+
+    public static final long CONFIG_SHORT_ANIM_TIME = 300L;
+
+    private List<View> topToolViewList = new ArrayList<>();
+    private List<View> bottomToolViewList = new ArrayList<>();
+
+    public void showFromTop(View view, long duration) {
+        if (view.getVisibility() == android.view.View.VISIBLE) {
+            return;
+        }
+        if (!view.isHardwareAccelerated()) {
+            view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+        }
+        view.setAlpha(0F);
+        view.setVisibility(View.VISIBLE);
+        view.animate()
+                .alpha(1f)
+                .translationY(0f)
+                .setInterpolator(new AccelerateInterpolator())
+                .setDuration(duration)
+                .setListener(new AnimatorListenerAdapter() {
+                    @Override
+                    public void onAnimationEnd(Animator animation) {
+                        super.onAnimationEnd(animation);
+                        animation.removeListener(this);
+                        view.setLayerType(View.LAYER_TYPE_NONE, null);
+                        view.clearAnimation();
+                    }
+                });
+    }
+
+    public void hideFromTop(View view, long duration) {
+        if (view.getVisibility() != android.view.View.VISIBLE) {
+            return;
+        }
+        if (!view.isHardwareAccelerated()) {
+            view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+        }
+        view.animate()
+                .alpha(0.0f)
+                .translationY(-1.0f * view.getHeight())
+                .setInterpolator(new AccelerateInterpolator())
+                .setDuration(duration)
+                .setListener(new AnimatorListenerAdapter() {
+                    @Override
+                    public void onAnimationEnd(Animator animation) {
+                        super.onAnimationEnd(animation);
+                        animation.removeListener(this);
+                        view.setLayerType(View.LAYER_TYPE_NONE, null);
+                        view.clearAnimation();
+                        view.setVisibility(View.GONE);
+                    }
+                });
+    }
+
+    public void showFromBottom(View view, long duration) {
+        if (view.getVisibility() == android.view.View.VISIBLE) {
+            return;
+        }
+        if (!view.isHardwareAccelerated()) {
+            view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+        }
+        view.setAlpha(0F);
+        view.setVisibility(View.VISIBLE);
+        view.animate()
+                .alpha(1f)
+                .translationY(0f)
+                .setInterpolator(new AccelerateInterpolator())
+                .setDuration(duration)
+                .setListener(new AnimatorListenerAdapter() {
+                    @Override
+                    public void onAnimationEnd(Animator animation) {
+                        super.onAnimationEnd(animation);
+                        animation.removeListener(this);
+                        view.setLayerType(View.LAYER_TYPE_NONE, null);
+                        view.clearAnimation();
+                    }
+                });
+    }
+
+    public void hideFromBottom(View view, long duration) {
+        if (view.getVisibility() != android.view.View.VISIBLE) {
+            return;
+        }
+        if (!view.isHardwareAccelerated()) {
+            view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+        }
+        view.animate()
+                .alpha(0.0f)
+                .translationY((float) view.getHeight())
+                .setInterpolator(new AccelerateInterpolator())
+                .setDuration(duration)
+                .setListener(new AnimatorListenerAdapter() {
+                    @Override
+                    public void onAnimationEnd(Animator animation) {
+                        super.onAnimationEnd(animation);
+                        animation.removeListener(this);
+                        view.setLayerType(View.LAYER_TYPE_NONE, null);
+                        view.clearAnimation();
+                        view.setVisibility(View.GONE);
+                    }
+                });
+    }
+
+
+
+    public void bindTopToolView(View... topToolView) {
+        topToolViewList.addAll(Arrays.asList(topToolView));
+    }
+
+    public void bindBottomToolViewList(View... bottomToolView) {
+        bottomToolViewList.addAll(Arrays.asList(bottomToolView));
+    }
+
+
+    public void fillScreenChange(boolean fillScreen) {
+        if (fillScreen) {
+            for (View view : topToolViewList) {
+                hideFromTop(view, CONFIG_SHORT_ANIM_TIME);
+            }
+            for (View view : bottomToolViewList) {
+                hideFromBottom(view, CONFIG_SHORT_ANIM_TIME);
+            }
+        } else {
+            for (View view : topToolViewList) {
+                showFromTop(view, CONFIG_SHORT_ANIM_TIME);
+            }
+            for (View view : bottomToolViewList) {
+                showFromBottom(view, CONFIG_SHORT_ANIM_TIME);
+            }
+        }
+    }
+}

+ 127 - 1
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/CPDFToolBar.java

@@ -15,18 +15,27 @@ import android.content.res.TypedArray;
 import android.graphics.drawable.Drawable;
 import android.text.TextUtils;
 import android.util.AttributeSet;
+import android.view.Gravity;
 import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
 import android.view.View;
 import android.widget.FrameLayout;
+import android.widget.LinearLayout;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.widget.AppCompatImageView;
 import androidx.appcompat.widget.AppCompatTextView;
+import androidx.appcompat.widget.PopupMenu;
+import androidx.constraintlayout.widget.ConstraintLayout;
 
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.common.utils.viewutils.CViewUtils;
 
+import java.util.ArrayList;
+import java.util.List;
+
 
 /**
  * pdf ui tool bar <br/>
@@ -64,7 +73,17 @@ import com.compdfkit.tools.common.utils.viewutils.CViewUtils;
  * moreBtnClick:
  * @see CPDFToolBar#setMoreBtnClickListener(OnClickListener)
  */
-public class CPDFToolBar extends FrameLayout {
+public class CPDFToolBar extends FrameLayout implements PopupMenu.OnMenuItemClickListener {
+
+
+
+    enum PreviewMode {
+        PDFView,
+        Annotation,
+        Form,
+        Edit,
+        PageEdit
+    }
 
     private AppCompatTextView tvToolBarTitle;
 
@@ -74,6 +93,27 @@ public class CPDFToolBar extends FrameLayout {
 
     private AppCompatImageView ivToolBarMoreBtn;
 
+    private AppCompatImageView ivToolBarThumbnail;
+
+    private ConstraintLayout clMainToolbar;
+
+    private AppCompatImageView ivTitleArrow;
+
+    private LinearLayout llTitle;
+
+    private PopupMenu popupMenu;
+
+    private List<PreviewMode> previewModes = new ArrayList<>();
+    private int samplePDFViewMenuId = View.generateViewId();
+    private int annotViewMenuId = View.generateViewId();
+    private int editMenuId = View.generateViewId();
+    private int pageEditMenuId = View.generateViewId();
+    private int formMenuId = View.generateViewId();
+
+    private PreviewMode currentPreviewMode = PreviewMode.PDFView;
+
+    private OnPreviewModeChangeListener changeListener;
+
     public CPDFToolBar(@NonNull Context context) {
         this(context, null);
     }
@@ -89,10 +129,20 @@ public class CPDFToolBar extends FrameLayout {
 
     private void initToolBar(Context context, @Nullable AttributeSet attrs) {
         LayoutInflater.from(getContext()).inflate(R.layout.tools_cpdf_tool_bar, this);
+        clMainToolbar = findViewById(R.id.cl_pdf_root_tool_bar);
         tvToolBarTitle = findViewById(R.id.tv_tool_bar_title);
         ivToolBarMoreBtn = findViewById(R.id.iv_tool_bar_more);
         ivToolBarSearchBtn = findViewById(R.id.iv_tool_bar_search);
         ivToolBarBoTaBtn = findViewById(R.id.iv_tool_bar_bota);
+        ivToolBarThumbnail = findViewById(R.id.iv_tool_bar_thumbnail);
+        llTitle = findViewById(R.id.ll_title);
+        ivTitleArrow = findViewById(R.id.iv_down_arrow);
+        popupMenu = new PopupMenu(getContext(), llTitle, Gravity.CENTER);
+        modifyPopupMenuStatus();
+        llTitle.setOnClickListener(v -> {
+            PopupMenu popupMenu = new PopupMenu(getContext(), llTitle, Gravity.CENTER);
+
+        });
         initAttributes(context, attrs);
     }
 
@@ -121,6 +171,63 @@ public class CPDFToolBar extends FrameLayout {
         }
     }
 
+    private void modifyPopupMenuStatus(){
+        ivTitleArrow.setVisibility(previewModes.size() <=0 ? GONE : VISIBLE);
+        popupMenu.getMenu().clear();
+        for (int i = 0; i < previewModes.size(); i++) {
+            PreviewMode type = previewModes.get(i);
+            int titleResId;
+            int menuId;
+            switch(type){
+                case Edit:
+                    titleResId = R.string.tools_menu_edit;
+                    menuId = editMenuId;
+                    break;
+                case Form:
+                    titleResId = R.string.tools_menu_form;
+                    menuId = formMenuId;
+                    break;
+                case PageEdit:
+                    titleResId = R.string.tools_menu_page_edit;
+                    menuId = pageEditMenuId;
+                    break;
+                case Annotation:
+                    titleResId = R.string.tools_menu_annotation;
+                    menuId = annotViewMenuId;
+                    break;
+                default:
+                    titleResId = R.string.tools_menu_pdfview;
+                    menuId = samplePDFViewMenuId;
+                    break;
+            }
+            popupMenu.getMenu().add(Menu.NONE, menuId, i, getContext().getString(titleResId));
+        }
+    }
+
+
+    @Override
+    public boolean onMenuItemClick(MenuItem item) {
+        if (item.getItemId() == samplePDFViewMenuId){
+
+        } else if (item.getItemId() == annotViewMenuId) {
+
+        } else if (item.getItemId() == editMenuId) {
+
+        } else if (item.getItemId() == pageEditMenuId) {
+
+        } else if (item.getItemId() == formMenuId){
+
+        }
+        return false;
+    }
+
+    private void changeMode(PreviewMode mode){
+        currentPreviewMode = mode;
+        if (changeListener != null) {
+            changeListener.change(currentPreviewMode);
+        }
+    }
+
     public void setSearchBtnClickListener(View.OnClickListener clickListener) {
         ivToolBarSearchBtn.setOnClickListener(clickListener);
     }
@@ -132,4 +239,23 @@ public class CPDFToolBar extends FrameLayout {
     public void setMoreBtnClickListener(View.OnClickListener clickListener) {
         ivToolBarMoreBtn.setOnClickListener(clickListener);
     }
+
+    public void setThumbnailBtnClickListener(View.OnClickListener clickListener){
+        ivToolBarThumbnail.setOnClickListener(clickListener);
+    }
+
+    public void setPreviewModeChangeListener(OnPreviewModeChangeListener changeListener) {
+        this.changeListener = changeListener;
+    }
+
+    public void addMode(PreviewMode previewMode){
+        previewModes.add(previewMode);
+        modifyPopupMenuStatus();
+    }
+
+    public interface OnPreviewModeChangeListener{
+        void change(PreviewMode mode);
+    }
+
+
 }

+ 16 - 0
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfbota/CPDFBotaDialogFragment.java

@@ -103,6 +103,7 @@ public class CPDFBotaDialogFragment extends BottomSheetDialogFragment {
             dismiss();
         });
         viewPager2.setAdapter(boTaViewPagerAdapter);
+        viewPager2.setCurrentItem(getDefaultSelectIndex(), false);
         viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
             @Override
             public void onPageSelected(int position) {
@@ -114,4 +115,19 @@ public class CPDFBotaDialogFragment extends BottomSheetDialogFragment {
         });
         tabLayoutMediator.attach();
     }
+
+    private int getDefaultSelectIndex(){
+        int defaultSelectIndex = 0;
+        if (tabs.size() <=1){
+            return 0;
+        }
+        for (int i = 0; i < tabs.size(); i++) {
+            CPDFBotaFragmentTabs tab = tabs.get(i);
+            if (tab.isDefaultSelect()){
+                return i;
+            }
+        }
+        return defaultSelectIndex;
+    }
+
 }

+ 10 - 0
compdfkit-tools/src/main/java/com/compdfkit/tools/common/views/pdfbota/CPDFBotaFragmentTabs.java

@@ -17,6 +17,8 @@ public class CPDFBotaFragmentTabs {
 
     private String title;
 
+    private boolean defaultSelect;
+
     public CPDFBotaFragmentTabs(@CPDFBOTA int botaType, String title){
         this.botaType = botaType;
         this.title = title;
@@ -37,4 +39,12 @@ public class CPDFBotaFragmentTabs {
     public void setTitle(String title) {
         this.title = title;
     }
+
+    public boolean isDefaultSelect() {
+        return defaultSelect;
+    }
+
+    public void setDefaultSelect(boolean defaultSelect) {
+        this.defaultSelect = defaultSelect;
+    }
 }

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

@@ -27,6 +27,7 @@ import androidx.annotation.Nullable;
 import androidx.appcompat.widget.ViewUtils;
 import androidx.interpolator.view.animation.FastOutLinearInInterpolator;
 
+import com.compdfkit.core.annotation.CPDFAnnotation;
 import com.compdfkit.core.document.CPDFDocument;
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.common.contextmenu.CContextMenuHelper;

Plik diff jest za duży
+ 8 - 0
compdfkit-tools/src/main/res/drawable/tools_ic_thumbnail.xml


+ 28 - 45
compdfkit-tools/src/main/res/layout/tools_cpdf_tool_bar.xml

@@ -4,59 +4,42 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:id="@+id/cl_pdf_root_tool_bar"
     tools:layout_height="?android:attr/actionBarSize">
 
+    <include layout="@layout/tools_cpdf_tool_bar_pdf_view_menu_layout"/>
 
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_tool_bar_title"
+    <LinearLayout
+        android:id="@+id/ll_title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        android:textColor="?android:attr/textColorPrimary"
-        app:layout_constraintTop_toTopOf="parent"
-        android:textSize="16sp"
-        tools:text="PDF View" />
-
-    <androidx.appcompat.widget.AppCompatImageView
-        android:id="@+id/iv_tool_bar_search"
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_margin="10dp"
-        android:padding="4dp"
-        app:tint="?android:attr/colorAccent"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintDimensionRatio="1:1"
-        app:layout_constraintEnd_toStartOf="@id/iv_tool_bar_bota"
-        app:layout_constraintTop_toTopOf="parent"
-        app:srcCompat="@drawable/tools_ic_search" />
-
-    <androidx.appcompat.widget.AppCompatImageView
-        android:id="@+id/iv_tool_bar_bota"
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_margin="10dp"
-        android:padding="4dp"
-        app:tint="?android:attr/colorAccent"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintDimensionRatio="1:1"
-        app:layout_constraintEnd_toStartOf="@id/iv_tool_bar_more"
         app:layout_constraintTop_toTopOf="parent"
-        app:srcCompat="@drawable/tools_ic_outline" />
-
-    <androidx.appcompat.widget.AppCompatImageView
-        android:id="@+id/iv_tool_bar_more"
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_margin="10dp"
-        android:padding="4dp"
-        app:tint="?android:attr/colorAccent"
+        app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintDimensionRatio="1:1"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:srcCompat="@drawable/tools_ic_more" />
+        android:gravity="center_vertical"
+        android:background="?android:attr/selectableItemBackground"
+        >
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tv_tool_bar_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="?android:attr/textColorPrimary"
+            android:textSize="16sp"
+            tools:text="PDF View" />
+
+        <androidx.appcompat.widget.AppCompatImageView
+            android:id="@+id/iv_down_arrow"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            tools:visibility="visible"
+            android:visibility="gone"
+            app:srcCompat="@drawable/tools_ic_arrow_down"
+            />
+
+    </LinearLayout>
+
 
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 62 - 0
compdfkit-tools/src/main/res/layout/tools_cpdf_tool_bar_pdf_view_menu_layout.xml

@@ -0,0 +1,62 @@
+<?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:layout_width="match_parent"
+    android:layout_height="?android:attr/actionBarSize">
+
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/iv_tool_bar_thumbnail"
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_margin="10dp"
+        android:padding="4dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintDimensionRatio="1:1"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:srcCompat="@drawable/tools_ic_thumbnail"
+        app:tint="?android:attr/colorAccent" />
+
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/iv_tool_bar_search"
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_margin="10dp"
+        android:padding="4dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintDimensionRatio="1:1"
+        app:layout_constraintEnd_toStartOf="@id/iv_tool_bar_bota"
+        app:layout_constraintTop_toTopOf="parent"
+        app:srcCompat="@drawable/tools_ic_search"
+        app:tint="?android:attr/colorAccent" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/iv_tool_bar_bota"
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_margin="10dp"
+        android:padding="4dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintDimensionRatio="1:1"
+        app:layout_constraintEnd_toStartOf="@id/iv_tool_bar_more"
+        app:layout_constraintTop_toTopOf="parent"
+        app:srcCompat="@drawable/tools_ic_outline"
+        app:tint="?android:attr/colorAccent" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/iv_tool_bar_more"
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_margin="10dp"
+        android:padding="4dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintDimensionRatio="1:1"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:srcCompat="@drawable/tools_ic_more"
+        app:tint="?android:attr/colorAccent" />
+
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 7 - 0
compdfkit-tools/src/main/res/values/tools_strings.xml

@@ -62,4 +62,11 @@
     <string name="tools_bookmark_title">Bookmark Title</string>
     <string name="tools_custom_themes_color">Custom</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>
+
+
 </resources>

+ 15 - 13
viewer-ctrl-demo/src/main/java/com/compdfkit/demo/viewer/PDFViewerSampleActivity.java

@@ -9,7 +9,6 @@
 
 package com.compdfkit.demo.viewer;
 
-import android.animation.ObjectAnimator;
 import android.os.Bundle;
 import android.view.View;
 
@@ -18,11 +17,10 @@ import androidx.appcompat.widget.PopupMenu;
 
 import com.compdfkit.demo.viewer.databinding.ViewerPdfSampleActivityBinding;
 import com.compdfkit.tools.common.utils.task.CExtractAssetFileTask;
-import com.compdfkit.tools.common.utils.animation.AnimationUtils;
+import com.compdfkit.tools.common.utils.animation.CFillScreenManager;
 import com.compdfkit.tools.common.views.pdfbota.CPDFBOTA;
 import com.compdfkit.tools.common.views.pdfbota.CPDFBotaDialogFragment;
 import com.compdfkit.tools.common.views.pdfbota.CPDFBotaFragmentTabs;
-import com.compdfkit.tools.common.views.pdfview.CPDFViewCtrl;
 import com.compdfkit.tools.viewer.pdfdisplaysettings.CPDFDisplaySettingDialogFragment;
 import com.compdfkit.tools.viewer.pdfinfo.CPDFDocumentInfoDialogFragment;
 import com.compdfkit.tools.viewer.pdfsearch.CSearchResultBottomSheetDialogFragment;
@@ -39,9 +37,7 @@ public class PDFViewerSampleActivity extends AppCompatActivity {
 
     private ViewerPdfSampleActivityBinding binding;
 
-    private ObjectAnimator showBottomToTopAnimator;
-
-    private ObjectAnimator showTopToBottomAnimator;
+    private CFillScreenManager screenManager = new CFillScreenManager();
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -55,12 +51,10 @@ public class PDFViewerSampleActivity extends AppCompatActivity {
             binding.pdfView.openPDF(filePath);
         });
 
+        screenManager.bindTopToolView(binding.flTool);
+
         binding.pdfView.setOnTapMainDocAreaCallback(() -> {
-            if (binding.flTool.getVisibility() == View.INVISIBLE){
-                AnimationUtils.showViewFromTopToBottom(binding.flTool, showTopToBottomAnimator );
-            }else {
-                AnimationUtils.hideViewFromBottomToTop(binding.flTool, showBottomToTopAnimator);
-            }
+            screenManager.fillScreenChange(binding.flTool.getVisibility() == View.VISIBLE);
         });
 
     }
@@ -75,17 +69,25 @@ public class PDFViewerSampleActivity extends AppCompatActivity {
             //Show a fragment of the PDF thumbnail and a dialog fragment of the PDF outline list.
             CPDFBotaDialogFragment botaDialogFragment = CPDFBotaDialogFragment.newInstance();
             botaDialogFragment.initWithPDFView(binding.pdfView);
-            CPDFBotaFragmentTabs thumbnailTabs = new CPDFBotaFragmentTabs(CPDFBOTA.THUMBNAIL, "Thumbnail");
             CPDFBotaFragmentTabs outlineTabs = new CPDFBotaFragmentTabs(CPDFBOTA.OUTLINE, "Outline");
             CPDFBotaFragmentTabs bookmarks = new CPDFBotaFragmentTabs(CPDFBOTA.BOOKMARKS, "Bookmarks");
             ArrayList<CPDFBotaFragmentTabs> tabs = new ArrayList<>();
-            tabs.add(thumbnailTabs);
             tabs.add(outlineTabs);
             tabs.add(bookmarks);
             botaDialogFragment.setBotaDialogTabs(tabs);
             botaDialogFragment.show(getSupportFragmentManager(), "boTaDialogFragment");
         });
 
+        binding.pdfToolBar.setThumbnailBtnClickListener(v -> {
+            CPDFBotaDialogFragment botaDialogFragment = CPDFBotaDialogFragment.newInstance();
+            botaDialogFragment.initWithPDFView(binding.pdfView);
+            CPDFBotaFragmentTabs thumbnailTabs = new CPDFBotaFragmentTabs(CPDFBOTA.THUMBNAIL, "Thumbnail");
+            ArrayList<CPDFBotaFragmentTabs> tabs = new ArrayList<>();
+            tabs.add(thumbnailTabs);
+            botaDialogFragment.setBotaDialogTabs(tabs);
+            botaDialogFragment.show(getSupportFragmentManager(), "boTaDialogFragment");
+        });
+
         binding.pdfToolBar.setMoreBtnClickListener(v -> {
             //Show the PDF settings dialog fragment
             PopupMenu popupMenu = new PopupMenu(this, v);