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)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- android:width="800dp"-->
|
||||
<!-- android:height="1280dp"-->
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/bg_page" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:width="450dp"
|
||||
android:height="430dp"
|
||||
android:gravity="top|center_horizontal"
|
||||
android:top="150dp">
|
||||
<bitmap android:src="@drawable/img_init" android:scaleType="fitCenter"/>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- android:width="800dp"-->
|
||||
<!-- android:height="1280dp"-->
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/bg_page" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:width="225dp"
|
||||
android:height="215dp"
|
||||
android:gravity="top|center_horizontal"
|
||||
android:top="75dp">
|
||||
<bitmap android:src="@drawable/img_init" android:scaleType="fitCenter"/>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -5,7 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/bg_page">
|
||||
tools:background="@color/bg_page">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/flStatusBar"
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="450dp"
|
||||
android:layout_height="430dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="150dp"
|
||||
android:src="@drawable/img_init"
|
||||
tools:ignore="ContentDescription"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnInit"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="100dp"
|
||||
android:background="@drawable/bg_init_button"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="设备初始化"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivQrCode"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="50dp"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@mipmap/ic_logo512" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -6,7 +6,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="false"
|
||||
android:background="@color/bg_page">
|
||||
tools:background="@color/bg_page">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/flStatusBar"
|
||||
|
||||
@@ -7,27 +7,26 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="450dp"
|
||||
android:layout_height="450dp"
|
||||
android:layout_width="225dp"
|
||||
android:layout_height="215dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="150dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:layout_marginTop="75dp"
|
||||
android:src="@drawable/img_init"
|
||||
tools:ignore="ContentDescription" />
|
||||
tools:ignore="ContentDescription"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnInit"
|
||||
android:layout_width="300dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="100dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="@drawable/bg_init_button"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="设备初始化"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible"
|
||||
tools:ignore="HardcodedText" />
|
||||
@@ -39,10 +38,10 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivQrCode"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:layout_marginBottom="25dp"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@mipmap/ic_logo512" />
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<!-- Status bar color. -->
|
||||
<!-- <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>-->
|
||||
<item name="android:statusBarColor">@color/white</item>
|
||||
<item name="android:windowBackground">@drawable/bg_splash</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
@@ -10,7 +10,9 @@
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<item name="android:statusBarColor">@color/bg_page</item>
|
||||
<!-- <item name="android:statusBarColor">@color/white</item>-->
|
||||
<item name="android:windowBackground">@drawable/bg_splash</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
<style name="LoadingDialog" parent="Theme.AppCompat.Dialog">
|
||||
|
||||
Reference in New Issue
Block a user