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
e30032aa
Commit
e30032aa
authored
May 30, 2023
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widget 1.0.7 去掉写的权限
parent
a2d680e3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
27 deletions
+5
-27
AndroidManifest.xml
sobot_network/src/main/AndroidManifest.xml
+0
-2
sobot-widget-publish-mavencentral.gradle
sobot_widget/sobot-widget-publish-mavencentral.gradle
+1
-1
AndroidManifest.xml
sobot_widget/src/main/AndroidManifest.xml
+0
-1
SobotBaseActivity.java
...main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
+4
-23
No files found.
sobot_network/src/main/AndroidManifest.xml
View file @
e30032aa
...
...
@@ -2,7 +2,6 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.sobot.network"
>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
</manifest>
\ No newline at end of file
sobot_widget/sobot-widget-publish-mavencentral.gradle
View file @
e30032aa
...
...
@@ -13,7 +13,7 @@ ext {
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'widget'
//项目名
// PUBLISH_ARTIFACT_ID = 'widget_x' //项目名
PUBLISH_VERSION
=
'1.0.
6
'
//版本号
PUBLISH_VERSION
=
'1.0.
7
'
//版本号
}
...
...
sobot_widget/src/main/AndroidManifest.xml
View file @
e30032aa
...
...
@@ -4,7 +4,6 @@
<!-- 访问权限 -->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_IMAGES"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_AUDIO"
/>
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
View file @
e30032aa
...
...
@@ -462,17 +462,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
//判断权限的结果,如果有被拒绝,就return
if
(
grantResults
[
i
]
!=
PackageManager
.
PERMISSION_GRANTED
)
{
String
permissionTitle
=
getResources
().
getString
(
R
.
string
.
sobot_no_permission_text
);
if
(
permissions
[
i
]
!=
null
&&
permissions
[
i
].
equals
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
))
{
permissionTitle
=
getResources
().
getString
(
R
.
string
.
sobot_no_write_external_storage_permission
);
if
(
ActivityCompat
.
shouldShowRequestPermissionRationale
(
this
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
&&
!
SobotWidgetApi
.
getSwitchMarkStatus
(
SobotMarkConfig
.
SHOW_PERMISSION_TIPS_POP
))
{
SobotToastUtil
.
showCustomLongToast
(
this
,
SobotSystemUtils
.
getAppName
(
this
)
+
getResources
().
getString
(
R
.
string
.
sobot_want_use_your
)
+
getResources
().
getString
(
R
.
string
.
sobot_memory_card
)
+
" , "
+
getResources
().
getString
(
R
.
string
.
sobot_memory_card_yongtu
));
}
else
{
//调用权限失败
if
(
permissionListener
!=
null
)
{
permissionListener
.
onPermissionErrorListener
(
this
,
permissionTitle
);
}
}
}
else
if
(
permissions
[
i
]
!=
null
&&
permissions
[
i
].
equals
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
))
{
if
(
permissions
[
i
]
!=
null
&&
permissions
[
i
].
equals
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
))
{
permissionTitle
=
getResources
().
getString
(
R
.
string
.
sobot_no_write_external_storage_permission
);
if
(
ActivityCompat
.
shouldShowRequestPermissionRationale
(
this
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
&&
!
SobotWidgetApi
.
getSwitchMarkStatus
(
SobotMarkConfig
.
SHOW_PERMISSION_TIPS_POP
))
{
SobotToastUtil
.
showCustomLongToast
(
this
,
SobotSystemUtils
.
getAppName
(
this
)
+
getResources
().
getString
(
R
.
string
.
sobot_want_use_your
)
+
getResources
().
getString
(
R
.
string
.
sobot_memory_card
)
+
" , "
+
getResources
().
getString
(
R
.
string
.
sobot_memory_card_yongtu
));
...
...
@@ -555,7 +545,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
protected
boolean
checkStoragePermission
(
int
checkType
)
{
//如果是升级Android13之前就已经具有读写SDK的权限,那么升级到13之后,自己具有上述三个权限。
//如果是升级Android13之后新装的应用,并且targetSDK小于33,则申请READ_EXTERNAL_STORAGE权限时,会自动转化为对上述三个权限的申请,权限申请框只一个
//如果是升级Android13之后新装的应用,并且targetSDK大于等于33,则申请READ_EXTERNAL_STORAGE权限时会自动拒绝
(同理WRITE_EXTERNAL_STORAGE也是一样)
。
//如果是升级Android13之后新装的应用,并且targetSDK大于等于33,则申请READ_EXTERNAL_STORAGE权限时会自动拒绝。
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
if
(
checkType
==
0
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
...
...
@@ -589,18 +579,10 @@ public abstract class SobotBaseActivity extends FragmentActivity {
}
}
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
23
&&
SobotSystemUtils
.
getTargetSdkVersion
(
getSobotBaseActivity
().
getApplicationContext
())
>=
23
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
//申请WRITE_EXTERNAL_STORAGE权限
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
return
false
;
}
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
//申请READ_EXTERNAL_STORAGE权限
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
this
.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
return
false
;
}
}
...
...
@@ -639,8 +621,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
}
}
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
23
&&
SobotSystemUtils
.
getTargetSdkVersion
(
getSobotBaseActivity
().
getApplicationContext
())
>=
23
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
if
(
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
return
false
;
}
...
...
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