299 lines
11 KiB
XML
299 lines
11 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||
|
||
|
||
<data>
|
||
<variable
|
||
name="click"
|
||
type="com.secure.demo.activity.main.MainActivity.ViewClick" />
|
||
</data>
|
||
|
||
<androidx.core.widget.NestedScrollView
|
||
android:layout_width="match_parent"
|
||
android:layout_height="match_parent"
|
||
android:fillViewport="true"
|
||
android:background="#F5F6FA">
|
||
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:orientation="vertical"
|
||
android:padding="16dp">
|
||
|
||
<!-- 标题 -->
|
||
<TextView
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:text="安全设备演示 · 模拟真实操作"
|
||
android:textSize="20sp"
|
||
android:textStyle="bold"
|
||
android:textColor="#1A1A2E" />
|
||
|
||
<TextView
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="2dp"
|
||
android:text="按真实使用流程逐步手动操作(注册 → 绑定 → 上传 → 下载 → 恢复出厂 → 重新注册 → 短信 → 恢复)"
|
||
android:textSize="12sp"
|
||
android:textColor="#888888" />
|
||
|
||
<!-- 设备状态摘要 -->
|
||
<TextView
|
||
android:id="@+id/status"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="12dp"
|
||
android:background="#FFFFFF"
|
||
android:padding="12dp"
|
||
android:text="设备未初始化..."
|
||
android:textSize="13sp"
|
||
android:typeface="monospace"
|
||
android:textColor="#333333"
|
||
android:elevation="1dp" />
|
||
|
||
<!-- 用户 ID -->
|
||
<TextView
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="12dp"
|
||
android:text="用户 ID(绑定/恢复身份)"
|
||
android:textSize="12sp"
|
||
android:textColor="#555555" />
|
||
|
||
<EditText
|
||
android:id="@+id/user_id"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:hint="例如 user-001"
|
||
android:text="user-001"
|
||
android:inputType="text"
|
||
android:background="@android:drawable/editbox_background" />
|
||
|
||
<!-- 手机号 -->
|
||
<TextView
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="8dp"
|
||
android:text="手机号(绑定与短信必须一致)"
|
||
android:textSize="12sp"
|
||
android:textColor="#555555" />
|
||
|
||
<EditText
|
||
android:id="@+id/phone"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:hint="例如 13800138000"
|
||
android:text="13800138000"
|
||
android:inputType="phone"
|
||
android:background="@android:drawable/editbox_background" />
|
||
|
||
<!-- ① 注册设备 | ② 绑定用户 -->
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="12dp"
|
||
android:orientation="horizontal">
|
||
|
||
<Button
|
||
android:id="@+id/btn_register"
|
||
android:layout_width="0dp"
|
||
android:onClick="@{click::registerDevice}"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:text="① 注册设备"
|
||
android:textSize="13sp" />
|
||
|
||
<Button
|
||
android:id="@+id/btn_bind"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:layout_marginStart="8dp"
|
||
android:onClick="@{click::bindUser}"
|
||
android:text="② 绑定用户"
|
||
android:textSize="13sp" />
|
||
</LinearLayout>
|
||
|
||
<!-- ③ 上传图片 | ④ 下载解密 -->
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="8dp"
|
||
android:orientation="horizontal">
|
||
|
||
<Button
|
||
android:id="@+id/btn_upload_image"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:onClick="@{click::uploadImage}"
|
||
android:text="③ 选择并上传图片"
|
||
android:textSize="13sp" />
|
||
|
||
<Button
|
||
android:id="@+id/btn_download"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:layout_marginStart="8dp"
|
||
android:onClick="@{click::downloadPhoto}"
|
||
android:text="④ 下载解密照片"
|
||
android:textSize="13sp" />
|
||
</LinearLayout>
|
||
|
||
<!-- ④b 下载解密(流式 StreamingResponseBody) -->
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="8dp"
|
||
android:orientation="horizontal">
|
||
|
||
<Button
|
||
android:id="@+id/btn_download_streaming"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:onClick="@{click::downloadPhotoStreaming}"
|
||
android:text="④b 下载解密(流式)"
|
||
android:textSize="13sp" />
|
||
</LinearLayout>
|
||
|
||
<!-- ④c 列出全部照片 | ④d 设备本地解密全部照片(端到端加密) -->
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="8dp"
|
||
android:orientation="horizontal">
|
||
|
||
<Button
|
||
android:id="@+id/btn_list_photos"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:onClick="@{click::listAllPhotos}"
|
||
android:text="④c 列出全部照片"
|
||
android:textSize="13sp" />
|
||
|
||
<Button
|
||
android:id="@+id/btn_download_all_local"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:layout_marginStart="8dp"
|
||
android:onClick="@{click::downloadAllPhotosLocal}"
|
||
android:text="④d 本地解密全部"
|
||
android:textSize="13sp" />
|
||
</LinearLayout>
|
||
|
||
<!-- ⑤ 恢复出厂 | ⑥ 重新注册 -->
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="8dp"
|
||
android:orientation="horizontal">
|
||
|
||
<Button
|
||
android:id="@+id/btn_reset"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:onClick="@{click::resetDevice}"
|
||
android:text="⑤ 恢复出厂"
|
||
android:textSize="13sp" />
|
||
|
||
<Button
|
||
android:id="@+id/btn_reregister"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:layout_marginStart="8dp"
|
||
android:onClick="@{click::reRegisterDevice}"
|
||
android:text="⑥ 重新注册"
|
||
android:textSize="13sp" />
|
||
</LinearLayout>
|
||
|
||
<!-- ⑦ 发送短信 -->
|
||
<Button
|
||
android:id="@+id/btn_sms"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="8dp"
|
||
android:onClick="@{click::sendSms}"
|
||
android:text="⑦ 发送短信验证码"
|
||
android:textSize="13sp" />
|
||
|
||
<!-- 短信验证码 -->
|
||
<EditText
|
||
android:id="@+id/sms_code"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="4dp"
|
||
android:hint="短信验证码(demo 固定 000000)"
|
||
android:text="000000"
|
||
android:inputType="number"
|
||
android:background="@android:drawable/editbox_background" />
|
||
|
||
<!-- ⑧ 恢复授权 | ⑨ 恢复照片 -->
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="8dp"
|
||
android:orientation="horizontal">
|
||
|
||
<Button
|
||
android:id="@+id/btn_recover"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:onClick="@{click::recoverDevice}"
|
||
android:text="⑧ 恢复授权"
|
||
android:textSize="13sp" />
|
||
|
||
<Button
|
||
android:id="@+id/btn_recover_photos"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:layout_marginStart="8dp"
|
||
android:onClick="@{click::recoverPhotos}"
|
||
android:text="⑨ 恢复照片"
|
||
android:textSize="13sp" />
|
||
</LinearLayout>
|
||
|
||
<!-- 图片预览 -->
|
||
<ImageView
|
||
android:id="@+id/img_preview"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="180dp"
|
||
android:layout_marginTop="12dp"
|
||
android:scaleType="centerInside"
|
||
android:background="#EEEEEE"
|
||
android:contentDescription="选中图片预览" />
|
||
|
||
<!-- 日志区 -->
|
||
<TextView
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_marginTop="12dp"
|
||
android:text="运行日志"
|
||
android:textSize="12sp"
|
||
android:textColor="#555555" />
|
||
|
||
<TextView
|
||
android:id="@+id/log"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="220dp"
|
||
android:layout_marginTop="12dp"
|
||
android:background="#1E1E2E"
|
||
android:padding="10dp"
|
||
android:textColor="#D0E8D0"
|
||
android:textSize="12sp"
|
||
android:typeface="monospace"
|
||
android:scrollbars="vertical"
|
||
android:fadeScrollbars="false"
|
||
android:focusable="true"
|
||
android:clickable="true" />
|
||
</LinearLayout>
|
||
</androidx.core.widget.NestedScrollView>
|
||
</layout>
|