Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_flowbox
Project
Project
Details
Activity
Releases
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
android
android_flowbox
Commits
c21be3f0
Commit
c21be3f0
authored
Jul 27, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去除权限校验
parent
3fe5fc6c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
48 deletions
+82
-48
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+4
-1
ScreenActivity.kt
...om/mints/flowbox/ui/activitys/keepalive/ScreenActivity.kt
+2
-3
WifiFragment.kt
...c/main/java/com/mints/flowbox/ui/fragment/WifiFragment.kt
+50
-44
Callback.kt
app/src/main/java/com/mints/flowbox/utils/Callback.kt
+6
-0
PermissionUtils.java
...rc/main/java/com/mints/flowbox/utils/PermissionUtils.java
+20
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
c21be3f0
...
...
@@ -43,7 +43,7 @@
<uses-permission
android:name=
"android.permission.SET_WALLPAPER"
/>
<uses-permission
android:name=
"android.permission.KILL_BACKGROUND_PROCESSES"
/>
<!-- 蘑菇星球 -->
<uses-permission
android:name=
"android.permission.REQUEST_DELETE_PACKAGES"
/>
<uses-permission
android:name=
"
.
android.permission.PROCESS_OUTGOING_CALLS"
/>
<uses-permission
android:name=
"android.permission.PROCESS_OUTGOING_CALLS"
/>
<permission
android:name=
"com.mints.flowbox.permission"
...
...
@@ -156,13 +156,16 @@
<activity
android:name=
".ui.activitys.Increasespeed2Activity"
android:launchMode=
"singleTop"
android:excludeFromRecents=
"true"
/>
<activity
android:name=
".ui.activitys.IncreasespeedActivity"
android:launchMode=
"singleTop"
android:excludeFromRecents=
"true"
/>
<activity
android:name=
".ui.activitys.CleanActivity"
android:launchMode=
"singleTop"
android:excludeFromRecents=
"true"
/>
<activity
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/keepalive/ScreenActivity.kt
View file @
c21be3f0
...
...
@@ -15,7 +15,6 @@ import com.mints.flowbox.utils.ToolUtil
import
com.mints.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.activity_screen.*
import
kotlinx.android.synthetic.main.activity_screen.fl_ad
import
net.phone.PhoneBrandUtils
import
java.util.*
class
ScreenActivity
:
OutAppActivity
(),
View
.
OnClickListener
{
...
...
@@ -78,7 +77,7 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
IncreasespeedActivity
.
INCREASE_TYPE
,
IncreasespeedActivity
.
INCREASE_BOOST
)
readyGo
(
IncreasespeedActivity
::
class
.
java
)
readyGo
(
IncreasespeedActivity
::
class
.
java
,
bundle
)
}
R
.
id
.
tvClean
->
{
// 一键清理
...
...
@@ -87,7 +86,7 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
IncreasespeedActivity
.
INCREASE_TYPE
,
IncreasespeedActivity
.
INCREASE_CLEAN
)
readyGo
(
IncreasespeedActivity
::
class
.
java
)
readyGo
(
IncreasespeedActivity
::
class
.
java
,
bundle
)
}
R
.
id
.
tvSaveBattery
->
{
val
bundle
=
Bundle
()
...
...
app/src/main/java/com/mints/flowbox/ui/fragment/WifiFragment.kt
View file @
c21be3f0
...
...
@@ -505,14 +505,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
readyGo
(
IncreasespeedActivity
::
class
.
java
,
bundle
)
}
R
.
id
.
btn_signal
->
{
// 信号增强
if
(
ActivityCompat
.
checkSelfPermission
(
requireActivity
(),
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
checkPermission
()
return
}
checkPermission
(
object
:
Callback
{
override
fun
success
()
{
// 未打开定位开关
if
(!
PermissionUtils
.
isOpenGps
(
mContext
))
{
...
...
@@ -529,6 +524,13 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
// 预加载信息流
ExpressManager
.
loadExpress
(
false
)
readyGo
(
SpeedFastActivity
::
class
.
java
)
}
override
fun
fail
()
{
}
})
}
R
.
id
.
ivImg
->
{
// 点我赚钱
(
requireActivity
()
as
MainActivity
).
clickTab4Layout
()
...
...
@@ -546,7 +548,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}
/** 检测权限 */
private
fun
checkPermission
()
{
private
fun
checkPermission
(
callback
:
Callback
)
{
val
request
:
Observable
<
Boolean
>
=
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
if
(
PhoneBrandUtils
.
isXiaomi
())
{
...
...
@@ -571,15 +573,15 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}
request
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
loadWifiData
()
},
1000
)
callback
.
success
()
}
else
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
showMissingPermissionDialog
(
"位置"
)
}
else
{
showMissingPermissionDialog
(
"位置,存储 "
)
}
callback
.
fail
()
}
}
}
...
...
@@ -610,30 +612,34 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
view
?.
let
{
if
(
it
.
id
==
R
.
id
.
btn
)
{
if
(
ActivityCompat
.
checkSelfPermission
(
requireActivity
(),
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
checkPermission
()
return
}
checkPermission
(
object
:
Callback
{
override
fun
success
()
{
// 未打开定位开关
if
(!
PermissionUtils
.
isOpenGps
(
mContext
))
{
ToastUtils
.
show
(
"GPS没有开启,申请打开GPS"
)
openGpsSettings
()
return
}
// 校验是否已经打开wifi
if
(!
wifiUtils
.
isWifiConnected
(
mContext
)
||
!
wifiUtils
.
isWifiEnable
)
{
ToastUtils
.
show
(
"wifi没有开启,申请打开wifi"
)
wifiUtils
.
openWifi
()
startActivity
(
Intent
(
Settings
.
ACTION_WIFI_SETTINGS
))
return
}
}
override
fun
fail
()
{
}
})
}
}
if
(
mWifiList
.
is
NotEmpty
()
&&
mWifiList
[
position
].
isConnected
)
return
if
(
mWifiList
.
is
Empty
()
||
mWifiList
[
position
].
isConnected
)
return
val
wifiListBean
=
mWifiList
[
position
]
if
(
wifiDialog
==
null
)
wifiDialog
=
...
...
app/src/main/java/com/mints/flowbox/utils/Callback.kt
0 → 100644
View file @
c21be3f0
package
com.mints.flowbox.utils
interface
Callback
{
fun
success
()
fun
fail
()
}
\ No newline at end of file
app/src/main/java/com/mints/flowbox/utils/PermissionUtils.java
View file @
c21be3f0
...
...
@@ -13,6 +13,7 @@ import android.provider.Settings;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.PermissionChecker
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
...
...
@@ -199,4 +200,23 @@ public class PermissionUtils {
}
}
/**
* 权限是否开启校验
*
* @param permission
* @return
*/
public
static
boolean
selfPermissionGranted
(
String
permission
,
Context
context
)
{
// For Android < Android M, self permissions are always granted.
boolean
result
=
true
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
// targetSdkVersion >= Android M, we can
// use Context#checkSelfPermission
result
=
context
.
checkSelfPermission
(
permission
)
==
PackageManager
.
PERMISSION_GRANTED
;
}
return
result
;
}
}
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