Skip to content

Commit ec3f90d

Browse files
committed
v2.5.0
1 parent 3290061 commit ec3f90d

File tree

403 files changed

+2339
-849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

403 files changed

+2339
-849
lines changed
-2.24 KB
Binary file not shown.
437 KB
Binary file not shown.

ComPDFKit_Tools/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ dependencies {
5757
api project(path:':ComPDFKit_Repo:compdfkit')
5858
api project(path:':ComPDFKit_Repo:compdfkit-ui')
5959
// or use
60-
// api ('com.compdf:compdfkit:2.4.7')
61-
// api ('com.compdf:compdfkit-ui:2.4.7')
60+
// api ('com.compdf:compdfkit:2.5.0')
61+
// api ('com.compdf:compdfkit-ui:2.5.0')
62+
6263
api 'com.github.bumptech.glide:glide:4.15.1'
6364
annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'
6465
api 'androidx.documentfile:documentfile:1.0.1'

ComPDFKit_Tools/src/main/assets/tools_default_configuration.json

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"modeConfig": {
33
"initialViewMode": "viewer",
4-
"readerOnly": false,
4+
"uiVisibilityMode": "automatic",
55
"availableViewModes": [
66
"viewer",
77
"annotations",
@@ -12,7 +12,10 @@
1212
},
1313
"toolbarConfig": {
1414
"mainToolbarVisible" : true,
15+
"contentEditorToolbarVisible" : true,
1516
"annotationToolbarVisible" : true,
17+
"formToolbarVisible" : true,
18+
"signatureToolbarVisible" : true,
1619
"showInkToggleButton": true,
1720
"androidAvailableActions": [
1821
"thumbnail",
@@ -270,17 +273,80 @@
270273
"themeMode" : "system",
271274
"fileSaveExtraFontSubset" : true,
272275
"watermark": {
273-
"saveAsNewFile" : true,
274-
"outsideBackgroundColor" : ""
276+
"types" : [ "text" , "image" ],
277+
"saveAsNewFile" : false,
278+
"outsideBackgroundColor" : "",
279+
"text" : "",
280+
"image" : "tools_logo",
281+
"textSize" : 80,
282+
"textColor" : "#FF000000",
283+
"scale" : 1.0,
284+
"rotation" : -45,
285+
"opacity" : 255,
286+
"isFront" : false,
287+
"isTilePage" : false
275288
},
276289
"thumbnail": {
277290
"title" : "",
278291
"backgroundColor": "",
279292
"editMode" : true
280293
},
294+
"bota": {
295+
"tabs": ["outline", "bookmark", "annotations"],
296+
"menus": {
297+
"annotations": {
298+
"global": [
299+
{ "id": "importAnnotation" },
300+
{ "id": "exportAnnotation" },
301+
{ "id": "removeAllAnnotation" },
302+
{ "id": "removeAllReply" }
303+
],
304+
"item": [
305+
{ "id": "reviewStatus",
306+
"subMenus": [
307+
"accepted",
308+
"rejected",
309+
"cancelled",
310+
"completed",
311+
"none"
312+
]
313+
},
314+
{ "id": "markedStatus" },
315+
{
316+
"id": "more",
317+
"subMenus": [
318+
"addReply",
319+
"viewReply",
320+
"delete"
321+
]
322+
}
323+
]
324+
}
325+
}
326+
},
281327
"signatureType": "manual",
282328
"enableExitSaveTips" : true,
283-
"enableErrorTips" : true
329+
"enableErrorTips" : true,
330+
"search": {
331+
"normalKeyword": {
332+
"borderColor": "#00000000",
333+
"fillColor": "#77FFFF00"
334+
},
335+
"focusKeyword": {
336+
"borderColor": "#00000000",
337+
"fillColor": "#CCFD7338"
338+
}
339+
},
340+
"pageEditor": {
341+
"menus": [
342+
"insertPage",
343+
"replacePage",
344+
"extractPage",
345+
"copyPage",
346+
"rotatePage",
347+
"deletePage"
348+
]
349+
}
284350
},
285351
"contextMenuConfig" : {
286352
"global": {

ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfannotationbar/CAnnotationToolbar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
2+
* Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
33
* <p>
44
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
55
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfannotationbar/adapter/CPDFAnnotationToolListAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
2+
* Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
33
* <p>
44
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
55
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfannotationbar/bean/CAnnotToolBean.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
2+
* Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
33
*
44
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
55
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
@@ -99,4 +99,5 @@ public void setColorOpacity(int colorOpacity) {
9999
public int getColorOpacity() {
100100
return colorOpacity;
101101
}
102+
102103
}

ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfannotationlist/CPDFAnnotationListFragment.java

Lines changed: 100 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
2+
* Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
33
* <p>
44
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
55
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
@@ -9,6 +9,7 @@
99

1010
package com.compdfkit.tools.annotation.pdfannotationlist;
1111

12+
1213
import android.app.Activity;
1314
import android.content.Intent;
1415
import android.net.Uri;
@@ -37,6 +38,9 @@
3738
import com.compdfkit.tools.annotation.pdfannotationlist.dialog.CPDFReplyDetailsDialogFragment;
3839
import com.compdfkit.tools.common.basic.fragment.CBasicThemeFragment;
3940
import com.compdfkit.tools.common.interfaces.COnSetPDFDisplayPageIndexListener;
41+
import com.compdfkit.tools.common.pdf.config.bota.CPDFBotaAnnotationMenu;
42+
import com.compdfkit.tools.common.pdf.config.bota.CPDFBotaGlobalMenuItem;
43+
import com.compdfkit.tools.common.pdf.config.bota.CPDFBotaItemMenu;
4044
import com.compdfkit.tools.common.utils.CFileUtils;
4145
import com.compdfkit.tools.common.utils.CLog;
4246
import com.compdfkit.tools.common.utils.CToastUtil;
@@ -65,6 +69,8 @@ public class CPDFAnnotationListFragment extends CBasicThemeFragment {
6569

6670
private ProgressBar progressBar;
6771

72+
private CPDFBotaAnnotationMenu annotationMenu = new CPDFBotaAnnotationMenu();
73+
6874

6975
public static CPDFAnnotationListFragment newInstance() {
7076
return new CPDFAnnotationListFragment();
@@ -109,6 +115,9 @@ public void initWithPDFView(CPDFViewCtrl pdfView) {
109115
this.pdfView = pdfView;
110116
}
111117

118+
public void setAnnotationMenu(CPDFBotaAnnotationMenu annotationMenu) {
119+
this.annotationMenu = annotationMenu;
120+
}
112121

113122
@Override
114123
protected int layoutId() {
@@ -125,7 +134,22 @@ protected void onCreateView(View rootView) {
125134
@Override
126135
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
127136
super.onViewCreated(view, savedInstanceState);
128-
listAdapter = new CPDFAnnotListAdapter();
137+
listAdapter = new CPDFAnnotListAdapter(false,false,false);
138+
if (annotationMenu != null && !annotationMenu.getItem().isEmpty()) {
139+
for (CPDFBotaItemMenu cpdfBotaItemMenu : annotationMenu.getItem()) {
140+
switch (cpdfBotaItemMenu.getId()) {
141+
case CPDFBotaAnnotationMenu.MENU_ID_REVIEW_STATUS:
142+
listAdapter.setShowReviewStatus(true);
143+
break;
144+
case CPDFBotaAnnotationMenu.MENU_ID_MARKED_STATUS:
145+
listAdapter.setShowMarkedStatus(true);
146+
break;
147+
case CPDFBotaAnnotationMenu.MENU_ID_MORE:
148+
listAdapter.setShowMoreMenu(true);
149+
break;
150+
}
151+
}
152+
}
129153
updateAnnotationList();
130154
listAdapter.addOnItemChildClickListener((adapter, view1, position) -> {
131155
CPDFAnnotListItem item = adapter.list.get(position);
@@ -137,7 +161,10 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
137161
}
138162
}
139163
} else if (view1.getId() == R.id.iv_review_status) {
140-
listAdapter.showReviewStatusMenu(getContext(), position, view1);
164+
List<String> subMenus = annotationMenu.getReviewStatusMenu().getSubMenus();
165+
if (subMenus != null){
166+
listAdapter.showReviewStatusMenu(getContext(), position, view1, subMenus);
167+
}
141168
} else if (view1.getId() == R.id.cb_marked_status) {
142169
listAdapter.showMarkedStatusMenu(getContext(), position, view1);
143170
} else if (view1.getId() == R.id.iv_more) {
@@ -183,29 +210,44 @@ public void updateAnnotationList(boolean showProgressBar) {
183210
*
184211
*/
185212
public void showAnnotationMenu(View anchorView) {
186-
CPopupMenuWindow menuWindow = new CPopupMenuWindow(getContext());
187-
boolean hasAnnotations = !listAdapter.list.isEmpty();
188-
menuWindow.addItem(R.string.tools_import_annotations, v -> importAnnotFileLauncher.launch(CFileUtils.getIntent("application/octet-stream")));
189-
menuWindow.addItem(R.string.tools_export_annotations,hasAnnotations, v -> {
190-
// Select the directory to export the annotation files
191-
String dirPath = Environment.getExternalStorageDirectory().getAbsolutePath();
192-
CFileDirectoryDialog directoryDialog = CFileDirectoryDialog.newInstance(dirPath, getString(R.string.tools_saving_path), getString(R.string.tools_okay));
193-
directoryDialog.setSelectFolderListener(dir -> {
194-
CPDFDocument document = pdfView.getCPdfReaderView().getPDFDocument();
195-
boolean result = CPDFAnnotDatas.exportAnnotations(document, dir, CFileUtils.getFileNameNoExtension(document.getFileName()));
196-
if (result) {
197-
CToastUtil.showLongToast(getContext(), R.string.tools_export_success);
213+
if (annotationMenu != null && annotationMenu.getGlobal() != null) {
214+
CPopupMenuWindow menuWindow = new CPopupMenuWindow(getContext());
215+
boolean hasAnnotations = !listAdapter.list.isEmpty();
216+
217+
for (CPDFBotaGlobalMenuItem cpdfBotaGlobalMenuItem : annotationMenu.getGlobal()) {
218+
switch (cpdfBotaGlobalMenuItem.getId()) {
219+
case CPDFBotaAnnotationMenu.GLOBAL_MENU_ID_IMPORT_ANNOTATION:
220+
menuWindow.addItem(R.string.tools_import_annotations, v -> importAnnotFileLauncher.launch(CFileUtils.getIntent("application/octet-stream")));
221+
break;
222+
case CPDFBotaAnnotationMenu.GLOBAL_MENU_ID_EXPORT_ANNOTATION:
223+
menuWindow.addItem(R.string.tools_export_annotations,hasAnnotations, v -> {
224+
// Select the directory to export the annotation files
225+
String dirPath = Environment.getExternalStorageDirectory().getAbsolutePath();
226+
CFileDirectoryDialog directoryDialog = CFileDirectoryDialog.newInstance(dirPath, getString(R.string.tools_saving_path), getString(R.string.tools_okay));
227+
directoryDialog.setSelectFolderListener(dir -> {
228+
CPDFDocument document = pdfView.getCPdfReaderView().getPDFDocument();
229+
boolean result = CPDFAnnotDatas.exportAnnotations(document, dir, CFileUtils.getFileNameNoExtension(document.getFileName()));
230+
if (result) {
231+
CToastUtil.showLongToast(getContext(), R.string.tools_export_success);
232+
}
233+
});
234+
directoryDialog.show(getChildFragmentManager(), "dirDialog");
235+
});
236+
break;
237+
case CPDFBotaAnnotationMenu.GLOBAL_MENU_ID_REMOVE_ALL_ANNOTATION:
238+
menuWindow.addItem(R.string.tools_delete_all_annotations, hasAnnotations, v -> deleteAllAnnotations());
239+
break;
240+
case CPDFBotaAnnotationMenu.GLOBAL_MENU_ID_REMOVE_ALL_REPLY:
241+
menuWindow.addItem(R.string.tools_delete_all_replies,hasAnnotations, v -> {
242+
CPDFDocument document = pdfView.getCPdfReaderView().getPDFDocument();
243+
CPDFAnnotDatas.removeAllAnnotationReply(document);
244+
updateAnnotationList();
245+
});
246+
break;
198247
}
199-
});
200-
directoryDialog.show(getChildFragmentManager(), "dirDialog");
201-
});
202-
menuWindow.addItem(R.string.tools_delete_all_annotations, hasAnnotations, v -> deleteAllAnnotations());
203-
menuWindow.addItem(R.string.tools_delete_all_replies,hasAnnotations, v -> {
204-
CPDFDocument document = pdfView.getCPdfReaderView().getPDFDocument();
205-
CPDFAnnotDatas.removeAllAnnotationReply(document);
206-
updateAnnotationList();
207-
});
208-
menuWindow.showAsDropDown(anchorView);
248+
}
249+
menuWindow.showAsDropDown(anchorView);
250+
}
209251
}
210252

211253
/**
@@ -229,27 +271,40 @@ public void deleteAllAnnotations() {
229271
*/
230272
private void showAnnotationMoreMenu(CPDFAnnotListItem item, int position, View anchorView) {
231273
CPopupMenuWindow moreMenu = new CPopupMenuWindow(getContext());
232-
moreMenu.addItem(R.string.tools_add_a_new_reply, v -> {
233-
CPDFEditReplyDialogFragment editReplyDialogFragment = CPDFEditReplyDialogFragment.addReply();
234-
editReplyDialogFragment.setReplyContentListener(content -> {
235-
CPDFReplyAnnotation replyAnnotation = item.getAttr().createReplyAnnotation();
236-
replyAnnotation.setTitle(pdfView.getCPDFConfiguration().annotationsConfig.annotationAuthor);
237-
replyAnnotation.setContent(content);
238-
showReplyDetailsFragment(item, position);
239-
});
240-
editReplyDialogFragment.show(getChildFragmentManager(), "addReplyDialogFragment");
241-
});
242-
moreMenu.addItem(R.string.tools_view_replies, v -> showReplyDetailsFragment(item, position));
243-
moreMenu.addItem(R.string.tools_delete_annotation, v -> {
244-
boolean result = item.getAttr().removeFromPage();
245-
if (result) {
246-
listAdapter.remove(position);
247-
ArrayList<Integer> pages = new ArrayList<>();
248-
pages.add(item.getPage());
249-
pdfView.getCPdfReaderView().reloadPages(pages);
250-
pdfView.getCPdfReaderView().postDelayed(() -> updateAnnotationList(false), 450);
274+
List<String> subMenus = annotationMenu.getMoreMenu().getSubMenus();
275+
if (subMenus != null && !subMenus.isEmpty()) {
276+
for (String menu : subMenus) {
277+
switch (menu) {
278+
case CPDFBotaAnnotationMenu.MORE_MENU_ID_ADD_REPLY:
279+
moreMenu.addItem(R.string.tools_add_a_new_reply, v -> {
280+
CPDFEditReplyDialogFragment editReplyDialogFragment = CPDFEditReplyDialogFragment.addReply();
281+
editReplyDialogFragment.setReplyContentListener(content -> {
282+
CPDFReplyAnnotation replyAnnotation = item.getAttr().createReplyAnnotation();
283+
replyAnnotation.setTitle(pdfView.getCPDFConfiguration().annotationsConfig.annotationAuthor);
284+
replyAnnotation.setContent(content);
285+
showReplyDetailsFragment(item, position);
286+
});
287+
editReplyDialogFragment.show(getChildFragmentManager(), "addReplyDialogFragment");
288+
});
289+
break;
290+
case CPDFBotaAnnotationMenu.MORE_MENU_ID_VIEW_REPLY:
291+
moreMenu.addItem(R.string.tools_view_replies, v -> showReplyDetailsFragment(item, position));
292+
break;
293+
case CPDFBotaAnnotationMenu.MORE_MENU_ID_DELETE:
294+
moreMenu.addItem(R.string.tools_delete_annotation, v -> {
295+
boolean result = item.getAttr().removeFromPage();
296+
if (result) {
297+
listAdapter.remove(position);
298+
ArrayList<Integer> pages = new ArrayList<>();
299+
pages.add(item.getPage());
300+
pdfView.getCPdfReaderView().reloadPages(pages);
301+
pdfView.getCPdfReaderView().postDelayed(() -> updateAnnotationList(false), 450);
302+
}
303+
});
304+
break;
305+
}
251306
}
252-
});
307+
}
253308
int[] windowPos = CDimensUtils.calculatePopWindowPos(anchorView, moreMenu.getContentView());
254309
moreMenu.setAnimationStyle(R.style.PopupAnimation);
255310
moreMenu.showAtLocation(anchorView, Gravity.START | Gravity.TOP, windowPos[0], windowPos[1]);

0 commit comments

Comments
 (0)