From 7ef51b79bbc8a41628a310f6d32bae3914e122a0 Mon Sep 17 00:00:00 2001 From: Kitsune Date: Mon, 28 Feb 2022 15:48:39 +0800 Subject: [PATCH] Pre-release --- app/build.gradle.kts | 4 +- app/src/main/assets/qq.json | 24 +++++++ .../me/kyuubiran/qqcleaner/ui/QQCleanerApp.kt | 12 ++-- .../qqcleaner/ui/composable/Switch.kt | 1 - .../ui/composable/dialog/ConfigAddDialog.kt | 17 ++--- .../ui/composable/dialog/ConfigDialog.kt | 19 +++--- .../ui/composable/dialog/SortAddDialog.kt | 7 +- .../ui/composable/dialog/SortDialog.kt | 22 +++++-- .../qqcleaner/ui/scene/AboutScreen.kt | 2 +- .../qqcleaner/ui/scene/ConfigScreen.kt | 5 +- .../qqcleaner/ui/scene/SortFixScreen.kt | 9 ++- .../qqcleaner/ui/scene/SortScreen.kt | 64 +++++++++---------- .../kyuubiran/qqcleaner/util/CleanManager.kt | 10 +-- app/src/main/res/values/strings.xml | 9 ++- 14 files changed, 120 insertions(+), 85 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 4484b41..c5c26fb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,8 +11,8 @@ android { applicationId = "me.kyuubiran.qqcleaner" minSdk = 26 targetSdk = 32 - versionCode = 66 - versionName = "2.0.0-beta4" + versionCode = 67 + versionName = "2.0.0 pre-release" vectorDrawables { useSupportLibrary = true } diff --git a/app/src/main/assets/qq.json b/app/src/main/assets/qq.json index 2a1edc2..86cc224 100644 --- a/app/src/main/assets/qq.json +++ b/app/src/main/assets/qq.json @@ -309,6 +309,30 @@ "suffix": "/TMAssistantSDK" } ] + }, + { + "title": "虚幻引擎", + "enable": false, + "path": [ + { + "prefix": "!PublicDataDir", + "suffix": "/files/UE4Game" + } + ] + }, + { + "title": "超级QQ秀", + "enable": false, + "path": [ + { + "prefix": "!PublicDataDir", + "suffix": "/files/QQShowDownload" + }, + { + "prefix": "!PublicDataDir", + "suffix": "/files/zootopia_download" + } + ] } ] } \ No newline at end of file diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/QQCleanerApp.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/QQCleanerApp.kt index 30d56b3..9e2a7f7 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/QQCleanerApp.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/QQCleanerApp.kt @@ -11,7 +11,6 @@ import me.kyuubiran.qqcleaner.ui.QQCleanerApp.Config import me.kyuubiran.qqcleaner.ui.QQCleanerApp.Developer import me.kyuubiran.qqcleaner.ui.QQCleanerApp.Main import me.kyuubiran.qqcleaner.ui.QQCleanerApp.Sort -import me.kyuubiran.qqcleaner.ui.QQCleanerApp.SortFix import me.kyuubiran.qqcleaner.ui.scene.* /** @@ -34,13 +33,18 @@ fun QQCleanerApp() { composable(Config) { ConfigScreen(navController = navController) + navController.addOnDestinationChangedListener { _, destination, _ -> + if (destination.route == Config) { + + } + } } composable(Sort) { SortScreen(navController = navController) } - composable(SortFix) { - SortFixScreen(navController = navController) - } +// composable(SortFix) { +// SortFixScreen(navController = navController) +// } composable(About) { diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/Switch.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/Switch.kt index 0c30254..f9bbaf6 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/Switch.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/Switch.kt @@ -69,7 +69,6 @@ fun Switch( // 通过 Boolean 反向给按钮赋值 LaunchedEffect(checked.value) { swipeableState.animateTo(if (checked.value) 1 else 0) - } // 按钮的宽高 diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/ConfigAddDialog.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/ConfigAddDialog.kt index 9eae2b8..84a839a 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/ConfigAddDialog.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/ConfigAddDialog.kt @@ -38,7 +38,7 @@ fun ConfigAddDialog( val state = remember { mutableStateOf(true) } BottomDialog( onDismissRequest = onDismissRequest, - dialogHeight = if (list.isEmpty()) 408f else 352f, + dialogHeight = if (list.isEmpty()) /* 408f else 352f */ 352f else 296f, dialogText = stringResource(id = dialog_title_config), state = state ) { @@ -78,13 +78,14 @@ fun ConfigAddDialog( state.value = false } ) - ConfigItem( - id = R.drawable.ic_add, - text = stringResource(id = R.string.create_config), - onClick = { - state.value = false - } - ) +// ConfigItem( +// id = R.drawable.ic_add, +// text = stringResource(id = R.string.create_config), +// onClick = { +// //TODO("新建配置") +// state.value = false +// } +// ) if (list.isEmpty()) { ConfigItem( id = R.drawable.ic_default, diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/ConfigDialog.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/ConfigDialog.kt index a52fceb..5ea58c8 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/ConfigDialog.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/ConfigDialog.kt @@ -52,8 +52,8 @@ fun ConfigDialog( EditDialog( onDismissRequest = onDismissRequest, dialogHeight = when (isDialogScreen.value) { - Main -> 520f - Edit -> 312f + Main -> /* 520f */ 464f + Edit -> /* 312f */ 256f Del -> 219f }, dialogText = when (isDialogScreen.value) { @@ -195,13 +195,14 @@ private fun ConfigUI( ) } ) - ConfigItem( - id = R.drawable.ic_edit_name, - text = stringResource(id = modify_config_name), - onClick = { - screen.value = Edit - } - ) +// ConfigItem( +// id = R.drawable.ic_edit_name, +// text = stringResource(id = modify_config_name), +// onClick = { +// //TODO("修改配置名称、作者") +// screen.value = Edit +// } +// ) ConfigItem( id = R.drawable.ic_save, text = stringResource(id = export_this_config), diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/SortAddDialog.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/SortAddDialog.kt index 4c55e4f..51c4797 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/SortAddDialog.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/SortAddDialog.kt @@ -20,14 +20,15 @@ import me.kyuubiran.qqcleaner.ui.util.hideKeyBoard @Composable fun SortAddDialog( - onDismissRequest: () -> Unit + isNew: Boolean = false, + onDismissRequest: () -> Unit = {}, ) { val state = remember { mutableStateOf(true) } val isSoftShowing = remember { mutableStateOf(true) } EditDialog( onDismissRequest = onDismissRequest, dialogHeight = 240f, - dialogText = stringResource(id = R.string.dialog_title_edit_config), + dialogText = stringResource(id = if (isNew) R.string.dialog_title_new_path else R.string.dialog_title_change_path_name), isSoftShowing = isSoftShowing, state = state ) { @@ -59,7 +60,7 @@ fun SortAddDialog( } false }, - hintText = "配置名称" + hintText = stringResource(id = R.string.path_name) ) // 判断是否为空,为空的时候无法点击不为空的时候,可以点击 diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/SortDialog.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/SortDialog.kt index 3302e57..cdccc06 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/SortDialog.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/composable/dialog/SortDialog.kt @@ -19,6 +19,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.navigation.NavController import me.kyuubiran.qqcleaner.R +import me.kyuubiran.qqcleaner.data.CleanData import me.kyuubiran.qqcleaner.ui.QQCleanerApp import me.kyuubiran.qqcleaner.ui.composable.EditText import me.kyuubiran.qqcleaner.ui.composable.Line @@ -26,6 +27,7 @@ import me.kyuubiran.qqcleaner.ui.composable.dialog.SortDialogScreen.* import me.kyuubiran.qqcleaner.ui.theme.QQCleanerColorTheme.colors import me.kyuubiran.qqcleaner.ui.theme.QQCleanerTypes import me.kyuubiran.qqcleaner.ui.util.RippleCustomTheme +import me.kyuubiran.qqcleaner.ui.util.Shared import me.kyuubiran.qqcleaner.ui.util.hideKeyBoard private enum class SortDialogScreen { @@ -37,6 +39,7 @@ private enum class SortDialogScreen { @Composable fun SortDialog( navController: NavController, + data: CleanData.PathData, onDismissRequest: () -> Unit ) { val state = remember { mutableStateOf(true) } @@ -50,8 +53,8 @@ fun SortDialog( Del -> 219f }, dialogText = when (isDialogScreen.value) { - Main -> "名字" - Edit -> stringResource(id = R.string.dialog_title_edit_config) + Main -> data.title + Edit -> stringResource(id = R.string.dialog_title_edit_path) Del -> stringResource(id = R.string.dialog_del_title) }, isSoftShowing = isSoftShowing, @@ -63,6 +66,7 @@ fun SortDialog( Main -> ConfigUI( state = state, navController = navController, + data = data, screen = isDialogScreen ) Edit -> EditUI( @@ -83,7 +87,8 @@ fun SortDialog( private fun ConfigUI( state: MutableState, navController: NavController, - screen: MutableState + screen: MutableState, + data: CleanData.PathData ) { Column { // 线条绘制 @@ -95,8 +100,9 @@ private fun ConfigUI( ) ConfigItem( id = R.drawable.ic_edit, - text = stringResource(id = R.string.modify_config), + text = stringResource(id = R.string.dialog_title_edit_path), onClick = { + Shared.currentEditCleanPathData = data state.value = false navController.navigate( QQCleanerApp.SortFix, @@ -105,8 +111,9 @@ private fun ConfigUI( ) ConfigItem( id = R.drawable.ic_edit_name, - text = stringResource(id = R.string.modify_config_name), + text = stringResource(id = R.string.dialog_title_change_path_name), onClick = { + //TODO("修改路径类别名字") screen.value = Edit } ) @@ -155,7 +162,7 @@ private fun EditUI( } false }, - hintText = "配置名称" + hintText = stringResource(id = R.string.path_name) ) // 判断是否为空,为空的时候无法点击不为空的时候,可以点击 @@ -182,7 +189,8 @@ private fun DelUI( end = 24.dp, bottom = 24.dp ), - text = "您确定要删除「」吗?", + //TODO("路径名称") + text = stringResource(id = R.string.confirm_delete, "config"), style = QQCleanerTypes.itemTextStyle, color = colors.secondTextColor ) diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/AboutScreen.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/AboutScreen.kt index 72e850d..8046436 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/AboutScreen.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/AboutScreen.kt @@ -72,7 +72,7 @@ fun AboutScreen(navController: NavController) { color = colors.firstTextColor ) Text( - text = "ver.${BuildConfig.VERSION_NAME}(${BuildConfig.VERSION_CODE})", + text = "Ver. ${BuildConfig.VERSION_NAME}(${BuildConfig.VERSION_CODE})", modifier = Modifier .padding(top = 18.dp) .align(Alignment.CenterHorizontally), diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/ConfigScreen.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/ConfigScreen.kt index 80e6117..3b934eb 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/ConfigScreen.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/ConfigScreen.kt @@ -38,12 +38,9 @@ import me.kyuubiran.qqcleaner.util.rememberMutableStateOf */ @Composable fun ConfigScreen(navController: NavController) { - // 配置文件列表 val cfgList = remember { - mutableStateListOf().apply { - addAll(CleanManager.getAllConfigs()) - } + mutableStateListOf(*CleanManager.getAllConfigs()) } // 新建配置对话框 diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/SortFixScreen.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/SortFixScreen.kt index b7291c4..815d3f8 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/SortFixScreen.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/SortFixScreen.kt @@ -33,7 +33,6 @@ import me.kyuubiran.qqcleaner.ui.util.Shared */ @Composable fun SortFixScreen(navController: NavController) { - var fileDialogShow by remember { mutableStateOf(false) } if (fileDialogShow) { FileDialog { @@ -65,8 +64,8 @@ fun SortFixScreen(navController: NavController) { titleText = Shared.currentEditCleanData.title, id = R.drawable.ic_save ) - // 这里判断是否为空 - if (true) { + + if (Shared.currentEditCleanPathData.pathList.isNotEmpty()) { LazyColumn( modifier = Modifier .padding(top = 24.dp) @@ -76,9 +75,9 @@ fun SortFixScreen(navController: NavController) { shape = QQCleanerShapes.cardGroupBackground ) ) { - items(2) { item -> + items(Shared.currentEditCleanPathData.pathList.size) { item -> FileItem( - text = "这个是第{$item}个,啦啦啦啦啦啦", + text = "这个是第${item}个,啦啦啦啦啦啦", onClick = { fileDialogShow = true } diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/SortScreen.kt b/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/SortScreen.kt index 487a026..27c1eab 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/SortScreen.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/ui/scene/SortScreen.kt @@ -7,7 +7,7 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.Text -import androidx.compose.runtime.* +import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -22,12 +22,9 @@ import me.kyuubiran.qqcleaner.QQCleanerData import me.kyuubiran.qqcleaner.QQCleanerData.statusBarHeight import me.kyuubiran.qqcleaner.R import me.kyuubiran.qqcleaner.data.CleanData -import me.kyuubiran.qqcleaner.ui.composable.Fab import me.kyuubiran.qqcleaner.ui.composable.Switch import me.kyuubiran.qqcleaner.ui.composable.SwitchItem import me.kyuubiran.qqcleaner.ui.composable.TopBar -import me.kyuubiran.qqcleaner.ui.composable.dialog.SortAddDialog -import me.kyuubiran.qqcleaner.ui.composable.dialog.SortDialog import me.kyuubiran.qqcleaner.ui.theme.QQCleanerColorTheme.colors import me.kyuubiran.qqcleaner.ui.theme.QQCleanerShapes.cardGroupBackground import me.kyuubiran.qqcleaner.ui.theme.QQCleanerTypes @@ -40,22 +37,10 @@ import me.kyuubiran.qqcleaner.util.rememberMutableStateOf @Composable fun SortScreen(navController: NavController) { val enable = rememberMutableStateOf(Shared.currentEditCleanData.enable) - - var sortDialogShow by remember { mutableStateOf(false) } - if (sortDialogShow) { - SortDialog( - navController = navController, - ) { - sortDialogShow = false - } - } - - var sortAddDialogShow by remember { mutableStateOf(false) } - if (sortAddDialogShow) { - SortAddDialog { - sortDialogShow = false - } - } +// var sortAddDialogShow by remember { mutableStateOf(false) } +// if (sortAddDialogShow) { +// SortAddDialog() +// } Box( modifier = Modifier @@ -66,6 +51,7 @@ fun SortScreen(navController: NavController) { Column { TopBar( backClick = { + //TODO("切换配置文件开关 外层状态并不会更新") navController.popBackStack() }, iconClick = { @@ -93,14 +79,15 @@ fun SortScreen(navController: NavController) { shape = cardGroupBackground ) ) { - - Row( modifier = Modifier .fillMaxWidth() .height(56.dp) .clip(cardGroupBackground) - .clickable { enable.value = !enable.value } + .clickable { + enable.value = !enable.value + Shared.currentEditCleanData.enable = enable.value + } .padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically ) { @@ -133,8 +120,18 @@ fun SortScreen(navController: NavController) { ) ) { items(Shared.currentEditCleanData.content) { item -> +// var sortDialogShow by remember { mutableStateOf(false) } +// if (sortDialogShow) { +// SortDialog( +// navController = navController, +// data = item, +// ) { +// sortDialogShow = false +// } +// } + SortItem(data = item, onLongClick = { - sortDialogShow = true +// sortDialogShow = true }) } } @@ -151,7 +148,6 @@ fun SortScreen(navController: NavController) { verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { - Image( painter = if (QQCleanerData.isDark) @@ -164,7 +160,7 @@ fun SortScreen(navController: NavController) { modifier = Modifier.size(96.dp) ) Text( - text = stringResource(id = R.string.add_sort), + text = stringResource(id = R.string.empty), style = QQCleanerTypes.EmptyTipStyle, color = colors.thirdTextColor, textAlign = TextAlign.Center, @@ -174,14 +170,14 @@ fun SortScreen(navController: NavController) { } } - Fab( - modifier = Modifier - .align(Alignment.BottomCenter), - text = stringResource(id = R.string.add_sort), - onClick = { - sortAddDialogShow = true - } - ) +// Fab( +// modifier = Modifier +// .align(Alignment.BottomCenter), +// text = stringResource(id = R.string.add_sort), +// onClick = { +// sortAddDialogShow = true +// } +// ) } } diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/util/CleanManager.kt b/app/src/main/java/me/kyuubiran/qqcleaner/util/CleanManager.kt index c866ba5..c3d10a7 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/util/CleanManager.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/util/CleanManager.kt @@ -41,11 +41,11 @@ object CleanManager { if (showToast) Log.toast(moduleRes.getString(R.string.clean_start)) getAllConfigsAsync { if (it.isEmpty() || it.all { c -> !c.enable }) { - Log.toast(moduleRes.getString(R.string.no_config_enabled)) - return@getAllConfigsAsync - } - it.forEach { data -> - execute(data, showToast) + if (showToast) Log.toast(moduleRes.getString(R.string.no_config_enabled)) + } else { + it.forEach { data -> + execute(data, showToast) + } } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5968456..59f4f1e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -30,8 +30,6 @@ 添加类别 新建配置 启用配置 - 添加路径 - 修改信息 选择本地文件 导入默认配置 已导入默认配置 @@ -88,6 +86,13 @@ 前往Github浏览项目 Telegram 频道 Telegram 聊天群组 + 添加路径类别 + 编辑路径类别内容 + 修改路径类别名称 + 路径类别名称 + 您确定要删除「%s」吗? + + 空空如也~