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
d792d693
Commit
d792d693
authored
Mar 11, 2024
by
郭倩芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
相册选照片、视频
parent
3ac11a71
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
8 deletions
+34
-8
build.gradle
app/build.gradle
+2
-3
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-0
build.gradle
sobot_widget/build.gradle
+1
-1
AndroidManifest.xml
sobot_widget/src/main/AndroidManifest.xml
+1
-0
SobotBaseConstant.java
.../src/main/java/com/sobot/widget/ui/SobotBaseConstant.java
+3
-0
SobotBaseActivity.java
...main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
+26
-4
No files found.
app/build.gradle
View file @
d792d693
...
@@ -3,13 +3,12 @@ plugins {
...
@@ -3,13 +3,12 @@ plugins {
}
}
android
{
android
{
compileSdkVersion
29
compileSdkVersion
34
buildToolsVersion
"29.0.0"
defaultConfig
{
defaultConfig
{
applicationId
"com.sobot.moduletest"
applicationId
"com.sobot.moduletest"
minSdkVersion
17
minSdkVersion
17
targetSdkVersion
29
targetSdkVersion
34
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
//添加此行
//添加此行
...
...
app/src/main/AndroidManifest.xml
View file @
d792d693
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
android:supportsRtl=
"true"
>
android:supportsRtl=
"true"
>
<activity
<activity
android:name=
".MainActivity"
android:name=
".MainActivity"
android:exported=
"true"
android:configChanges=
"orientation|keyboardHidden|screenSize|touchscreen|navigation|locale|fontScale|uiMode|screenLayout|smallestScreenSize"
>
android:configChanges=
"orientation|keyboardHidden|screenSize|touchscreen|navigation|locale|fontScale|uiMode|screenLayout|smallestScreenSize"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
sobot_widget/build.gradle
View file @
d792d693
...
@@ -3,7 +3,7 @@ plugins {
...
@@ -3,7 +3,7 @@ plugins {
}
}
android
{
android
{
compileSdkVersion
3
3
compileSdkVersion
3
4
defaultConfig
{
defaultConfig
{
minSdkVersion
17
minSdkVersion
17
...
...
sobot_widget/src/main/AndroidManifest.xml
View file @
d792d693
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
<uses-permission
android:name=
"android.permission.READ_MEDIA_IMAGES"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_IMAGES"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_AUDIO"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_AUDIO"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_VIDEO"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_VIDEO"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_VISUAL_USER_SELECTED"
/>
<uses-permission
android:name=
"com.google.android.apps.photos.permission.GOOGLE_PHOTOS"
/>
<uses-permission
android:name=
"com.google.android.apps.photos.permission.GOOGLE_PHOTOS"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/SobotBaseConstant.java
View file @
d792d693
...
@@ -9,4 +9,6 @@ public class SobotBaseConstant {
...
@@ -9,4 +9,6 @@ public class SobotBaseConstant {
public
static
final
int
REQUEST_CODE_VIDEO
=
1002
;
public
static
final
int
REQUEST_CODE_VIDEO
=
1002
;
//直接照相获取图片
//直接照相获取图片
public
static
final
int
REQUEST_CODE_MAKEPICTUREFROMCAMERA
=
1003
;
public
static
final
int
REQUEST_CODE_MAKEPICTUREFROMCAMERA
=
1003
;
//获取图库视频和相册的code
public
static
final
int
REQUEST_CODE_ALBUM
=
1004
;
}
}
\ No newline at end of file
sobot_widget/src/main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
View file @
d792d693
...
@@ -606,7 +606,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
...
@@ -606,7 +606,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
!=
PackageManager
.
PERMISSION_GRANTED
)
{
//申请图片权限
//申请图片权限
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_IMAGES
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_IMAGES
,
Manifest
.
permission
.
READ_MEDIA_VISUAL_USER_SELECTED
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
return
false
;
return
false
;
}
}
}
else
if
(
checkType
==
1
)
{
}
else
if
(
checkType
==
1
)
{
...
@@ -623,7 +623,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
...
@@ -623,7 +623,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_AUDIO
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_AUDIO
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
return
false
;
return
false
;
}
}
}
else
{
}
else
if
(
checkType
==
3
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
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_VIDEO
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_AUDIO
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_AUDIO
)
...
@@ -632,6 +632,17 @@ public abstract class SobotBaseActivity extends FragmentActivity {
...
@@ -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
);
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
;
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
)
{
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
23
&&
SobotSystemUtils
.
getTargetSdkVersion
(
getSobotBaseActivity
().
getApplicationContext
())
>=
23
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
...
@@ -667,13 +678,24 @@ public abstract class SobotBaseActivity extends FragmentActivity {
...
@@ -667,13 +678,24 @@ public abstract class SobotBaseActivity extends FragmentActivity {
!=
PackageManager
.
PERMISSION_GRANTED
)
{
!=
PackageManager
.
PERMISSION_GRANTED
)
{
return
false
;
return
false
;
}
}
}
else
{
}
else
if
(
checkPermissionType
==
3
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
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_VIDEO
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_AUDIO
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_AUDIO
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
!=
PackageManager
.
PERMISSION_GRANTED
)
{
return
false
;
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
)
{
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
23
&&
SobotSystemUtils
.
getTargetSdkVersion
(
getSobotBaseActivity
().
getApplicationContext
())
>=
23
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
...
@@ -792,7 +814,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
...
@@ -792,7 +814,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
* @param title
* @param title
* @param content
* @param content
* @param type
* @param type
* @param checkPermissionType 0:图片权限 1:视频权限,2:音频权限,3,所有细分的权限
, android 13 使用
* @param checkPermissionType 0:图片权限 1:视频权限,2:音频权限,3,所有细分的权限
android 13 使用 4.相册权限,视频加图片
* @return
* @return
*/
*/
public
boolean
checkIsShowPermissionPop
(
String
title
,
String
content
,
final
int
type
,
final
int
checkPermissionType
)
{
public
boolean
checkIsShowPermissionPop
(
String
title
,
String
content
,
final
int
type
,
final
int
checkPermissionType
)
{
...
...
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