|
@@ -16,6 +16,7 @@ import android.os.Environment;
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
|
|
|
|
import androidx.core.content.ContextCompat;
|
|
import androidx.core.content.ContextCompat;
|
|
|
|
+import androidx.fragment.app.FragmentActivity;
|
|
|
|
|
|
import com.compdfkit.core.annotation.CPDFBorderStyle;
|
|
import com.compdfkit.core.annotation.CPDFBorderStyle;
|
|
import com.compdfkit.core.annotation.CPDFLineAnnotation;
|
|
import com.compdfkit.core.annotation.CPDFLineAnnotation;
|
|
@@ -39,6 +40,7 @@ import com.compdfkit.tools.common.contextmenu.impl.CSearchReplaceContextMenuView
|
|
import com.compdfkit.tools.common.contextmenu.impl.CSignatureContextMenuView;
|
|
import com.compdfkit.tools.common.contextmenu.impl.CSignatureContextMenuView;
|
|
import com.compdfkit.tools.common.utils.CFileUtils;
|
|
import com.compdfkit.tools.common.utils.CFileUtils;
|
|
import com.compdfkit.tools.common.utils.CPermissionUtil;
|
|
import com.compdfkit.tools.common.utils.CPermissionUtil;
|
|
|
|
+import com.compdfkit.tools.common.utils.dialog.CLoadingDialog;
|
|
import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleType;
|
|
import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleType;
|
|
import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.manager.CStyleManager;
|
|
import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.manager.CStyleManager;
|
|
import com.compdfkit.tools.common.views.pdfview.CPDFViewCtrl;
|
|
import com.compdfkit.tools.common.views.pdfview.CPDFViewCtrl;
|
|
@@ -108,7 +110,7 @@ public class CBasicPDFFragment extends CPermissionFragment {
|
|
.setShape(CStyleType.ANNOT_LINE, defaultColor, 255, defaultColor, 255, 5, null)
|
|
.setShape(CStyleType.ANNOT_LINE, defaultColor, 255, defaultColor, 255, 5, null)
|
|
.setShapeArrow(defaultColor, 255, defaultColor, 255, 5,
|
|
.setShapeArrow(defaultColor, 255, defaultColor, 255, 5,
|
|
CPDFLineAnnotation.LineType.LINETYPE_NONE, CPDFLineAnnotation.LineType.LINETYPE_ARROW,
|
|
CPDFLineAnnotation.LineType.LINETYPE_NONE, CPDFLineAnnotation.LineType.LINETYPE_ARROW,
|
|
- new CPDFBorderStyle(CPDFBorderStyle.Style.Border_Solid,5,new float[]{8.0F, 0F}))
|
|
|
|
|
|
+ new CPDFBorderStyle(CPDFBorderStyle.Style.Border_Solid, 5, new float[]{8.0F, 0F}))
|
|
.setInkAttribute(defaultColor, 255, 10, 10)
|
|
.setInkAttribute(defaultColor, 255, 10, 10)
|
|
.setFreeText(defaultColor, 255, 50)
|
|
.setFreeText(defaultColor, 255, 50)
|
|
.init(pdfView, true);
|
|
.init(pdfView, true);
|
|
@@ -160,7 +162,7 @@ public class CBasicPDFFragment extends CPermissionFragment {
|
|
protected void sharePDF(CPDFViewCtrl pdfView) {
|
|
protected void sharePDF(CPDFViewCtrl pdfView) {
|
|
pdfView.exitEditMode();
|
|
pdfView.exitEditMode();
|
|
CPDFDocument document = pdfView.getCPdfReaderView().getPDFDocument();
|
|
CPDFDocument document = pdfView.getCPdfReaderView().getPDFDocument();
|
|
- if (document == null){
|
|
|
|
|
|
+ if (document == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
boolean isExternalFile = !TextUtils.isEmpty(document.getAbsolutePath()) &&
|
|
boolean isExternalFile = !TextUtils.isEmpty(document.getAbsolutePath()) &&
|
|
@@ -178,8 +180,8 @@ public class CBasicPDFFragment extends CPermissionFragment {
|
|
CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", pdfUri);
|
|
CFileUtils.shareFile(getContext(), getString(R.string.tools_share_to), "application/pdf", pdfUri);
|
|
}
|
|
}
|
|
}, e -> {
|
|
}, e -> {
|
|
- if (e instanceof CPDFDocumentException){
|
|
|
|
- if (!document.isCanWrite() && document.hasRepaired()){
|
|
|
|
|
|
+ if (e instanceof CPDFDocumentException) {
|
|
|
|
+ if (!document.isCanWrite() && document.hasRepaired()) {
|
|
pdfView.showWritePermissionsDialog(document);
|
|
pdfView.showWritePermissionsDialog(document);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -195,4 +197,22 @@ public class CBasicPDFFragment extends CPermissionFragment {
|
|
pageEditDialogFragment.setOnBackListener(backListener);
|
|
pageEditDialogFragment.setOnBackListener(backListener);
|
|
pageEditDialogFragment.show(getChildFragmentManager(), "pageEditDialogFragment");
|
|
pageEditDialogFragment.show(getChildFragmentManager(), "pageEditDialogFragment");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private CLoadingDialog loadingDialog;
|
|
|
|
+
|
|
|
|
+ protected void showLoadingDialog() {
|
|
|
|
+ if (loadingDialog != null && loadingDialog.isVisible()) {
|
|
|
|
+ loadingDialog.dismiss();
|
|
|
|
+ }
|
|
|
|
+ if (getContext() instanceof FragmentActivity) {
|
|
|
|
+ loadingDialog = CLoadingDialog.newInstance();
|
|
|
|
+ loadingDialog.show(((FragmentActivity) getContext()).getSupportFragmentManager(), "loadingDialog");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void dismissLoadingDialog() {
|
|
|
|
+ if (loadingDialog != null) {
|
|
|
|
+ loadingDialog.dismiss();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|