Skip to content

Commit

Permalink
Bugfix && Add more clean path
Browse files Browse the repository at this point in the history
  • Loading branch information
KyuubiRan committed Nov 20, 2020
1 parent 1f9a63d commit 242efe1
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 43 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "me.kyuubiran.qqcleaner"
minSdkVersion 21
targetSdkVersion 30
versionCode 15
versionName "1.2.3"
versionCode 16
versionName "1.2.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,18 @@ class SettingsActivity : AppCompatTransferActivity() {
}

private fun toggleCleanedTimeShow() {
val currentCleanedTime = getLong(CFG_CURRENT_CLEANED_TIME)
setConfig(CFG_AUTO_CLEAN_ENABLED, autoClean.isChecked)
if (getLong(CFG_CURRENT_CLEANED_TIME).toString() == "null" ||
getLong(CFG_CURRENT_CLEANED_TIME) == 0L
) {
if (currentCleanedTime == 0L) {
cleanedTime.setSummary(R.string.no_cleaned_his_hint)
} else {
val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
cleanedTime.summary = format.format(getLong(CFG_CURRENT_CLEANED_TIME))
try {
val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
cleanedTime.summary = format.format(currentCleanedTime)
} catch (e: Exception) {
loge(e)
cleanedTime.summary = "喵喵喵"
}
}
cleanedTime.isVisible = autoClean.isChecked
autoCleanMode.isVisible = autoClean.isChecked
Expand All @@ -159,7 +163,7 @@ class SettingsActivity : AppCompatTransferActivity() {
private fun setHistorySummary() {
if (getConfig(CFG_TOTAL_CLEANED_SIZE) != 0) {
cleanedHistory.summary =
"总共为您腾出:${getLong(CFG_TOTAL_CLEANED_SIZE)?.let { it2 -> formatSize(it2) }}空间"
"总共为您腾出:${formatSize(getLong(CFG_TOTAL_CLEANED_SIZE))}空间"
} else {
cleanedHistory.setSummary(R.string.no_cleaned_his_hint)
}
Expand Down
70 changes: 42 additions & 28 deletions app/src/main/java/me/kyuubiran/qqcleaner/utils/CleanManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ object CleanManager {
when (item) {
CACHES -> {
arr.add(File("$rootDataDir/cache"))
arr.add(File("$MobileQQ/diskcache"))
arr.add(File("$MobileQQ/Scribble/ScribbleCache"))
arr.add(File("$MobileQQDir/diskcache"))
arr.add(File("$MobileQQDir/Scribble/ScribbleCache"))
}
PICTURE -> {
arr.add(File("$MobileQQ/photo"))
arr.add(File("$MobileQQ/chatpic"))
arr.add(File("$MobileQQ/thumb"))
arr.add(File("$MobileQQDir/photo"))
arr.add(File("$MobileQQDir/chatpic"))
arr.add(File("$MobileQQDir/thumb"))
arr.add(File("$QQ_Images/QQEditPic"))
arr.add(File("$MobileQQ/hotpic"))
arr.add(File("$MobileQQDir/hotpic"))
}
SHORT_VIDEO -> {
arr.add(File("$TencentDir/shortvideo"))
arr.add(File("$MobileQQDir/shortvideo"))
}
ADS -> {
arr.add(File("$MobileQQ/qbosssplahAD"))
arr.add(File("$MobileQQ/pddata"))
arr.add(File("$MobileQQDir/qbosssplahAD"))
arr.add(File("$MobileQQDir/pddata"))
}
ARK_APP -> {
arr.add(File("$TencentDir/mini"))
Expand All @@ -69,64 +69,78 @@ object CleanManager {
arr.add(File("$rootTencentDir/msflogs/com/tencent/mobileqq"))
}
DIY_CARD -> {
arr.add(File("$MobileQQ/.apollo"))
arr.add(File("$MobileQQDir/.apollo"))
}
FONT -> {
arr.add(File("$MobileQQ/.font_info"))
arr.add(File("$MobileQQ/.hiboom_font"))
arr.add(File("$MobileQQDir/.font_info"))
arr.add(File("$MobileQQDir/.hiboom_font"))
}
GIFT -> {
arr.add(File("$MobileQQ/.gift"))
arr.add(File("$MobileQQDir/.gift"))
}
ENTRY_EFFECT -> {
arr.add(File("$MobileQQ/.troop/enter_effects"))
arr.add(File("$MobileQQDir/.troop/enter_effects"))
}
USER_ICON -> {
arr.add(File("$MobileQQ/head"))
arr.add(File("$MobileQQDir/head"))
}
ICON_PENDANT -> {
arr.add(File("$MobileQQ/.pendant"))
arr.add(File("$MobileQQDir/.pendant"))
}
USER_BACKGROUND -> {
arr.add(File("$MobileQQ/.profilecard"))
arr.add(File("$MobileQQDir/.profilecard"))
}
STICKER_RECOMMEND -> {
arr.add(File("$MobileQQ/.sticker_recommended_pics"))
arr.add(File("$MobileQQ/pe"))
arr.add(File("$MobileQQDir/.sticker_recommended_pics"))
arr.add(File("$MobileQQDir/pe"))
}
POKE -> {
arr.add(File("$MobileQQ/.vaspoke"))
arr.add(File("$MobileQQ/newpoke"))
arr.add(File("$MobileQQ/poke"))
arr.add(File("$MobileQQDir/.vaspoke"))
arr.add(File("$MobileQQDir/newpoke"))
arr.add(File("$MobileQQDir/poke"))
}
VIP_ICON -> {
arr.add(File("$MobileQQ/.vipicon"))
arr.add(File("$MobileQQDir/.vipicon"))
}
DOU_TU -> {
arr.add(File("$MobileQQ/DoutuRes"))
arr.add(File("$MobileQQDir/DoutuRes"))
}
VIDEO_BACKGROUND -> {
arr.add(File("$MobileQQ/funcall"))
arr.add(File("$MobileQQDir/funcall"))
}
RECEIVE_FILE_CACHE -> {
arr.add(File("$QQfile_recv/trooptmp"))
arr.add(File("$QQfile_recv/tmp"))
arr.add(File("$QQfile_recv/thumbnails"))
}
OTHERS -> {
arr.add(File("$MobileQQ/qav"))
arr.add(File("$MobileQQ/qqmusic"))
arr.add(File("$MobileQQDir/qav"))
arr.add(File("$MobileQQDir/qqmusic"))
arr.add(File("$TencentDir/TMAssistantSDK"))
}
}
return arr
}

// storage/emulated/0/Android/data/com.tencent.mobileqq
private var rootDataDir: String? = qqContext?.externalCacheDir?.parentFile?.path

// storage/emulated/0/
private var rootDir: String? = qqContext?.obbDir?.parentFile?.parentFile?.parentFile?.path

// storage/emulated/0/tencent
private var rootTencentDir = "$rootDir/tencent"

// storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent
private var TencentDir = "$rootDataDir/Tencent"
private var MobileQQ = "$TencentDir/MobileQQ"

// storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/MobileQQ
private var MobileQQDir = "$TencentDir/MobileQQ"

// storage/emulated/0/Android/data/com.tencent.mobileqq/QQ_Images
private var QQ_Images = "$rootDataDir/QQ_Images"

// storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/QQfile_recv
private var QQfile_recv = "$TencentDir/QQfile_recv"

private fun getHalfList(): ArrayList<File> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ object ConfigManager {
return getConfig()?.get(key)
}

fun getLong(key: String): Long? {
return getConfig()?.getLong(key)
fun getLong(key: String): Long {
return getConfig()?.getLong(key) ?: 0L
}

fun <T> setConfig(key: String, value: T) {
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">QQ瘦身</string>
<string name="version_name">1.2.3</string>
<string name="version_name">1.2.4</string>
<string name="title_activity_settings">QQ瘦身</string>
<string name="res_inject_success">注入资源成功</string>

Expand Down Expand Up @@ -33,10 +33,11 @@
<string name="support_me">点我扶贫</string>
<string name="support_me_hint">本模块完全免费开源 一切开发旨在学习 请勿用于非法用途 喜欢本模块的可以捐赠支持我 谢谢~</string>
<string name="about">公告</string>
<string name="about_hint">注意:本模块不会清理聊天记录以及接收文件等重要东西\n
<string name="about_hint">注意:本模块不会清理聊天记录、接收文件、保存的图片、表情收藏等重要东西\n
[更新日志]\n
-1.2.3\n
1.修改提示\n
2.修复Bug
-1.2.4\n
1.修复:短视频目录不正确\n
2.可能修复:打开模块设置界面导致QQ闪退\n
3.添加一个其他目录
</string>
</resources>

0 comments on commit 242efe1

Please sign in to comment.