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
+627
-962
No files matched your search
@@ -27,7 +27,8 @@
|
||||
"mcp__plugin_serena_serena__replace_content",
|
||||
"Bash(git reset:*)",
|
||||
"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.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.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -15,7 +20,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.airbnb.lottie.LottieAnimationView;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
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.AppConfig;
|
||||
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.wallpaper.AlbumPreferences;
|
||||
import cn.hugh.bz.gk2.wallpaper.WallpaperPreferences;
|
||||
|
||||
/**
|
||||
* 主页 Fragment
|
||||
* 负责显示服务状态和启用/禁用服务
|
||||
* 主页 Fragment (Dashboard)
|
||||
* 负责显示当前壁纸、服务状态和快速操作
|
||||
*/
|
||||
public class HomeFragment extends Fragment {
|
||||
private static final String TAG = "HomeFragment";
|
||||
|
||||
// 状态相关
|
||||
private TextView tvStatus;
|
||||
private LottieAnimationView statusAnimation;
|
||||
private TextView tvFolderInfo;
|
||||
private TextView tvSingleImageInfo;
|
||||
private Button btnToggle;
|
||||
private Button btnChangeNow;
|
||||
private View viewStatusDot;
|
||||
private MaterialButton btnToggle;
|
||||
|
||||
// 壁纸预览相关
|
||||
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 tvAlbumInfo;
|
||||
private Button btnManageAlbums;
|
||||
private MaterialButton btnManageAlbums;
|
||||
|
||||
private WallpaperPreferences prefs;
|
||||
private AppConfig config;
|
||||
private AlbumPreferences albumPrefs;
|
||||
private ImageLoader imageLoader;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
@@ -60,226 +76,205 @@ public class HomeFragment extends Fragment {
|
||||
prefs = new WallpaperPreferences(requireContext());
|
||||
config = prefs.loadConfig();
|
||||
albumPrefs = new AlbumPreferences(requireContext());
|
||||
imageLoader = new ImageLoader(requireContext());
|
||||
|
||||
// 创建默认相册(如果不存在)
|
||||
albumPrefs.createDefaultAlbumIfNeeded();
|
||||
|
||||
initViews(view);
|
||||
updateUI();
|
||||
updateAlbumInfo();
|
||||
loadCurrentWallpaper();
|
||||
|
||||
// 应用背景图片
|
||||
// 应用自定义背景(如果有)
|
||||
BackgroundHelper.applyBackground(requireContext(), view);
|
||||
}
|
||||
|
||||
private void initViews(View view) {
|
||||
// 状态
|
||||
tvStatus = view.findViewById(R.id.tvStatus);
|
||||
statusAnimation = view.findViewById(R.id.statusAnimation);
|
||||
tvFolderInfo = view.findViewById(R.id.tvFolderInfo);
|
||||
tvSingleImageInfo = view.findViewById(R.id.tvSingleImageInfo);
|
||||
viewStatusDot = view.findViewById(R.id.viewStatusDot);
|
||||
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);
|
||||
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);
|
||||
tvAlbumInfo = view.findViewById(R.id.tvAlbumInfo);
|
||||
btnManageAlbums = view.findViewById(R.id.btnManageAlbums);
|
||||
|
||||
btnToggle.setOnClickListener(v -> toggleService());
|
||||
btnChangeNow.setOnClickListener(v -> changeWallpaperNow());
|
||||
btnOpenGallery.setOnClickListener(v -> openInGallery());
|
||||
touchOverlay.setOnClickListener(v -> openInGallery());
|
||||
btnManageAlbums.setOnClickListener(v -> openAlbumManagement());
|
||||
}
|
||||
|
||||
private void toggleService() {
|
||||
if (!config.hasMedia()) {
|
||||
Toast.makeText(requireContext(), "请先在相册页面添加文件夹或图片", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(requireContext(), "请先在相册页面添加图片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean newState = !config.isEnabled();
|
||||
|
||||
if (newState) {
|
||||
// 每次启用都弹出壁纸设置引导
|
||||
showSetWallpaperDialog();
|
||||
} else {
|
||||
config.setEnabled(newState);
|
||||
config.setEnabled(false);
|
||||
prefs.saveConfig(config);
|
||||
|
||||
cn.hugh.bz.gk2.utils.AlarmScheduler scheduler = new cn.hugh.bz.gk2.utils.AlarmScheduler(requireContext());
|
||||
scheduler.cancelSchedule();
|
||||
new cn.hugh.bz.gk2.utils.AlarmScheduler(requireContext()).cancelSchedule();
|
||||
Toast.makeText(requireContext(), "已禁用", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
updateUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示引导设置壁纸的对话框
|
||||
*/
|
||||
private void showSetWallpaperDialog() {
|
||||
new androidx.appcompat.app.AlertDialog.Builder(requireContext())
|
||||
.setTitle("设置动态壁纸")
|
||||
.setMessage("点击「确定」后将打开壁纸选择界面,请选择「BzForGk2」作为动态壁纸。\n\n设置完成后返回应用即可自动启用。")
|
||||
.setTitle("启用壁纸服务")
|
||||
.setMessage("点击确定后请选择「BzForGk2」作为动态壁纸。")
|
||||
.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();
|
||||
// 启用服务
|
||||
config.setEnabled(true);
|
||||
prefs.saveConfig(config);
|
||||
|
||||
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();
|
||||
new cn.hugh.bz.gk2.utils.AlarmScheduler(requireContext()).scheduleWallpaperChange(config.getIntervalMinutes());
|
||||
updateUI();
|
||||
})
|
||||
.setNegativeButton("取消", null)
|
||||
.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开系统壁纸选择界面
|
||||
*/
|
||||
private void openWallpaperSelector() {
|
||||
try {
|
||||
Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
|
||||
intent.putExtra(
|
||||
WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
|
||||
new android.content.ComponentName(requireContext(), cn.hugh.bz.gk2.wallpaper.AutoWallpaperService.class)
|
||||
);
|
||||
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
|
||||
new android.content.ComponentName(requireContext(), cn.hugh.bz.gk2.wallpaper.AutoWallpaperService.class));
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
// 如果上述方法失败,尝试打开壁纸选择器
|
||||
try {
|
||||
Intent intent = new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
|
||||
startActivity(intent);
|
||||
Toast.makeText(requireContext(), "请选择 BzForGk2 动态壁纸", Toast.LENGTH_LONG).show();
|
||||
startActivity(new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER));
|
||||
} catch (Exception ex) {
|
||||
// 最后的备用方案:打开壁纸设置页面
|
||||
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();
|
||||
}
|
||||
Toast.makeText(requireContext(), "无法打开壁纸设置", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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()) {
|
||||
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;
|
||||
}
|
||||
|
||||
android.util.Log.i(TAG, "changeWallpaperNow: sending broadcast");
|
||||
cn.hugh.bz.gk2.utils.FileLogger.getInstance(requireContext()).log(TAG, "changeWallpaperNow: sending broadcast");
|
||||
|
||||
// 直接实例化 BroadcastReceiver 并调用 onReceive(避免隐式广播限制)
|
||||
btnChangeNow.setEnabled(false);
|
||||
|
||||
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); // 非定时触发
|
||||
intent.putExtra("force_change", true);
|
||||
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() {
|
||||
// 切换到相册页面(ViewPager 的第 3 个页面,索引为 2)
|
||||
if (getActivity() instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) getActivity();
|
||||
activity.switchToPage(2); // 2 是相册管理页面的索引
|
||||
((MainActivity) getActivity()).switchToPage(1); // 调整后的相册页索引为 1
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUI() {
|
||||
// 检测壁纸服务是否真实在运行
|
||||
boolean isServiceActuallyRunning = WallpaperServiceHelper.isServiceRunning(requireContext());
|
||||
boolean isConfigEnabled = config.isEnabled();
|
||||
|
||||
// Update status - 优先使用实际运行状态
|
||||
if (isServiceActuallyRunning && isConfigEnabled) {
|
||||
// 服务真正在运行
|
||||
tvStatus.setText(R.string.status_enabled);
|
||||
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);
|
||||
}
|
||||
boolean isRunning = WallpaperServiceHelper.isServiceRunning(requireContext()) && config.isEnabled();
|
||||
|
||||
if (isRunning) {
|
||||
tvStatus.setText("服务已开启");
|
||||
viewStatusDot.setBackgroundResource(R.drawable.status_indicator_enabled);
|
||||
btnToggle.setText("禁用");
|
||||
} else {
|
||||
// 服务已禁用
|
||||
tvStatus.setText(R.string.status_disabled);
|
||||
btnToggle.setText(R.string.enable);
|
||||
btnChangeNow.setEnabled(false);
|
||||
// 停止 Lottie 动画
|
||||
if (statusAnimation != null) {
|
||||
statusAnimation.cancelAnimation();
|
||||
statusAnimation.setProgress(0f);
|
||||
}
|
||||
tvStatus.setText("服务已禁用");
|
||||
viewStatusDot.setBackgroundResource(R.drawable.status_indicator_disabled);
|
||||
btnToggle.setText("启用");
|
||||
}
|
||||
|
||||
// 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();
|
||||
if (activeAlbum != null) {
|
||||
tvAlbumName.setText(activeAlbum.getName());
|
||||
tvAlbumInfo.setText(activeAlbum.getMediaSummary());
|
||||
} else {
|
||||
tvAlbumName.setText("默认相册");
|
||||
tvAlbumInfo.setText("无媒体内容");
|
||||
}
|
||||
tvAlbumName.setText(activeAlbum != null ? activeAlbum.getName() : "默认相册");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -287,12 +282,6 @@ public class HomeFragment extends Fragment {
|
||||
super.onResume();
|
||||
config = prefs.loadConfig();
|
||||
updateUI();
|
||||
updateAlbumInfo();
|
||||
|
||||
// 重新应用背景图片(从设置页面返回时可能需要更新)
|
||||
View rootView = getView();
|
||||
if (rootView != null) {
|
||||
BackgroundHelper.applyBackground(requireContext(), rootView);
|
||||
}
|
||||
loadCurrentWallpaper();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
// 导航容器 ID(LinearLayout,用于点击事件)
|
||||
int[] navContainerIds = {
|
||||
R.id.navHome,
|
||||
R.id.navWallpaper,
|
||||
R.id.navAlbum,
|
||||
R.id.navHistory,
|
||||
R.id.navSettings
|
||||
@@ -179,7 +178,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
// 导航文本 ID(TextView,用于更新选中状态)
|
||||
int[] navTextIds = {
|
||||
R.id.tvNavHome,
|
||||
R.id.tvNavWallpaper,
|
||||
R.id.tvNavAlbum,
|
||||
R.id.tvNavHistory,
|
||||
R.id.tvNavSettings
|
||||
@@ -188,18 +186,17 @@ public class MainActivity extends AppCompatActivity {
|
||||
// 图标 ID
|
||||
int[] navIconIds = {
|
||||
R.id.ivNavHome,
|
||||
R.id.ivNavWallpaper,
|
||||
R.id.ivNavAlbum,
|
||||
R.id.ivNavHistory,
|
||||
R.id.ivNavSettings
|
||||
};
|
||||
|
||||
// 初始化导航项和图标数组
|
||||
navContainers = new LinearLayout[5];
|
||||
navItems = new TextView[5];
|
||||
navIcons = new ImageView[5];
|
||||
navContainers = new LinearLayout[4];
|
||||
navItems = new TextView[4];
|
||||
navIcons = new ImageView[4];
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
navContainers[i] = findViewById(navContainerIds[i]);
|
||||
navItems[i] = findViewById(navTextIds[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) {
|
||||
if (viewPager != null && position >= 0 && position < 5) {
|
||||
if (viewPager != null && position >= 0 && position < 4) {
|
||||
viewPager.setCurrentItem(position, false);
|
||||
// 更新底部导航选中状态
|
||||
updateNavSelection(position);
|
||||
|
||||
@@ -6,10 +6,10 @@ import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
/**
|
||||
* ViewPager2 适配器,用于管理五个 Fragment 页面
|
||||
* ViewPager2 适配器,用于管理四个 Fragment 页面
|
||||
*/
|
||||
public class ViewPagerAdapter extends FragmentStateAdapter {
|
||||
private static final int NUM_PAGES = 5;
|
||||
private static final int NUM_PAGES = 4;
|
||||
|
||||
public ViewPagerAdapter(FragmentActivity fa) {
|
||||
super(fa);
|
||||
@@ -22,12 +22,10 @@ public class ViewPagerAdapter extends FragmentStateAdapter {
|
||||
case 0:
|
||||
return new HomeFragment();
|
||||
case 1:
|
||||
return new CurrentWallpaperFragment();
|
||||
case 2:
|
||||
return new AlbumManagementFragment();
|
||||
case 3:
|
||||
case 2:
|
||||
return new WallpaperHistoryFragment();
|
||||
case 4:
|
||||
case 3:
|
||||
return new SettingsFragment();
|
||||
default:
|
||||
return new HomeFragment();
|
||||
@@ -38,4 +36,4 @@ public class ViewPagerAdapter extends FragmentStateAdapter {
|
||||
public int getItemCount() {
|
||||
return NUM_PAGES;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -81,6 +81,12 @@ public class WallpaperHistoryFragment extends Fragment {
|
||||
public void onItemClick(WallpaperHistory history) {
|
||||
openAlbumForHistory(history);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReuseClick(WallpaperHistory history) {
|
||||
// 跳转到相册管理页面并定位到该相册
|
||||
jumpToAlbum(history.getAlbumId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDelete(WallpaperHistory history) {
|
||||
@@ -93,6 +99,18 @@ public class WallpaperHistoryFragment extends Fragment {
|
||||
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() {
|
||||
historyList = historyManager.loadHistory();
|
||||
adapter.updateHistory(historyList);
|
||||
@@ -211,16 +229,18 @@ public class WallpaperHistoryFragment extends Fragment {
|
||||
}
|
||||
|
||||
class HistoryViewHolder extends RecyclerView.ViewHolder {
|
||||
private final android.widget.ImageView ivThumbnail;
|
||||
private final ImageView ivThumbnail;
|
||||
private final TextView tvAlbumName;
|
||||
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) {
|
||||
super(itemView);
|
||||
ivThumbnail = itemView.findViewById(R.id.ivThumbnail);
|
||||
tvAlbumName = itemView.findViewById(R.id.tvAlbumName);
|
||||
tvTimestamp = itemView.findViewById(R.id.tvTimestamp);
|
||||
btnReuse = itemView.findViewById(R.id.btnReuse);
|
||||
btnDelete = itemView.findViewById(R.id.btnDelete);
|
||||
}
|
||||
|
||||
@@ -238,16 +258,23 @@ public class WallpaperHistoryFragment extends Fragment {
|
||||
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()));
|
||||
tvTimestamp.setText(timestamp);
|
||||
|
||||
// 卡片点击事件
|
||||
// 卡片点击事件 (预览大图)
|
||||
itemView.setOnClickListener(v -> {
|
||||
if (callback != null) {
|
||||
callback.onItemClick(history);
|
||||
}
|
||||
});
|
||||
|
||||
// 跳转相册按钮
|
||||
btnReuse.setOnClickListener(v -> {
|
||||
if (callback != null) {
|
||||
callback.onReuseClick(history);
|
||||
}
|
||||
});
|
||||
|
||||
// 删除按钮
|
||||
btnDelete.setOnClickListener(v -> {
|
||||
@@ -260,7 +287,8 @@ public class WallpaperHistoryFragment extends Fragment {
|
||||
|
||||
interface HistoryCallback {
|
||||
void onItemClick(WallpaperHistory history);
|
||||
void onReuseClick(WallpaperHistory history);
|
||||
void onDelete(WallpaperHistory history);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@
|
||||
android:paddingEnd="8dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<!-- 主页 -->
|
||||
<!-- 主页 (仪表盘) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/navHome"
|
||||
android:layout_width="0dp"
|
||||
@@ -73,38 +73,6 @@
|
||||
|
||||
</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
|
||||
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"?>
|
||||
<androidx.core.widget.NestedScrollView
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
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="@android:color/transparent"
|
||||
android:fillViewport="true">
|
||||
android:background="@color/bg_primary">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="@dimen/spacing_lg"
|
||||
android:paddingTop="@dimen/spacing_lg"
|
||||
android:paddingBottom="100dp"
|
||||
android:clipToPadding="false">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- Header -->
|
||||
<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
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/spacing_lg"
|
||||
app:cardElevation="0dp"
|
||||
app:cardCornerRadius="@dimen/corner_radius_lg"
|
||||
app:cardBackgroundColor="@color/bg_card"
|
||||
app:strokeColor="@color/bg_secondary_modern"
|
||||
app:strokeWidth="1dp">
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="80dp">
|
||||
|
||||
<!-- 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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/spacing_xl">
|
||||
android:padding="16dp">
|
||||
|
||||
<!-- 动画容器 -->
|
||||
<FrameLayout
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:background="@drawable/bg_icon_container_sky"
|
||||
android:backgroundTint="@color/sky_blue_container"
|
||||
android:padding="20dp">
|
||||
<!-- Media Info Card -->
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="0dp"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="#E0E0E0"
|
||||
app:cardBackgroundColor="@color/white">
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
android:id="@+id/statusAnimation"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:lottie_rawRes="@raw/status_active"
|
||||
app:lottie_loop="true"
|
||||
app:lottie_autoPlay="false" />
|
||||
</FrameLayout>
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/status_disabled"
|
||||
android:textSize="@dimen/text_size_lg"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary_modern"
|
||||
android:layout_marginTop="@dimen/spacing_md" />
|
||||
<TextView
|
||||
android:id="@+id/tvWallpaperName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="wallpaper_name.jpg"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary"
|
||||
android:ellipsize="middle"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFolderInfo"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvResolution"
|
||||
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:text="服务未运行"
|
||||
android:textSize="@dimen/text_size_sm"
|
||||
android:textColor="@color/text_secondary_modern"
|
||||
android:layout_marginTop="@dimen/spacing_xs" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSingleImageInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/text_size_sm"
|
||||
android:textColor="@color/text_secondary_modern"
|
||||
android:visibility="gone" />
|
||||
android:layout_marginTop="12dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
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>
|
||||
|
||||
</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>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<!-- 当前相册卡片 -->
|
||||
<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>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -1,68 +1,107 @@
|
||||
<?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:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/background">
|
||||
android:background="@color/bg_primary">
|
||||
|
||||
<!-- 标题栏 -->
|
||||
<LinearLayout
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:background="@color/surface">
|
||||
android:background="@android:color/transparent"
|
||||
app:elevation="0dp">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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
|
||||
android:layout_width="0dp"
|
||||
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:id="@+id/tvEmptyHint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:text="清空"
|
||||
android:textSize="14sp"
|
||||
app:icon="@drawable/ic_delete"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="4dp"
|
||||
app:cornerRadius="8dp"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:textColor="@color/error"
|
||||
app:iconTint="@color/error"
|
||||
app:strokeColor="@color/error" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="暂无历史记录
|
||||
使用后的壁纸会出现在这里"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/text_hint"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<!-- 历史记录列表 -->
|
||||
<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>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -5,76 +5,105 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:strokeWidth="0dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackground">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 缩略图 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivThumbnail"
|
||||
<!-- Image Container -->
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="@color/image_placeholder" />
|
||||
android:layout_height="180dp">
|
||||
|
||||
<!-- 信息区域 -->
|
||||
<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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp">
|
||||
|
||||
<!-- 相册名称 -->
|
||||
<TextView
|
||||
android:id="@+id/tvAlbumName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="相册名称"
|
||||
android:textSize="14sp"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:drawableStart="@drawable/ic_album"
|
||||
android:drawablePadding="4dp" />
|
||||
android:ellipsize="end" />
|
||||
|
||||
<!-- 时间戳 -->
|
||||
<TextView
|
||||
android:id="@+id/tvTimestamp"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="01-15 14:30"
|
||||
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:orientation="horizontal"
|
||||
android:layout_marginTop="8dp"
|
||||
app:icon="@drawable/ic_delete"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="4dp"
|
||||
app:cornerRadius="6dp"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:textColor="@color/error"
|
||||
app:iconTint="@color/error"
|
||||
app:strokeColor="@color/error" />
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<!-- Reuse/Jump Button -->
|
||||
<TextView
|
||||
android:id="@+id/btnReuse"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
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>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@@ -3,30 +3,17 @@
|
||||
<item
|
||||
android:id="@+id/nav_home"
|
||||
android:icon="@drawable/ic_home"
|
||||
android:title="@string/nav_home"
|
||||
android:orderInCategory="0" />
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_wallpaper"
|
||||
android:icon="@drawable/ic_image"
|
||||
android:title="@string/nav_wallpaper"
|
||||
android:orderInCategory="1" />
|
||||
|
||||
android:title="首页" />
|
||||
<item
|
||||
android:id="@+id/nav_albums"
|
||||
android:icon="@drawable/ic_album"
|
||||
android:title="@string/nav_albums"
|
||||
android:orderInCategory="2" />
|
||||
|
||||
android:title="相册" />
|
||||
<item
|
||||
android:id="@+id/nav_history"
|
||||
android:icon="@drawable/ic_history"
|
||||
android:title="@string/nav_history"
|
||||
android:orderInCategory="3" />
|
||||
|
||||
android:title="历史" />
|
||||
<item
|
||||
android:id="@+id/nav_settings"
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:title="@string/nav_settings"
|
||||
android:orderInCategory="4" />
|
||||
</menu>
|
||||
android:title="设置" />
|
||||
</menu>
|
||||
Reference in new issue
Block a user