|
@@ -16,8 +16,8 @@ import static com.compdfkit.tools.contenteditor.CEditToolbar.SELECT_AREA_TEXT;
|
|
|
|
|
|
import android.Manifest;
|
|
import android.Manifest;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
-import android.content.Intent;
|
|
|
|
import android.content.res.Configuration;
|
|
import android.content.res.Configuration;
|
|
|
|
+import android.graphics.Color;
|
|
import android.graphics.Paint;
|
|
import android.graphics.Paint;
|
|
import android.net.Uri;
|
|
import android.net.Uri;
|
|
import android.os.Build;
|
|
import android.os.Build;
|
|
@@ -41,6 +41,7 @@ import com.compdfkit.core.annotation.CPDFAnnotation;
|
|
import com.compdfkit.core.annotation.CPDFFreetextAnnotation;
|
|
import com.compdfkit.core.annotation.CPDFFreetextAnnotation;
|
|
import com.compdfkit.core.annotation.form.CPDFSignatureWidget;
|
|
import com.compdfkit.core.annotation.form.CPDFSignatureWidget;
|
|
import com.compdfkit.core.document.CPDFDocument;
|
|
import com.compdfkit.core.document.CPDFDocument;
|
|
|
|
+import com.compdfkit.core.edit.CPDFEditConfig;
|
|
import com.compdfkit.core.edit.CPDFEditManager;
|
|
import com.compdfkit.core.edit.CPDFEditManager;
|
|
import com.compdfkit.core.edit.CPDFEditPage;
|
|
import com.compdfkit.core.edit.CPDFEditPage;
|
|
import com.compdfkit.core.page.CPDFPage;
|
|
import com.compdfkit.core.page.CPDFPage;
|
|
@@ -90,6 +91,7 @@ import com.compdfkit.ui.proxy.CPDFAnnotDefaultImpl;
|
|
import com.compdfkit.ui.proxy.form.CPDFComboboxWidgetImpl;
|
|
import com.compdfkit.ui.proxy.form.CPDFComboboxWidgetImpl;
|
|
import com.compdfkit.ui.proxy.form.CPDFListboxWidgetImpl;
|
|
import com.compdfkit.ui.proxy.form.CPDFListboxWidgetImpl;
|
|
import com.compdfkit.ui.proxy.form.CPDFPushbuttonWidgetImpl;
|
|
import com.compdfkit.ui.proxy.form.CPDFPushbuttonWidgetImpl;
|
|
|
|
+import com.compdfkit.ui.reader.CPDFPageView;
|
|
import com.compdfkit.ui.reader.CPDFReaderView;
|
|
import com.compdfkit.ui.reader.CPDFReaderView;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
@@ -107,7 +109,7 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
|
|
|
|
public static final String EXTRA_CONFIGURATION = "extra_configuration";
|
|
public static final String EXTRA_CONFIGURATION = "extra_configuration";
|
|
|
|
|
|
- protected CSampleScreenManager screenManager = new CSampleScreenManager();
|
|
|
|
|
|
+ public CSampleScreenManager screenManager = new CSampleScreenManager();
|
|
|
|
|
|
public ConstraintLayout clRoot;
|
|
public ConstraintLayout clRoot;
|
|
|
|
|
|
@@ -281,6 +283,9 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
pdfSearchToolBarView.showSearchReplaceContextMenu();
|
|
pdfSearchToolBarView.showSearchReplaceContextMenu();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ if (pdfView.getCPdfReaderView().getTouchMode() == CPDFReaderView.TouchMode.SCREENSHOT){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (!cpdfConfiguration.modeConfig.readerOnly){
|
|
if (!cpdfConfiguration.modeConfig.readerOnly){
|
|
//Use the CFillScreenManager.class to manage fullscreen switching.
|
|
//Use the CFillScreenManager.class to manage fullscreen switching.
|
|
screenManager.fillScreenChange();
|
|
screenManager.fillScreenChange();
|
|
@@ -315,8 +320,9 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
if (pdfView.getCPdfReaderView() == null) {
|
|
if (pdfView.getCPdfReaderView() == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- pdfView.getCPdfReaderView().removeAllAnnotFocus();
|
|
|
|
- IContextMenuShowListener contextMenuShowListener = pdfView.getCPdfReaderView().getContextMenuShowListener();
|
|
|
|
|
|
+ CPDFReaderView readerView = pdfView.getCPdfReaderView();
|
|
|
|
+ readerView.removeAllAnnotFocus();
|
|
|
|
+ IContextMenuShowListener contextMenuShowListener = readerView.getContextMenuShowListener();
|
|
if (contextMenuShowListener != null) {
|
|
if (contextMenuShowListener != null) {
|
|
contextMenuShowListener.dismissContextMenu();
|
|
contextMenuShowListener.dismissContextMenu();
|
|
}
|
|
}
|
|
@@ -326,17 +332,20 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
signatureToolBar.reset();
|
|
signatureToolBar.reset();
|
|
resetContextMenu(pdfView, mode);
|
|
resetContextMenu(pdfView, mode);
|
|
SignatureWidgetImpl.previewMode = mode;
|
|
SignatureWidgetImpl.previewMode = mode;
|
|
- CPDFEditManager editManager = pdfView.getCPdfReaderView().getEditManager();
|
|
|
|
|
|
+ CPDFEditManager editManager = readerView.getEditManager();
|
|
if (mode == CPreviewMode.Edit) {
|
|
if (mode == CPreviewMode.Edit) {
|
|
- pdfView.getCPdfReaderView().setViewMode(CPDFReaderView.ViewMode.PDFEDIT);
|
|
|
|
|
|
+ readerView.setViewMode(CPDFReaderView.ViewMode.PDFEDIT);
|
|
if (editManager != null && !editManager.isEditMode()) {
|
|
if (editManager != null && !editManager.isEditMode()) {
|
|
editManager.enable();
|
|
editManager.enable();
|
|
editManager.beginEdit(CPDFEditPage.LoadTextImage);
|
|
editManager.beginEdit(CPDFEditPage.LoadTextImage);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if (editManager != null && editManager.isEditMode()) {
|
|
|
|
- editManager.endEdit();
|
|
|
|
|
|
+
|
|
|
|
+ if (readerView.getTouchMode() == CPDFReaderView.TouchMode.SCREENSHOT
|
|
|
|
+ && readerView.getViewMode() == CPDFReaderView.ViewMode.PDFEDIT){
|
|
|
|
+ readerView.setTouchMode(CPDFReaderView.TouchMode.EDIT);
|
|
}
|
|
}
|
|
|
|
+ pdfView.exitEditMode();
|
|
switch (mode) {
|
|
switch (mode) {
|
|
case Viewer:
|
|
case Viewer:
|
|
case Signature:
|
|
case Signature:
|
|
@@ -483,6 +492,7 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
if (curEditMode > CPDFEditPage.LoadNone) {
|
|
if (curEditMode > CPDFEditPage.LoadNone) {
|
|
CPDFEditManager editManager = pdfView.getCPdfReaderView().getEditManager();
|
|
CPDFEditManager editManager = pdfView.getCPdfReaderView().getEditManager();
|
|
if (!editManager.isEditMode()) {
|
|
if (!editManager.isEditMode()) {
|
|
|
|
+ editManager.enable();
|
|
editManager.beginEdit(curEditMode);
|
|
editManager.beginEdit(curEditMode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -502,6 +512,16 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
}
|
|
}
|
|
editToolBar.initWithPDFView(pdfView);
|
|
editToolBar.initWithPDFView(pdfView);
|
|
editToolBar.setEditMode(false);
|
|
editToolBar.setEditMode(false);
|
|
|
|
+ CPDFEditConfig editConfig = pdfView.getCPdfReaderView()
|
|
|
|
+ .getEditManager()
|
|
|
|
+ .getEditConfigBuilder()
|
|
|
|
+ .setScreenshotRectColor(Color.TRANSPARENT)
|
|
|
|
+ .setScreenshotBorderColor(ContextCompat.getColor(getContext(), R.color.tools_color_accent))
|
|
|
|
+ .setScreenshotBorderDash(new float[]{8.0F, 4F})
|
|
|
|
+ .build();
|
|
|
|
+
|
|
|
|
+ pdfView.getCPdfReaderView().getEditManager().updateEditConfig(editConfig);
|
|
|
|
+
|
|
editToolBar.setEditPropertyBtnClickListener((view) -> {
|
|
editToolBar.setEditPropertyBtnClickListener((view) -> {
|
|
int type = pdfView.getCPdfReaderView().getSelectAreaType();
|
|
int type = pdfView.getCPdfReaderView().getSelectAreaType();
|
|
CStyleType styleType = CStyleType.UNKNOWN;
|
|
CStyleType styleType = CStyleType.UNKNOWN;
|
|
@@ -646,6 +666,23 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
break;
|
|
break;
|
|
|
|
+ case Snip:
|
|
|
|
+ menuWindow.addItem(R.drawable.tools_ic_snap, R.string.tools_snap, v -> {
|
|
|
|
+ CPDFReaderView readerView = pdfView.getCPdfReaderView();
|
|
|
|
+ readerView.removeAllAnnotFocus();
|
|
|
|
+ if (readerView.getContextMenuShowListener() != null) {
|
|
|
|
+ readerView.getContextMenuShowListener().dismissContextMenu();
|
|
|
|
+ }
|
|
|
|
+ for (int i = 0; i < readerView.getChildCount(); i++) {
|
|
|
|
+ CPDFPageView view = (CPDFPageView) readerView.getChildAt(i);
|
|
|
|
+ view.clearScreenShotRect();
|
|
|
|
+ }
|
|
|
|
+ // enter fill screen mode
|
|
|
|
+ screenManager.fillScreenChange();
|
|
|
|
+ // enter screenshot mode , Please select the screenshot area in the reader view
|
|
|
|
+ readerView.setTouchMode(CPDFReaderView.TouchMode.SCREENSHOT);
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|