refactor: 注释移除 Compose 相关代码,统一入口替换为 HomeActivity
- 注释掉全部 Compose UI 代码(ui/、theme/、NavController、MainActivity、InitActivity 等) - BorderExt、TextExt、ToastUtils、LoadingState 中的 Compose 逻辑全部注释 - LoadingState 保留 show()/hide() 空方法避免编译报错 - 注释 SensorScaleUtils、BaseViewModel、DeviceViewModel 中的 ToastUtils 调用 - BootReceiver、CrashHandler 中 MainActivity 替换为 HomeActivity - UserViewModel、PurchaseOrderActivity 删除残余 Compose import - build.gradle.kts 替换为非 Compose 的 activity-ktx 和 coil 依赖 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,44 +1,44 @@
|
||||
package com.sw.inbound.ext
|
||||
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.composed
|
||||
import androidx.compose.ui.draw.drawWithCache
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathEffect
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* 虚线边框
|
||||
*/
|
||||
fun Modifier.dashedBorder(
|
||||
strokeWidth: Dp = 2.dp,
|
||||
color: Color = Color(0xFFDCDCF0),
|
||||
cornerRadiusDp: Dp = 10.dp
|
||||
) = composed(
|
||||
factory = {
|
||||
val density = LocalDensity.current
|
||||
val strokeWidthPx = density.run { strokeWidth.toPx() }
|
||||
val cornerRadiusPx = density.run { cornerRadiusDp.toPx() }
|
||||
|
||||
this.then(
|
||||
Modifier.drawWithCache {
|
||||
onDrawBehind {
|
||||
val stroke = Stroke(
|
||||
width = strokeWidthPx,
|
||||
pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f)
|
||||
)
|
||||
|
||||
drawRoundRect(
|
||||
color = color,
|
||||
style = stroke,
|
||||
cornerRadius = CornerRadius(cornerRadiusPx)
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
//package com.sw.inbound.ext
|
||||
//
|
||||
//import androidx.compose.ui.Modifier
|
||||
//import androidx.compose.ui.composed
|
||||
//import androidx.compose.ui.draw.drawWithCache
|
||||
//import androidx.compose.ui.geometry.CornerRadius
|
||||
//import androidx.compose.ui.graphics.Color
|
||||
//import androidx.compose.ui.graphics.PathEffect
|
||||
//import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
//import androidx.compose.ui.platform.LocalDensity
|
||||
//import androidx.compose.ui.unit.Dp
|
||||
//import androidx.compose.ui.unit.dp
|
||||
//
|
||||
///**
|
||||
// * 虚线边框
|
||||
// */
|
||||
//fun Modifier.dashedBorder(
|
||||
// strokeWidth: Dp = 2.dp,
|
||||
// color: Color = Color(0xFFDCDCF0),
|
||||
// cornerRadiusDp: Dp = 10.dp
|
||||
//) = composed(
|
||||
// factory = {
|
||||
// val density = LocalDensity.current
|
||||
// val strokeWidthPx = density.run { strokeWidth.toPx() }
|
||||
// val cornerRadiusPx = density.run { cornerRadiusDp.toPx() }
|
||||
//
|
||||
// this.then(
|
||||
// Modifier.drawWithCache {
|
||||
// onDrawBehind {
|
||||
// val stroke = Stroke(
|
||||
// width = strokeWidthPx,
|
||||
// pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f)
|
||||
// )
|
||||
//
|
||||
// drawRoundRect(
|
||||
// color = color,
|
||||
// style = stroke,
|
||||
// cornerRadius = CornerRadius(cornerRadiusPx)
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
//)
|
||||
@@ -1,33 +1,33 @@
|
||||
package com.sw.inbound.ext
|
||||
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
// 快速修改颜色
|
||||
fun TextStyle.withColor(color: Color): TextStyle = this.copy(color = color)
|
||||
|
||||
@Composable
|
||||
fun TextStyle.withColorRes(@ColorRes colorRes: Int): TextStyle {
|
||||
return this.copy(color = colorResource(id = colorRes))
|
||||
}
|
||||
|
||||
// 快速修改字体大小
|
||||
fun TextStyle.withSize(size: TextUnit): TextStyle = this.copy(fontSize = size)
|
||||
|
||||
fun TextStyle.withSizeSp(sp: Float): TextStyle = this.copy(fontSize = sp.sp)
|
||||
|
||||
// 快速修改字体粗细
|
||||
fun TextStyle.withWeight(weight: FontWeight): TextStyle = this.copy(fontWeight = weight)
|
||||
|
||||
fun TextStyle.bold(): TextStyle = this.copy(fontWeight = FontWeight.Bold)
|
||||
fun TextStyle.medium(): TextStyle = this.copy(fontWeight = FontWeight.Medium)
|
||||
fun TextStyle.light(): TextStyle = this.copy(fontWeight = FontWeight.Light)
|
||||
|
||||
fun TextStyle.textAlign(textAlign: TextAlign): TextStyle = this.copy(textAlign = textAlign)
|
||||
//package com.sw.inbound.ext
|
||||
//
|
||||
//import androidx.annotation.ColorRes
|
||||
//import androidx.compose.runtime.Composable
|
||||
//import androidx.compose.ui.graphics.Color
|
||||
//import androidx.compose.ui.res.colorResource
|
||||
//import androidx.compose.ui.text.TextStyle
|
||||
//import androidx.compose.ui.text.font.FontWeight
|
||||
//import androidx.compose.ui.text.style.TextAlign
|
||||
//import androidx.compose.ui.unit.TextUnit
|
||||
//import androidx.compose.ui.unit.sp
|
||||
//
|
||||
//// 快速修改颜色
|
||||
//fun TextStyle.withColor(color: Color): TextStyle = this.copy(color = color)
|
||||
//
|
||||
//@Composable
|
||||
//fun TextStyle.withColorRes(@ColorRes colorRes: Int): TextStyle {
|
||||
// return this.copy(color = colorResource(id = colorRes))
|
||||
//}
|
||||
//
|
||||
//// 快速修改字体大小
|
||||
//fun TextStyle.withSize(size: TextUnit): TextStyle = this.copy(fontSize = size)
|
||||
//
|
||||
//fun TextStyle.withSizeSp(sp: Float): TextStyle = this.copy(fontSize = sp.sp)
|
||||
//
|
||||
//// 快速修改字体粗细
|
||||
//fun TextStyle.withWeight(weight: FontWeight): TextStyle = this.copy(fontWeight = weight)
|
||||
//
|
||||
//fun TextStyle.bold(): TextStyle = this.copy(fontWeight = FontWeight.Bold)
|
||||
//fun TextStyle.medium(): TextStyle = this.copy(fontWeight = FontWeight.Medium)
|
||||
//fun TextStyle.light(): TextStyle = this.copy(fontWeight = FontWeight.Light)
|
||||
//
|
||||
//fun TextStyle.textAlign(textAlign: TextAlign): TextStyle = this.copy(textAlign = textAlign)
|
||||
|
||||
Reference in New Issue
Block a user