refactor(activity): 优化启动页跳转延迟及子设备页面稳定性,修复导航栏闪烁问题
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 横屏专用启动背景,适配子设备 800×480 屏幕 -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 背景色铺满全屏 -->
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/bg_color"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 图片居中显示,适配横屏比例 -->
|
||||
<item
|
||||
android:width="200dp"
|
||||
android:height="190dp"
|
||||
android:gravity="center">
|
||||
<bitmap android:src="@drawable/img_init" android:scaleType="fitCenter"/>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 横屏 800×480 专用布局,View ID 与 activity_init.xml 完全一致,供子设备使用 -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg_color">
|
||||
|
||||
<!-- 主内容区:水平居中排列加载区和网络错误区 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/llNetwork"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<!-- 加载动画容器 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/llLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:visibility="visible">
|
||||
|
||||
<!-- 加载动画 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivLoading"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/loading_spinner"
|
||||
android:contentDescription="加载中" />
|
||||
|
||||
<!-- 倒计时文字 -->
|
||||
<TextView
|
||||
android:id="@+id/tvCountdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="60秒"
|
||||
android:textSize="32sp"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="16dp" />
|
||||
|
||||
<!-- 提示文字 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="网络连接检测中,请稍后……"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#555555"
|
||||
android:layout_marginTop="10dp"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 连接网络按钮容器 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/llNetworkButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<!-- 网络错误图标 -->
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/ic_network_error"
|
||||
android:contentDescription="网络连接失败"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<!-- 连接失败提示 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="网络连接失败"
|
||||
android:textSize="28sp"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="20dp"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<!-- 连接网络按钮 -->
|
||||
<Button
|
||||
android:id="@+id/btnConnectNetwork"
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="56dp"
|
||||
android:text="连接网络"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/btn_connect_network"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 以下 View 在此布局中不使用,保留 ID 确保 ActivityInitBinding.bind() 不崩溃 -->
|
||||
<TextView
|
||||
android:id="@+id/btnInit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivQrCode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -11,6 +11,8 @@
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<!-- 导航栏颜色与背景一致,避免启动时黑色闪烁;上滑 transient 导航栏由系统控制不受影响 -->
|
||||
<item name="android:navigationBarColor">@color/bg_color</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<!-- <item name="android:layout_width">828dp</item>-->
|
||||
<item name="android:fitsSystemWindows">false</item>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<!-- 导航栏颜色与背景一致,避免启动时黑色闪烁;上滑 transient 导航栏由系统控制不受影响 -->
|
||||
<item name="android:navigationBarColor">@color/bg_color</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<!-- <item name="android:layout_width">828dp</item>-->
|
||||
<item name="android:fitsSystemWindows">false</item>
|
||||
@@ -19,6 +21,11 @@
|
||||
|
||||
</style>
|
||||
|
||||
<!-- 非启动页主题:windowBackground 为纯色,避免 bg_splash 闪烁 -->
|
||||
<style name="Theme.DishMatch.NoSplash" parent="Theme.DishMatch">
|
||||
<item name="android:windowBackground">@color/bg_color</item>
|
||||
</style>
|
||||
|
||||
<style name="CookButtonStyle" parent="Widget.MaterialComponents.Button">
|
||||
<!-- 禁用默认背景色 -->
|
||||
<item name="backgroundTint">@null</item>
|
||||
|
||||
Reference in New Issue
Block a user