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
Hide 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 @@
...
@@ -43,7 +43,7 @@
<uses-permission
android:name=
"android.permission.SET_WALLPAPER"
/>
<uses-permission
android:name=
"android.permission.SET_WALLPAPER"
/>
<uses-permission
android:name=
"android.permission.KILL_BACKGROUND_PROCESSES"
/>
<!-- 蘑菇星球 -->
<uses-permission
android:name=
"android.permission.KILL_BACKGROUND_PROCESSES"
/>
<!-- 蘑菇星球 -->
<uses-permission
android:name=
"android.permission.REQUEST_DELETE_PACKAGES"
/>
<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
<permission
android:name=
"com.mints.flowbox.permission"
android:name=
"com.mints.flowbox.permission"
...
@@ -156,13 +156,16 @@
...
@@ -156,13 +156,16 @@
<activity
<activity
android:name=
".ui.activitys.Increasespeed2Activity"
android:name=
".ui.activitys.Increasespeed2Activity"
android:launchMode=
"singleTop"
android:excludeFromRecents=
"true"
/>
android:excludeFromRecents=
"true"
/>
<activity
<activity
android:name=
".ui.activitys.IncreasespeedActivity"
android:name=
".ui.activitys.IncreasespeedActivity"
android:launchMode=
"singleTop"
android:excludeFromRecents=
"true"
/>
android:excludeFromRecents=
"true"
/>
<activity
<activity
android:name=
".ui.activitys.CleanActivity"
android:name=
".ui.activitys.CleanActivity"
android:launchMode=
"singleTop"
android:excludeFromRecents=
"true"
/>
android:excludeFromRecents=
"true"
/>
<activity
<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
...
@@ -15,7 +15,6 @@ import com.mints.flowbox.utils.ToolUtil
import
com.mints.library.utils.nodoubleclick.AntiShake
import
com.mints.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.activity_screen.*
import
kotlinx.android.synthetic.main.activity_screen.*
import
kotlinx.android.synthetic.main.activity_screen.fl_ad
import
kotlinx.android.synthetic.main.activity_screen.fl_ad
import
net.phone.PhoneBrandUtils
import
java.util.*
import
java.util.*
class
ScreenActivity
:
OutAppActivity
(),
View
.
OnClickListener
{
class
ScreenActivity
:
OutAppActivity
(),
View
.
OnClickListener
{
...
@@ -78,7 +77,7 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
...
@@ -78,7 +77,7 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
IncreasespeedActivity
.
INCREASE_TYPE
,
IncreasespeedActivity
.
INCREASE_TYPE
,
IncreasespeedActivity
.
INCREASE_BOOST
IncreasespeedActivity
.
INCREASE_BOOST
)
)
readyGo
(
IncreasespeedActivity
::
class
.
java
)
readyGo
(
IncreasespeedActivity
::
class
.
java
,
bundle
)
}
}
R
.
id
.
tvClean
->
{
R
.
id
.
tvClean
->
{
// 一键清理
// 一键清理
...
@@ -87,7 +86,7 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
...
@@ -87,7 +86,7 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
IncreasespeedActivity
.
INCREASE_TYPE
,
IncreasespeedActivity
.
INCREASE_TYPE
,
IncreasespeedActivity
.
INCREASE_CLEAN
IncreasespeedActivity
.
INCREASE_CLEAN
)
)
readyGo
(
IncreasespeedActivity
::
class
.
java
)
readyGo
(
IncreasespeedActivity
::
class
.
java
,
bundle
)
}
}
R
.
id
.
tvSaveBattery
->
{
R
.
id
.
tvSaveBattery
->
{
val
bundle
=
Bundle
()
val
bundle
=
Bundle
()
...
...
app/src/main/java/com/mints/flowbox/ui/fragment/WifiFragment.kt
View file @
c21be3f0
...
@@ -505,30 +505,32 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -505,30 +505,32 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
readyGo
(
IncreasespeedActivity
::
class
.
java
,
bundle
)
readyGo
(
IncreasespeedActivity
::
class
.
java
,
bundle
)
}
}
R
.
id
.
btn_signal
->
{
// 信号增强
R
.
id
.
btn_signal
->
{
// 信号增强
if
(
ActivityCompat
.
checkSelfPermission
(
requireActivity
(),
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
checkPermission
()
return
}
// 未打开定位开关
checkPermission
(
object
:
Callback
{
if
(!
PermissionUtils
.
isOpenGps
(
mContext
))
{
override
fun
success
()
{
openGpsSettings
()
return
}
if
(!
wifiUtils
.
isWifiConnected
(
mContext
)
||
!
wifiUtils
.
isWifiEnable
)
{
// 未打开定位开关
wifiUtils
.
openWifi
()
if
(!
PermissionUtils
.
isOpenGps
(
mContext
))
{
startActivity
(
Intent
(
Settings
.
ACTION_WIFI_SETTINGS
)
)
openGpsSettings
(
)
return
return
}
}
// 预加载信息流
if
(!
wifiUtils
.
isWifiConnected
(
mContext
)
||
!
wifiUtils
.
isWifiEnable
)
{
ExpressManager
.
loadExpress
(
false
)
wifiUtils
.
openWifi
()
readyGo
(
SpeedFastActivity
::
class
.
java
)
startActivity
(
Intent
(
Settings
.
ACTION_WIFI_SETTINGS
))
return
}
// 预加载信息流
ExpressManager
.
loadExpress
(
false
)
readyGo
(
SpeedFastActivity
::
class
.
java
)
}
override
fun
fail
()
{
}
})
}
}
R
.
id
.
ivImg
->
{
// 点我赚钱
R
.
id
.
ivImg
->
{
// 点我赚钱
(
requireActivity
()
as
MainActivity
).
clickTab4Layout
()
(
requireActivity
()
as
MainActivity
).
clickTab4Layout
()
...
@@ -546,7 +548,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -546,7 +548,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}
}
/** 检测权限 */
/** 检测权限 */
private
fun
checkPermission
()
{
private
fun
checkPermission
(
callback
:
Callback
)
{
val
request
:
Observable
<
Boolean
>
=
val
request
:
Observable
<
Boolean
>
=
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
if
(
PhoneBrandUtils
.
isXiaomi
())
{
if
(
PhoneBrandUtils
.
isXiaomi
())
{
...
@@ -571,15 +573,15 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -571,15 +573,15 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}
}
request
.
subscribe
{
granted
:
Boolean
->
request
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
if
(
granted
)
{
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
callback
.
success
()
loadWifiData
()
},
1000
)
}
else
{
}
else
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
showMissingPermissionDialog
(
"位置"
)
showMissingPermissionDialog
(
"位置"
)
}
else
{
}
else
{
showMissingPermissionDialog
(
"位置,存储 "
)
showMissingPermissionDialog
(
"位置,存储 "
)
}
}
callback
.
fail
()
}
}
}
}
}
}
...
@@ -610,30 +612,34 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -610,30 +612,34 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
view
?.
let
{
view
?.
let
{
if
(
it
.
id
==
R
.
id
.
btn
)
{
if
(
it
.
id
==
R
.
id
.
btn
)
{
if
(
ActivityCompat
.
checkSelfPermission
(
requireActivity
(),
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
checkPermission
()
return
}
// 未打开定位开关
checkPermission
(
object
:
Callback
{
if
(!
PermissionUtils
.
isOpenGps
(
mContext
))
{
override
fun
success
()
{
openGpsSettings
()
// 未打开定位开关
return
if
(!
PermissionUtils
.
isOpenGps
(
mContext
))
{
}
ToastUtils
.
show
(
"GPS没有开启,申请打开GPS"
)
openGpsSettings
()
return
}
if
(!
wifiUtils
.
isWifiConnected
(
mContext
)
||
!
wifiUtils
.
isWifiEnable
)
{
// 校验是否已经打开wifi
wifiUtils
.
openWifi
()
if
(!
wifiUtils
.
isWifiConnected
(
mContext
)
||
!
wifiUtils
.
isWifiEnable
)
{
startActivity
(
Intent
(
Settings
.
ACTION_WIFI_SETTINGS
))
ToastUtils
.
show
(
"wifi没有开启,申请打开wifi"
)
return
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
]
val
wifiListBean
=
mWifiList
[
position
]
if
(
wifiDialog
==
null
)
wifiDialog
=
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;
...
@@ -13,6 +13,7 @@ import android.provider.Settings;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.PermissionChecker
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -199,4 +200,23 @@ public class PermissionUtils {
...
@@ -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