diff --git a/app/build.gradle b/app/build.gradle
index 80f9e16..474a177 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,8 +10,8 @@ android {
applicationId "me.kyuubiran.qqcleaner"
minSdkVersion 21
targetSdkVersion 30
- versionCode 10
- versionName "1.0"
+ versionCode 11
+ versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 220a425..5298da4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,7 +1,6 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/activity/SettingsActivity.kt b/app/src/main/java/me/kyuubiran/qqcleaner/activity/SettingsActivity.kt
index 59385fa..739ded0 100644
--- a/app/src/main/java/me/kyuubiran/qqcleaner/activity/SettingsActivity.kt
+++ b/app/src/main/java/me/kyuubiran/qqcleaner/activity/SettingsActivity.kt
@@ -3,13 +3,16 @@ package me.kyuubiran.qqcleaner.activity
import android.content.Intent
import android.net.Uri
import android.os.Bundle
+import androidx.preference.MultiSelectListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import me.kyuubiran.qqcleaner.R
+import me.kyuubiran.qqcleaner.dialog.CUSTOMER_MODE
import me.kyuubiran.qqcleaner.dialog.CleanDialog.showConfirmDialog
import me.kyuubiran.qqcleaner.dialog.FULL_MODE
import me.kyuubiran.qqcleaner.dialog.HALF_MODE
+import me.kyuubiran.qqcleaner.utils.CleanManager
import me.kyuubiran.qqcleaner.utils.qqContext
import me.kyuubiran.qqcleaner.utils.showToastBySystem
@@ -31,7 +34,8 @@ class SettingsActivity : AppCompatTransferActivity() {
private lateinit var cleanedTime: Preference
private lateinit var halfClean: Preference
private lateinit var fullClean: Preference
- private lateinit var customerClean: Preference
+ private lateinit var customerCleanList: MultiSelectListPreference
+ private lateinit var doCustomerClean: Preference
private lateinit var supportMe: Preference
private lateinit var gotoGithub: Preference
@@ -41,7 +45,8 @@ class SettingsActivity : AppCompatTransferActivity() {
cleanedTime = findPreference("CleanedTime")!!
halfClean = findPreference("HalfClean")!!
fullClean = findPreference("FullClean")!!
- customerClean = findPreference("CustomerClean")!!
+ customerCleanList = findPreference("CustomerClean")!!
+ doCustomerClean = findPreference("DoCustomerClean")!!
gotoGithub = findPreference("GotoGithub")!!
supportMe = findPreference("SupportMe")!!
init()
@@ -61,8 +66,12 @@ class SettingsActivity : AppCompatTransferActivity() {
onClickCleanFull()
true
}
- customerClean.setOnPreferenceClickListener {
- onClickCustomer()
+ customerCleanList.setOnPreferenceChangeListener { _, _ ->
+ true
+ }
+ doCustomerClean.setOnPreferenceClickListener {
+ CleanManager.customerList = customerCleanList.values
+ showConfirmDialog(CUSTOMER_MODE, this.activity!!)
true
}
gotoGithub.setOnPreferenceClickListener {
@@ -94,11 +103,6 @@ class SettingsActivity : AppCompatTransferActivity() {
showConfirmDialog(FULL_MODE, this.activity!!)
}
- private fun onClickCustomer() {
-// showCustomerDialog(this.activity!!)
- qqContext?.showToastBySystem("还在制作中> <")
- }
-
private fun toggleCleanedTimeShow() {
cleanedTime.isVisible = autoClean.isChecked
diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/dialog/CleanDialog.kt b/app/src/main/java/me/kyuubiran/qqcleaner/dialog/CleanDialog.kt
index 2f8ef51..4e8af15 100644
--- a/app/src/main/java/me/kyuubiran/qqcleaner/dialog/CleanDialog.kt
+++ b/app/src/main/java/me/kyuubiran/qqcleaner/dialog/CleanDialog.kt
@@ -6,6 +6,7 @@ import me.kyuubiran.qqcleaner.utils.CleanManager
const val HALF_MODE = 0
const val FULL_MODE = 1
+const val CUSTOMER_MODE = 2
object CleanDialog {
fun showConfirmDialog(mode: Int, context: Context) {
@@ -17,19 +18,10 @@ object CleanDialog {
when (mode) {
HALF_MODE -> CleanManager.halfClean()
FULL_MODE -> CleanManager.fullClean()
+ CUSTOMER_MODE -> CleanManager.customerClean()
}
}
.create()
.show()
}
-
- fun showCustomerDialog(context: Context) {
- AlertDialog.Builder(context)
- .setTitle("Tips")
- .setMessage("你确定要清理吗?")
- .setNegativeButton("取消") { _, _ -> }
- .setPositiveButton("确定") { _, _ -> }
- .create()
- .show()
- }
}
diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/hook/ModuleEntryHook.kt b/app/src/main/java/me/kyuubiran/qqcleaner/hook/ModuleEntryHook.kt
index 271e637..6e7854c 100644
--- a/app/src/main/java/me/kyuubiran/qqcleaner/hook/ModuleEntryHook.kt
+++ b/app/src/main/java/me/kyuubiran/qqcleaner/hook/ModuleEntryHook.kt
@@ -30,7 +30,7 @@ class ModuleEntryHook {
val vg = item?.parent as ViewGroup
vg.addView(entry, 2)
entry.setOnClickListener {
- val intent = Intent(context, SettingsActivity::class.java)
+ val intent = Intent(qqContext, SettingsActivity::class.java)
context?.startActivity(intent)
}
} catch (e: Exception) {
diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/utils/CleanManager.kt b/app/src/main/java/me/kyuubiran/qqcleaner/utils/CleanManager.kt
index 7a5399b..589ade2 100644
--- a/app/src/main/java/me/kyuubiran/qqcleaner/utils/CleanManager.kt
+++ b/app/src/main/java/me/kyuubiran/qqcleaner/utils/CleanManager.kt
@@ -4,6 +4,10 @@ import java.io.File
import kotlin.concurrent.thread
object CleanManager {
+ const val HALF_MODE = "half_mode"
+ const val FULL_MODE = "full_mode"
+ const val CUSTOMER_MODE = "customer_mode"
+
const val CACHES = "caches"
const val PICTURE = "picture"
const val SHORT_VIDEO = "short_video"
@@ -25,6 +29,8 @@ object CleanManager {
const val RECEIVE_FILE_CACHE = "receive_file_cache"
const val OTHERS = "others"
+ lateinit var customerList: Set
+
private fun getFiles(item: String): ArrayList {
val arr = ArrayList()
when (item) {
@@ -147,9 +153,20 @@ object CleanManager {
return arr
}
+ private fun getCustomerList(): ArrayList {
+ val arr = ArrayList()
+ for (s in customerList) {
+ arr.addAll(getFiles(s))
+ }
+ return arr
+ }
- fun autoClean() {
-
+ fun autoClean(mode: String) {
+ when (mode) {
+ HALF_MODE -> halfClean()
+ FULL_MODE -> fullClean()
+ CUSTOMER_MODE -> customerClean()
+ }
}
fun halfClean() {
@@ -161,10 +178,10 @@ object CleanManager {
}
fun customerClean() {
-
+ doClean(getCustomerList())
}
- fun doClean(files: ArrayList) {
+ private fun doClean(files: ArrayList) {
thread {
try {
qqContext?.showToastBySystem("好耶 开始清理了")
diff --git a/app/src/main/res/layout/settings_activity.xml b/app/src/main/res/layout/settings_activity.xml
index 625682a..e371863 100644
--- a/app/src/main/res/layout/settings_activity.xml
+++ b/app/src/main/res/layout/settings_activity.xml
@@ -1,9 +1,26 @@
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+
+
+
-
\ No newline at end of file
+
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 7760ac4..2856e4f 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -1,5 +1,17 @@
+
+ - 一键瘦身
+ - 完全瘦身
+ - 自定义瘦身
+
+
+
+ - half_mode
+ - full_mode
+ - customer_mode
+
+
- 各类缓存
- 图片
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 39f82b7..fad33ab 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -6,7 +6,9 @@
定时清理
启用定时清理
上次清理时间
+ 清理方案
还没有记录哦~
+ 三选一哦
清理缓存
一键瘦身
@@ -15,10 +17,11 @@
把QQ能清理的都给他清理了
自定义瘦身
我要自己选!
+ 执行自定义瘦身
其他
模块版本
- 1.0
+ 1.1
点我前往项目地址
模块作者:KyuubiRan
扶贫
diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml
index 44790ac..2662a22 100644
--- a/app/src/main/res/xml/root_preferences.xml
+++ b/app/src/main/res/xml/root_preferences.xml
@@ -5,6 +5,11 @@
+
-
+