Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sobot_android
Sobot_module_Dev
Commits
d5b99c63
Commit
d5b99c63
authored
Mar 11, 2024
by
郭倩芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
相册选照片、视频
parent
d12c7004
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
SobotBaseActivity.java
...main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
+26
-4
No files found.
sobot_widget/src/main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
View file @
d5b99c63
...
...
@@ -594,7 +594,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
/**
* 检查存储权限
*
* @param checkType 0:图片权限 1:视频权限,2:音频权限,3,所有细分的权限, android 13 使用
* @param checkType 0:图片权限 1:视频权限,2:音频权限,3,所有细分的权限, android 13 使用
4:相册权限,读取相册图片和视频
* @return true, 已经获取权限;false,没有权限,尝试获取
*/
protected
boolean
checkStoragePermission
(
int
checkType
)
{
...
...
@@ -623,7 +623,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_AUDIO
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
return
false
;
}
}
else
{
}
else
if
(
checkType
==
3
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_VIDEO
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_AUDIO
)
...
...
@@ -632,6 +632,17 @@ public abstract class SobotBaseActivity extends FragmentActivity {
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_AUDIO
,
Manifest
.
permission
.
READ_MEDIA_IMAGES
,
Manifest
.
permission
.
READ_MEDIA_VIDEO
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
return
false
;
}
}
else
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
==
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_VIDEO
)
==
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_VISUAL_USER_SELECTED
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
return
true
;
}
else
{
//申请:图片权限 视频权限 音频权限
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_IMAGES
,
Manifest
.
permission
.
READ_MEDIA_VIDEO
,
Manifest
.
permission
.
READ_MEDIA_VISUAL_USER_SELECTED
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
return
false
;
}
}
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
23
&&
SobotSystemUtils
.
getTargetSdkVersion
(
getSobotBaseActivity
().
getApplicationContext
())
>=
23
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
...
...
@@ -647,7 +658,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
/**
* 判断是否有存储卡权限
*
* @param checkPermissionType 0:图片权限 1:视频权限,2:音频权限,3,所有细分的权限, android 13 使用
* @param checkPermissionType 0:图片权限 1:视频权限,2:音频权限,3,所有细分的权限, android 13 使用
4:相册权限,读取相册图片和视频
* @return true, 已经获取权限;false,没有权限
*/
protected
boolean
isHasStoragePermission
(
int
checkPermissionType
)
{
...
...
@@ -667,13 +678,24 @@ public abstract class SobotBaseActivity extends FragmentActivity {
!=
PackageManager
.
PERMISSION_GRANTED
)
{
return
false
;
}
}
else
{
}
else
if
(
checkPermissionType
==
3
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_VIDEO
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_AUDIO
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
return
false
;
}
}
else
{
// SobotLogUtils.d("=======READ_MEDIA_IMAGES=====" + ContextCompat.checkSelfPermission(getSobotBaseActivity(), Manifest.permission.READ_MEDIA_IMAGES)+"===="+(ContextCompat.checkSelfPermission(getSobotBaseActivity(), Manifest.permission.READ_MEDIA_IMAGES) == PackageManager.PERMISSION_GRANTED));
// SobotLogUtils.d("=======READ_MEDIA_VIDEO=====" + ContextCompat.checkSelfPermission(getSobotBaseActivity(), Manifest.permission.READ_MEDIA_VIDEO)+"===="+(ContextCompat.checkSelfPermission(getSobotBaseActivity(), Manifest.permission.READ_MEDIA_VIDEO) == PackageManager.PERMISSION_GRANTED));
// SobotLogUtils.d("=======READ_MEDIA_VISUAL_USER_SELECTED=====" + ContextCompat.checkSelfPermission(getSobotBaseActivity(), Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED)+"===="+(ContextCompat.checkSelfPermission(getSobotBaseActivity(), Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED) == PackageManager.PERMISSION_GRANTED));
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
==
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_VIDEO
)
==
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_VISUAL_USER_SELECTED
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
return
true
;
}
else
{
return
false
;
}
}
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
23
&&
SobotSystemUtils
.
getTargetSdkVersion
(
getSobotBaseActivity
().
getApplicationContext
())
>=
23
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment