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
Expand all
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 {
implementation
'com.github.bumptech.glide:glide:4.11.0'
implementation
'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation
'androidx.documentfile:documentfile:1.0.1'
annotationProcessor
'com.github.bumptech.glide:compiler:4.11.0'
// 65536
implementation
'androidx.multidex:multidex:2.0.1'
...
...
app/proguard-rules.pro
View file @
80bdeaf4
...
...
@@ -277,7 +277,8 @@
# 避免影响升级功能,需要keep住support包的类
-keep class android.support.
*
*{*;}
# 避免清理aidl
-keep class android.content.pm.
*
* { *; }
# ===================== shareSDK START ================
-dontwarn com.mob.
*
*
...
...
app/src/main/AndroidManifest.xml
View file @
80bdeaf4
...
...
@@ -5,6 +5,7 @@
<uses-permission
android:name=
"android.permission.DISABLE_KEYGUARD"
/>
<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.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;
import
com.mints.flowbox.keepalive.WifiStateWatch
;
import
com.mints.flowbox.manager.CsjGroMoreManager
;
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.TzManager
;
import
com.mints.flowbox.manager.ad.WnManager
;
...
...
@@ -186,6 +187,8 @@ public class MintsApplication extends BaseApp {
// Toast.makeText(this, "测试:主进程重启成功", Toast.LENGTH_LONG).show();
// }
TrackManager
.
getInstance
().
getOuterAdConfig
();
WifiStateWatch
.
getInstance
(
this
).
begin
(
new
WifiStateWatch
.
WifiStateListener
()
{
@Override
public
void
onWifiOpen
()
{
...
...
app/src/main/java/com/mints/flowbox/ad/full/FullGroManager.java
View file @
80bdeaf4
...
...
@@ -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
)
{
LogUtil
.
d
(
TAG
,
"showFullAd isLoadSuccess="
+
isLoadSuccess
+
" isReady="
+
mTTFullVideoAd
.
isReady
());
}
...
...
@@ -240,7 +243,7 @@ public class FullGroManager {
/**
* 激励视频交互回调
*/
private
TTFullVideoAdListener
mTTFullVideoAdListener
=
new
TTFullVideoAdListener
()
{
private
final
TTFullVideoAdListener
mTTFullVideoAdListener
=
new
TTFullVideoAdListener
()
{
@Override
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() {
//// interstitialGroManager?.showInteractionAd()
//// }
// Constant.GROMORE_FULL_AD -> {
fullGroManager
?.
setWifiAdStatusListener
(
wifiAdStatusListener
)
fullGroManager
?.
showFullAd
()
// }
// }
...
...
@@ -133,7 +134,7 @@ class WifiAdManager private constructor() {
// interstitialGroManager?.showInteractionAd(_activity)
// }
// 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 {
}
else
{
uuid
=
UUID
.
fromString
(
uuidStr
);
}
int
uid
=
getUid
(
context
,
"com.mints.c
leaner
"
);
int
uid
=
getUid
(
context
,
"com.mints.c
amera
"
);
//通过包名获取uid
StorageStats
storageStats
=
null
;
try
{
...
...
app/src/main/java/com/mints/flowbox/keepalive/AlarmManager.java
View file @
80bdeaf4
...
...
@@ -136,8 +136,8 @@ public class AlarmManager implements WeakHandler.IHandler {
}
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
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
);
}
else
{
...
...
app/src/main/java/com/mints/flowbox/keepalive/OutAppRouter.kt
View file @
80bdeaf4
...
...
@@ -62,6 +62,12 @@ object OutAppRouter {
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_BROUGHT_TO_FRONT
}
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
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
)
}
else
{
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/CleanActivity.kt
View file @
80bdeaf4
package
com.mints.flowbox.ui.activitys
import
android.annotation.SuppressLint
import
android.app.ActivityManager
import
android.content.Context
import
android.graphics.Color
import
android.os.Build
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.view.WindowManager
import
android.view.animation.Animation
...
...
@@ -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.ChildInfo
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.SpanUtils
import
kotlinx.android.synthetic.main.activity_clean.*
...
...
@@ -139,6 +143,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
childInfo
.
headId
=
cacheListItem
.
applicationIcon
childInfo
.
fileSize
=
cacheListItem
.
cacheSize
childInfo
.
filePath
=
cacheListItem
.
filePath
childInfo
.
pkgName
=
cacheListItem
.
packageName
childInfo
.
tint
=
"建议清理"
childInfo
.
isChecked
=
true
mCleanList
[
taskType
].
childList
.
add
(
childInfo
)
...
...
@@ -208,7 +213,6 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
mCleanTimer
=
Timer
()
mCleanTimer
?.
schedule
(
object
:
TimerTask
()
{
override
fun
run
()
{
runOnUiThread
{
// 单项清理清理完成或没有继续清理的
if
(!
isItemCleanOk
)
{
...
...
@@ -240,21 +244,15 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
var
removeIndex
=
-
1
var
removeChildInfo
:
ChildInfo
?
=
null
// 清理动画
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
)
if
(
taskType
==
0
)
{
cleaningOperation
(
mContext
,
mCleanList
[
taskType
].
childList
)
}
if
(
taskType
==
0
)
{
// cleaningOperation(mContext)
if
(
taskType
==
1
)
{
if
(
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
R
)
{
// TODO 清理缓存
// CleanRDataUtil.getAndroidDataCacheUri()
}
}
if
(
taskType
==
4
)
{
...
...
@@ -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
++
...
...
@@ -479,41 +490,13 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
}
/** 清理内存 */
private
fun
cleaningOperation
(
ctx
:
Context
)
{
// val infoList = am.runningAppProcesses
// val serviceInfos = am.getRunningServices(100)
// var count = 0
// if (infoList != null) {
// 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")
//// }
//// }
// }
// }
private
fun
cleaningOperation
(
ctx
:
Context
,
list
:
List
<
ChildInfo
>)
{
val
am
=
ctx
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
)
as
ActivityManager
for
(
childInfo
in
list
)
{
if
(
childInfo
.
getName
()
!=
Constant
.
MINTS_PKG_NAME
)
{
am
.
killBackgroundProcesses
(
childInfo
.
pkgName
)
}
}
}
}
app/src/main/java/com/mints/flowbox/ui/activitys/MainActivity.kt
View file @
80bdeaf4
...
...
@@ -58,7 +58,6 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override
fun
initViewsAndEvents
()
{
// 奖励页预加载 信息流广告
ExpressManager
.
loadExpress
(
true
)
PreLoadExpressManager
.
loadADFrameLayout
()
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
import
android.os.Handler
import
android.os.Looper
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.ad.express.ExpressManager
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.utils.ForegroundOrBackground
import
com.mints.flowbox.utils.LogUtil
import
kotlinx.android.synthetic.main.activity_boost_fast.*
import
kotlinx.android.synthetic.main.activity_boost_fast.iv_close
import
net.phone.PhoneBrandUtils
import
java.util.*
import
kotlin.random.Random
/**
...
...
@@ -79,15 +82,37 @@ class BoostFastActivity : BaseActivity() {
Handler
(
Looper
.
getMainLooper
()).
postDelayed
(
{
YoYo
.
with
(
Techniques
.
FadeOut
).
duration
(
500
).
playOn
(
container
)
YoYo
.
with
(
Techniques
.
FadeOut
).
duration
(
500
).
playOn
(
ccav_speed
)
WifiAdManager
.
instance
.
setWifiAdStatusListener
(
object
:
WifiAdStatusListener
{
override
fun
adSuccess
()
{
}
override
fun
adFail
()
{
}
override
fun
adClose
()
{
}
})
WifiAdManager
.
instance
.
showInterstitial
(
this
@BoostFastActivity
)
},
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
.
visibility
=
View
.
GONE
container
.
visibility
=
View
.
GONE
...
...
@@ -107,19 +132,6 @@ class BoostFastActivity : BaseActivity() {
TransparentActivity
.
TIMING_TYPE_SAFE
->
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
()
{
...
...
@@ -129,6 +141,11 @@ class BoostFastActivity : BaseActivity() {
}
}
override
fun
onDestroy
()
{
WifiAdManager
.
instance
.
onDestroy
()
super
.
onDestroy
()
}
override
fun
onResume
()
{
super
.
onResume
()
initExpress
()
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/keepalive/TransparentActivity.kt
View file @
80bdeaf4
...
...
@@ -54,6 +54,7 @@ class TransparentActivity : BaseActivity() {
ExpressManager
.
loadAppOutExpress
()
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
)
startActivity
(
intent
)
finish
()
...
...
app/src/main/java/com/mints/flowbox/ui/adapter/MainWifiAdapter.kt
View file @
80bdeaf4
...
...
@@ -4,6 +4,7 @@ import android.content.Context
import
android.content.Intent
import
android.graphics.Color
import
android.provider.Settings
import
android.text.TextUtils
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -81,6 +82,18 @@ class MainWifiAdapter(val context: Context, val taskData: MutableList<WifiListBe
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
{
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 {
public
String
tint
;
// 提示
public
String
filePath
;
// 路径
public
boolean
isChecked
;
// 是否选中
public
String
pkgName
;
// 包名
public
String
isPkgName
()
{
return
pkgName
;
}
public
void
setPkgName
(
String
pkgName
)
{
this
.
pkgName
=
pkgName
;
}
public
Object
getHeadId
()
{
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,
openGpsSettings
()
}
updateUiState
()
btn_signal
.
postDelayed
({
rope
=
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
500
).
repeat
(-
1
).
playOn
(
btn_signal
)
},
200
)
// 防止banner刷新太快
// if (AntiShake.check(fl_wifi_banner?.id)) return
// BannerManager.instance.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_wifi_banner)
...
...
@@ -120,14 +126,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
/** 重置wifi数据 */
@SuppressLint
(
"SetTextI18n"
)
private
fun
loadWifiData
()
{
btn_signal
.
postDelayed
({
rope
=
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
500
).
repeat
(-
1
).
playOn
(
btn_signal
)
},
200
)
if
(
wifiUtils
.
isWifiEnable
)
{
mWifiList
.
clear
()
updateUiState
()
if
(
wifiUtils
.
isWifiEnable
)
{
val
connectionWifiInfo
=
wifiUtils
.
connectionWifiInfo
// 校验是否有定位权限
...
...
@@ -148,7 +149,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
btn_signal
.
text
=
"打开设置"
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_none
)
}
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
swipeRefreshLayout
.
isRefreshing
=
false
},
1000
)
return
}
...
...
@@ -157,28 +160,49 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
tv_wifi_ssid
.
text
=
connectionWifiInfo
.
ssid
.
replace
(
"\""
,
""
)
tv_wifi_info
.
text
=
"连接成功,安全保护中"
btn_signal
.
text
=
"信号增强"
if
(
connectionWifiInfo
.
rssi
>
-
70
)
{
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi
)
}
else
{
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_low
)
}
generateWifiListData
(
connectionWifiInfo
,
true
)
}
else
{
tv_wifi_ssid
.
text
=
"WIFI未连接"
tv_wifi_info
.
text
=
"请连接无线网络"
btn_signal
.
text
=
"打开设置"
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_none
)
generateWifiListData
(
null
,
false
)
}
generateWifiListData
(
connectionWifiInfo
)
}
else
{
tv_wifi_ssid
.
text
=
"WIFI未开启"
tv_wifi_info
.
text
=
"请先开启无线网络"
btn_signal
.
text
=
"开启WIFI"
imageView2
.
setImageResource
(
R
.
mipmap
.
ic_main_wifi_none
)
swipeRefreshLayout
.
isRefreshing
=
false
generateWifiListData
(
null
,
false
)
}
}
/** 生成wifi列表数据 */
private
fun
generateWifiListData
(
connectionWifiInfo
:
WifiInfo
)
{
val
ssid
=
connectionWifiInfo
.
ssid
.
replace
(
"\""
,
""
)
private
fun
generateWifiListData
(
connectionWifiInfo
:
WifiInfo
?,
isConnected
:
Boolean
)
{
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
)
{
if
(
TextUtils
.
isEmpty
(
scanResult
.
SSID
))
continue
if
(
TextUtils
.
equals
(
scanResult
.
SSID
,
ssid
))
{
...
...
@@ -225,7 +249,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
Collections
.
swap
(
mWifiList
,
0
,
connectIndex
)
}
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
swipeRefreshLayout
.
isRefreshing
=
false
},
1000
)
mMainWifiAdapter
?.
notifyDataSetChanged
()
}
...
...
@@ -257,7 +284,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}
if
(
AppConfig
.
isCanSaveBattery
)
{
if
(
AppConfig
.
fakeBoostCount
!=
0
)
{
AppConfig
.
fakeSaveBatteryCount
=
1
+
Random
.
nextInt
(
8
)
}
tv_save_battery
.
text
=
SpanUtils
()
.
append
(
"超强省电\n"
)
.
append
(
"${AppConfig.fakeSaveBatteryCount}个"
)
...
...
@@ -311,7 +340,12 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}
private
fun
initRecy
()
{
recy_wifi
.
addItemDecoration
(
RecyItemDecoration
(
mContext
,
DividerItemDecoration
.
VERTICAL
))
recy_wifi
.
addItemDecoration
(
RecyItemDecoration
(
mContext
,
DividerItemDecoration
.
VERTICAL
)
)
mMainWifiAdapter
=
MainWifiAdapter
(
mContext
,
mWifiList
)
recy_wifi
.
adapter
=
mMainWifiAdapter
mMainWifiAdapter
?.
setOnItemClickListener
(
this
)
...
...
@@ -559,6 +593,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
object
:
WifiUtils
.
CallBack
{
override
fun
onSuccess
()
{
ToastUtils
.
show
(
"连接成功..."
)
requireActivity
().
runOnUiThread
{
loadWifiData
()
}
}
override
fun
onFail
()
{
...
...
app/src/main/java/com/mints/flowbox/utils/CleanRDataUtil.kt
0 → 100644
View file @
80bdeaf4
This diff is collapsed.
Click to expand it.
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 {
ConnectivityManager
connectivityManager
=
(
ConnectivityManager
)
context
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
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;
import
android.app.Activity
;
import
android.app.ActivityManager
;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.provider.Settings
;
import
com.activityutil.ActivityManagerProxy
;
import
com.activityutil.BringToFrontListener
;
import
com.activityutil.ContextLike
;
import
com.mints.flowbox.MintsApplication
;
import
com.mints.flowbox.keepalive.NotificationUtil
;
import
com.mints.flowbox.utils.ForegroundOrBackground
;
import
net.phone.PhoneBrandUtils
;
import
org.jetbrains.annotations.NotNull
;
...
...
@@ -28,6 +27,10 @@ public class IntentUtils {
public
static
final
String
TAG
=
"IntentUtils"
;
public
static
void
startActivity2
(
Intent
intent
)
{
if
(
PhoneBrandUtils
.
isHuaweiHonor
()){
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
);
return
;
}
try
{
ActivityManagerProxy
.
INSTANCE
.
bringToFront
(
new
BringToFrontListener
()
{
@Override
...
...
@@ -46,17 +49,9 @@ public class IntentUtils {
public
static
void
startActivity
(
Activity
activity
,
Intent
intent
)
{
try
{
if
(
Build
.
VERSION
.
SDK_INT
<=
Build
.
VERSION_CODES
.
Q
)
{
moveToFront
(
activity
);
activity
.
startActivity
(
intent
);
activity
.
moveTaskToBack
(
true
);
// PendingIntent pendingIntent =
// PendingIntent.getActivity(activity, 0, intent, 0);
// pendingIntent.send();
}
else
{
NotificationUtils
.
INSTANCE
.
sendNotificationFullScreen
(
MintsApplication
.
getContext
(),
""
,
""
,
intent
);
}
}
catch
(
Exception
e
)
{
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