cleanup: 移除冗余依赖、死代码和构建配置
- core: 移除未使用的 uiTooling/uiToolingPreview debug 依赖 - app: 删除冗余 ndk abiFilters、bundle.language、netty pickFirsts - app: 修复 packaging.excludes 花括号展开语法 - Platform: 删除死代码 AppPredictiveBackHandler 及未使用 import - CalendarMonthView: 删除重复 import animateFloatAsState Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
57eae41c65
commit
5bac114c16
@ -30,9 +30,6 @@ android {
|
||||
versionCode = 1
|
||||
versionName = appVersionName
|
||||
|
||||
ndk {
|
||||
abiFilters += listOf("arm64-v8a", "armeabi-v7a")
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@ -68,22 +65,18 @@ android {
|
||||
packaging {
|
||||
resources {
|
||||
excludes += listOf(
|
||||
"/META-INF/{AL2.0,LGPL2.1}",
|
||||
"/META-INF/AL2.0",
|
||||
"/META-INF/LGPL2.1",
|
||||
"/META-INF/LICENSE*",
|
||||
"/META-INF/NOTICE*",
|
||||
"META-INF/DEPENDENCIES",
|
||||
"**/*.kotlin_metadata",
|
||||
"**/*.kotlin_module",
|
||||
)
|
||||
pickFirsts += listOf(
|
||||
"META-INF/INDEX.LIST",
|
||||
"META-INF/io.netty.versions.properties",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
bundle {
|
||||
language { enableSplit = true }
|
||||
density { enableSplit = true }
|
||||
abi { enableSplit = true }
|
||||
}
|
||||
|
||||
@ -49,8 +49,6 @@ dependencies {
|
||||
implementation(libs.compose.animation)
|
||||
implementation(libs.compose.material3)
|
||||
implementation(libs.compose.ui)
|
||||
debugImplementation(libs.compose.uiToolingPreview)
|
||||
debugImplementation(libs.compose.uiTooling)
|
||||
|
||||
implementation(libs.kotlinx.datetime)
|
||||
implementation(libs.tyme4kt)
|
||||
|
||||
@ -1,13 +1,8 @@
|
||||
package plus.rua.project
|
||||
|
||||
import android.os.Build
|
||||
import androidx.activity.BackEventCompat
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.activity.compose.PredictiveBackHandler
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
/**
|
||||
* 获取 WebP 动画资源的 URI。
|
||||
@ -37,36 +32,3 @@ fun getAppVersion(): String {
|
||||
"unknown"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 预测性返回手势处理器(Android 13+)。
|
||||
*
|
||||
* @param enabled 是否启用
|
||||
* @param onProgress 手势进度回调(0.0~1.0),跟手过程中持续调用
|
||||
* @param onBack 手势完成回调(滑动距离足够,执行返回)
|
||||
* @param onCancel 手势取消回调(滑动距离不足,回弹)
|
||||
*/
|
||||
@Composable
|
||||
fun AppPredictiveBackHandler(
|
||||
enabled: Boolean = true,
|
||||
onProgress: (Float) -> Unit = {},
|
||||
onBack: () -> Unit,
|
||||
onCancel: () -> Unit = {}
|
||||
) {
|
||||
// 官方 PredictiveBackHandler — Flow 模式:collect 完成=返回,CancellationException=取消
|
||||
PredictiveBackHandler(enabled = enabled) { progress: Flow<BackEventCompat> ->
|
||||
try {
|
||||
progress.collect { event ->
|
||||
onProgress(event.progress)
|
||||
}
|
||||
onBack()
|
||||
} catch (e: CancellationException) {
|
||||
onCancel()
|
||||
}
|
||||
}
|
||||
|
||||
// 降级:部分设备(如 OPPO/ColorOS)不通过 OnBackInvokedCallback 分发返回事件
|
||||
BackHandler(enabled = enabled) {
|
||||
onBack()
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ import androidx.compose.animation.scaleOut
|
||||
import androidx.compose.animation.slideInVertically
|
||||
import androidx.compose.animation.slideOutVertically
|
||||
import androidx.compose.animation.togetherWith
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.ui.graphics.TransformOrigin
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.background
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user