增加初始化功能

This commit is contained in:
2025-09-11 16:09:07 +08:00
parent e153f3e3b9
commit a355828bab
21 changed files with 1286 additions and 57 deletions
@@ -133,20 +133,20 @@ class HomeActivity : BaseActivity() {
}
TaskManager.startTask()
var androidId = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID)
// androidId = "d0e7a2d5f25c775c"
Log.d(TAG, "onCreate: androidId=${androidId}")
if (androidId == "65e1012638f78260" || androidId == "40f89e91ee40611d") {
androidId = "d0e7a2d5f25c775c"
}
App.getInstance().deviceId = androidId
//"53babf69-0d2f-3875-a649-f2e12f80ad4c1"
val swDpValue = resources?.configuration?.smallestScreenWidthDp
Log.d(TAG, "onCreate: swDpValue=$swDpValue")
// var androidId = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID)
//// androidId = "d0e7a2d5f25c775c"
// Log.d(TAG, "onCreate: androidId=${androidId}")
// if (androidId == "65e1012638f78260" || androidId == "40f89e91ee40611d") {
// androidId = "d0e7a2d5f25c775c"
// }
// App.deviceId = androidId
// //"53babf69-0d2f-3875-a649-f2e12f80ad4c1"
//
// val swDpValue = resources?.configuration?.smallestScreenWidthDp
// Log.d(TAG, "onCreate: swDpValue=$swDpValue")
viewModel.getAccessToken(App.getInstance().deviceId)
viewModel.getAccessToken(App.deviceId)
// repeat(100) {
// lifecycleScope.launch {
@@ -183,9 +183,9 @@ class HomeActivity : BaseActivity() {
private fun getTokenSuccess(data: RespData<*>) {
Log.d(TAG, "getTokenSuccess: $data")
data.result?.let {
App.getInstance().accessToken = it.toString()
App.accessToken = it.toString()
//UIUtils.toast(it.toString())
viewModel.getShelfList(deviceId = App.getInstance().deviceId)
viewModel.getShelfList(deviceId = App.deviceId)
}
}
@@ -201,7 +201,7 @@ class HomeActivity : BaseActivity() {
loadEmptyView()
return
}
App.getInstance().canteenId = data.result.canteenId
App.canteenId = data.result.canteenId
val tempList = data.result.containerGoodsList
if (tempList.isNullOrEmpty()) {
loadEmptyView()
@@ -215,8 +215,8 @@ class HomeActivity : BaseActivity() {
val subList01 = tempList.subList(0, 5)
val subList02 = tempList.subList(5, 10)
repeat(5) { index ->
list.add(subList01[index].also { it.deviceId = App.getInstance().deviceId })
list.add(subList02[index].also { it.deviceId = App.getInstance().deviceId })
list.add(subList01[index].also { it.deviceId = App.deviceId })
list.add(subList02[index].also { it.deviceId = App.deviceId })
}
shelfAdapter.notifyDataSetChanged()
}
@@ -491,7 +491,7 @@ class HomeActivity : BaseActivity() {
binding.include?.let {
it.root.visible()
it.root.setOnClickListener {
viewModel.getAccessToken(App.getInstance().deviceId)
viewModel.getAccessToken(App.deviceId)
}
it.ivEmptyIcon.setImageResource(R.drawable.ic_empty_white)
it.tvEmptyContent.setTextColor(Color.WHITE)