Files
Inbound20260114/app/src/main/java/com/sw/inbound/InitActivity.kt
T
lvmengandClaude Sonnet 4.6 2c3ebd86f9 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>
2026-03-06 09:28:55 +08:00

184 lines
6.6 KiB
Kotlin

//package com.sw.inbound
//
//import android.content.Intent
//import android.os.Bundle
//import android.view.WindowManager
//import androidx.activity.ComponentActivity
////import androidx.activity.compose.setContent
//import androidx.activity.enableEdgeToEdge
////import androidx.compose.animation.AnimatedVisibility
////import androidx.compose.animation.expandIn
////import androidx.compose.animation.shrinkOut
////import androidx.compose.foundation.Image
////import androidx.compose.foundation.background
////import androidx.compose.foundation.layout.Column
////import androidx.compose.foundation.layout.Spacer
////import androidx.compose.foundation.layout.WindowInsets
////import androidx.compose.foundation.layout.fillMaxSize
////import androidx.compose.foundation.layout.navigationBars
////import androidx.compose.foundation.layout.padding
////import androidx.compose.foundation.layout.size
////import androidx.compose.foundation.layout.width
////import androidx.compose.foundation.layout.windowInsetsBottomHeight
////import androidx.compose.foundation.layout.wrapContentWidth
////import androidx.compose.foundation.shape.RoundedCornerShape
////import androidx.compose.material3.Button
////import androidx.compose.material3.ButtonDefaults
////import androidx.compose.material3.Text
////import androidx.compose.runtime.Composable
////import androidx.compose.runtime.LaunchedEffect
////import androidx.compose.runtime.State
////import androidx.compose.runtime.collectAsState
////import androidx.compose.runtime.getValue
////import androidx.compose.ui.Alignment
////import androidx.compose.ui.Modifier
////import androidx.compose.ui.graphics.Color
////import androidx.compose.ui.graphics.asImageBitmap
////import androidx.compose.ui.platform.LocalContext
////import androidx.compose.ui.res.painterResource
////import androidx.compose.ui.text.font.FontWeight
////import androidx.compose.ui.tooling.preview.Preview
////import androidx.compose.ui.unit.dp
////import androidx.compose.ui.unit.sp
////import androidx.hilt.navigation.compose.hiltViewModel
////import com.sw.inbound.utils.AppUtil
////import com.sw.inbound.utils.QRCodeUtil
////import com.sw.inbound.viewmodel.DeviceViewModel
//import dagger.hilt.android.AndroidEntryPoint
////import kotlinx.coroutines.delay
////import kotlinx.coroutines.flow.StateFlow
//
///**
// * 设备初始化界面
// */
//@AndroidEntryPoint
//class InitActivity : ComponentActivity() {
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// enableEdgeToEdge()
// window.setFlags(
// WindowManager.LayoutParams.FLAG_FULLSCREEN,
// WindowManager.LayoutParams.FLAG_FULLSCREEN
// )
//// setContent {
//// InitScreen()
//// }
// }
//
//// private var scale = 0.8F
////
//// private val qrCodeBmp by lazy {
//// QRCodeUtil.generateQRCode(
//// content = GlobalData.deviceId,
//// size = (scale * 150).toInt()
//// )
//// }
//
//// @Preview(widthDp = 1920, heightDp = 1080)
//// @Composable
//// fun InitScreen(
//// viewModel: DeviceViewModel = hiltViewModel<DeviceViewModel>()
//// ) {
////// val context = LocalContext.current
//// val hasDeviceData = viewModel.checkEquipmentInfo()
//// val deviceInfoResult = viewModel.deviceInfoResult.collectAsState()
////
//// if (hasDeviceData) {
//// LaunchedEffect(this) {
//// delay(1500)
//// goLoginActivity()
//// }
//// } else {
//// FirstPage(viewModel)
//// }
//// if (deviceInfoResult.value == true) {
//// goLoginActivity()
//// }
//// }
////
////
//// @Composable
//// fun FirstPage(viewModel: DeviceViewModel) {
//// Column(
//// horizontalAlignment = Alignment.CenterHorizontally,
//// modifier = Modifier.size(
//// 1920.dp, 1080.dp
//// )
//// ) {
//// Spacer(
//// modifier = Modifier
//// .padding(top = (scale * 112).dp)
//// .background(Color.White.copy(alpha = 0.0F))
//// .size((scale * 337).dp, (scale * 322).dp)
//// )
////
//// Button(
//// onClick = {
//// viewModel.getDeviceToken()
//// },
//// colors = ButtonDefaults.buttonColors(
//// contentColor = Color.Transparent,
//// containerColor = Color(0xFF08C6DC)
//// ),
//// shape = RoundedCornerShape((scale * 8).dp),
//// modifier = Modifier
//// .width((scale * 225).dp)
//// .padding(top = (scale * 75).dp)
//// .padding((scale * 10).dp)
//// ) {
//// Text(
//// text = "设备初始化",
//// color = Color.White,
//// fontSize = (scale * 22).sp,
//// fontWeight = FontWeight.Bold,
//// )
//// }
//// Spacer(
//// modifier = Modifier
//// .wrapContentWidth()
//// .weight(1F)
//// )
//// Image(
//// bitmap = qrCodeBmp!!.asImageBitmap(),
//// contentDescription = "",
//// modifier = Modifier
//// .padding(bottom = 10.dp)
//// .size((scale * 150).dp, (scale * 150).dp)
//// )
//// Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars))
//// }
//// }
//// AnimatedVisibility(
//// visible = isSuccess.not(),
//// enter = expandIn(clip = false),
//// exit = shrinkOut(clip = false)
//// ) {}
//// fun initialize() {
//// var deviceId = AppUtil.getUDID(this)
//// deviceId = "6ce7cd59-b875-38b2-b73d-88a570be3212"
//// GlobalData.deviceId = deviceId
//// val isSuccess = deviceViewModel.checkEquipmentInfo()
//// if (isSuccess) {
//// goLoginActivity()
//// return
//// }
//// binding.ivQrCode.setImageBitmap(
//// QRCodeUtil.generateQRCode(
//// content = GlobalData.deviceId,
//// size = 200
//// )
//// )
//// binding.btnInit.setOnClickListener {
//// deviceViewModel.getDeviceToken()
//// }
//// }
//
// private fun goLoginActivity() {
// val intent = Intent(this, MainActivity::class.java)
// startActivity(intent)
// finish()
// }
//
//
//}