This commit is contained in:
fengjignqi
2026-11-12 14:05:05 +08:00
parent 244f3fb8e0
commit 2a1e77e866
424 changed files with 32002 additions and 1387 deletions

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
<layout
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">
@@ -14,6 +15,7 @@
tools:locale="en">
<!-- 复用通用标题栏,通过可选参数设置本页标题和深色文字。 -->
<include
android:id="@+id/include_title"
layout="@layout/include_activity_top_title_layout"
@@ -23,6 +25,7 @@
app:titleTextColor="@{@color/device_home_text}" />
<!-- 内容允许滚动,小屏幕和较大字体下仍能查看底部卡片。 -->
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
@@ -31,574 +34,42 @@
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingHorizontal="25dp"
android:paddingTop="7dp"
android:paddingBottom="24dp">
<!-- 按窗口宽度测量,大屏内容居中,手机保持占满宽度。 -->
<!-- 设备基础信息,图标和产品图暂用 ic_launcher 占位。 -->
<androidx.cardview.widget.CardView
android:id="@+id/cv_preview_device"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
android:layout_gravity="top|center_horizontal"
app:maxContentWidth="1100dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="16dp"
app:cardElevation="1dp"
app:cardPreventCornerOverlap="false">
android:clipToPadding="false"
android:orientation="vertical"
android:paddingHorizontal="25dp"
android:paddingTop="7dp"
android:paddingBottom="24dp">
<RelativeLayout
<include
layout="@layout/device_preview_device_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<include
layout="@layout/device_preview_carbon_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="166dp"
android:paddingBottom="7dp">
android:layout_marginTop="12dp" />
<LinearLayout
android:id="@+id/ll_preview_device_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_preview_device_icon"
android:layout_width="46dp"
android:layout_height="46dp"
android:background="@drawable/device_home_icon_bg"
android:contentDescription="@null"
android:padding="10dp"
android:src="@mipmap/ic_launcher" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/tv_preview_device_name"
style="@style/DevicePreviewHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:minHeight="19dp"
android:text="@string/device_preview_name" />
<LinearLayout
android:id="@+id/ll_preview_online"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="15dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<View
android:id="@+id/view_preview_online_dot"
android:layout_width="7dp"
android:layout_height="7dp"
android:background="@drawable/device_home_status_dot" />
<TextView
android:id="@+id/tv_preview_online"
style="@style/DevicePreviewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/device_home_online"
android:textColor="@color/device_home_online"
android:textSize="11.5sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/iv_preview_product"
android:layout_width="164dp"
android:layout_height="116dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="43dp"
android:layout_marginEnd="14dp"
android:contentDescription="@null"
android:scaleType="fitCenter"
android:src="@mipmap/ic_launcher" />
<LinearLayout
android:id="@+id/ll_preview_realtime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/ll_preview_device_header"
android:layout_toStartOf="@id/iv_preview_product"
android:layout_marginTop="18dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="8dp"
android:orientation="vertical">
<TextView
style="@style/DevicePreviewLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="15dp"
android:text="@string/device_preview_power_label"
android:textSize="11sp" />
<TextView
android:id="@+id/tv_preview_power"
style="@style/DevicePreviewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:minHeight="22dp"
android:text="@string/device_preview_demo_power"
android:textSize="17sp" />
<TextView
style="@style/DevicePreviewLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:minHeight="15dp"
android:text="@string/device_preview_temperature_label"
android:textSize="11sp" />
<TextView
android:id="@+id/tv_preview_temperature"
style="@style/DevicePreviewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:minHeight="22dp"
android:text="@string/device_preview_demo_temperature"
android:textSize="17sp" />
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<!-- 今日减排及积分,所有示例数据都保留独立控件 ID 便于后续绑定。 -->
<androidx.cardview.widget.CardView
android:id="@+id/cv_preview_carbon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="16dp"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false">
<LinearLayout
<include
layout="@layout/device_preview_actions_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="159dp"
android:orientation="vertical"
android:paddingStart="21dp"
android:paddingEnd="14dp"
android:paddingTop="9dp"
android:paddingBottom="9dp">
<LinearLayout
android:id="@+id/ll_preview_carbon_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="19dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:contentDescription="@null"
android:src="@mipmap/ic_launcher" />
<TextView
style="@style/DevicePreviewHeading"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:text="@string/device_preview_carbon_title" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:contentDescription="@null"
android:src="@mipmap/icon_point_right"
android:tint="@color/device_home_offline" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
style="@style/DevicePreviewLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="14dp"
android:text="@string/device_preview_electricity_label" />
<TextView
android:id="@+id/tv_preview_electricity"
style="@style/DevicePreviewValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="19dp"
android:text="@string/device_preview_demo_electricity" />
<Space
android:layout_width="1dp"
android:layout_height="7dp" />
<TextView
style="@style/DevicePreviewLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="14dp"
android:text="@string/device_preview_money_label" />
<TextView
android:id="@+id/tv_preview_money"
style="@style/DevicePreviewValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="19dp"
android:text="@string/device_preview_demo_money"
android:textColor="@color/device_home_orange" />
<Space
android:layout_width="1dp"
android:layout_height="7dp" />
<TextView
style="@style/DevicePreviewLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="14dp"
android:text="@string/device_preview_carbon_label" />
<TextView
android:id="@+id/tv_preview_carbon"
style="@style/DevicePreviewValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="19dp"
android:text="@string/device_preview_demo_carbon" />
</LinearLayout>
<LinearLayout
android:layout_width="132dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:paddingTop="16dp">
<FrameLayout
android:layout_width="66dp"
android:layout_height="66dp">
<!-- 复用配网页面的圆头橙色进度环;此处 74 为静态展示值。 -->
<com.ckkj.griddle.custom.view.ProvisionProgressView
android:id="@+id/preview_points_progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:importantForAccessibility="no"
app:provisionProgress="74"
app:provisionStrokeWidth="6dp"
app:provisionInset="0dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/tv_preview_points"
style="@style/DevicePreviewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:minHeight="17dp"
android:text="@string/device_preview_demo_points"
android:textSize="13sp" />
<TextView
style="@style/DevicePreviewLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:minHeight="11dp"
android:text="@string/device_preview_points_label"
android:textColor="@color/device_home_muted"
android:textSize="8.5sp" />
</LinearLayout>
</FrameLayout>
<TextView
android:id="@+id/tv_preview_equivalent"
style="@style/DevicePreviewLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:gravity="center"
android:minHeight="12dp"
android:text="@string/device_preview_equivalent"
android:textColor="@color/device_home_muted"
android:textSize="9sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="11dp"
android:baselineAligned="false"
android:orientation="horizontal">
<!-- 今日节省卡片。 -->
<androidx.cardview.widget.CardView
android:id="@+id/cv_preview_savings"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:layout_weight="1"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="16dp"
app:cardElevation="1dp"
app:cardPreventCornerOverlap="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="160dp"
android:orientation="vertical"
android:padding="11dp">
<TextView
style="@style/DevicePreviewSmallHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="17dp"
android:text="@string/device_preview_savings_title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="16dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
style="@style/DevicePreviewLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/device_preview_charcoal_label" />
<TextView
android:id="@+id/tv_preview_charcoal"
style="@style/DevicePreviewValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="@string/device_preview_demo_charcoal"
android:textSize="12.5sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="16dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
style="@style/DevicePreviewLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/device_preview_saving_label" />
<TextView
android:id="@+id/tv_preview_saving"
style="@style/DevicePreviewValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="@string/device_preview_demo_saving"
android:textSize="12.5sp" />
</LinearLayout>
<ImageView
android:id="@+id/iv_preview_savings"
android:layout_width="81dp"
android:layout_height="53dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="18dp"
android:contentDescription="@null"
android:scaleType="fitCenter"
android:src="@mipmap/ic_launcher" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- 快捷操作暂只保留入口控件,业务点击由后续页面逻辑接入。 -->
<androidx.cardview.widget.CardView
android:id="@+id/cv_preview_actions"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="16dp"
app:cardElevation="1dp"
app:cardPreventCornerOverlap="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="160dp"
android:orientation="vertical"
android:padding="11dp">
<TextView
style="@style/DevicePreviewSmallHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="17dp"
android:text="@string/device_preview_actions_title" />
<LinearLayout
android:id="@+id/ll_preview_stats"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:minHeight="34dp"
android:background="@drawable/device_preview_action_bg"
android:foreground="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="9dp"
android:paddingVertical="6dp">
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:background="@drawable/device_preview_action_icon_bg"
android:contentDescription="@null"
android:padding="4dp"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv_carbon_status"
style="@style/DevicePreviewAction"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/device_preview_stats" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_preview_control"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="34dp"
android:background="@drawable/device_preview_action_bg"
android:foreground="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="9dp"
android:paddingVertical="6dp">
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:background="@drawable/device_preview_action_icon_bg"
android:contentDescription="@null"
android:padding="4dp"
android:src="@mipmap/ic_launcher" />
<TextView
style="@style/DevicePreviewAction"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/device_preview_control" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_preview_carbon_points"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="34dp"
android:background="@drawable/device_preview_action_bg"
android:foreground="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="9dp"
android:paddingVertical="6dp">
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:background="@drawable/device_preview_action_icon_bg"
android:contentDescription="@null"
android:padding="4dp"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv_carbon_points"
style="@style/DevicePreviewAction"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/device_preview_carbon_points" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
android:layout_marginTop="12dp" />
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
</FrameLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</layout>