feat(activity): 添加 Zip 文件下载解压工具和趣味页面
- 新增 ZipDownloadUtils:支持大文件下载、进度回调、断点续传 - 新增 ZipExtractUtils:支持 Zip 文件解压、进度回调、自动创建目录 - 新增 ModelResourceManager:高层资源管理器,协调下载和解压流程 - 新增 FunActivity:趣味测试页面,包含 3 个按钮 - 按钮 1:下载 Zip 文件 - 按钮 2:解压 Zip 文件 - 按钮 3:读取 JSON 并保存到 ObjectBox 数据库 - 新增 activity_fun.xml:趣味页面布局 - 新增 ZipToolsUsageExample:工具使用示例文档 - 改进 ToastUtils:改为 Context 扩展方法 (toast/toastLong) - 暂时注释 HomeActivity 中 tvTime 的点击事件
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 标题栏区域 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="60dp"
|
||||
android:paddingEnd="60dp"
|
||||
android:paddingTop="22dp">
|
||||
|
||||
<!-- 返回按钮 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivBack"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:contentDescription="返回"
|
||||
android:src="@mipmap/ic_back" />
|
||||
|
||||
<!-- 标题文字 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:text="趣味页面"
|
||||
android:textColor="@color/title"
|
||||
android:textSize="36sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<!-- 占位弹性空间 -->
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="60dp">
|
||||
|
||||
<!-- 下载按钮 -->
|
||||
<Button
|
||||
android:id="@+id/btnDownload"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="1. 下载 Zip 文件"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:backgroundTint="@color/title"
|
||||
android:layout_marginBottom="30dp" />
|
||||
|
||||
<!-- 解压按钮 -->
|
||||
<Button
|
||||
android:id="@+id/btnExtract"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="2. 解压 Zip 文件"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:backgroundTint="@color/title"
|
||||
android:layout_marginBottom="30dp" />
|
||||
|
||||
<!-- 读取并保存按钮 -->
|
||||
<Button
|
||||
android:id="@+id/btnLoadAndSave"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="3. 读取并保存到数据库"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:backgroundTint="@color/title"
|
||||
android:layout_marginBottom="30dp" />
|
||||
|
||||
<!-- 进度/状态显示 -->
|
||||
<TextView
|
||||
android:id="@+id/tvProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="就绪"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:layout_marginTop="30dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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="@mipmap/bg"
|
||||
@@ -39,7 +40,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
android:visibility="visible" />
|
||||
android:visibility="visible"
|
||||
tools:text="2026-03-13 星期五"/>
|
||||
|
||||
<!-- 用户信息区(已登录时显示,未登录隐藏) -->
|
||||
<LinearLayout
|
||||
|
||||
Reference in New Issue
Block a user