|
@@ -278,7 +278,7 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
pdfView.setOnTapMainDocAreaCallback(() -> {
|
|
pdfView.setOnTapMainDocAreaCallback(() -> {
|
|
- if (pdfSearchToolBarView.getVisibility() == VISIBLE){
|
|
|
|
|
|
+ if (pdfSearchToolBarView.getVisibility() == VISIBLE) {
|
|
pdfSearchToolBarView.showSearchReplaceContextMenu();
|
|
pdfSearchToolBarView.showSearchReplaceContextMenu();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -655,12 +655,12 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
File file = new File(dir, CFileUtils.getFileNameNoExtension(document.getFileName()) + getString(R.string.tools_flattened_suffix));
|
|
File file = new File(dir, CFileUtils.getFileNameNoExtension(document.getFileName()) + getString(R.string.tools_flattened_suffix));
|
|
file = CFileUtils.renameNameSuffix(file);
|
|
file = CFileUtils.renameNameSuffix(file);
|
|
File finalFile = file;
|
|
File finalFile = file;
|
|
- CThreadPoolUtils.getInstance().executeIO(() ->{
|
|
|
|
|
|
+ CThreadPoolUtils.getInstance().executeIO(() -> {
|
|
boolean result = document.flattenAllPages(CPDFPage.PDFFlattenOption.FLAT_NORMALDISPLAY);
|
|
boolean result = document.flattenAllPages(CPDFPage.PDFFlattenOption.FLAT_NORMALDISPLAY);
|
|
if (result) {
|
|
if (result) {
|
|
try {
|
|
try {
|
|
boolean saveResult = document.saveAs(finalFile.getAbsolutePath(), false);
|
|
boolean saveResult = document.saveAs(finalFile.getAbsolutePath(), false);
|
|
- CThreadPoolUtils.getInstance().executeMain(()->{
|
|
|
|
|
|
+ CThreadPoolUtils.getInstance().executeMain(() -> {
|
|
dismissLoadingDialog();
|
|
dismissLoadingDialog();
|
|
if (saveResult) {
|
|
if (saveResult) {
|
|
CToastUtil.showLongToast(getContext(), R.string.tools_save_success);
|
|
CToastUtil.showLongToast(getContext(), R.string.tools_save_success);
|
|
@@ -678,7 +678,7 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
dismissLoadingDialog();
|
|
dismissLoadingDialog();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -743,34 +743,9 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
}
|
|
}
|
|
|
|
|
|
private void onDoNext() {
|
|
private void onDoNext() {
|
|
- if (CPermissionUtil.hasStoragePermissions(getContext())) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (Build.VERSION.SDK_INT >= CPermissionUtil.VERSION_TIRAMISU) {
|
|
|
|
- if (CPermissionUtil.checkManifestPermission(getContext(), Manifest.permission.MANAGE_EXTERNAL_STORAGE)){
|
|
|
|
- requestManageStoragePermission.launch(new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION));
|
|
|
|
- }
|
|
|
|
- } else if (Build.VERSION.SDK_INT >= CPermissionUtil.VERSION_R) {
|
|
|
|
- multiplePermissionResultLauncher.launch(STORAGE_PERMISSIONS, result -> {
|
|
|
|
- if (CPermissionUtil.hasStoragePermissions(getContext())) {
|
|
|
|
- initDocument(null);
|
|
|
|
- } else {
|
|
|
|
- if (!Environment.isExternalStorageManager() && CPermissionUtil.checkManifestPermission(getContext(), Manifest.permission.MANAGE_EXTERNAL_STORAGE)) {
|
|
|
|
- requestManageStoragePermission.launch(new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- multiplePermissionResultLauncher.launch(STORAGE_PERMISSIONS, result -> {
|
|
|
|
- if (CPermissionUtil.hasStoragePermissions(getContext())) {
|
|
|
|
- initDocument(null);
|
|
|
|
- } else {
|
|
|
|
- if (!CPermissionUtil.shouldShowRequestPermissionRationale(requireActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
|
|
|
- showPermissionsRequiredDialog();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ multiplePermissionResultLauncher.launch(STORAGE_PERMISSIONS, result -> {
|
|
|
|
+
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
private void showSettingEncryptionDialog() {
|
|
private void showSettingEncryptionDialog() {
|