|
@@ -17,6 +17,8 @@ import static com.compdfkit.tools.contenteditor.CEditToolbar.SELECT_AREA_TEXT;
|
|
|
import android.Manifest;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
+import android.content.pm.PackageInfo;
|
|
|
+import android.content.pm.PackageManager;
|
|
|
import android.content.res.Configuration;
|
|
|
import android.graphics.Paint;
|
|
|
import android.net.Uri;
|
|
@@ -25,6 +27,7 @@ import android.os.Bundle;
|
|
|
import android.os.Environment;
|
|
|
import android.provider.Settings;
|
|
|
import android.text.TextUtils;
|
|
|
+import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
@@ -52,6 +55,7 @@ import com.compdfkit.tools.common.contextmenu.CPDFContextMenuHelper;
|
|
|
import com.compdfkit.tools.common.pdf.config.CPDFConfiguration;
|
|
|
import com.compdfkit.tools.common.pdf.config.ToolbarConfig;
|
|
|
import com.compdfkit.tools.common.utils.CFileUtils;
|
|
|
+import com.compdfkit.tools.common.utils.CLog;
|
|
|
import com.compdfkit.tools.common.utils.CPermissionUtil;
|
|
|
import com.compdfkit.tools.common.utils.CToastUtil;
|
|
|
import com.compdfkit.tools.common.utils.activitycontracts.CSelectPDFDocumentResultContract;
|
|
@@ -91,6 +95,7 @@ import com.compdfkit.ui.reader.CPDFReaderView;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -743,13 +748,15 @@ public class CPDFDocumentFragment extends CBasicPDFFragment {
|
|
|
return;
|
|
|
}
|
|
|
if (Build.VERSION.SDK_INT >= CPermissionUtil.VERSION_TIRAMISU) {
|
|
|
- requestManageStoragePermission.launch(new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION));
|
|
|
+ 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()) {
|
|
|
+ if (!Environment.isExternalStorageManager() && CPermissionUtil.checkManifestPermission(getContext(), Manifest.permission.MANAGE_EXTERNAL_STORAGE)) {
|
|
|
requestManageStoragePermission.launch(new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION));
|
|
|
}
|
|
|
}
|