Skip to content

Commit 740dd98

Browse files
committed
v5.4: 新增关于页面功能
新增功能 - 在主界面功能列表底部添加「关于」入口 - 关于对话框显示应用版本信息 - 支持跳转到 Telegram 群组和 GitHub 仓库 - 自动读取应用版本号 界面优化 - 统一卡片设计风格 - 优化布局位置(功能列表底部) - 添加点击动画效果 - 简洁的信息展示 技术改进 - HomeFragment 实现关于对话框逻辑 - PackageManager 自动获取版本信息 - 统一链接跳转处理 - 完善错误处理和日志 文件变更 - 新增 dialog_about.xml 布局文件 - 更新 fragment_home.xml 添加关于卡片 - 更新 HomeFragment.kt 实现功能 - 移除 MainActivity 中的悬浮按钮相关代码 - 新增 RELEASE_NOTES_v5.4.md 版本说明
1 parent 674b7af commit 740dd98

5 files changed

Lines changed: 290 additions & 2 deletions

File tree

RELEASE_NOTES_v5.4.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# CloudFlare Assistant v5.4 版本更新
2+
3+
## 🎉 新增功能
4+
5+
### 关于页面
6+
- **新增"关于"功能**:在主界面功能列表底部添加关于入口
7+
- **应用信息展示**:显示应用版本号(自动读取)
8+
- **社交链接**
9+
- Telegram 群组:https://t.me/CFmuort
10+
- GitHub 源码:https://github.com/a422015028/CloudFlareAssistant
11+
- **一键跳转**:点击链接直接跳转到浏览器或应用
12+
13+
## 🎨 界面优化
14+
15+
### 布局改进
16+
- **统一风格**:关于入口采用与其他功能一致的卡片设计
17+
- **位置优化**:放置在功能列表最底部,不影响主要功能使用
18+
- **交互体验**:添加点击动画效果,与其他功能卡片保持一致
19+
20+
### 用户体验
21+
- **版本自动读取**:关于对话框自动显示当前应用版本
22+
- **错误处理**:链接打开失败时提供友好提示
23+
- **简洁设计**:移除冗余信息,只保留核心内容
24+
25+
## 📋 技术细节
26+
27+
### 代码优化
28+
-`HomeFragment` 中实现关于对话框逻辑
29+
- 使用 `PackageManager` 自动获取版本信息
30+
- 统一链接跳转处理机制
31+
- 完善异常处理和日志记录
32+
33+
### 布局文件
34+
- 新增 `dialog_about.xml` - 关于对话框布局
35+
- 更新 `fragment_home.xml` - 添加关于卡片
36+
- 简化 `activity_main.xml` - 移除悬浮按钮
37+
38+
## 📝 版本信息
39+
40+
- **版本号**:5.4
41+
- **构建代码**:2025121602
42+
- **发布日期**:2025年12月16日
43+
44+
## 🔗 相关链接
45+
46+
- Telegram 群组:https://t.me/CFmuort
47+
- GitHub 仓库:https://github.com/a422015028/CloudFlareAssistant
48+
- 项目 Wiki:https://github.com/a422015028/CloudFlareAssistant/wiki
49+
50+
## 📦 安装说明
51+
52+
- 最低 Android 版本:7.0 (API 25)
53+
- 目标 Android 版本:14 (API 34)
54+
- 支持架构:armeabi-v7a, arm64-v8a, x86, x86_64
55+
56+
---
57+
58+
感谢使用 CloudFlare Assistant!如有问题或建议,欢迎加入 Telegram 群组交流。

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ android {
2020
applicationId = "com.muort.upworker"
2121
minSdk = 25
2222
targetSdk = 34
23-
versionCode = 2025121601
24-
versionName = "5.3"
23+
versionCode = 2025121602
24+
versionName = "5.4"
2525

2626
vectorDrawables {
2727
useSupportLibrary = true

app/src/main/java/com/muort/upworker/feature/home/HomeFragment.kt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.muort.upworker.feature.home
22

3+
import android.content.Intent
4+
import android.net.Uri
35
import android.os.Bundle
46
import android.view.LayoutInflater
57
import android.view.View
@@ -10,12 +12,16 @@ import androidx.lifecycle.Lifecycle
1012
import androidx.lifecycle.lifecycleScope
1113
import androidx.lifecycle.repeatOnLifecycle
1214
import androidx.navigation.fragment.findNavController
15+
import com.google.android.material.dialog.MaterialAlertDialogBuilder
1316
import com.muort.upworker.R
1417
import com.muort.upworker.core.util.AnimationHelper
18+
import com.muort.upworker.core.util.showToast
19+
import com.muort.upworker.databinding.DialogAboutBinding
1520
import com.muort.upworker.databinding.FragmentHomeBinding
1621
import com.muort.upworker.feature.account.AccountViewModel
1722
import dagger.hilt.android.AndroidEntryPoint
1823
import kotlinx.coroutines.launch
24+
import timber.log.Timber
1925

2026
@AndroidEntryPoint
2127
class HomeFragment : Fragment() {
@@ -96,6 +102,11 @@ class HomeFragment : Fragment() {
96102
findNavController().navigate(R.id.action_home_to_backup)
97103
}, 150)
98104
}
105+
106+
binding.aboutCard.setOnClickListener {
107+
AnimationHelper.scaleDown(it)
108+
showAboutDialog()
109+
}
99110
}
100111

