|
@@ -278,7 +278,7 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
|
}
|
|
|
});
|
|
|
pdfView.setOnTapMainDocAreaCallback(() -> {
|
|
|
- if (pdfSearchToolBarView.getVisibility() == VISIBLE){
|
|
|
+ if (pdfSearchToolBarView.getVisibility() == VISIBLE) {
|
|
|
pdfSearchToolBarView.showSearchReplaceContextMenu();
|
|
|
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 = CFileUtils.renameNameSuffix(file);
|
|
|
File finalFile = file;
|
|
|
- CThreadPoolUtils.getInstance().executeIO(() ->{
|
|
|
+ CThreadPoolUtils.getInstance().executeIO(() -> {
|
|
|
boolean result = document.flattenAllPages(CPDFPage.PDFFlattenOption.FLAT_NORMALDISPLAY);
|
|
|
if (result) {
|
|
|
try {
|
|
|
boolean saveResult = document.saveAs(finalFile.getAbsolutePath(), false);
|
|
|
- CThreadPoolUtils.getInstance().executeMain(()->{
|
|
|
+ CThreadPoolUtils.getInstance().executeMain(() -> {
|
|
|
dismissLoadingDialog();
|
|
|
if (saveResult) {
|
|
|
CToastUtil.showLongToast(getContext(), R.string.tools_save_success);
|
|
@@ -678,7 +678,7 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
dismissLoadingDialog();
|
|
|
}
|
|
|
});
|
|
@@ -743,34 +743,9 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
|
}
|
|
|
|
|
|
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() {
|