|
@@ -40,7 +40,8 @@ class AppAdapter(var context: Context, var data: ArrayList<AppInfo>) :
|
40
|
40
|
holder.mBinding.itemCv.setText(appInfo.name)
|
41
|
41
|
holder.mBinding.itemCv.setOnClickListener {
|
42
|
42
|
if (appInfo.packageName.equals(Const.CUSTOMSPEEDAPP)){
|
43
|
|
- clearMemory()
|
|
43
|
+ StrategyUtils.clearMemory(context,data)
|
|
44
|
+ Toaster.show("加速完成。")
|
44
|
45
|
}else if (appInfo.packageName.equals(Const.CUSTOMCLEARAPP)){
|
45
|
46
|
Toaster.showLong("清理缓存")
|
46
|
47
|
}else if (appInfo.packageName.equals(Const.CUSTOMROTATIONAPP)){
|
|
@@ -64,22 +65,6 @@ class AppAdapter(var context: Context, var data: ArrayList<AppInfo>) :
|
64
|
65
|
}
|
65
|
66
|
}
|
66
|
67
|
|
67
|
|
- private fun clearMemory() {
|
68
|
|
- try {
|
69
|
|
- val service : ActivityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
70
|
|
- val runningAppProcesses = service.runningAppProcesses
|
71
|
|
- runningAppProcesses.forEach {process->
|
72
|
|
- LogShow("当前运行应用名称"+process.processName+"|||"+process?.importanceReasonComponent?.packageName)
|
73
|
|
- data.filter { it.packageName.equals(process.processName) }.forEach {
|
74
|
|
- ManageApplication.killApplicationProcess(it.packageName)
|
75
|
|
- }
|
76
|
|
- }
|
77
|
|
- Toaster.show("加速完成。")
|
78
|
|
- }catch (e:Exception){
|
79
|
|
-
|
80
|
|
- }
|
81
|
|
- }
|
82
|
|
-
|
83
|
68
|
class AppViewHolder(binding: ItemAppBinding) : RecyclerView.ViewHolder(binding.root) {
|
84
|
69
|
var mBinding = binding
|
85
|
70
|
}
|