Merge remote-tracking branch 'origin/main'
# Conflicts: # app/src/main/java/com/shuwei/intelligent/shelves/InitActivity.kt # app/src/main/java/com/shuwei/intelligent/shelves/net/ApiService.kt # app/src/main/java/com/shuwei/intelligent/shelves/net/NetViewModel.kt
This commit is contained in:
@@ -111,6 +111,7 @@ class HomeActivity : BaseActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityHomeBinding.inflate(layoutInflater)
|
||||
EventBus.getDefault().register(this)
|
||||
setBackground()
|
||||
setContentView(binding.root)
|
||||
|
||||
updateLeftStatus("1-1冷藏柜 -°C / -%")
|
||||
|
||||
@@ -81,6 +81,7 @@ class ShelfActivity : BaseActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityShelfBinding.inflate(layoutInflater)
|
||||
setBackground()
|
||||
setContentView(binding.root)
|
||||
EventBus.getDefault().register(this)
|
||||
// tvFoodWeight =binding.tvFoodWeight
|
||||
|
||||
@@ -48,14 +48,14 @@ open class BaseActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.setDecorFitsSystemWindows(false)
|
||||
window.insetsController?.apply {
|
||||
hide(WindowInsets.Type.statusBars()) // 隐藏状态栏
|
||||
systemBarsBehavior =
|
||||
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE // 滑动时临时显示
|
||||
}
|
||||
}
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// window.setDecorFitsSystemWindows(false)
|
||||
// window.insetsController?.apply {
|
||||
// hide(WindowInsets.Type.statusBars()) // 隐藏状态栏
|
||||
// systemBarsBehavior =
|
||||
// WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE // 滑动时临时显示
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -77,6 +77,10 @@ open class BaseActivity : AppCompatActivity() {
|
||||
binding.tvRightStatus.setTextColor(color)
|
||||
}
|
||||
|
||||
fun setBackground() {
|
||||
binding.root.setBackgroundColor(ContextCompat.getColor(this,R.color.bg_page))
|
||||
}
|
||||
|
||||
override fun setContentView(view: View?) {
|
||||
if (view == binding.root) {
|
||||
super.setContentView(view)
|
||||
|
||||
@@ -3,14 +3,14 @@ package com.shuwei.intelligent.shelves.utils
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.shuwei.intelligent.shelves.HomeActivity
|
||||
import com.shuwei.intelligent.shelves.InitActivity
|
||||
import kotlin.jvm.java
|
||||
|
||||
class BootReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (Intent.ACTION_BOOT_COMPLETED == intent.action) {
|
||||
// 启动服务或Activity
|
||||
val launchIntent = Intent(context, HomeActivity::class.java)
|
||||
val launchIntent = Intent(context, InitActivity::class.java)
|
||||
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(launchIntent)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user