101112
private fun animateFeatureCards() {
@@ -121,6 +132,44 @@ class HomeFragment : Fragment() {
121132
}
122133
}
123134

135+
private fun showAboutDialog() {
136+
val dialogBinding = DialogAboutBinding.inflate(LayoutInflater.from(requireContext()))
137+
138+
// 自动读取版本号
139+
try {
140+
val versionName = requireContext().packageManager.getPackageInfo(requireContext().packageName, 0).versionName
141+
dialogBinding.tvVersion.text = "版本 $versionName"
142+
} catch (e: Exception) {
143+
Timber.e(e, "Failed to get version name")
144+
}
145+
146+
val dialog = MaterialAlertDialogBuilder(requireContext())
147+
.setView(dialogBinding.root)
148+
.create()
149+
150+
// Telegram 链接点击
151+
dialogBinding.layoutTelegram.setOnClickListener {
152+
openUrl("https://t.me/CFmuort")
153+
}
154+
155+
// GitHub 链接点击
156+
dialogBinding.layoutGithub.setOnClickListener {
157+
openUrl("https://github.com/a422015028/CloudFlareAssistant")
158+
}
159+
160+
dialog.show()
161+
}
162+
163+
private fun openUrl(url: String) {
164+
try {
165+
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
166+
startActivity(intent)
167+
} catch (e: Exception) {
168+
requireContext().showToast("无法打开链接")
169+
Timber.e(e, "Failed to open URL: $url")
170+
}
171+
}
172+
124173
private fun observeViewModel() {
125174
viewLifecycleOwner.lifecycleScope.launch {
126175
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="wrap_content"
5+
android:orientation="vertical"
6+
android:padding="24dp">
7+
8+
<!-- App Icon -->
9+
<ImageView
10+
android:layout_width="80dp"
11+
android:layout_height="80dp"
12+
android:layout_gravity="center_horizontal"
13+
android:layout_marginBottom="16dp"
14+
android:contentDescription="@string/app_name"
15+
android:src="@mipmap/ic_launcher" />
16+
17+
<!-- App Name -->
18+
<TextView
19+
android:layout_width="wrap_content"
20+
android:layout_height="wrap_content"
21+
android:layout_gravity="center_horizontal"
22+
android:text="@string/app_name"
23+
android:textColor="?attr/colorPrimary"
24+
android:textSize="24sp"
25+
android:textStyle="bold" />
26+
27+
<!-- Version -->
28+
<TextView
29+
android:id="@+id/tvVersion"
30+
android:layout_width="wrap_content"
31+
android:layout_height="wrap_content"
32+
android:layout_gravity="center_horizontal"
33+
android:layout_marginTop="8dp"
34+
android:text="版本 5.3"
35+
android:textColor="?android:attr/textColorSecondary"
36+
android:textSize="14sp" />
37+
38+
<!-- Divider -->
39+
<View
40+
android:layout_width="match_parent"
41+
android:layout_height="1dp"
42+
android:layout_marginTop="20dp"
43+
android:layout_marginBottom="20dp"
44+
android:background="?android:attr/listDivider" />
45+
46+
<!-- TG Group -->
47+
<LinearLayout
48+
android:id="@+id/layoutTelegram"
49+
android:layout_width="match_parent"
50+
android:layout_height="wrap_content"
51+
android:background="?attr/selectableItemBackground"
52+
android:clickable="true"
53+
android:focusable="true"
54+
android:gravity="center_vertical"
55+
android:orientation="horizontal"
56+
android:padding="12dp">
57+
58+
<TextView
59+
android:layout_width="0dp"
60+
android:layout_height="wrap_content"
61+
android:layout_weight="1"
62+
android:text="📱 Telegram 群组"
63+
android:textColor="?attr/colorPrimary"
64+
android:textSize="15sp"
65+
android:textStyle="bold" />
66+
67+
<TextView
68+
android:id="@+id/tvTelegramLink"
69+
android:layout_width="wrap_content"
70+
android:layout_height="wrap_content"
71+
android:text="加入讨论 →"
72+
android:textColor="?attr/colorPrimary"
73+
android:textSize="14sp" />
74+
</LinearLayout>
75+
76+
<!-- GitHub -->
77+
<LinearLayout
78+
android:id="@+id/layoutGithub"
79+
android:layout_width="match_parent"
80+
android:layout_height="wrap_content"
81+
android:layout_marginTop="8dp"
82+
android:background="?attr/selectableItemBackground"
83+
android:clickable="true"
84+
android:focusable="true"
85+
android:gravity="center_vertical"
86+
android:orientation="horizontal"
87+
android:padding="12dp">
88+
89+
<TextView
90+
android:layout_width="0dp"
91+
android:layout_height="wrap_content"
92+
android:layout_weight="1"
93+
android:text="🌟 GitHub"
94+
android:textColor="?attr/colorPrimary"
95+
android:textSize="15sp"
96+
android:textStyle="bold" />
97+
98+
<TextView
99+
android:id="@+id/tvGithubLink"
100+
android:layout_width="wrap_content"
101+
android:layout_height="wrap_content"
102+
android:text="查看源码 →"
103+
android:textColor="?attr/colorPrimary"
104+
android:textSize="14sp" />
105+
</LinearLayout>
106+
107+
<!-- Divider -->
108+
<View
109+
android:layout_width="match_parent"
110+
android:layout_height="1dp"
111+
android:layout_marginTop="20dp"
112+
android:layout_marginBottom="16dp"
113+
android:background="?android:attr/listDivider" />
114+
115+
<!-- Copyright -->
116+
<TextView
117+
android:layout_width="match_parent"
118+
android:layout_height="wrap_content"
119+
android:gravity="center"
120+
android:text="© 2025 CloudFlare Assistant\nMIT License"
121+
android:textColor="?android:attr/textColorSecondary"
122+
android:textSize="12sp" />
123+
124+
</LinearLayout>

app/src/main/res/layout/fragment_home.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,63 @@
462462

463463
</com.google.android.material.card.MaterialCardView>
464464

465+
<!-- About -->
466+
<com.google.android.material.card.MaterialCardView
467+
android:id="@+id/aboutCard"
468+
android:layout_width="match_parent"
469+
android:layout_height="wrap_content"
470+
android:layout_marginBottom="12dp"
471+
android:clickable="true"
472+
android:focusable="true"
473+
app:cardElevation="2dp"
474+
app:cardCornerRadius="8dp">
475+
476+
<LinearLayout
477+
android:layout_width="match_parent"
478+
android:layout_height="wrap_content"
479+
android:orientation="horizontal"
480+
android:padding="16dp"
481+
android:gravity="center_vertical">
482+
483+
<ImageView
484+
android:layout_width="40dp"
485+
android:layout_height="40dp"
486+
android:src="@android:drawable/ic_menu_info_details"
487+
android:tint="?attr/colorPrimary" />
488+
489+
<LinearLayout
490+
android:layout_width="0dp"
491+
android:layout_height="wrap_content"
492+
android:layout_weight="1"
493+
android:orientation="vertical"
494+
android:layout_marginStart="16dp">
495+
496+
<TextView
497+
android:layout_width="wrap_content"
498+
android:layout_height="wrap_content"
499+
android:text="关于"
500+
android:textSize="16sp"
501+
android:textStyle="bold" />
502+
503+
<TextView
504+
android:layout_width="wrap_content"
505+
android:layout_height="wrap_content"
506+
android:text="应用信息和联系方式"
507+
android:textSize="12sp"
508+
android:textColor="?android:textColorSecondary" />
509+
510+
</LinearLayout>
511+
512+
<ImageView
513+
android:layout_width="24dp"
514+
android:layout_height="24dp"
515+
android:src="@android:drawable/ic_menu_more"
516+
android:tint="?android:textColorSecondary" />
517+
518+
</LinearLayout>
519+
520+
</com.google.android.material.card.MaterialCardView>
521+
465522
</LinearLayout>
466523

467524
</androidx.core.widget.NestedScrollView>

0 commit comments

Comments
 (0)