我正在调查适用于 Android 的 PDF 库 PSPDFKit。
// Inside my app's dependencies {}
implementation 'com.pspdfkit:pspdfkit-demo:4.0.2'
该库令人印象深刻,并具有许多“开箱即用”的宝贵功能。但是,我遇到了创建注释注释时显示的对话框片段的问题。
我需要一个自定义的对话框 UI,因为我的应用程序显示的 PDF 允许多个用户添加/编辑注释。这需要在编辑注释时显示的对话框包含创建注释的用户个人资料图像和全名。
我com.pspdfkit.ui.PdfFragment
在我的应用程序中用作子片段,并且在创建和/或编辑注释注释时看不到任何允许我提供自定义 dialogFragment 的方式。
是否可以自定义在 PSPDFKit 中创建/编辑注释片段时显示的对话框片段?
从我所看到的源代码来看,我需要在 PSPDFKit 中重写这个方法。
public void enterAnnotationCreationMode(@NonNull final AnnotationTool annotationTool) {
this.viewCoordinator.a(new b() {
public void run(@NonNull FrameLayout container, @NonNull PdfPasswordView passwordView, @NonNull View errorView, @NonNull final DocumentView documentView) {
el var10000 = com.pspdfkit.framework.a.d();
PdfFragment.this.getContext();
if(var10000.a(PdfFragment.this.configuration)) {
if(!PdfFragment.this.getAnnotationPreferences().isAnnotationCreatorSet()) {
AnnotationCreatorInputDialogFragment.show(PdfFragment.this.getActivity().getSupportFragmentManager(), (String)null, new OnAnnotationCreatorSetListener() {
public void onAnnotationCreatorSet(String annotationCreator) {
documentView.enterAnnotationCreationMode(annotationTool);
}
public void onAbort() {
}
});
com.pspdfkit.framework.a.f().a("show_annotation_creator_dialog").a();
} else {
documentView.enterAnnotationCreationMode(annotationTool);
}
} else {
throw new PSPDFKitException("Entering annotation creation mode for " + annotationTool + " is not permitted, either by the license or configuration.");
}
}
}, true);
}