From aa091c047f297bd058739194a2d6229432662cd3 Mon Sep 17 00:00:00 2001 From: hugh <1012760428@qq.com> Date: Sun, 25 Jan 2026 14:54:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20UI=20=E7=8E=B0=E4=BB=A3=E5=8C=96?= =?UTF-8?q?=E9=87=8D=E6=9E=84=20-=20=E6=9A=97=E9=BB=91=E5=A5=A2=E5=8D=8E?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=20+=20Lottie=20=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实施基于 Lottie + Material 3 的暗黑奢华 + 玻璃拟态风格的现代化界面重构 主要变更: - 配色方案:深邃黑背景 + 皇家紫强调色 + 翡翠绿状态色 - 依赖升级:Lottie 6.3.0 + Material 3 1.11.0 + Blurry 4.0.1 - Lottie 动画:5 个优化的 JSON 动画文件(状态、加载、成功、刷新、空状态) - 玻璃拟态效果:半透明卡片 + 细腻边框 + 圆角设计 - 布局重构:主页、壁纸预览、相册管理、相册卡片全面重构 - 动画逻辑:HomeFragment 集成 Lottie 状态动画 - 设计规范:统一的尺寸系统(dimens.xml)和 Material 3 暗色主题 技术亮点: - 暗色主题让壁纸预览更突出 - 玻璃拟态创造深度和层次感 - Lottie 动画文件 < 50KB,性能优化 - Material 3 原生暗色主题支持 - 向后兼容旧的配色引用 文档:docs/ui-modernization-summary.md --- app/build.gradle | 8 +- .../java/cn/hugh/bz/gk2/ui/HomeFragment.java | 20 +- app/src/main/res/drawable/bg_glass_card.xml | 20 + .../main/res/drawable/bg_gradient_button.xml | 10 + .../main/res/drawable/bg_gradient_overlay.xml | 9 + app/src/main/res/drawable/bg_status_glow.xml | 8 + app/src/main/res/drawable/ic_arrow_back.xml | 10 + .../main/res/drawable/ic_arrow_forward.xml | 10 + app/src/main/res/layout/activity_main.xml | 6 +- .../res/layout/fragment_album_management.xml | 15 +- .../res/layout/fragment_current_wallpaper.xml | 155 +++++-- app/src/main/res/layout/fragment_home.xml | 124 +++--- app/src/main/res/layout/item_album_card.xml | 74 ++-- app/src/main/res/raw/empty.json | 89 ++++ app/src/main/res/raw/loading.json | 92 ++++ app/src/main/res/raw/refresh.json | 96 +++++ app/src/main/res/raw/status_active.json | 93 ++++ app/src/main/res/raw/success.json | 95 +++++ app/src/main/res/values/colors.xml | 63 ++- app/src/main/res/values/dimens.xml | 53 +++ app/src/main/res/values/themes.xml | 53 ++- docs/ui-modernization-summary.md | 396 ++++++++++++++++++ 22 files changed, 1321 insertions(+), 178 deletions(-) create mode 100644 app/src/main/res/drawable/bg_glass_card.xml create mode 100644 app/src/main/res/drawable/bg_gradient_button.xml create mode 100644 app/src/main/res/drawable/bg_gradient_overlay.xml create mode 100644 app/src/main/res/drawable/bg_status_glow.xml create mode 100644 app/src/main/res/drawable/ic_arrow_back.xml create mode 100644 app/src/main/res/drawable/ic_arrow_forward.xml create mode 100644 app/src/main/res/raw/empty.json create mode 100644 app/src/main/res/raw/loading.json create mode 100644 app/src/main/res/raw/refresh.json create mode 100644 app/src/main/res/raw/status_active.json create mode 100644 app/src/main/res/raw/success.json create mode 100644 app/src/main/res/values/dimens.xml create mode 100644 docs/ui-modernization-summary.md diff --git a/app/build.gradle b/app/build.gradle index c3c6656..2ce0dc5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -44,7 +44,7 @@ configurations.all { dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.9.0' + implementation 'com.google.android.material:material:1.11.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' // Glide for image loading @@ -56,4 +56,10 @@ dependencies { // Permissions implementation 'androidx.core:core:1.12.0' + + // Lottie animations + implementation 'com.airbnb.android:lottie:6.3.0' + + // Blur effect for glassmorphism + implementation 'jp.wasabeef:blurry:4.0.1' } diff --git a/app/src/main/java/cn/hugh/bz/gk2/ui/HomeFragment.java b/app/src/main/java/cn/hugh/bz/gk2/ui/HomeFragment.java index 248c11a..336392e 100644 --- a/app/src/main/java/cn/hugh/bz/gk2/ui/HomeFragment.java +++ b/app/src/main/java/cn/hugh/bz/gk2/ui/HomeFragment.java @@ -15,6 +15,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; +import com.airbnb.lottie.LottieAnimationView; + import java.util.List; import cn.hugh.bz.gk2.R; @@ -31,7 +33,7 @@ public class HomeFragment extends Fragment { private static final String TAG = "HomeFragment"; private TextView tvStatus; - private View statusIndicator; + private LottieAnimationView statusAnimation; private TextView tvFolderInfo; private TextView tvSingleImageInfo; private Button btnToggle; @@ -67,7 +69,7 @@ public class HomeFragment extends Fragment { private void initViews(View view) { tvStatus = view.findViewById(R.id.tvStatus); - statusIndicator = view.findViewById(R.id.statusIndicator); + statusAnimation = view.findViewById(R.id.statusAnimation); tvFolderInfo = view.findViewById(R.id.tvFolderInfo); tvSingleImageInfo = view.findViewById(R.id.tvSingleImageInfo); btnToggle = view.findViewById(R.id.btnToggle); @@ -211,17 +213,19 @@ public class HomeFragment extends Fragment { tvStatus.setText(R.string.status_enabled); btnToggle.setText(R.string.disable); btnChangeNow.setEnabled(true); - // 更新状态指示器 - if (statusIndicator != null) { - statusIndicator.setBackgroundResource(R.drawable.status_indicator_enabled); + // 启动 Lottie 动画 + if (statusAnimation != null) { + statusAnimation.setAnimation(R.raw.status_active); + statusAnimation.playAnimation(); } } else { tvStatus.setText(R.string.status_disabled); btnToggle.setText(R.string.enable); btnChangeNow.setEnabled(false); - // 更新状态指示器 - if (statusIndicator != null) { - statusIndicator.setBackgroundResource(R.drawable.status_indicator_disabled); + // 停止 Lottie 动画 + if (statusAnimation != null) { + statusAnimation.cancelAnimation(); + statusAnimation.setProgress(0f); } } diff --git a/app/src/main/res/drawable/bg_glass_card.xml b/app/src/main/res/drawable/bg_glass_card.xml new file mode 100644 index 0000000..79a75e2 --- /dev/null +++ b/app/src/main/res/drawable/bg_glass_card.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/bg_gradient_button.xml b/app/src/main/res/drawable/bg_gradient_button.xml new file mode 100644 index 0000000..bf83654 --- /dev/null +++ b/app/src/main/res/drawable/bg_gradient_button.xml @@ -0,0 +1,10 @@ + + + + + diff --git a/app/src/main/res/drawable/bg_gradient_overlay.xml b/app/src/main/res/drawable/bg_gradient_overlay.xml new file mode 100644 index 0000000..1a50adc --- /dev/null +++ b/app/src/main/res/drawable/bg_gradient_overlay.xml @@ -0,0 +1,9 @@ + + + + diff --git a/app/src/main/res/drawable/bg_status_glow.xml b/app/src/main/res/drawable/bg_status_glow.xml new file mode 100644 index 0000000..91aa2d7 --- /dev/null +++ b/app/src/main/res/drawable/bg_status_glow.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_arrow_back.xml b/app/src/main/res/drawable/ic_arrow_back.xml new file mode 100644 index 0000000..925a3a5 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_back.xml @@ -0,0 +1,10 @@ + + + + diff --git a/app/src/main/res/drawable/ic_arrow_forward.xml b/app/src/main/res/drawable/ic_arrow_forward.xml new file mode 100644 index 0000000..42528a9 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_forward.xml @@ -0,0 +1,10 @@ + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index d052e9d..b9c7b5e 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -5,6 +5,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/bg_primary" tools:context=".ui.MainActivity"> + android:padding="@dimen/spacing_md"> @@ -36,11 +36,12 @@ android:layout_width="wrap_content" android:layout_height="48dp" android:text="+ 新建" - android:textSize="14sp" + android:textSize="@dimen/text_size_sm" + android:backgroundTint="@color/accent_primary" app:icon="@drawable/ic_add" app:iconGravity="textStart" - app:cornerRadius="12dp" - style="@style/Widget.Material3.Button.TonalButton" /> + app:cornerRadius="@dimen/corner_radius_md" + style="@style/Widget.Material3.Button" /> diff --git a/app/src/main/res/layout/fragment_current_wallpaper.xml b/app/src/main/res/layout/fragment_current_wallpaper.xml index 402cdc8..d3590d0 100644 --- a/app/src/main/res/layout/fragment_current_wallpaper.xml +++ b/app/src/main/res/layout/fragment_current_wallpaper.xml @@ -5,71 +5,140 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/bg_primary" android:fillViewport="true"> - + + app:layout_constraintEnd_toEndOf="parent"> - + + + + + + + + + + + + + + + + + + + + app:layout_constraintEnd_toEndOf="parent"> - + -