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,56 +1,56 @@
|
||||
package com.sw.inbound.utils
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
object ToastUtils {
|
||||
private var show by mutableStateOf(false)
|
||||
private var message by mutableStateOf("")
|
||||
|
||||
fun showToast(msg: String) {
|
||||
message = msg
|
||||
show = true
|
||||
// Toast.makeText(ContextUtils.getAppContext(), msg, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ToastComposable() {
|
||||
if (show) {
|
||||
LaunchedEffect(Unit) {
|
||||
delay(2000) // 自动2秒后消失
|
||||
show = false
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
// .fillMaxWidth()
|
||||
.fillMaxSize()
|
||||
.padding(bottom = 156.dp),
|
||||
contentAlignment = Alignment.BottomCenter
|
||||
) {
|
||||
Text(
|
||||
text = message,
|
||||
modifier = Modifier
|
||||
.background(Color.Black.copy(alpha = 0.7f), RoundedCornerShape(8.dp))
|
||||
.padding(horizontal = 24.dp, vertical = 12.dp),
|
||||
color = Color.White,
|
||||
fontSize = 24.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.sw.inbound.utils
|
||||
//
|
||||
//import androidx.compose.foundation.background
|
||||
//import androidx.compose.foundation.layout.Box
|
||||
//import androidx.compose.foundation.layout.fillMaxSize
|
||||
//import androidx.compose.foundation.layout.padding
|
||||
//import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
//import androidx.compose.material3.Text
|
||||
//import androidx.compose.runtime.Composable
|
||||
//import androidx.compose.runtime.LaunchedEffect
|
||||
//import androidx.compose.runtime.getValue
|
||||
//import androidx.compose.runtime.mutableStateOf
|
||||
//import androidx.compose.runtime.setValue
|
||||
//import androidx.compose.ui.Alignment
|
||||
//import androidx.compose.ui.Modifier
|
||||
//import androidx.compose.ui.graphics.Color
|
||||
//import androidx.compose.ui.unit.dp
|
||||
//import androidx.compose.ui.unit.sp
|
||||
//import kotlinx.coroutines.delay
|
||||
//
|
||||
//object ToastUtils {
|
||||
// private var show by mutableStateOf(false)
|
||||
// private var message by mutableStateOf("")
|
||||
//
|
||||
// fun showToast(msg: String) {
|
||||
// message = msg
|
||||
// show = true
|
||||
//// Toast.makeText(ContextUtils.getAppContext(), msg, Toast.LENGTH_LONG).show()
|
||||
// }
|
||||
//
|
||||
// @Composable
|
||||
// fun ToastComposable() {
|
||||
// if (show) {
|
||||
// LaunchedEffect(Unit) {
|
||||
// delay(2000) // 自动2秒后消失
|
||||
// show = false
|
||||
// }
|
||||
// Box(
|
||||
// modifier = Modifier
|
||||
//// .fillMaxWidth()
|
||||
// .fillMaxSize()
|
||||
// .padding(bottom = 156.dp),
|
||||
// contentAlignment = Alignment.BottomCenter
|
||||
// ) {
|
||||
// Text(
|
||||
// text = message,
|
||||
// modifier = Modifier
|
||||
// .background(Color.Black.copy(alpha = 0.7f), RoundedCornerShape(8.dp))
|
||||
// .padding(horizontal = 24.dp, vertical = 12.dp),
|
||||
// color = Color.White,
|
||||
// fontSize = 24.sp
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user