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
80bdeaf4
Commit
80bdeaf4
authored
Jul 17, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
适配android10连接wifi,界面优化
parent
6737bb78
Changes
27
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
505 additions
and
114 deletions
+505
-114
build.gradle
app/build.gradle
+1
-0
proguard-rules.pro
app/proguard-rules.pro
+2
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-0
IPackageDataObserver.aidl
...rc/main/aidl/android/content/pm/IPackageDataObserver.aidl
+11
-0
IPackageStatsObserver.aidl
...c/main/aidl/android/content/pm/IPackageStatsObserver.aidl
+13
-0
PackageStats.aidl
app/src/main/aidl/android/content/pm/PackageStats.aidl
+3
-0
MintsApplication.java
app/src/main/java/com/mints/flowbox/MintsApplication.java
+3
-0
FullGroManager.java
...c/main/java/com/mints/flowbox/ad/full/FullGroManager.java
+5
-2
WifiAdManager.kt
app/src/main/java/com/mints/flowbox/ad/wifi/WifiAdManager.kt
+2
-1
CleanUtils.java
app/src/main/java/com/mints/flowbox/clean/CleanUtils.java
+1
-1
AlarmManager.java
...c/main/java/com/mints/flowbox/keepalive/AlarmManager.java
+1
-1
OutAppRouter.kt
...src/main/java/com/mints/flowbox/keepalive/OutAppRouter.kt
+6
-0
CleanActivity.kt
...main/java/com/mints/flowbox/ui/activitys/CleanActivity.kt
+32
-49
MainActivity.kt
.../main/java/com/mints/flowbox/ui/activitys/MainActivity.kt
+0
-1
BoostFastActivity.kt
...mints/flowbox/ui/activitys/keepalive/BoostFastActivity.kt
+44
-27
TransparentActivity.kt
...nts/flowbox/ui/activitys/keepalive/TransparentActivity.kt
+1
-0
MainWifiAdapter.kt
...main/java/com/mints/flowbox/ui/adapter/MainWifiAdapter.kt
+13
-0
ExpandInfo.java
...n/java/com/mints/flowbox/ui/adapter/clean/ExpandInfo.java
+9
-0
WifiFragment.kt
...c/main/java/com/mints/flowbox/ui/fragment/WifiFragment.kt
+52
-15
CleanRDataUtil.kt
app/src/main/java/com/mints/flowbox/utils/CleanRDataUtil.kt
+250
-0
CleanUtils.java
app/src/main/java/com/mints/flowbox/utils/CleanUtils.java
+44
-0
WifiUtils.java
app/src/main/java/com/mints/flowbox/utils/WifiUtils.java
+1
-1
IntentUtils.java
...n/java/com/mints/flowbox/utils/keepalive/IntentUtils.java
+10
-15
ic_main_wifi_low.png
app/src/main/res/mipmap-xhdpi/ic_main_wifi_low.png
+0
-0
ic_main_wifi_signal_level_1.png
...src/main/res/mipmap-xhdpi/ic_main_wifi_signal_level_1.png
+0
-0
ic_main_wifi_signal_level_2.png
...src/main/res/mipmap-xhdpi/ic_main_wifi_signal_level_2.png
+0
-0
ic_main_wifi_signal_level_3.png
...src/main/res/mipmap-xhdpi/ic_main_wifi_signal_level_3.png
+0
-0
No files found.
app/build.gradle
View file @
80bdeaf4
...
@@ -180,6 +180,7 @@ dependencies {
...
@@ -180,6 +180,7 @@ dependencies {
implementation
'com.github.bumptech.glide:glide:4.11.0'
implementation
'com.github.bumptech.glide:glide:4.11.0'
implementation
'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation
'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation
'androidx.documentfile:documentfile:1.0.1'
annotationProcessor
'com.github.bumptech.glide:compiler:4.11.0'
annotationProcessor
'com.github.bumptech.glide:compiler:4.11.0'
// 65536
// 65536
implementation
'androidx.multidex:multidex:2.0.1'
implementation
'androidx.multidex:multidex:2.0.1'
...
...
app/proguard-rules.pro
View file @
80bdeaf4
...
@@ -277,7 +277,8 @@
...
@@ -277,7 +277,8 @@
# 避免影响升级功能,需要keep住support包的类
# 避免影响升级功能,需要keep住support包的类
-keep class android.support.
*
*{*;}
-keep class android.support.
*
*{*;}
# 避免清理aidl
-keep class android.content.pm.
*
* { *; }
# ===================== shareSDK START ================
# ===================== shareSDK START ================
-dontwarn com.mob.
*
*
-dontwarn com.mob.
*
*
...
...
app/src/main/AndroidManifest.xml
View file @
80bdeaf4
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<uses-permission
android:name=
"android.permission.DISABLE_KEYGUARD"
/>
<uses-permission
android:name=
"android.permission.DISABLE_KEYGUARD"
/>
<uses-permission
android:name=
"android.permission.GET_PACKAGE_SIZE"
/>
<uses-permission
android:name=
"android.permission.GET_PACKAGE_SIZE"
/>
<uses-permission
android:name=
"android.permission.PACKAGE_USAGE_STATS"
/>
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.USE_FULL_SCREEN_INTENT"
/>
<uses-permission
android:name=
"android.permission.USE_FULL_SCREEN_INTENT"
/>
...
...
app/src/main/aidl/android/content/pm/IPackageDataObserver.aidl
0 → 100644
View file @
80bdeaf4
package
android
.
content
.
pm
;
/**
*
API
for
package
data
change
related
callbacks
from
the
Package
Manager
.
*
Some
usage
scenarios
include
deletion
of
cache
directory
,
generate
*
statistics
related
to
code
,
data
,
cache
usage
(
TODO
)
*
{@
hide
}
*/
oneway
interface
IPackageDataObserver
{
void
onRemoveCompleted
(
in
String
packageName
,
boolean
succeeded
);
}
\ No newline at end of file
app/src/main/aidl/android/content/pm/IPackageStatsObserver.aidl
0 → 100644
View file @
80bdeaf4
package
android
.
content
.
pm
;
import
android
.
content
.
pm
.
PackageStats
;
/**
*
API
for
package
data
change
related
callbacks
from
the
Package
Manager
.
*
Some
usage
scenarios
include
deletion
of
cache
directory
,
generate
*
statistics
related
to
code
,
data
,
cache
usage
(
TODO
)
*
{@
hide
}
*/
oneway
interface
IPackageStatsObserver
{
void
onGetStatsCompleted
(
in
PackageStats
pStats
,
boolean
succeeded
);
}
\ No newline at end of file
app/src/main/aidl/android/content/pm/PackageStats.aidl
0 → 100644
View file @
80bdeaf4
package
android
.
content
.
pm
;
parcelable
PackageStats
;
\ No newline at end of file
app/src/main/java/com/mints/flowbox/MintsApplication.java
View file @
80bdeaf4
...
@@ -28,6 +28,7 @@ import com.mints.flowbox.keepalive.ScreenWatch;
...
@@ -28,6 +28,7 @@ import com.mints.flowbox.keepalive.ScreenWatch;
import
com.mints.flowbox.keepalive.WifiStateWatch
;
import
com.mints.flowbox.keepalive.WifiStateWatch
;
import
com.mints.flowbox.manager.CsjGroMoreManager
;
import
com.mints.flowbox.manager.CsjGroMoreManager
;
import
com.mints.flowbox.manager.MiitHelper
;
import
com.mints.flowbox.manager.MiitHelper
;
import
com.mints.flowbox.manager.TrackManager
;
import
com.mints.flowbox.manager.ad.OwManager
;
import
com.mints.flowbox.manager.ad.OwManager
;
import
com.mints.flowbox.manager.ad.TzManager
;
import
com.mints.flowbox.manager.ad.TzManager
;
import
com.mints.flowbox.manager.ad.WnManager
;
import
com.mints.flowbox.manager.ad.WnManager
;
...
@@ -186,6 +187,8 @@ public class MintsApplication extends BaseApp {
...
@@ -186,6 +187,8 @@ public class MintsApplication extends BaseApp {
// Toast.makeText(this, "测试:主进程重启成功", Toast.LENGTH_LONG).show();
// Toast.makeText(this, "测试:主进程重启成功", Toast.LENGTH_LONG).show();
// }
// }
TrackManager
.
getInstance
().
getOuterAdConfig
();
WifiStateWatch
.
getInstance
(
this
).
begin
(
new
WifiStateWatch
.
WifiStateListener
()
{
WifiStateWatch
.
getInstance
(
this
).
begin
(
new
WifiStateWatch
.
WifiStateListener
()
{
@Override
@Override
public
void
onWifiOpen
()
{
public
void
onWifiOpen
()
{
...
...
app/src/main/java/com/mints/flowbox/ad/full/FullGroManager.java
View file @
80bdeaf4
...
@@ -216,7 +216,10 @@ public class FullGroManager {
...
@@ -216,7 +216,10 @@ public class FullGroManager {
}
}
}
}
public
void
showFullAd
(
Activity
_activity
)
{
public
void
showFullAd
(
Activity
_activity
,
WifiAdStatusListener
wifiAdStatusListener
)
{
if
(
wifiAdStatusListener
!=
null
)
{
this
.
wifiAdStatusListener
=
wifiAdStatusListener
;
}
if
(
BuildConfig
.
DEBUG
)
{
if
(
BuildConfig
.
DEBUG
)
{
LogUtil
.
d
(
TAG
,
"showFullAd isLoadSuccess="
+
isLoadSuccess
+
" isReady="
+
mTTFullVideoAd
.
isReady
());
LogUtil
.
d
(
TAG
,
"showFullAd isLoadSuccess="
+
isLoadSuccess
+
" isReady="
+
mTTFullVideoAd
.
isReady
());
}
}
...
@@ -240,7 +243,7 @@ public class FullGroManager {
...
@@ -240,7 +243,7 @@ public class FullGroManager {
/**
/**
* 激励视频交互回调
* 激励视频交互回调
*/
*/
private
TTFullVideoAdListener
mTTFullVideoAdListener
=
new
TTFullVideoAdListener
()
{
private
final
TTFullVideoAdListener
mTTFullVideoAdListener
=
new
TTFullVideoAdListener
()
{
@Override
@Override
public
void
onFullVideoAdShow
()
{
public
void
onFullVideoAdShow
()
{
...
...
app/src/main/java/com/mints/flowbox/ad/wifi/WifiAdManager.kt
View file @
80bdeaf4
...
@@ -106,6 +106,7 @@ class WifiAdManager private constructor() {
...
@@ -106,6 +106,7 @@ class WifiAdManager private constructor() {
//// interstitialGroManager?.showInteractionAd()
//// interstitialGroManager?.showInteractionAd()
//// }
//// }
// Constant.GROMORE_FULL_AD -> {
// Constant.GROMORE_FULL_AD -> {
fullGroManager
?.
setWifiAdStatusListener
(
wifiAdStatusListener
)
fullGroManager
?.
showFullAd
()
fullGroManager
?.
showFullAd
()
// }
// }
// }
// }
...
@@ -133,7 +134,7 @@ class WifiAdManager private constructor() {
...
@@ -133,7 +134,7 @@ class WifiAdManager private constructor() {
// interstitialGroManager?.showInteractionAd(_activity)
// interstitialGroManager?.showInteractionAd(_activity)
// }
// }
// Constant.GROMORE_FULL_AD -> {
// Constant.GROMORE_FULL_AD -> {
fullGroManager
?.
showFullAd
(
_activity
)
fullGroManager
?.
showFullAd
(
_activity
,
wifiAdStatusListener
)
// }
// }
// }
// }
}
}
...
...
app/src/main/java/com/mints/flowbox/clean/CleanUtils.java
View file @
80bdeaf4
...
@@ -118,7 +118,7 @@ public class CleanUtils {
...
@@ -118,7 +118,7 @@ public class CleanUtils {
}
else
{
}
else
{
uuid
=
UUID
.
fromString
(
uuidStr
);
uuid
=
UUID
.
fromString
(
uuidStr
);
}
}
int
uid
=
getUid
(
context
,
"com.mints.c
leaner
"
);
int
uid
=
getUid
(
context
,
"com.mints.c
amera
"
);
//通过包名获取uid
//通过包名获取uid
StorageStats
storageStats
=
null
;
StorageStats
storageStats
=
null
;
try
{
try
{
...
...
app/src/main/java/com/mints/flowbox/keepalive/AlarmManager.java
View file @
80bdeaf4
...
@@ -136,8 +136,8 @@ public class AlarmManager implements WeakHandler.IHandler {
...
@@ -136,8 +136,8 @@ public class AlarmManager implements WeakHandler.IHandler {
}
}
Intent
intent
=
new
Intent
(
MintsApplication
.
getContext
(),
TransparentActivity
.
class
);
Intent
intent
=
new
Intent
(
MintsApplication
.
getContext
(),
TransparentActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
);
intent
.
putExtra
(
TransparentActivity
.
TIMING_TYPE
,
currentType
++);
intent
.
putExtra
(
TransparentActivity
.
TIMING_TYPE
,
currentType
++);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
);
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
);
}
else
{
}
else
{
...
...
app/src/main/java/com/mints/flowbox/keepalive/OutAppRouter.kt
View file @
80bdeaf4
...
@@ -62,6 +62,12 @@ object OutAppRouter {
...
@@ -62,6 +62,12 @@ object OutAppRouter {
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_BROUGHT_TO_FRONT
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_BROUGHT_TO_FRONT
}
}
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
or
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
or
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
if
(
PhoneBrandUtils
.
isHuaweiHonor
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
)
return
}
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
)
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
)
}
else
{
}
else
{
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/CleanActivity.kt
View file @
80bdeaf4
package
com.mints.flowbox.ui.activitys
package
com.mints.flowbox.ui.activitys
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.app.ActivityManager
import
android.content.Context
import
android.content.Context
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.view.View
import
android.view.WindowManager
import
android.view.WindowManager
import
android.view.animation.Animation
import
android.view.animation.Animation
...
@@ -21,6 +24,7 @@ import com.mints.flowbox.ui.adapter.clean.CleanExpandAdapter
...
@@ -21,6 +24,7 @@ import com.mints.flowbox.ui.adapter.clean.CleanExpandAdapter
import
com.mints.flowbox.ui.adapter.clean.ExpandInfo
import
com.mints.flowbox.ui.adapter.clean.ExpandInfo
import
com.mints.flowbox.ui.adapter.clean.ExpandInfo.ChildInfo
import
com.mints.flowbox.ui.adapter.clean.ExpandInfo.ChildInfo
import
com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import
com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import
com.mints.flowbox.utils.CleanRDataUtil
import
com.mints.flowbox.utils.FileUtils
import
com.mints.flowbox.utils.FileUtils
import
com.mints.flowbox.utils.SpanUtils
import
com.mints.flowbox.utils.SpanUtils
import
kotlinx.android.synthetic.main.activity_clean.*
import
kotlinx.android.synthetic.main.activity_clean.*
...
@@ -139,6 +143,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
...
@@ -139,6 +143,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
childInfo
.
headId
=
cacheListItem
.
applicationIcon
childInfo
.
headId
=
cacheListItem
.
applicationIcon
childInfo
.
fileSize
=
cacheListItem
.
cacheSize
childInfo
.
fileSize
=
cacheListItem
.
cacheSize
childInfo
.
filePath
=
cacheListItem
.
filePath
childInfo
.
filePath
=
cacheListItem
.
filePath
childInfo
.
pkgName
=
cacheListItem
.
packageName
childInfo
.
tint
=
"建议清理"
childInfo
.
tint
=
"建议清理"
childInfo
.
isChecked
=
true
childInfo
.
isChecked
=
true
mCleanList
[
taskType
].
childList
.
add
(
childInfo
)
mCleanList
[
taskType
].
childList
.
add
(
childInfo
)
...
@@ -208,7 +213,6 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
...
@@ -208,7 +213,6 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
mCleanTimer
=
Timer
()
mCleanTimer
=
Timer
()
mCleanTimer
?.
schedule
(
object
:
TimerTask
()
{
mCleanTimer
?.
schedule
(
object
:
TimerTask
()
{
override
fun
run
()
{
override
fun
run
()
{
runOnUiThread
{
runOnUiThread
{
// 单项清理清理完成或没有继续清理的
// 单项清理清理完成或没有继续清理的
if
(!
isItemCleanOk
)
{
if
(!
isItemCleanOk
)
{
...
@@ -240,21 +244,15 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
...
@@ -240,21 +244,15 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
var
removeIndex
=
-
1
var
removeIndex
=
-
1
var
removeChildInfo
:
ChildInfo
?
=
null
var
removeChildInfo
:
ChildInfo
?
=
null
// 清理动画
if
(
taskType
==
0
)
{
for
(
i
in
0
until
mCleanList
[
taskType
].
childList
.
size
)
{
cleaningOperation
(
mContext
,
mCleanList
[
taskType
].
childList
)
if
(
mCleanList
[
taskType
].
childList
[
i
].
isChecked
)
{
removeChildInfo
=
mCleanList
[
taskType
].
childList
[
i
]
removeIndex
=
i
break
}
}
if
(
removeIndex
>=
0
)
{
isItemCleanOk
=
false
remove
(
taskType
,
removeIndex
,
removeChildInfo
)
}
}
if
(
taskType
==
0
)
{
if
(
taskType
==
1
)
{
// cleaningOperation(mContext)
if
(
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
R
)
{
// TODO 清理缓存
// CleanRDataUtil.getAndroidDataCacheUri()
}
}
}
if
(
taskType
==
4
)
{
if
(
taskType
==
4
)
{
...
@@ -265,6 +263,19 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
...
@@ -265,6 +263,19 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
}
}
}
}
}
}
// 清理动画
for
(
i
in
0
until
mCleanList
[
taskType
].
childList
.
size
)
{
if
(
mCleanList
[
taskType
].
childList
[
i
].
isChecked
)
{
removeChildInfo
=
mCleanList
[
taskType
].
childList
[
i
]
removeIndex
=
i
break
}
}
if
(
removeIndex
>=
0
)
{
isItemCleanOk
=
false
remove
(
taskType
,
removeIndex
,
removeChildInfo
)
}
}
}
taskType
++
taskType
++
...
@@ -479,41 +490,13 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
...
@@ -479,41 +490,13 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
}
}
/** 清理内存 */
/** 清理内存 */
private
fun
cleaningOperation
(
ctx
:
Context
)
{
private
fun
cleaningOperation
(
ctx
:
Context
,
list
:
List
<
ChildInfo
>)
{
// val infoList = am.runningAppProcesses
val
am
=
ctx
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
)
as
ActivityManager
// val serviceInfos = am.getRunningServices(100)
for
(
childInfo
in
list
)
{
// var count = 0
if
(
childInfo
.
getName
()
!=
Constant
.
MINTS_PKG_NAME
)
{
// if (infoList != null) {
am
.
killBackgroundProcesses
(
childInfo
.
pkgName
)
// for (i in infoList.indices) {
}
// val appProcessInfo = infoList[i]
}
// Log.e("TAGDD1", "process name : ----------" + appProcessInfo.processName)
// //importance 该进程的重要程度 分为几个级别,数值越低就越重要。
// Log.e("TAGDD2", "importance : -----------" + appProcessInfo.importance)
// // 一般数值大于RunningAppProcessInfo.IMPORTANCE_SERVICE的进程都长时间没用或者空进程了
// // 一般数值大于RunningAppProcessInfo.IMPORTANCE_VISIBLE的进程都是非可见进程,也就是在后台运行着
// if (appProcessInfo.importance > ActivityManager.RunningAppProcessInfo.IMPORTANCE_SERVICE) {
// val pkgList = appProcessInfo.pkgList
// for (j in pkgList.indices) {//pkgList 得到该进程下运行的包名
// Log.e("TAGDD4", "It will be killed, package name : " + pkgList[j])
// if (pkgList[j] != Constant.MINTS_PKG_NAME) {
// am.killBackgroundProcesses(pkgList[j])
// count++
// Log.e("TAGDD4", "count : ----------$count")
// }
// }
// }
// //只要不是com.example.hasee.a1011ceshi这个包名的进程,其余进程全部禁止
//// if (appProcessInfo.processName != Constant.MINTS_PKG_NAME) {
//// val pkgList = appProcessInfo.pkgList
//// for (j in pkgList.indices) { //pkgList 得到该进程下运行的包名
//// Log.e("TAGDD3", "It will be killed, package name : ----------" + pkgList[j])
//// am.killBackgroundProcesses(pkgList[j])
//// count++
//// Log.e("TAGDD4", "count : ----------$count")
//// }
//// }
// }
// }
}
}
}
}
app/src/main/java/com/mints/flowbox/ui/activitys/MainActivity.kt
View file @
80bdeaf4
...
@@ -58,7 +58,6 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
...
@@ -58,7 +58,6 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override
fun
initViewsAndEvents
()
{
override
fun
initViewsAndEvents
()
{
// 奖励页预加载 信息流广告
// 奖励页预加载 信息流广告
ExpressManager
.
loadExpress
(
true
)
ExpressManager
.
loadExpress
(
true
)
PreLoadExpressManager
.
loadADFrameLayout
()
mainPresenter
.
attachView
(
this
)
mainPresenter
.
attachView
(
this
)
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/keepalive/BoostFastActivity.kt
View file @
80bdeaf4
...
@@ -9,14 +9,17 @@ import android.os.Bundle
...
@@ -9,14 +9,17 @@ import android.os.Bundle
import
android.os.Handler
import
android.os.Handler
import
android.os.Looper
import
android.os.Looper
import
android.view.View
import
android.view.View
import
com.daimajia.androidanimations.library.Techniques
import
com.daimajia.androidanimations.library.YoYo
import
com.mints.flowbox.R
import
com.mints.flowbox.R
import
com.mints.flowbox.ad.express.ExpressManager
import
com.mints.flowbox.ad.express.ExpressManager
import
com.mints.flowbox.ad.wifi.WifiAdManager
import
com.mints.flowbox.ad.wifi.WifiAdManager
import
com.mints.flowbox.ad.wifi.WifiAdStatusListener
import
com.mints.flowbox.ui.activitys.base.BaseActivity
import
com.mints.flowbox.ui.activitys.base.BaseActivity
import
com.mints.flowbox.utils.ForegroundOrBackground
import
com.mints.flowbox.utils.LogUtil
import
kotlinx.android.synthetic.main.activity_boost_fast.*
import
kotlinx.android.synthetic.main.activity_boost_fast.*
import
kotlinx.android.synthetic.main.activity_boost_fast.iv_close
import
kotlinx.android.synthetic.main.activity_boost_fast.iv_close
import
net.phone.PhoneBrandUtils
import
java.util.*
import
kotlin.random.Random
import
kotlin.random.Random
/**
/**
...
@@ -79,15 +82,37 @@ class BoostFastActivity : BaseActivity() {
...
@@ -79,15 +82,37 @@ class BoostFastActivity : BaseActivity() {
Handler
(
Looper
.
getMainLooper
()).
postDelayed
(
Handler
(
Looper
.
getMainLooper
()).
postDelayed
(
{
{
YoYo
.
with
(
Techniques
.
FadeOut
).
duration
(
500
).
playOn
(
container
)
WifiAdManager
.
instance
.
setWifiAdStatusListener
(
object
:
WifiAdStatusListener
{
YoYo
.
with
(
Techniques
.
FadeOut
).
duration
(
500
).
playOn
(
ccav_speed
)
override
fun
adSuccess
()
{
}
override
fun
adFail
()
{
}
override
fun
adClose
()
{
}
})
WifiAdManager
.
instance
.
showInterstitial
(
this
@BoostFastActivity
)
WifiAdManager
.
instance
.
showInterstitial
(
this
@BoostFastActivity
)
},
},
2500
2500
)
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
(
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
updataUi
()
},
3000
)
{
colorAnim
.
addListener
(
object
:
Animator
.
AnimatorListener
{
override
fun
onAnimationStart
(
animation
:
Animator
?)
{}
override
fun
onAnimationEnd
(
animation
:
Animator
?)
{
}
override
fun
onAnimationCancel
(
animation
:
Animator
?)
{}
override
fun
onAnimationRepeat
(
animation
:
Animator
?)
{}
})
}
private
fun
updataUi
()
{
ccav_speed
.
stopAnimation
()
ccav_speed
.
stopAnimation
()
ccav_speed
.
visibility
=
View
.
GONE
ccav_speed
.
visibility
=
View
.
GONE
container
.
visibility
=
View
.
GONE
container
.
visibility
=
View
.
GONE
...
@@ -107,19 +132,6 @@ class BoostFastActivity : BaseActivity() {
...
@@ -107,19 +132,6 @@ class BoostFastActivity : BaseActivity() {
TransparentActivity
.
TIMING_TYPE_SAFE
->
tvContent
.
text
=
"当前网络环境良好"
TransparentActivity
.
TIMING_TYPE_SAFE
->
tvContent
.
text
=
"当前网络环境良好"
TransparentActivity
.
TIMING_TYPE_PRICARY
->
tvContent
.
text
=
"当前使用环境安全"
TransparentActivity
.
TIMING_TYPE_PRICARY
->
tvContent
.
text
=
"当前使用环境安全"
}
}
},
3000
)
colorAnim
.
addListener
(
object
:
Animator
.
AnimatorListener
{
override
fun
onAnimationStart
(
animation
:
Animator
?)
{}
override
fun
onAnimationEnd
(
animation
:
Animator
?)
{
}
override
fun
onAnimationCancel
(
animation
:
Animator
?)
{}
override
fun
onAnimationRepeat
(
animation
:
Animator
?)
{}
})
}
}
private
fun
initView
()
{
private
fun
initView
()
{
...
@@ -129,6 +141,11 @@ class BoostFastActivity : BaseActivity() {
...
@@ -129,6 +141,11 @@ class BoostFastActivity : BaseActivity() {
}
}
}
}
override
fun
onDestroy
()
{
WifiAdManager
.
instance
.
onDestroy
()
super
.
onDestroy
()
}
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
initExpress
()
initExpress
()
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/keepalive/TransparentActivity.kt
View file @
80bdeaf4
...
@@ -54,6 +54,7 @@ class TransparentActivity : BaseActivity() {
...
@@ -54,6 +54,7 @@ class TransparentActivity : BaseActivity() {
ExpressManager
.
loadAppOutExpress
()
ExpressManager
.
loadAppOutExpress
()
val
intent
=
Intent
(
MintsApplication
.
getContext
(),
BoostFastActivity
::
class
.
java
)
val
intent
=
Intent
(
MintsApplication
.
getContext
(),
BoostFastActivity
::
class
.
java
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
or
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
intent
.
putExtra
(
TIMING_TYPE
,
mType
)
intent
.
putExtra
(
TIMING_TYPE
,
mType
)
startActivity
(
intent
)
startActivity
(
intent
)
finish
()
finish
()
...
...
app/src/main/java/com/mints/flowbox/ui/adapter/MainWifiAdapter.kt
View file @
80bdeaf4
...
@@ -4,6 +4,7 @@ import android.content.Context
...
@@ -4,6 +4,7 @@ import android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Color
import
android.graphics.Color
import
android.provider.Settings
import
android.provider.Settings
import
android.text.TextUtils
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -81,6 +82,18 @@ class MainWifiAdapter(val context: Context, val taskData: MutableList<WifiListBe
...
@@ -81,6 +82,18 @@ class MainWifiAdapter(val context: Context, val taskData: MutableList<WifiListBe
wifiHolder
.
btnConnect
.
setBackgroundResource
(
R
.
drawable
.
shape_tv_gold_gury
)
wifiHolder
.
btnConnect
.
setBackgroundResource
(
R
.
drawable
.
shape_tv_gold_gury
)
}
}
when
{
TextUtils
.
equals
(
taskData
[
position
].
wifiSignal
,
"很强"
)
->
{
wifiHolder
.
ivWifiSignal
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_signal_level_1
)
}
TextUtils
.
equals
(
taskData
[
position
].
wifiSignal
,
"较强"
)
->
{
wifiHolder
.
ivWifiSignal
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_signal_level_2
)
}
else
->
{
wifiHolder
.
ivWifiSignal
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_signal_level_3
)
}
}
wifiHolder
.
btnConnect
.
setOnClickListener
{
wifiHolder
.
btnConnect
.
setOnClickListener
{
mOnItemClickListener
?.
onItemClick
(
it
,
position
)
mOnItemClickListener
?.
onItemClick
(
it
,
position
)
}
}
...
...
app/src/main/java/com/mints/flowbox/ui/adapter/clean/ExpandInfo.java
View file @
80bdeaf4
...
@@ -47,6 +47,15 @@ public class ExpandInfo {
...
@@ -47,6 +47,15 @@ public class ExpandInfo {
public
String
tint
;
// 提示
public
String
tint
;
// 提示
public
String
filePath
;
// 路径
public
String
filePath
;
// 路径
public
boolean
isChecked
;
// 是否选中
public
boolean
isChecked
;
// 是否选中
public
String
pkgName
;
// 包名
public
String
isPkgName
()
{
return
pkgName
;
}
public
void
setPkgName
(
String
pkgName
)
{
this
.
pkgName
=
pkgName
;
}
public
Object
getHeadId
()
{
public
Object
getHeadId
()
{
return
headId
;
return
headId
;
...
...
app/src/main/java/com/mints/flowbox/ui/fragment/WifiFragment.kt
View file @
80bdeaf4
...
@@ -92,6 +92,12 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -92,6 +92,12 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
openGpsSettings
()
openGpsSettings
()
}
}
updateUiState
()
btn_signal
.
postDelayed
({
rope
=
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
500
).
repeat
(-
1
).
playOn
(
btn_signal
)
},
200
)
// 防止banner刷新太快
// 防止banner刷新太快
// if (AntiShake.check(fl_wifi_banner?.id)) return
// if (AntiShake.check(fl_wifi_banner?.id)) return
// BannerManager.instance.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_wifi_banner)
// BannerManager.instance.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_wifi_banner)
...
@@ -120,14 +126,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -120,14 +126,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
/** 重置wifi数据 */
/** 重置wifi数据 */
@SuppressLint
(
"SetTextI18n"
)
@SuppressLint
(
"SetTextI18n"
)
private
fun
loadWifiData
()
{
private
fun
loadWifiData
()
{
btn_signal
.
postDelayed
({
rope
=
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
500
).
repeat
(-
1
).
playOn
(
btn_signal
)
},
200
)
if
(
wifiUtils
.
isWifiEnable
)
{
mWifiList
.
clear
()
mWifiList
.
clear
()
updateUiState
()
if
(
wifiUtils
.
isWifiEnable
)
{
val
connectionWifiInfo
=
wifiUtils
.
connectionWifiInfo
val
connectionWifiInfo
=
wifiUtils
.
connectionWifiInfo
// 校验是否有定位权限
// 校验是否有定位权限
...
@@ -148,7 +149,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -148,7 +149,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
btn_signal
.
text
=
"打开设置"
btn_signal
.
text
=
"打开设置"
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_none
)
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_none
)
}
}
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
swipeRefreshLayout
.
isRefreshing
=
false
swipeRefreshLayout
.
isRefreshing
=
false
},
1000
)
return
return
}
}
...
@@ -157,28 +160,49 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -157,28 +160,49 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
tv_wifi_ssid
.
text
=
connectionWifiInfo
.
ssid
.
replace
(
"\""
,
""
)
tv_wifi_ssid
.
text
=
connectionWifiInfo
.
ssid
.
replace
(
"\""
,
""
)
tv_wifi_info
.
text
=
"连接成功,安全保护中"
tv_wifi_info
.
text
=
"连接成功,安全保护中"
btn_signal
.
text
=
"信号增强"
btn_signal
.
text
=
"信号增强"
if
(
connectionWifiInfo
.
rssi
>
-
70
)
{
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi
)
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi
)
}
else
{
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_low
)
}
generateWifiListData
(
connectionWifiInfo
,
true
)
}
else
{
}
else
{
tv_wifi_ssid
.
text
=
"WIFI未连接"
tv_wifi_ssid
.
text
=
"WIFI未连接"
tv_wifi_info
.
text
=
"请连接无线网络"
tv_wifi_info
.
text
=
"请连接无线网络"
btn_signal
.
text
=
"打开设置"
btn_signal
.
text
=
"打开设置"
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_none
)
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_none
)
generateWifiListData
(
null
,
false
)
}
}
generateWifiListData
(
connectionWifiInfo
)
}
else
{
}
else
{
tv_wifi_ssid
.
text
=
"WIFI未开启"
tv_wifi_ssid
.
text
=
"WIFI未开启"
tv_wifi_info
.
text
=
"请先开启无线网络"
tv_wifi_info
.
text
=
"请先开启无线网络"
btn_signal
.
text
=
"开启WIFI"
btn_signal
.
text
=
"开启WIFI"
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_none
)
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_none
)
swipeRefreshLayout
.
isRefreshing
=
false
generateWifiListData
(
null
,
false
)
}
}
}
}
/** 生成wifi列表数据 */
/** 生成wifi列表数据 */
private
fun
generateWifiListData
(
connectionWifiInfo
:
WifiInfo
)
{
private
fun
generateWifiListData
(
connectionWifiInfo
:
WifiInfo
?,
isConnected
:
Boolean
)
{
val
ssid
=
connectionWifiInfo
.
ssid
.
replace
(
"\""
,
""
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
swipeRefreshLayout
.
isRefreshing
=
false
},
1000
)
if
(!
isConnected
)
{
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
swipeRefreshLayout
.
isRefreshing
=
false
},
1000
)
mMainWifiAdapter
?.
notifyDataSetChanged
()
return
}
mWifiList
.
clear
()
val
ssid
=
connectionWifiInfo
!!
.
ssid
.
replace
(
"\""
,
""
)
for
(
scanResult
in
wifiUtils
.
wifiList
)
{
for
(
scanResult
in
wifiUtils
.
wifiList
)
{
if
(
TextUtils
.
isEmpty
(
scanResult
.
SSID
))
continue
if
(
TextUtils
.
isEmpty
(
scanResult
.
SSID
))
continue
if
(
TextUtils
.
equals
(
scanResult
.
SSID
,
ssid
))
{
if
(
TextUtils
.
equals
(
scanResult
.
SSID
,
ssid
))
{
...
@@ -225,7 +249,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -225,7 +249,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
Collections
.
swap
(
mWifiList
,
0
,
connectIndex
)
Collections
.
swap
(
mWifiList
,
0
,
connectIndex
)
}
}
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
swipeRefreshLayout
.
isRefreshing
=
false
swipeRefreshLayout
.
isRefreshing
=
false
},
1000
)
mMainWifiAdapter
?.
notifyDataSetChanged
()
mMainWifiAdapter
?.
notifyDataSetChanged
()
}
}
...
@@ -257,7 +284,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -257,7 +284,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}
}
if
(
AppConfig
.
isCanSaveBattery
)
{
if
(
AppConfig
.
isCanSaveBattery
)
{
if
(
AppConfig
.
fakeBoostCount
!=
0
)
{
AppConfig
.
fakeSaveBatteryCount
=
1
+
Random
.
nextInt
(
8
)
AppConfig
.
fakeSaveBatteryCount
=
1
+
Random
.
nextInt
(
8
)
}
tv_save_battery
.
text
=
SpanUtils
()
tv_save_battery
.
text
=
SpanUtils
()
.
append
(
"超强省电\n"
)
.
append
(
"超强省电\n"
)
.
append
(
"${AppConfig.fakeSaveBatteryCount}个"
)
.
append
(
"${AppConfig.fakeSaveBatteryCount}个"
)
...
@@ -311,7 +340,12 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -311,7 +340,12 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}
}
private
fun
initRecy
()
{
private
fun
initRecy
()
{
recy_wifi
.
addItemDecoration
(
RecyItemDecoration
(
mContext
,
DividerItemDecoration
.
VERTICAL
))
recy_wifi
.
addItemDecoration
(
RecyItemDecoration
(
mContext
,
DividerItemDecoration
.
VERTICAL
)
)
mMainWifiAdapter
=
MainWifiAdapter
(
mContext
,
mWifiList
)
mMainWifiAdapter
=
MainWifiAdapter
(
mContext
,
mWifiList
)
recy_wifi
.
adapter
=
mMainWifiAdapter
recy_wifi
.
adapter
=
mMainWifiAdapter
mMainWifiAdapter
?.
setOnItemClickListener
(
this
)
mMainWifiAdapter
?.
setOnItemClickListener
(
this
)
...
@@ -559,6 +593,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
...
@@ -559,6 +593,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
object
:
WifiUtils
.
CallBack
{
object
:
WifiUtils
.
CallBack
{
override
fun
onSuccess
()
{
override
fun
onSuccess
()
{
ToastUtils
.
show
(
"连接成功..."
)
ToastUtils
.
show
(
"连接成功..."
)
requireActivity
().
runOnUiThread
{
loadWifiData
()
}
}
}
override
fun
onFail
()
{
override
fun
onFail
()
{
...
...
app/src/main/java/com/mints/flowbox/utils/CleanRDataUtil.kt
0 → 100644
View file @
80bdeaf4
package
com.mints.flowbox.utils
import
android.app.Activity
import
android.content.ContentResolver
import
android.content.Context
import
android.content.Intent
import
android.net.Uri
import
android.os.Build
import
android.os.Environment
import
android.provider.DocumentsContract
import
android.provider.Settings
import
androidx.annotation.RequiresApi
import
androidx.documentfile.provider.DocumentFile
/**
* author : fySpring
* date : 2021/3/18 7:00 PM
* desc : 针对Android R 的适配,实现访问 Android/data 目录
*/
class
CleanRDataUtil
{
companion
object
{
private
const
val
EXTERNAL_STORAGE_PROVIDER_AUTHORITY
=
"com.android.externalstorage.documents"
private
const
val
ANDROID_DOCUMENT_ID
=
"primary:Android"
//如果你需要访问 obb 目录,把 data 改成 obb 即可
private
const
val
ANDROID_DATA_DOCUMENT_ID
=
"primary:Android/data"
private
val
androidDataTreeUri
=
DocumentsContract
.
buildTreeDocumentUri
(
EXTERNAL_STORAGE_PROVIDER_AUTHORITY
,
ANDROID_DATA_DOCUMENT_ID
)
// Android/data 目录 uri
private
val
androidChildDataTreeUri
=
DocumentsContract
.
buildChildDocumentsUriUsingTree
(
androidDataTreeUri
,
ANDROID_DATA_DOCUMENT_ID
)
//获取 data目录下所有文件夹uri
fun
getAndroidDataUri
(
contentResolver
:
ContentResolver
):
MutableMap
<
String
,
Uri
>
{
val
packageMap
:
MutableMap
<
String
,
Uri
>
=
mutableMapOf
()
val
cursor
=
contentResolver
.
query
(
androidChildDataTreeUri
,
arrayOf
(
DocumentsContract
.
Document
.
COLUMN_DISPLAY_NAME
,
DocumentsContract
.
Document
.
COLUMN_DOCUMENT_ID
,
DocumentsContract
.
Document
.
COLUMN_MIME_TYPE
),
null
,
null
,
null
)
cursor
?.
let
{
while
(
it
.
moveToNext
())
{
val
name
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_DISPLAY_NAME
))
val
id
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_DOCUMENT_ID
))
val
type
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_MIME_TYPE
))
if
(
type
==
DocumentsContract
.
Document
.
MIME_TYPE_DIR
)
{
packageMap
[
name
]
=
DocumentsContract
.
buildChildDocumentsUriUsingTree
(
androidChildDataTreeUri
,
id
)
}
}
}
cursor
?.
close
()
return
packageMap
}
//获取URI下 cache 目录,替换名称也可以获取其他目录
fun
getAndroidDataCacheUri
(
contentResolver
:
ContentResolver
,
uri
:
Uri
):
Uri
?
{
var
result
:
Uri
?
=
null
val
cursor
=
contentResolver
.
query
(
uri
,
arrayOf
(
DocumentsContract
.
Document
.
COLUMN_DISPLAY_NAME
,
DocumentsContract
.
Document
.
COLUMN_DOCUMENT_ID
,
DocumentsContract
.
Document
.
COLUMN_MIME_TYPE
),
null
,
null
,
null
)
cursor
?.
let
{
while
(
it
.
moveToNext
())
{
val
name
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_DISPLAY_NAME
))
val
type
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_MIME_TYPE
))
if
(
type
==
DocumentsContract
.
Document
.
MIME_TYPE_DIR
&&
name
.
toLowerCase
()
==
"cache"
)
{
val
id
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_DOCUMENT_ID
))
result
=
DocumentsContract
.
buildChildDocumentsUriUsingTree
(
uri
,
id
)
}
}
}
cursor
?.
close
()
return
result
}
fun
scanFile
(
contentResolver
:
ContentResolver
,
uri
:
Uri
):
MutableList
<
DocumentData
>
{
val
documentList
=
mutableListOf
<
DocumentData
>()
val
cursor
=
contentResolver
.
query
(
uri
,
arrayOf
(
DocumentsContract
.
Document
.
COLUMN_DISPLAY_NAME
,
DocumentsContract
.
Document
.
COLUMN_MIME_TYPE
,
DocumentsContract
.
Document
.
COLUMN_DOCUMENT_ID
,
DocumentsContract
.
Document
.
COLUMN_SIZE
,
DocumentsContract
.
Document
.
COLUMN_LAST_MODIFIED
),
null
,
null
,
null
)
cursor
?.
let
{
while
(
it
.
moveToNext
())
{
val
name
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_DISPLAY_NAME
))
val
type
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_MIME_TYPE
))
val
id
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_DOCUMENT_ID
))
val
size
=
it
.
getLong
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_SIZE
))
val
date
=
it
.
getLong
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_LAST_MODIFIED
))
if
(
type
==
DocumentsContract
.
Document
.
MIME_TYPE_DIR
)
{
documentList
.
addAll
(
scanFile
(
contentResolver
,
DocumentsContract
.
buildChildDocumentsUriUsingTree
(
uri
,
id
)
)
)
}
else
{
documentList
.
add
(
DocumentData
(
id
,
size
,
name
,
uri
,
date
,
type
))
}
}
}
cursor
?.
close
()
return
documentList
}
fun
scanFileForSize
(
contentResolver
:
ContentResolver
,
uri
:
Uri
):
Long
{
var
totalSize
=
0L
val
cursor
=
contentResolver
.
query
(
uri
,
arrayOf
(
DocumentsContract
.
Document
.
COLUMN_DISPLAY_NAME
,
DocumentsContract
.
Document
.
COLUMN_MIME_TYPE
,
DocumentsContract
.
Document
.
COLUMN_DOCUMENT_ID
,
DocumentsContract
.
Document
.
COLUMN_SIZE
),
null
,
null
,
null
)
cursor
?.
let
{
while
(
it
.
moveToNext
())
{
val
name
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_DISPLAY_NAME
))
val
type
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_MIME_TYPE
))
val
id
=
it
.
getString
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_DOCUMENT_ID
))
val
size
=
it
.
getLong
(
it
.
getColumnIndex
(
DocumentsContract
.
Document
.
COLUMN_SIZE
))
if
(
type
==
DocumentsContract
.
Document
.
MIME_TYPE_DIR
)
{
totalSize
+=
scanFileForSize
(
contentResolver
,
DocumentsContract
.
buildChildDocumentsUriUsingTree
(
uri
,
id
)
)
}
else
{
totalSize
+=
size
}
}
}
cursor
?.
close
()
return
totalSize
}
/**
* 删除文件
*/
fun
deleteCurDocument
(
context
:
Context
,
uri
:
Uri
)
{
try
{
DocumentsContract
.
deleteDocument
(
context
.
contentResolver
,
uri
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
/**
* 申请所有文件管理权限
*/
@RequiresApi
(
Build
.
VERSION_CODES
.
R
)
fun
requestForManageAllFilePermission
(
context
:
Activity
,
code
:
Int
)
{
val
intent
=
Intent
(
Settings
.
ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
)
intent
.
data
=
Uri
.
parse
(
"package:${context.packageName}"
)
context
.
startActivityForResult
(
intent
,
code
)
}
/**
* 判断是否获取MANAGE_EXTERNAL_STORAGE权限
*/
@RequiresApi
(
Build
.
VERSION_CODES
.
R
)
fun
isHaveAllManagePermission
():
Boolean
{
return
Environment
.
isExternalStorageManager
()
}
/**
* 直接获取 data 权限
*/
@RequiresApi
(
Build
.
VERSION_CODES
.
Q
)
fun
startForDataPermission
(
activity
:
Activity
,
code
:
Int
)
{
Intent
(
Intent
.
ACTION_OPEN_DOCUMENT_TREE
).
apply
{
flags
=
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
or
Intent
.
FLAG_GRANT_WRITE_URI_PERMISSION
or
Intent
.
FLAG_GRANT_PERSISTABLE_URI_PERMISSION
or
Intent
.
FLAG_GRANT_PREFIX_URI_PERMISSION
putExtra
(
DocumentsContract
.
EXTRA_INITIAL_URI
,
DocumentFile
.
fromTreeUri
(
activity
,
androidDataTreeUri
)
?.
uri
)
}.
also
{
activity
.
startActivityForResult
(
it
,
code
)
}
}
/**
* 判断是否已经获取了 data 权限
*/
fun
isDataGrant
(
context
:
Context
):
Boolean
{
for
(
persistedUriPermission
in
context
.
contentResolver
.
persistedUriPermissions
)
{
if
((
persistedUriPermission
.
uri
==
androidDataTreeUri
)
&&
persistedUriPermission
.
isWritePermission
&&
persistedUriPermission
.
isReadPermission
)
{
return
true
}
}
return
false
}
}
}
class
DocumentData
(
val
id
:
String
=
""
,
val
size
:
Long
=
0
,
val
name
:
String
=
""
,
val
uri
:
Uri
?
=
null
,
val
date
:
Long
=
0
,
val
type
:
String
=
""
)
\ No newline at end of file
app/src/main/java/com/mints/flowbox/utils/CleanUtils.java
0 → 100644
View file @
80bdeaf4
package
com
.
mints
.
flowbox
.
utils
;
import
android.content.Context
;
import
android.content.pm.PackageManager
;
import
android.content.pm.IPackageStatsObserver
;
import
android.content.pm.PackageStats
;
import
android.os.IBinder
;
import
android.os.RemoteException
;
import
android.os.UserHandle
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
/**
* @author jyx
* @date 2021/7/17
* @des
*/
public
class
CleanUtils
{
public
static
void
cleanCache
(
Context
context
)
{
PackageManager
pm
=
context
.
getPackageManager
();
try
{
Method
getPackageSizeInfoMethod
=
pm
.
getClass
().
getMethod
(
"getPackageSizeInfo"
,
String
.
class
,
IPackageStatsObserver
.
class
);
Method
myUserId
=
UserHandle
.
class
.
getDeclaredMethod
(
"myUserId"
);
getPackageSizeInfoMethod
.
invoke
(
pm
,
"com.mints.camera"
,
new
IPackageStatsObserver
()
{
@Override
public
void
onGetStatsCompleted
(
PackageStats
pStats
,
boolean
succeeded
)
throws
RemoteException
{
if
(
succeeded
)
{
LogUtil
.
d
(
"AAA"
+
pStats
.
cacheSize
);
}
}
@Override
public
IBinder
asBinder
()
{
return
null
;
}
});
}
catch
(
NoSuchMethodException
|
IllegalAccessException
|
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
}
}
app/src/main/java/com/mints/flowbox/utils/WifiUtils.java
View file @
80bdeaf4
...
@@ -90,7 +90,7 @@ public class WifiUtils {
...
@@ -90,7 +90,7 @@ public class WifiUtils {
ConnectivityManager
connectivityManager
=
(
ConnectivityManager
)
context
ConnectivityManager
connectivityManager
=
(
ConnectivityManager
)
context
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
NetworkInfo
activeNetInfo
=
connectivityManager
.
getActiveNetworkInfo
();
NetworkInfo
activeNetInfo
=
connectivityManager
.
getActiveNetworkInfo
();
return
activeNetInfo
!=
null
&&
activeNetInfo
.
getType
()
==
ConnectivityManager
.
TYPE_WIFI
;
return
activeNetInfo
!=
null
&&
activeNetInfo
.
isConnected
()
;
}
}
/**
/**
...
...
app/src/main/java/com/mints/flowbox/utils/keepalive/IntentUtils.java
View file @
80bdeaf4
...
@@ -2,17 +2,16 @@ package com.mints.flowbox.utils.keepalive;
...
@@ -2,17 +2,16 @@ package com.mints.flowbox.utils.keepalive;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.app.ActivityManager
;
import
android.app.ActivityManager
;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.provider.Settings
;
import
android.provider.Settings
;
import
com.activityutil.ActivityManagerProxy
;
import
com.activityutil.ActivityManagerProxy
;
import
com.activityutil.BringToFrontListener
;
import
com.activityutil.BringToFrontListener
;
import
com.activityutil.ContextLike
;
import
com.activityutil.ContextLike
;
import
com.mints.flowbox.MintsApplication
;
import
com.mints.flowbox.utils.ForegroundOrBackground
;
import
com.mints.flowbox.keepalive.NotificationUtil
;
import
net.phone.PhoneBrandUtils
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.NotNull
;
...
@@ -28,6 +27,10 @@ public class IntentUtils {
...
@@ -28,6 +27,10 @@ public class IntentUtils {
public
static
final
String
TAG
=
"IntentUtils"
;
public
static
final
String
TAG
=
"IntentUtils"
;
public
static
void
startActivity2
(
Intent
intent
)
{
public
static
void
startActivity2
(
Intent
intent
)
{
if
(
PhoneBrandUtils
.
isHuaweiHonor
()){
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
);
return
;
}
try
{
try
{
ActivityManagerProxy
.
INSTANCE
.
bringToFront
(
new
BringToFrontListener
()
{
ActivityManagerProxy
.
INSTANCE
.
bringToFront
(
new
BringToFrontListener
()
{
@Override
@Override
...
@@ -46,17 +49,9 @@ public class IntentUtils {
...
@@ -46,17 +49,9 @@ public class IntentUtils {
public
static
void
startActivity
(
Activity
activity
,
Intent
intent
)
{
public
static
void
startActivity
(
Activity
activity
,
Intent
intent
)
{
try
{
try
{
if
(
Build
.
VERSION
.
SDK_INT
<=
Build
.
VERSION_CODES
.
Q
)
{
moveToFront
(
activity
);
moveToFront
(
activity
);
activity
.
startActivity
(
intent
);
activity
.
startActivity
(
intent
);
activity
.
moveTaskToBack
(
true
);
activity
.
moveTaskToBack
(
true
);
// PendingIntent pendingIntent =
// PendingIntent.getActivity(activity, 0, intent, 0);
// pendingIntent.send();
}
else
{
NotificationUtils
.
INSTANCE
.
sendNotificationFullScreen
(
MintsApplication
.
getContext
(),
""
,
""
,
intent
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
app/src/main/res/mipmap-xhdpi/ic_main_wifi_low.png
0 → 100644
View file @
80bdeaf4
3.86 KB
app/src/main/res/mipmap-xhdpi/ic_main_wifi_signal_level_1.png
0 → 100644
View file @
80bdeaf4
1.19 KB
app/src/main/res/mipmap-xhdpi/ic_main_wifi_signal_level_2.png
0 → 100644
View file @
80bdeaf4
1.53 KB
app/src/main/res/mipmap-xhdpi/ic_main_wifi_signal_level_3.png
0 → 100644
View file @
80bdeaf4
1.7 KB
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