refactor: 将壁纸预览整合到主页,采用沉浸式设计并简化应用结构
- 删除独立的"当前壁纸"页面(CurrentWallpaperFragment) - 将壁纸预览功能整合到主页,采用沉浸式卡片设计 - 优化主页布局,添加浮动快速操作按钮 - 简化应用结构,从 5 个页面减少到 4 个页面 - 优化历史记录页面,添加"跳转相册"功能 - 更新底部导航栏,移除独立的壁纸导航项 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7139e4d1fd
commit
f78695077a
12 files changed
+619
-954
No files matched your search
@@ -27,7 +27,8 @@
|
|||||||
"mcp__plugin_serena_serena__replace_content",
|
"mcp__plugin_serena_serena__replace_content",
|
||||||
"Bash(git reset:*)",
|
"Bash(git reset:*)",
|
||||||
"mcp__plugin_serena_serena__create_text_file",
|
"mcp__plugin_serena_serena__create_text_file",
|
||||||
"Bash(powershell:*)"
|
"Bash(powershell:*)",
|
||||||
|
"Bash(find:*)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,255 +0,0 @@
|
|||||||
package cn.hugh.bz.gk2.ui;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.provider.OpenableColumns;
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
import com.google.android.material.button.MaterialButton;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import cn.hugh.bz.gk2.R;
|
|
||||||
import cn.hugh.bz.gk2.utils.BackgroundHelper;
|
|
||||||
import cn.hugh.bz.gk2.utils.ImageLoader;
|
|
||||||
import cn.hugh.bz.gk2.wallpaper.WallpaperPreferences;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前壁纸 Fragment
|
|
||||||
* 显示当前壁纸大图预览、壁纸信息和操作按钮
|
|
||||||
*/
|
|
||||||
public class CurrentWallpaperFragment extends Fragment {
|
|
||||||
|
|
||||||
private ImageView ivWallpaper;
|
|
||||||
private View touchOverlay;
|
|
||||||
private TextView tvWallpaperName;
|
|
||||||
private TextView tvResolution;
|
|
||||||
private TextView tvFileSize;
|
|
||||||
private TextView tvPath;
|
|
||||||
private MaterialButton btnNext;
|
|
||||||
private MaterialButton btnOpenGallery;
|
|
||||||
|
|
||||||
private WallpaperPreferences prefs;
|
|
||||||
private ImageLoader imageLoader;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
return inflater.inflate(R.layout.fragment_current_wallpaper, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
|
|
||||||
prefs = new WallpaperPreferences(requireContext());
|
|
||||||
imageLoader = new ImageLoader(requireContext());
|
|
||||||
|
|
||||||
initViews(view);
|
|
||||||
loadCurrentWallpaper();
|
|
||||||
|
|
||||||
// 应用背景图片
|
|
||||||
BackgroundHelper.applyBackground(requireContext(), view);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initViews(View view) {
|
|
||||||
ivWallpaper = view.findViewById(R.id.ivWallpaper);
|
|
||||||
touchOverlay = view.findViewById(R.id.touchOverlay);
|
|
||||||
tvWallpaperName = view.findViewById(R.id.tvWallpaperName);
|
|
||||||
tvResolution = view.findViewById(R.id.tvResolution);
|
|
||||||
tvFileSize = view.findViewById(R.id.tvFileSize);
|
|
||||||
tvPath = view.findViewById(R.id.tvPath);
|
|
||||||
btnNext = view.findViewById(R.id.btnNext);
|
|
||||||
btnOpenGallery = view.findViewById(R.id.btnOpenGallery);
|
|
||||||
|
|
||||||
btnNext.setOnClickListener(v -> showNextWallpaper());
|
|
||||||
btnOpenGallery.setOnClickListener(v -> openInGallery());
|
|
||||||
touchOverlay.setOnClickListener(v -> openInGallery());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadCurrentWallpaper() {
|
|
||||||
String currentUri = prefs.getLastUri();
|
|
||||||
|
|
||||||
if (currentUri == null || currentUri.isEmpty()) {
|
|
||||||
showNoWallpaper();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示加载状态
|
|
||||||
tvWallpaperName.setText("加载中...");
|
|
||||||
tvResolution.setText("-- x --");
|
|
||||||
tvFileSize.setText("-- MB");
|
|
||||||
tvPath.setText(currentUri);
|
|
||||||
btnNext.setEnabled(false);
|
|
||||||
|
|
||||||
// 获取文件大小和名称
|
|
||||||
new Thread(() -> {
|
|
||||||
String fileSizeStr = getFileSize(Uri.parse(currentUri));
|
|
||||||
String displayName = getDisplayName(currentUri);
|
|
||||||
|
|
||||||
requireActivity().runOnUiThread(() -> {
|
|
||||||
tvFileSize.setText(fileSizeStr);
|
|
||||||
tvWallpaperName.setText(displayName);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 加载图片
|
|
||||||
Bitmap bitmap = imageLoader.loadImage(currentUri, 1080, 1920);
|
|
||||||
|
|
||||||
requireActivity().runOnUiThread(() -> {
|
|
||||||
if (bitmap != null) {
|
|
||||||
ivWallpaper.setImageBitmap(bitmap);
|
|
||||||
tvResolution.setText(bitmap.getWidth() + " x " + bitmap.getHeight());
|
|
||||||
btnNext.setEnabled(true);
|
|
||||||
} else {
|
|
||||||
showError();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getFileSize(Uri uri) {
|
|
||||||
try (Cursor cursor = requireContext().getContentResolver().query(uri, null, null, null, null)) {
|
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
|
||||||
int sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE);
|
|
||||||
if (sizeIndex != -1) {
|
|
||||||
long size = cursor.getLong(sizeIndex);
|
|
||||||
return formatFileSize(size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return "未知大小";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String formatFileSize(long size) {
|
|
||||||
if (size <= 0) return "0 B";
|
|
||||||
final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"};
|
|
||||||
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
|
|
||||||
return String.format("%.1f %s", size / Math.pow(1024, digitGroups), units[digitGroups]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showNoWallpaper() {
|
|
||||||
ivWallpaper.setImageDrawable(null);
|
|
||||||
tvWallpaperName.setText("未设置壁纸");
|
|
||||||
tvResolution.setText("--");
|
|
||||||
tvFileSize.setText("--");
|
|
||||||
tvPath.setText("");
|
|
||||||
btnNext.setEnabled(false);
|
|
||||||
btnOpenGallery.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showError() {
|
|
||||||
ivWallpaper.setImageDrawable(null);
|
|
||||||
tvWallpaperName.setText("加载失败");
|
|
||||||
btnNext.setEnabled(true); // 允许尝试下一张
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showNextWallpaper() {
|
|
||||||
android.util.Log.i("CurrentWallpaperFragment", "showNextWallpaper() called");
|
|
||||||
|
|
||||||
cn.hugh.bz.gk2.model.AppConfig config = prefs.loadConfig();
|
|
||||||
|
|
||||||
if (config.getSelectedFolders().isEmpty() &&
|
|
||||||
(config.getImageUris() == null || config.getImageUris().isEmpty())) {
|
|
||||||
Toast.makeText(requireContext(), "请先在相册页面添加图片", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 禁用按钮防止重复点击
|
|
||||||
btnNext.setEnabled(false);
|
|
||||||
btnNext.setText("切换中...");
|
|
||||||
|
|
||||||
// 发送广播
|
|
||||||
cn.hugh.bz.gk2.receiver.WallpaperChangeReceiver receiver = new cn.hugh.bz.gk2.receiver.WallpaperChangeReceiver();
|
|
||||||
Intent intent = new Intent("cn.hugh.bz.gk2.ACTION_CHANGE_WALLPAPER");
|
|
||||||
intent.putExtra("force_change", true);
|
|
||||||
intent.putExtra("scheduled", false);
|
|
||||||
receiver.onReceive(requireContext(), intent);
|
|
||||||
|
|
||||||
Toast.makeText(requireContext(), "已切换", Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
// 延迟刷新
|
|
||||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
|
||||||
loadCurrentWallpaper();
|
|
||||||
btnNext.setText("切换下一张");
|
|
||||||
btnNext.setEnabled(true);
|
|
||||||
}, 800);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openInGallery() {
|
|
||||||
String currentUri = prefs.getLastUri();
|
|
||||||
if (currentUri != null) {
|
|
||||||
try {
|
|
||||||
Uri uri = Uri.parse(currentUri);
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
|
||||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
||||||
startActivity(intent);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Toast.makeText(requireContext(), "无法打开图片", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getDisplayName(String uriString) {
|
|
||||||
if (uriString == null || uriString.isEmpty()) {
|
|
||||||
return "未知图片";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Uri uri = Uri.parse(uriString);
|
|
||||||
|
|
||||||
// 尝试从 ContentResolver 获取文件名
|
|
||||||
try (Cursor cursor = requireContext().getContentResolver().query(uri, null, null, null, null)) {
|
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
|
||||||
int nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
|
|
||||||
if (nameIndex != -1) {
|
|
||||||
return cursor.getString(nameIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果失败,回退到路径解析
|
|
||||||
String path = uri.getLastPathSegment();
|
|
||||||
if (path != null) {
|
|
||||||
if (path.contains(":")) {
|
|
||||||
String[] parts = path.split(":");
|
|
||||||
if (parts.length > 1) {
|
|
||||||
path = parts[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (path.contains("/")) {
|
|
||||||
String[] segments = path.split("/");
|
|
||||||
path = segments[segments.length - 1];
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
return "未命名图片";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
loadCurrentWallpaper();
|
|
||||||
|
|
||||||
View rootView = getView();
|
|
||||||
if (rootView != null) {
|
|
||||||
BackgroundHelper.applyBackground(requireContext(), rootView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,12 +2,17 @@ package cn.hugh.bz.gk2.ui;
|
|||||||
|
|
||||||
import android.app.WallpaperManager;
|
import android.app.WallpaperManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.provider.OpenableColumns;
|
||||||
|
import android.database.Cursor;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -15,7 +20,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.airbnb.lottie.LottieAnimationView;
|
import com.google.android.material.button.MaterialButton;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -23,30 +28,41 @@ import cn.hugh.bz.gk2.R;
|
|||||||
import cn.hugh.bz.gk2.model.Album;
|
import cn.hugh.bz.gk2.model.Album;
|
||||||
import cn.hugh.bz.gk2.model.AppConfig;
|
import cn.hugh.bz.gk2.model.AppConfig;
|
||||||
import cn.hugh.bz.gk2.utils.BackgroundHelper;
|
import cn.hugh.bz.gk2.utils.BackgroundHelper;
|
||||||
|
import cn.hugh.bz.gk2.utils.ImageLoader;
|
||||||
import cn.hugh.bz.gk2.utils.WallpaperServiceHelper;
|
import cn.hugh.bz.gk2.utils.WallpaperServiceHelper;
|
||||||
import cn.hugh.bz.gk2.wallpaper.AlbumPreferences;
|
import cn.hugh.bz.gk2.wallpaper.AlbumPreferences;
|
||||||
import cn.hugh.bz.gk2.wallpaper.WallpaperPreferences;
|
import cn.hugh.bz.gk2.wallpaper.WallpaperPreferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主页 Fragment
|
* 主页 Fragment (Dashboard)
|
||||||
* 负责显示服务状态和启用/禁用服务
|
* 负责显示当前壁纸、服务状态和快速操作
|
||||||
*/
|
*/
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment {
|
||||||
private static final String TAG = "HomeFragment";
|
private static final String TAG = "HomeFragment";
|
||||||
|
|
||||||
|
// 状态相关
|
||||||
private TextView tvStatus;
|
private TextView tvStatus;
|
||||||
private LottieAnimationView statusAnimation;
|
private View viewStatusDot;
|
||||||
private TextView tvFolderInfo;
|
private MaterialButton btnToggle;
|
||||||
private TextView tvSingleImageInfo;
|
|
||||||
private Button btnToggle;
|
// 壁纸预览相关
|
||||||
private Button btnChangeNow;
|
private ImageView ivBlurBackground;
|
||||||
|
private ImageView ivCurrentWallpaper;
|
||||||
|
private View touchOverlay;
|
||||||
|
private MaterialButton btnChangeNow;
|
||||||
|
private MaterialButton btnOpenGallery;
|
||||||
|
|
||||||
|
// 信息相关
|
||||||
|
private TextView tvWallpaperName;
|
||||||
|
private TextView tvResolution;
|
||||||
|
private TextView tvFileSize;
|
||||||
private TextView tvAlbumName;
|
private TextView tvAlbumName;
|
||||||
private TextView tvAlbumInfo;
|
private MaterialButton btnManageAlbums;
|
||||||
private Button btnManageAlbums;
|
|
||||||
|
|
||||||
private WallpaperPreferences prefs;
|
private WallpaperPreferences prefs;
|
||||||
private AppConfig config;
|
private AppConfig config;
|
||||||
private AlbumPreferences albumPrefs;
|
private AlbumPreferences albumPrefs;
|
||||||
|
private ImageLoader imageLoader;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
@@ -60,226 +76,205 @@ public class HomeFragment extends Fragment {
|
|||||||
prefs = new WallpaperPreferences(requireContext());
|
prefs = new WallpaperPreferences(requireContext());
|
||||||
config = prefs.loadConfig();
|
config = prefs.loadConfig();
|
||||||
albumPrefs = new AlbumPreferences(requireContext());
|
albumPrefs = new AlbumPreferences(requireContext());
|
||||||
|
imageLoader = new ImageLoader(requireContext());
|
||||||
|
|
||||||
// 创建默认相册(如果不存在)
|
|
||||||
albumPrefs.createDefaultAlbumIfNeeded();
|
albumPrefs.createDefaultAlbumIfNeeded();
|
||||||
|
|
||||||
initViews(view);
|
initViews(view);
|
||||||
updateUI();
|
updateUI();
|
||||||
updateAlbumInfo();
|
loadCurrentWallpaper();
|
||||||
|
|
||||||
// 应用背景图片
|
// 应用自定义背景(如果有)
|
||||||
BackgroundHelper.applyBackground(requireContext(), view);
|
BackgroundHelper.applyBackground(requireContext(), view);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initViews(View view) {
|
private void initViews(View view) {
|
||||||
|
// 状态
|
||||||
tvStatus = view.findViewById(R.id.tvStatus);
|
tvStatus = view.findViewById(R.id.tvStatus);
|
||||||
statusAnimation = view.findViewById(R.id.statusAnimation);
|
viewStatusDot = view.findViewById(R.id.viewStatusDot);
|
||||||
tvFolderInfo = view.findViewById(R.id.tvFolderInfo);
|
|
||||||
tvSingleImageInfo = view.findViewById(R.id.tvSingleImageInfo);
|
|
||||||
btnToggle = view.findViewById(R.id.btnToggle);
|
btnToggle = view.findViewById(R.id.btnToggle);
|
||||||
|
|
||||||
|
// 预览
|
||||||
|
ivBlurBackground = view.findViewById(R.id.ivBlurBackground);
|
||||||
|
ivCurrentWallpaper = view.findViewById(R.id.ivCurrentWallpaper);
|
||||||
|
touchOverlay = view.findViewById(R.id.touchOverlay);
|
||||||
btnChangeNow = view.findViewById(R.id.btnChangeNow);
|
btnChangeNow = view.findViewById(R.id.btnChangeNow);
|
||||||
|
btnOpenGallery = view.findViewById(R.id.btnOpenGallery);
|
||||||
|
|
||||||
|
// 信息
|
||||||
|
tvWallpaperName = view.findViewById(R.id.tvWallpaperName);
|
||||||
|
tvResolution = view.findViewById(R.id.tvResolution);
|
||||||
|
tvFileSize = view.findViewById(R.id.tvFileSize);
|
||||||
tvAlbumName = view.findViewById(R.id.tvAlbumName);
|
tvAlbumName = view.findViewById(R.id.tvAlbumName);
|
||||||
tvAlbumInfo = view.findViewById(R.id.tvAlbumInfo);
|
|
||||||
btnManageAlbums = view.findViewById(R.id.btnManageAlbums);
|
btnManageAlbums = view.findViewById(R.id.btnManageAlbums);
|
||||||
|
|
||||||
btnToggle.setOnClickListener(v -> toggleService());
|
btnToggle.setOnClickListener(v -> toggleService());
|
||||||
btnChangeNow.setOnClickListener(v -> changeWallpaperNow());
|
btnChangeNow.setOnClickListener(v -> changeWallpaperNow());
|
||||||
|
btnOpenGallery.setOnClickListener(v -> openInGallery());
|
||||||
|
touchOverlay.setOnClickListener(v -> openInGallery());
|
||||||
btnManageAlbums.setOnClickListener(v -> openAlbumManagement());
|
btnManageAlbums.setOnClickListener(v -> openAlbumManagement());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleService() {
|
private void toggleService() {
|
||||||
if (!config.hasMedia()) {
|
if (!config.hasMedia()) {
|
||||||
Toast.makeText(requireContext(), "请先在相册页面添加文件夹或图片", Toast.LENGTH_SHORT).show();
|
Toast.makeText(requireContext(), "请先在相册页面添加图片", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean newState = !config.isEnabled();
|
boolean newState = !config.isEnabled();
|
||||||
|
|
||||||
if (newState) {
|
if (newState) {
|
||||||
// 每次启用都弹出壁纸设置引导
|
|
||||||
showSetWallpaperDialog();
|
showSetWallpaperDialog();
|
||||||
} else {
|
} else {
|
||||||
config.setEnabled(newState);
|
config.setEnabled(false);
|
||||||
prefs.saveConfig(config);
|
prefs.saveConfig(config);
|
||||||
|
new cn.hugh.bz.gk2.utils.AlarmScheduler(requireContext()).cancelSchedule();
|
||||||
cn.hugh.bz.gk2.utils.AlarmScheduler scheduler = new cn.hugh.bz.gk2.utils.AlarmScheduler(requireContext());
|
|
||||||
scheduler.cancelSchedule();
|
|
||||||
Toast.makeText(requireContext(), "已禁用", Toast.LENGTH_SHORT).show();
|
Toast.makeText(requireContext(), "已禁用", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUI();
|
updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示引导设置壁纸的对话框
|
|
||||||
*/
|
|
||||||
private void showSetWallpaperDialog() {
|
private void showSetWallpaperDialog() {
|
||||||
new androidx.appcompat.app.AlertDialog.Builder(requireContext())
|
new androidx.appcompat.app.AlertDialog.Builder(requireContext())
|
||||||
.setTitle("设置动态壁纸")
|
.setTitle("启用壁纸服务")
|
||||||
.setMessage("点击「确定」后将打开壁纸选择界面,请选择「BzForGk2」作为动态壁纸。\n\n设置完成后返回应用即可自动启用。")
|
.setMessage("点击确定后请选择「BzForGk2」作为动态壁纸。")
|
||||||
.setPositiveButton("确定", (dialog, which) -> {
|
.setPositiveButton("确定", (dialog, which) -> {
|
||||||
cn.hugh.bz.gk2.utils.FileLogger fileLogger = cn.hugh.bz.gk2.utils.FileLogger.getInstance(requireContext());
|
|
||||||
String msg = "User confirmed wallpaper service enable";
|
|
||||||
android.util.Log.i(TAG, msg);
|
|
||||||
fileLogger.log(TAG, msg);
|
|
||||||
|
|
||||||
openWallpaperSelector();
|
openWallpaperSelector();
|
||||||
// 启用服务
|
|
||||||
config.setEnabled(true);
|
config.setEnabled(true);
|
||||||
prefs.saveConfig(config);
|
prefs.saveConfig(config);
|
||||||
|
new cn.hugh.bz.gk2.utils.AlarmScheduler(requireContext()).scheduleWallpaperChange(config.getIntervalMinutes());
|
||||||
String scheduleMsg = "Scheduling alarm with interval: " + config.getIntervalMinutes() + " minutes";
|
|
||||||
android.util.Log.i(TAG, scheduleMsg);
|
|
||||||
fileLogger.log(TAG, scheduleMsg);
|
|
||||||
|
|
||||||
cn.hugh.bz.gk2.utils.AlarmScheduler scheduler = new cn.hugh.bz.gk2.utils.AlarmScheduler(requireContext());
|
|
||||||
scheduler.scheduleWallpaperChange(config.getIntervalMinutes());
|
|
||||||
|
|
||||||
Toast.makeText(requireContext(), "已启用,请选择壁纸", Toast.LENGTH_LONG).show();
|
|
||||||
updateUI();
|
updateUI();
|
||||||
})
|
})
|
||||||
.setNegativeButton("取消", null)
|
.setNegativeButton("取消", null)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开系统壁纸选择界面
|
|
||||||
*/
|
|
||||||
private void openWallpaperSelector() {
|
private void openWallpaperSelector() {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
|
Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
|
||||||
intent.putExtra(
|
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
|
||||||
WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
|
new android.content.ComponentName(requireContext(), cn.hugh.bz.gk2.wallpaper.AutoWallpaperService.class));
|
||||||
new android.content.ComponentName(requireContext(), cn.hugh.bz.gk2.wallpaper.AutoWallpaperService.class)
|
|
||||||
);
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 如果上述方法失败,尝试打开壁纸选择器
|
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
|
startActivity(new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER));
|
||||||
startActivity(intent);
|
|
||||||
Toast.makeText(requireContext(), "请选择 BzForGk2 动态壁纸", Toast.LENGTH_LONG).show();
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
// 最后的备用方案:打开壁纸设置页面
|
Toast.makeText(requireContext(), "无法打开壁纸设置", Toast.LENGTH_SHORT).show();
|
||||||
try {
|
|
||||||
Intent intent = new Intent("android.settings.WALLPAPER_SETTINGS");
|
|
||||||
startActivity(intent);
|
|
||||||
Toast.makeText(requireContext(), "请选择 动态壁纸 → BzForGk2", Toast.LENGTH_LONG).show();
|
|
||||||
} catch (Exception exc) {
|
|
||||||
Toast.makeText(requireContext(), "无法打开壁纸设置,请手动去系统设置中选择", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeWallpaperNow() {
|
private void changeWallpaperNow() {
|
||||||
android.util.Log.i(TAG, "changeWallpaperNow() called");
|
|
||||||
cn.hugh.bz.gk2.utils.FileLogger.getInstance(requireContext()).log(TAG, "changeWallpaperNow() called");
|
|
||||||
|
|
||||||
android.util.Log.i(TAG, "Selected folders count: " + config.getSelectedFolders().size());
|
|
||||||
cn.hugh.bz.gk2.utils.FileLogger.getInstance(requireContext()).log(TAG, "Selected folders count: " + config.getSelectedFolders().size());
|
|
||||||
|
|
||||||
List<String> imageUris = config.getImageUris();
|
|
||||||
int imageCount = (imageUris != null) ? imageUris.size() : 0;
|
|
||||||
android.util.Log.i(TAG, "Image URIs count: " + imageCount);
|
|
||||||
cn.hugh.bz.gk2.utils.FileLogger.getInstance(requireContext()).log(TAG, "Image URIs count: " + imageCount);
|
|
||||||
|
|
||||||
if (!config.hasMedia()) {
|
if (!config.hasMedia()) {
|
||||||
android.util.Log.w(TAG, "No media available, showing toast");
|
Toast.makeText(requireContext(), "请先添加图片", Toast.LENGTH_SHORT).show();
|
||||||
Toast.makeText(requireContext(), "请先在相册页面添加文件夹或图片", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
android.util.Log.i(TAG, "changeWallpaperNow: sending broadcast");
|
btnChangeNow.setEnabled(false);
|
||||||
cn.hugh.bz.gk2.utils.FileLogger.getInstance(requireContext()).log(TAG, "changeWallpaperNow: sending broadcast");
|
|
||||||
|
|
||||||
// 直接实例化 BroadcastReceiver 并调用 onReceive(避免隐式广播限制)
|
|
||||||
cn.hugh.bz.gk2.receiver.WallpaperChangeReceiver receiver = new cn.hugh.bz.gk2.receiver.WallpaperChangeReceiver();
|
cn.hugh.bz.gk2.receiver.WallpaperChangeReceiver receiver = new cn.hugh.bz.gk2.receiver.WallpaperChangeReceiver();
|
||||||
Intent intent = new Intent("cn.hugh.bz.gk2.ACTION_CHANGE_WALLPAPER");
|
Intent intent = new Intent("cn.hugh.bz.gk2.ACTION_CHANGE_WALLPAPER");
|
||||||
intent.putExtra("force_change", true); // 用户主动触发
|
intent.putExtra("force_change", true);
|
||||||
intent.putExtra("scheduled", false); // 非定时触发
|
|
||||||
receiver.onReceive(requireContext(), intent);
|
receiver.onReceive(requireContext(), intent);
|
||||||
|
|
||||||
Toast.makeText(requireContext(), "壁纸已更换", Toast.LENGTH_SHORT).show();
|
Toast.makeText(requireContext(), "正在更换...", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||||
|
loadCurrentWallpaper();
|
||||||
|
btnChangeNow.setEnabled(true);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadCurrentWallpaper() {
|
||||||
|
String currentUri = prefs.getLastUri();
|
||||||
|
if (currentUri == null || currentUri.isEmpty()) {
|
||||||
|
tvWallpaperName.setText("未设置壁纸");
|
||||||
|
ivCurrentWallpaper.setImageResource(R.drawable.ic_image);
|
||||||
|
ivBlurBackground.setImageDrawable(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
String fileName = getDisplayName(currentUri);
|
||||||
|
String size = getFileSize(Uri.parse(currentUri));
|
||||||
|
Bitmap bitmap = imageLoader.loadImage(currentUri, 500, 800); // 预览图不需要太大
|
||||||
|
|
||||||
|
if (isAdded()) {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
tvWallpaperName.setText(fileName);
|
||||||
|
tvFileSize.setText(size);
|
||||||
|
if (bitmap != null) {
|
||||||
|
ivCurrentWallpaper.setImageBitmap(bitmap);
|
||||||
|
ivBlurBackground.setImageBitmap(bitmap); // 布局中 alpha 已经设为 0.4
|
||||||
|
tvResolution.setText(bitmap.getWidth() + " x " + bitmap.getHeight());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDisplayName(String uriString) {
|
||||||
|
try {
|
||||||
|
Uri uri = Uri.parse(uriString);
|
||||||
|
try (Cursor cursor = requireContext().getContentResolver().query(uri, null, null, null, null)) {
|
||||||
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
|
int nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
|
||||||
|
if (nameIndex != -1) return cursor.getString(nameIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return uri.getLastPathSegment();
|
||||||
|
} catch (Exception e) { return "未知文件"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getFileSize(Uri uri) {
|
||||||
|
try (Cursor cursor = requireContext().getContentResolver().query(uri, null, null, null, null)) {
|
||||||
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
|
int sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE);
|
||||||
|
if (sizeIndex != -1) {
|
||||||
|
long size = cursor.getLong(sizeIndex);
|
||||||
|
if (size <= 0) return "0 B";
|
||||||
|
final String[] units = new String[]{"B", "KB", "MB", "GB"};
|
||||||
|
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
|
||||||
|
return String.format("%.1f %s", size / Math.pow(1024, digitGroups), units[digitGroups]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {}
|
||||||
|
return "未知大小";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openInGallery() {
|
||||||
|
String uriStr = prefs.getLastUri();
|
||||||
|
if (uriStr != null) {
|
||||||
|
try {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uriStr));
|
||||||
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toast.makeText(requireContext(), "无法打开图片", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openAlbumManagement() {
|
private void openAlbumManagement() {
|
||||||
// 切换到相册页面(ViewPager 的第 3 个页面,索引为 2)
|
|
||||||
if (getActivity() instanceof MainActivity) {
|
if (getActivity() instanceof MainActivity) {
|
||||||
MainActivity activity = (MainActivity) getActivity();
|
((MainActivity) getActivity()).switchToPage(1); // 调整后的相册页索引为 1
|
||||||
activity.switchToPage(2); // 2 是相册管理页面的索引
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUI() {
|
private void updateUI() {
|
||||||
// 检测壁纸服务是否真实在运行
|
boolean isRunning = WallpaperServiceHelper.isServiceRunning(requireContext()) && config.isEnabled();
|
||||||
boolean isServiceActuallyRunning = WallpaperServiceHelper.isServiceRunning(requireContext());
|
|
||||||
boolean isConfigEnabled = config.isEnabled();
|
|
||||||
|
|
||||||
// Update status - 优先使用实际运行状态
|
if (isRunning) {
|
||||||
if (isServiceActuallyRunning && isConfigEnabled) {
|
tvStatus.setText("服务已开启");
|
||||||
// 服务真正在运行
|
viewStatusDot.setBackgroundResource(R.drawable.status_indicator_enabled);
|
||||||
tvStatus.setText(R.string.status_enabled);
|
btnToggle.setText("禁用");
|
||||||
btnToggle.setText(R.string.disable);
|
|
||||||
btnChangeNow.setEnabled(true);
|
|
||||||
// 启动 Lottie 动画
|
|
||||||
if (statusAnimation != null) {
|
|
||||||
statusAnimation.setAnimation(R.raw.status_active);
|
|
||||||
statusAnimation.playAnimation();
|
|
||||||
}
|
|
||||||
} else if (isConfigEnabled && !isServiceActuallyRunning) {
|
|
||||||
// 配置已启用但服务未运行(用户可能还没选择壁纸)
|
|
||||||
tvStatus.setText("等待设置壁纸");
|
|
||||||
btnToggle.setText(R.string.disable);
|
|
||||||
btnChangeNow.setEnabled(false);
|
|
||||||
// 停止 Lottie 动画
|
|
||||||
if (statusAnimation != null) {
|
|
||||||
statusAnimation.cancelAnimation();
|
|
||||||
statusAnimation.setProgress(0f);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// 服务已禁用
|
tvStatus.setText("服务已禁用");
|
||||||
tvStatus.setText(R.string.status_disabled);
|
viewStatusDot.setBackgroundResource(R.drawable.status_indicator_disabled);
|
||||||
btnToggle.setText(R.string.enable);
|
btnToggle.setText("启用");
|
||||||
btnChangeNow.setEnabled(false);
|
|
||||||
// 停止 Lottie 动画
|
|
||||||
if (statusAnimation != null) {
|
|
||||||
statusAnimation.cancelAnimation();
|
|
||||||
statusAnimation.setProgress(0f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update folder info
|
|
||||||
int folderCount = config.getSelectedFolders().size();
|
|
||||||
if (folderCount == 0) {
|
|
||||||
tvFolderInfo.setText("未选择文件夹");
|
|
||||||
} else {
|
|
||||||
tvFolderInfo.setText("已选择 " + folderCount + " 个文件夹");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update single image info
|
|
||||||
List<String> imageUris = config.getImageUris();
|
|
||||||
if (imageUris != null && !imageUris.isEmpty()) {
|
|
||||||
tvSingleImageInfo.setText("已选择 " + imageUris.size() + " 张图片");
|
|
||||||
tvSingleImageInfo.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
tvSingleImageInfo.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新相册信息显示
|
|
||||||
*/
|
|
||||||
private void updateAlbumInfo() {
|
|
||||||
Album activeAlbum = albumPrefs.getActiveAlbum();
|
Album activeAlbum = albumPrefs.getActiveAlbum();
|
||||||
if (activeAlbum != null) {
|
tvAlbumName.setText(activeAlbum != null ? activeAlbum.getName() : "默认相册");
|
||||||
tvAlbumName.setText(activeAlbum.getName());
|
|
||||||
tvAlbumInfo.setText(activeAlbum.getMediaSummary());
|
|
||||||
} else {
|
|
||||||
tvAlbumName.setText("默认相册");
|
|
||||||
tvAlbumInfo.setText("无媒体内容");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -287,12 +282,6 @@ public class HomeFragment extends Fragment {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
config = prefs.loadConfig();
|
config = prefs.loadConfig();
|
||||||
updateUI();
|
updateUI();
|
||||||
updateAlbumInfo();
|
loadCurrentWallpaper();
|
||||||
|
|
||||||
// 重新应用背景图片(从设置页面返回时可能需要更新)
|
|
||||||
View rootView = getView();
|
|
||||||
if (rootView != null) {
|
|
||||||
BackgroundHelper.applyBackground(requireContext(), rootView);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
// 导航容器 ID(LinearLayout,用于点击事件)
|
// 导航容器 ID(LinearLayout,用于点击事件)
|
||||||
int[] navContainerIds = {
|
int[] navContainerIds = {
|
||||||
R.id.navHome,
|
R.id.navHome,
|
||||||
R.id.navWallpaper,
|
|
||||||
R.id.navAlbum,
|
R.id.navAlbum,
|
||||||
R.id.navHistory,
|
R.id.navHistory,
|
||||||
R.id.navSettings
|
R.id.navSettings
|
||||||
@@ -179,7 +178,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
// 导航文本 ID(TextView,用于更新选中状态)
|
// 导航文本 ID(TextView,用于更新选中状态)
|
||||||
int[] navTextIds = {
|
int[] navTextIds = {
|
||||||
R.id.tvNavHome,
|
R.id.tvNavHome,
|
||||||
R.id.tvNavWallpaper,
|
|
||||||
R.id.tvNavAlbum,
|
R.id.tvNavAlbum,
|
||||||
R.id.tvNavHistory,
|
R.id.tvNavHistory,
|
||||||
R.id.tvNavSettings
|
R.id.tvNavSettings
|
||||||
@@ -188,18 +186,17 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
// 图标 ID
|
// 图标 ID
|
||||||
int[] navIconIds = {
|
int[] navIconIds = {
|
||||||
R.id.ivNavHome,
|
R.id.ivNavHome,
|
||||||
R.id.ivNavWallpaper,
|
|
||||||
R.id.ivNavAlbum,
|
R.id.ivNavAlbum,
|
||||||
R.id.ivNavHistory,
|
R.id.ivNavHistory,
|
||||||
R.id.ivNavSettings
|
R.id.ivNavSettings
|
||||||
};
|
};
|
||||||
|
|
||||||
// 初始化导航项和图标数组
|
// 初始化导航项和图标数组
|
||||||
navContainers = new LinearLayout[5];
|
navContainers = new LinearLayout[4];
|
||||||
navItems = new TextView[5];
|
navItems = new TextView[4];
|
||||||
navIcons = new ImageView[5];
|
navIcons = new ImageView[4];
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
navContainers[i] = findViewById(navContainerIds[i]);
|
navContainers[i] = findViewById(navContainerIds[i]);
|
||||||
navItems[i] = findViewById(navTextIds[i]);
|
navItems[i] = findViewById(navTextIds[i]);
|
||||||
navIcons[i] = findViewById(navIconIds[i]);
|
navIcons[i] = findViewById(navIconIds[i]);
|
||||||
@@ -254,10 +251,10 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 切换到指定的页面
|
* 切换到指定的页面
|
||||||
* @param position 页面索引(0=主页,1=壁纸,2=相册,3=历史,4=设置)
|
* @param position 页面索引(0=主页,1=相册,2=历史,3=设置)
|
||||||
*/
|
*/
|
||||||
public void switchToPage(int position) {
|
public void switchToPage(int position) {
|
||||||
if (viewPager != null && position >= 0 && position < 5) {
|
if (viewPager != null && position >= 0 && position < 4) {
|
||||||
viewPager.setCurrentItem(position, false);
|
viewPager.setCurrentItem(position, false);
|
||||||
// 更新底部导航选中状态
|
// 更新底部导航选中状态
|
||||||
updateNavSelection(position);
|
updateNavSelection(position);
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ViewPager2 适配器,用于管理五个 Fragment 页面
|
* ViewPager2 适配器,用于管理四个 Fragment 页面
|
||||||
*/
|
*/
|
||||||
public class ViewPagerAdapter extends FragmentStateAdapter {
|
public class ViewPagerAdapter extends FragmentStateAdapter {
|
||||||
private static final int NUM_PAGES = 5;
|
private static final int NUM_PAGES = 4;
|
||||||
|
|
||||||
public ViewPagerAdapter(FragmentActivity fa) {
|
public ViewPagerAdapter(FragmentActivity fa) {
|
||||||
super(fa);
|
super(fa);
|
||||||
@@ -22,12 +22,10 @@ public class ViewPagerAdapter extends FragmentStateAdapter {
|
|||||||
case 0:
|
case 0:
|
||||||
return new HomeFragment();
|
return new HomeFragment();
|
||||||
case 1:
|
case 1:
|
||||||
return new CurrentWallpaperFragment();
|
|
||||||
case 2:
|
|
||||||
return new AlbumManagementFragment();
|
return new AlbumManagementFragment();
|
||||||
case 3:
|
case 2:
|
||||||
return new WallpaperHistoryFragment();
|
return new WallpaperHistoryFragment();
|
||||||
case 4:
|
case 3:
|
||||||
return new SettingsFragment();
|
return new SettingsFragment();
|
||||||
default:
|
default:
|
||||||
return new HomeFragment();
|
return new HomeFragment();
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import android.content.Intent;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.DocumentsContract;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -82,6 +82,12 @@ public class WallpaperHistoryFragment extends Fragment {
|
|||||||
openAlbumForHistory(history);
|
openAlbumForHistory(history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReuseClick(WallpaperHistory history) {
|
||||||
|
// 跳转到相册管理页面并定位到该相册
|
||||||
|
jumpToAlbum(history.getAlbumId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDelete(WallpaperHistory history) {
|
public void onDelete(WallpaperHistory history) {
|
||||||
deleteHistory(history);
|
deleteHistory(history);
|
||||||
@@ -93,6 +99,18 @@ public class WallpaperHistoryFragment extends Fragment {
|
|||||||
btnClearHistory.setOnClickListener(v -> confirmClearHistory());
|
btnClearHistory.setOnClickListener(v -> confirmClearHistory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void jumpToAlbum(String albumId) {
|
||||||
|
if (albumId == null) return;
|
||||||
|
|
||||||
|
// 设置目标相册ID(需要在 AlbumManagementFragment 中处理)
|
||||||
|
AlbumManagementFragment.targetAlbumId = albumId;
|
||||||
|
|
||||||
|
// 切换到相册页面 (Index 1)
|
||||||
|
if (getActivity() instanceof MainActivity) {
|
||||||
|
((MainActivity) getActivity()).switchToPage(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void loadHistory() {
|
private void loadHistory() {
|
||||||
historyList = historyManager.loadHistory();
|
historyList = historyManager.loadHistory();
|
||||||
adapter.updateHistory(historyList);
|
adapter.updateHistory(historyList);
|
||||||
@@ -211,16 +229,18 @@ public class WallpaperHistoryFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class HistoryViewHolder extends RecyclerView.ViewHolder {
|
class HistoryViewHolder extends RecyclerView.ViewHolder {
|
||||||
private final android.widget.ImageView ivThumbnail;
|
private final ImageView ivThumbnail;
|
||||||
private final TextView tvAlbumName;
|
private final TextView tvAlbumName;
|
||||||
private final TextView tvTimestamp;
|
private final TextView tvTimestamp;
|
||||||
private final MaterialButton btnDelete;
|
private final TextView btnReuse; // Changed to TextView for click area
|
||||||
|
private final ImageView btnDelete; // Changed to ImageView
|
||||||
|
|
||||||
public HistoryViewHolder(@NonNull View itemView) {
|
public HistoryViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
ivThumbnail = itemView.findViewById(R.id.ivThumbnail);
|
ivThumbnail = itemView.findViewById(R.id.ivThumbnail);
|
||||||
tvAlbumName = itemView.findViewById(R.id.tvAlbumName);
|
tvAlbumName = itemView.findViewById(R.id.tvAlbumName);
|
||||||
tvTimestamp = itemView.findViewById(R.id.tvTimestamp);
|
tvTimestamp = itemView.findViewById(R.id.tvTimestamp);
|
||||||
|
btnReuse = itemView.findViewById(R.id.btnReuse);
|
||||||
btnDelete = itemView.findViewById(R.id.btnDelete);
|
btnDelete = itemView.findViewById(R.id.btnDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,17 +258,24 @@ public class WallpaperHistoryFragment extends Fragment {
|
|||||||
tvAlbumName.setText(history.getAlbumName());
|
tvAlbumName.setText(history.getAlbumName());
|
||||||
|
|
||||||
// 时间戳格式化
|
// 时间戳格式化
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm", Locale.getDefault());
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.getDefault());
|
||||||
String timestamp = sdf.format(new Date(history.getTimestamp()));
|
String timestamp = sdf.format(new Date(history.getTimestamp()));
|
||||||
tvTimestamp.setText(timestamp);
|
tvTimestamp.setText(timestamp);
|
||||||
|
|
||||||
// 卡片点击事件
|
// 卡片点击事件 (预览大图)
|
||||||
itemView.setOnClickListener(v -> {
|
itemView.setOnClickListener(v -> {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onItemClick(history);
|
callback.onItemClick(history);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 跳转相册按钮
|
||||||
|
btnReuse.setOnClickListener(v -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onReuseClick(history);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 删除按钮
|
// 删除按钮
|
||||||
btnDelete.setOnClickListener(v -> {
|
btnDelete.setOnClickListener(v -> {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
@@ -260,6 +287,7 @@ public class WallpaperHistoryFragment extends Fragment {
|
|||||||
|
|
||||||
interface HistoryCallback {
|
interface HistoryCallback {
|
||||||
void onItemClick(WallpaperHistory history);
|
void onItemClick(WallpaperHistory history);
|
||||||
|
void onReuseClick(WallpaperHistory history);
|
||||||
void onDelete(WallpaperHistory history);
|
void onDelete(WallpaperHistory history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
android:paddingEnd="8dp"
|
android:paddingEnd="8dp"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<!-- 主页 -->
|
<!-- 主页 (仪表盘) -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/navHome"
|
android:id="@+id/navHome"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -73,38 +73,6 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 壁纸 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/navWallpaper"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:background="@drawable/selector_nav_item_bg"
|
|
||||||
android:layout_marginEnd="4dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/ivNavWallpaper"
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
|
||||||
android:src="@drawable/ic_image"
|
|
||||||
app:tint="@color/selector_nav_item_icon_color" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvNavWallpaper"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="壁纸"
|
|
||||||
android:textSize="10sp"
|
|
||||||
android:textColor="@color/selector_nav_item_text_color"
|
|
||||||
android:layout_marginTop="2dp"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- 相册 -->
|
<!-- 相册 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/navAlbum"
|
android:id="@+id/navAlbum"
|
||||||
|
|||||||
@@ -1,183 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
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"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/bg_primary_modern">
|
|
||||||
|
|
||||||
<!-- 顶部标题 -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="当前壁纸"
|
|
||||||
android:textSize="@dimen/text_size_xl"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/text_primary_modern"
|
|
||||||
android:layout_marginTop="@dimen/spacing_lg"
|
|
||||||
android:layout_marginStart="@dimen/spacing_lg"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
|
||||||
|
|
||||||
<!-- 壁纸预览卡片 (占据主要空间) -->
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/cardWallpaper"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginHorizontal="@dimen/spacing_lg"
|
|
||||||
android:layout_marginTop="@dimen/spacing_md"
|
|
||||||
android:layout_marginBottom="@dimen/spacing_lg"
|
|
||||||
app:cardElevation="0dp"
|
|
||||||
app:cardCornerRadius="@dimen/corner_radius_lg"
|
|
||||||
app:cardBackgroundColor="@color/bg_secondary_modern"
|
|
||||||
app:strokeColor="@color/bg_secondary_modern"
|
|
||||||
app:strokeWidth="1dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvTitle"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/infoContainer">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/ivWallpaper"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:contentDescription="当前壁纸预览" />
|
|
||||||
|
|
||||||
<!-- 点击提示遮罩 -->
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:id="@+id/touchOverlay" />
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
<!-- 底部信息和操作区 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/infoContainer"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingHorizontal="@dimen/spacing_lg"
|
|
||||||
android:paddingBottom="100dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent">
|
|
||||||
|
|
||||||
<!-- 壁纸信息 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_marginBottom="@dimen/spacing_lg">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvWallpaperName"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Loading..."
|
|
||||||
android:textSize="@dimen/text_size_lg"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/text_primary_modern"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:ellipsize="end" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginTop="@dimen/spacing_xs"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="@dimen/icon_size_xs"
|
|
||||||
android:layout_height="@dimen/icon_size_xs"
|
|
||||||
android:src="@drawable/ic_image"
|
|
||||||
app:tint="@color/text_secondary_modern" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvResolution"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="1080 x 1920"
|
|
||||||
android:textSize="@dimen/text_size_sm"
|
|
||||||
android:textColor="@color/text_secondary_modern"
|
|
||||||
android:layout_marginStart="4dp" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="12dp"
|
|
||||||
android:background="@color/text_hint_modern"
|
|
||||||
android:layout_marginHorizontal="8dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvFileSize"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="2.5 MB"
|
|
||||||
android:textSize="@dimen/text_size_sm"
|
|
||||||
android:textColor="@color/text_secondary_modern" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvPath"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="/storage/emulated/0/..."
|
|
||||||
android:textSize="@dimen/text_size_xs"
|
|
||||||
android:textColor="@color/text_hint_modern"
|
|
||||||
android:layout_marginTop="@dimen/spacing_sm"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:ellipsize="middle"
|
|
||||||
android:background="@drawable/badge_background"
|
|
||||||
android:backgroundTint="@color/bg_secondary_modern"
|
|
||||||
android:paddingHorizontal="8dp"
|
|
||||||
android:paddingVertical="4dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- 操作按钮行 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btnOpenGallery"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="查看原图"
|
|
||||||
android:textSize="@dimen/text_size_md"
|
|
||||||
android:textColor="@color/text_primary_modern"
|
|
||||||
app:icon="@drawable/ic_image"
|
|
||||||
app:iconTint="@color/text_primary_modern"
|
|
||||||
app:backgroundTint="@color/bg_secondary_modern"
|
|
||||||
app:cornerRadius="@dimen/corner_radius_pill"
|
|
||||||
style="@style/Widget.Material3.Button.Icon"
|
|
||||||
android:layout_marginEnd="@dimen/spacing_sm" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btnNext"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:layout_weight="1.5"
|
|
||||||
android:text="切换下一张"
|
|
||||||
android:textSize="@dimen/text_size_md"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:icon="@drawable/ic_arrow_forward"
|
|
||||||
app:iconGravity="textEnd"
|
|
||||||
app:backgroundTint="@color/sky_blue_primary"
|
|
||||||
app:cornerRadius="@dimen/corner_radius_pill"
|
|
||||||
style="@style/Widget.Material3.Button.Icon"
|
|
||||||
android:layout_marginStart="@dimen/spacing_sm" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -1,221 +1,288 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/transparent"
|
android:background="@color/bg_primary">
|
||||||
android:fillViewport="true">
|
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.core.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent">
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingHorizontal="@dimen/spacing_lg"
|
|
||||||
android:paddingTop="@dimen/spacing_lg"
|
|
||||||
android:paddingBottom="100dp"
|
|
||||||
android:clipToPadding="false">
|
|
||||||
|
|
||||||
<!-- Header -->
|
<LinearLayout
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/app_name"
|
|
||||||
android:textSize="@dimen/text_size_xl"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/text_primary_modern"
|
|
||||||
android:layout_marginBottom="@dimen/spacing_lg" />
|
|
||||||
|
|
||||||
<!-- 状态仪表盘 -->
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/spacing_lg"
|
android:orientation="vertical"
|
||||||
app:cardElevation="0dp"
|
android:paddingBottom="80dp">
|
||||||
app:cardCornerRadius="@dimen/corner_radius_lg"
|
|
||||||
app:cardBackgroundColor="@color/bg_card"
|
|
||||||
app:strokeColor="@color/bg_secondary_modern"
|
|
||||||
app:strokeWidth="1dp">
|
|
||||||
|
|
||||||
|
<!-- Top Immersive Preview Section -->
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="420dp">
|
||||||
|
|
||||||
|
<!-- Blurred Background -->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivBlurBackground"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:alpha="0.4" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/bg_gradient_overlay" />
|
||||||
|
|
||||||
|
<!-- Main Content -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingTop="48dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="当前正在播放"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/text_secondary"
|
||||||
|
android:letterSpacing="0.1"
|
||||||
|
android:textAllCaps="true" />
|
||||||
|
|
||||||
|
<!-- Floating Card for Wallpaper -->
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:layout_width="220dp"
|
||||||
|
android:layout_height="360dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:cardCornerRadius="24dp"
|
||||||
|
app:cardElevation="12dp"
|
||||||
|
app:strokeWidth="4dp"
|
||||||
|
app:strokeColor="@color/white">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivCurrentWallpaper"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/ic_image" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/touchOverlay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/selectableItemBackground" />
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Floating Quick Actions -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@drawable/bg_glass_card"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnChangeNow"
|
||||||
|
style="@style/Widget.Material3.Button.IconButton"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
app:icon="@drawable/ic_refresh"
|
||||||
|
app:iconSize="24dp"
|
||||||
|
app:iconTint="@color/sky_blue_primary"
|
||||||
|
app:backgroundTint="@android:color/transparent" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnOpenGallery"
|
||||||
|
style="@style/Widget.Material3.Button.IconButton"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
app:icon="@drawable/ic_image"
|
||||||
|
app:iconSize="22dp"
|
||||||
|
app:iconTint="@color/text_primary"
|
||||||
|
app:backgroundTint="@android:color/transparent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<!-- Status Bar Strip -->
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="-12dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="4dp"
|
||||||
|
app:cardBackgroundColor="@color/white">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingHorizontal="16dp">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/viewStatusDot"
|
||||||
|
android:layout_width="10dp"
|
||||||
|
android:layout_height="10dp"
|
||||||
|
android:background="@drawable/status_indicator_enabled" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvStatus"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:text="服务已开启"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/text_primary"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnToggle"
|
||||||
|
style="@style/Widget.Material3.Button.TextButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="禁用"
|
||||||
|
android:textColor="@color/accent_primary"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<!-- Details Section -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center"
|
android:padding="16dp">
|
||||||
android:padding="@dimen/spacing_xl">
|
|
||||||
|
|
||||||
<!-- 动画容器 -->
|
<!-- Media Info Card -->
|
||||||
<FrameLayout
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:layout_width="120dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="120dp"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/bg_icon_container_sky"
|
app:cardCornerRadius="16dp"
|
||||||
android:backgroundTint="@color/sky_blue_container"
|
app:cardElevation="0dp"
|
||||||
android:padding="20dp">
|
app:strokeWidth="1dp"
|
||||||
|
app:strokeColor="#E0E0E0"
|
||||||
|
app:cardBackgroundColor="@color/white">
|
||||||
|
|
||||||
<com.airbnb.lottie.LottieAnimationView
|
<LinearLayout
|
||||||
android:id="@+id/statusAnimation"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
app:lottie_rawRes="@raw/status_active"
|
android:orientation="vertical"
|
||||||
app:lottie_loop="true"
|
android:padding="16dp">
|
||||||
app:lottie_autoPlay="false" />
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvStatus"
|
android:id="@+id/tvWallpaperName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/status_disabled"
|
android:text="wallpaper_name.jpg"
|
||||||
android:textSize="@dimen/text_size_lg"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/text_primary_modern"
|
android:textColor="@color/text_primary"
|
||||||
android:layout_marginTop="@dimen/spacing_md" />
|
android:ellipsize="middle"
|
||||||
|
android:singleLine="true" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/tvFolderInfo"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginTop="8dp"
|
||||||
android:text="服务未运行"
|
android:orientation="horizontal">
|
||||||
android:textSize="@dimen/text_size_sm"
|
|
||||||
android:textColor="@color/text_secondary_modern"
|
|
||||||
android:layout_marginTop="@dimen/spacing_xs" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvSingleImageInfo"
|
android:id="@+id/tvResolution"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="1080 x 1920"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="@color/text_secondary" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=" • "
|
||||||
|
android:textColor="@color/text_hint" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvFileSize"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="2.4 MB"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="@color/text_secondary" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<!-- Active Album Card -->
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="@dimen/text_size_sm"
|
android:layout_marginTop="12dp"
|
||||||
android:textColor="@color/text_secondary_modern"
|
app:cardCornerRadius="16dp"
|
||||||
android:visibility="gone" />
|
app:cardElevation="0dp"
|
||||||
|
app:strokeWidth="1dp"
|
||||||
|
app:strokeColor="#E0E0E0"
|
||||||
|
app:cardBackgroundColor="@color/white">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="当前相册"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="@color/text_secondary" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvAlbumName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:text="默认相册"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/text_primary" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnManageAlbums"
|
||||||
|
style="@style/Widget.Material3.Button.TonalButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:text="管理"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:backgroundTint="@color/sky_blue_container"
|
||||||
|
android:textColor="@color/sky_blue_primary"
|
||||||
|
app:cornerRadius="18dp"
|
||||||
|
android:insetTop="0dp"
|
||||||
|
android:insetBottom="0dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
<!-- 控制按钮组 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginBottom="@dimen/spacing_lg">
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btnToggle"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="72dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginEnd="@dimen/spacing_sm"
|
|
||||||
android:text="@string/enable"
|
|
||||||
android:textSize="@dimen/text_size_md"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:icon="@drawable/ic_play"
|
|
||||||
app:iconSize="24dp"
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:cornerRadius="@dimen/corner_radius_lg"
|
|
||||||
app:backgroundTint="@color/sky_blue_primary"
|
|
||||||
style="@style/Widget.Material3.Button.Icon" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btnChangeNow"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="72dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginStart="@dimen/spacing_sm"
|
|
||||||
android:text="@string/change_now"
|
|
||||||
android:textSize="@dimen/text_size_md"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:enabled="false"
|
|
||||||
app:icon="@drawable/ic_refresh"
|
|
||||||
app:iconSize="24dp"
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:cornerRadius="@dimen/corner_radius_lg"
|
|
||||||
app:backgroundTint="@color/azure_blue_container"
|
|
||||||
app:iconTint="@color/azure_blue_dark"
|
|
||||||
android:textColor="@color/azure_blue_dark"
|
|
||||||
style="@style/Widget.Material3.Button.Icon" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
<!-- 当前相册卡片 -->
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="正在播放"
|
|
||||||
android:textSize="@dimen/text_size_md"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/text_primary_modern"
|
|
||||||
android:layout_marginBottom="@dimen/spacing_sm"
|
|
||||||
android:layout_marginStart="@dimen/spacing_xs" />
|
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/cardAlbum"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:cardElevation="0dp"
|
|
||||||
app:cardCornerRadius="@dimen/corner_radius_lg"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
|
||||||
app:strokeColor="@color/bg_secondary_modern"
|
|
||||||
app:strokeWidth="1dp">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="@dimen/spacing_md">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/ivAlbumIcon"
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:src="@drawable/ic_album"
|
|
||||||
app:tint="@color/sky_blue_primary"
|
|
||||||
android:background="@drawable/bg_icon_container_sky"
|
|
||||||
android:backgroundTint="@color/sky_blue_container"
|
|
||||||
android:padding="12dp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvAlbumName"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="默认相册"
|
|
||||||
android:textSize="@dimen/text_size_md"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/text_primary_modern"
|
|
||||||
android:layout_marginStart="@dimen/spacing_md"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/ivAlbumIcon"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/ivAlbumIcon"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/btnManageAlbums" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvAlbumInfo"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="0 个文件夹 · 0 张图片"
|
|
||||||
android:textSize="@dimen/text_size_sm"
|
|
||||||
android:textColor="@color/text_secondary_modern"
|
|
||||||
android:layout_marginStart="@dimen/spacing_md"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/ivAlbumIcon"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/ivAlbumIcon"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/btnManageAlbums" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btnManageAlbums"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="管理"
|
|
||||||
style="@style/Widget.Material3.Button.TextButton"
|
|
||||||
android:textColor="@color/sky_blue_primary"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
|
||||||
@@ -1,68 +1,107 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:background="@color/bg_primary">
|
||||||
android:background="@color/background">
|
|
||||||
|
|
||||||
<!-- 标题栏 -->
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:background="@android:color/transparent"
|
||||||
android:gravity="center_vertical"
|
app:elevation="0dp">
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
android:paddingTop="16dp"
|
android:layout_width="match_parent"
|
||||||
android:paddingBottom="12dp"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/surface">
|
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingHorizontal="24dp"
|
||||||
|
android:paddingTop="32dp"
|
||||||
|
android:paddingBottom="16dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="历史记录"
|
||||||
|
android:textSize="32sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/text_primary" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:text="回顾您使用过的壁纸"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/text_secondary" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnClearHistory"
|
||||||
|
style="@style/Widget.Material3.Button.TonalButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="清空"
|
||||||
|
android:textColor="@color/status_error_text"
|
||||||
|
app:backgroundTint="@color/status_error_bg"
|
||||||
|
app:icon="@drawable/ic_delete"
|
||||||
|
app:iconTint="@color/status_error_text"
|
||||||
|
app:cornerRadius="20dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rvHistory"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingHorizontal="12dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="80dp"
|
||||||
|
android:clipToPadding="false" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:id="@+id/tvEmptyHint"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="壁纸历史"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/text_primary" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btnClearHistory"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="36dp"
|
android:layout_height="wrap_content"
|
||||||
android:text="清空"
|
android:layout_gravity="center"
|
||||||
android:textSize="14sp"
|
android:text="暂无历史记录
|
||||||
app:icon="@drawable/ic_delete"
|
使用后的壁纸会出现在这里"
|
||||||
app:iconGravity="textStart"
|
android:textSize="16sp"
|
||||||
app:iconPadding="4dp"
|
android:textColor="@color/text_hint"
|
||||||
app:cornerRadius="8dp"
|
android:gravity="center"
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
android:lineSpacingExtra="4dp"
|
||||||
android:textColor="@color/error"
|
android:visibility="gone" />
|
||||||
app:iconTint="@color/error"
|
|
||||||
app:strokeColor="@color/error" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<!-- 历史记录列表 -->
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rvHistory"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:clipToPadding="false" />
|
|
||||||
|
|
||||||
<!-- 空状态提示 -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvEmptyHint"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="暂无历史记录\n壁纸使用后会自动记录在这里"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textColor="@color/text_hint"
|
|
||||||
android:gravity="center"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -5,73 +5,102 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="6dp"
|
android:layout_margin="6dp"
|
||||||
app:cardElevation="2dp"
|
app:cardElevation="0dp"
|
||||||
app:cardCornerRadius="12dp"
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardBackgroundColor="@color/white"
|
||||||
|
app:strokeWidth="0dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true">
|
android:focusable="true"
|
||||||
|
android:foreground="?attr/selectableItemBackground">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<!-- 缩略图 -->
|
<!-- Image Container -->
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/ivThumbnail"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="150dp"
|
android:layout_height="180dp">
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:background="@color/image_placeholder" />
|
|
||||||
|
|
||||||
<!-- 信息区域 -->
|
<ImageView
|
||||||
|
android:id="@+id/ivThumbnail"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:background="@color/bg_secondary_modern" />
|
||||||
|
|
||||||
|
<!-- Gradient Overlay for Text Readability -->
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:background="@drawable/bg_gradient_overlay"
|
||||||
|
android:rotation="180" />
|
||||||
|
|
||||||
|
<!-- Timestamp Badge -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvTimestamp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="top|end"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:background="@drawable/bg_glass_card"
|
||||||
|
android:paddingHorizontal="8dp"
|
||||||
|
android:paddingVertical="4dp"
|
||||||
|
android:text="14:30"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<!-- Info Section -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="12dp">
|
android:padding="12dp">
|
||||||
|
|
||||||
<!-- 相册名称 -->
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvAlbumName"
|
android:id="@+id/tvAlbumName"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="相册名称"
|
android:text="相册名称"
|
||||||
android:textSize="14sp"
|
android:textSize="13sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/text_primary"
|
android:textColor="@color/text_primary"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end" />
|
||||||
android:drawableStart="@drawable/ic_album"
|
|
||||||
android:drawablePadding="4dp" />
|
|
||||||
|
|
||||||
<!-- 时间戳 -->
|
<LinearLayout
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvTimestamp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="01-15 14:30"
|
android:orientation="horizontal"
|
||||||
android:textSize="12sp"
|
|
||||||
android:textColor="@color/text_hint"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:drawableStart="@drawable/ic_schedule"
|
|
||||||
android:drawablePadding="4dp" />
|
|
||||||
|
|
||||||
<!-- 删除按钮 -->
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btnDelete"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:text="删除"
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
app:icon="@drawable/ic_delete"
|
android:gravity="center_vertical">
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:iconPadding="4dp"
|
<!-- Reuse/Jump Button -->
|
||||||
app:cornerRadius="6dp"
|
<TextView
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
android:id="@+id/btnReuse"
|
||||||
android:textColor="@color/error"
|
android:layout_width="0dp"
|
||||||
app:iconTint="@color/error"
|
android:layout_height="wrap_content"
|
||||||
app:strokeColor="@color/error" />
|
android:layout_weight="1"
|
||||||
|
android:text="跳转相册"
|
||||||
|
android:textSize="11sp"
|
||||||
|
android:textColor="@color/sky_blue_primary"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<!-- Delete Button -->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/btnDelete"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:src="@drawable/ic_delete"
|
||||||
|
app:tint="@color/text_hint"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -3,30 +3,17 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/nav_home"
|
android:id="@+id/nav_home"
|
||||||
android:icon="@drawable/ic_home"
|
android:icon="@drawable/ic_home"
|
||||||
android:title="@string/nav_home"
|
android:title="首页" />
|
||||||
android:orderInCategory="0" />
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/nav_wallpaper"
|
|
||||||
android:icon="@drawable/ic_image"
|
|
||||||
android:title="@string/nav_wallpaper"
|
|
||||||
android:orderInCategory="1" />
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_albums"
|
android:id="@+id/nav_albums"
|
||||||
android:icon="@drawable/ic_album"
|
android:icon="@drawable/ic_album"
|
||||||
android:title="@string/nav_albums"
|
android:title="相册" />
|
||||||
android:orderInCategory="2" />
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_history"
|
android:id="@+id/nav_history"
|
||||||
android:icon="@drawable/ic_history"
|
android:icon="@drawable/ic_history"
|
||||||
android:title="@string/nav_history"
|
android:title="历史" />
|
||||||
android:orderInCategory="3" />
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_settings"
|
android:id="@+id/nav_settings"
|
||||||
android:icon="@drawable/ic_settings"
|
android:icon="@drawable/ic_settings"
|
||||||
android:title="@string/nav_settings"
|
android:title="设置" />
|
||||||
android:orderInCategory="4" />
|
|
||||||
</menu>
|
</menu>
|
||||||
Reference in new issue
Block a user