20251201_040959_262
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sun Nov 30 18:31:19 GMT 2025
|
||||
#Sun Nov 30 20:02:18 GMT 2025
|
||||
stageCount=13
|
||||
libraryProject=
|
||||
baseVersion=15.11
|
||||
publishVersion=15.11.12
|
||||
buildCount=15
|
||||
buildCount=20
|
||||
baseBetaVersion=15.11.13
|
||||
|
||||
@@ -2,7 +2,6 @@ package cc.winboll.studio.powerbell;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.view.Gravity;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.ToastUtils;
|
||||
import cc.winboll.studio.powerbell.receivers.GlobalApplicationReceiver;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,14 +14,16 @@ public class BackgroundBean extends BaseBean {
|
||||
|
||||
public static final String TAG = "BackgroundPictureBean";
|
||||
|
||||
// 核心字段:背景图片文件名(对应BackgroundSource目录下的图片文件)
|
||||
// 核心字段:背景图片文件名(对应应用私有目录下的图片文件,与BackgroundSettingsActivity的_mSourceCroppedFile匹配)
|
||||
private String backgroundFileName = "";
|
||||
// 附加字段:图片信息(如Uri、网络地址等,仅作备注,不参与路径生成)
|
||||
private String backgroundFileInfo = "";
|
||||
// 控制字段:是否启用背景图片(true-显示背景图,false-显示透明背景)
|
||||
private boolean isUseBackgroundFile = false;
|
||||
// 核心字段:压缩后背景图片文件名(对应BackgroundSource目录下的压缩图片)
|
||||
// 核心字段:压缩后背景图片文件名(对应应用私有目录下的压缩图片,与saveCropBitmap的压缩图匹配)
|
||||
private String backgroundScaledCompressFileName = "";
|
||||
// 新增:压缩后背景图片完整路径(解决仅存文件名导致的路径拼接错误,适配BackgroundSettingsActivity的私有目录)
|
||||
private String backgroundScaledCompressFilePath = "";
|
||||
// 控制字段:是否启用压缩背景图(true-加载压缩图,false-加载原图)
|
||||
private boolean isUseScaledCompress = false;
|
||||
// 裁剪比例字段:背景图宽高比(默认1:1,用于固定比例裁剪)
|
||||
@@ -69,6 +71,17 @@ public class BackgroundBean extends BaseBean {
|
||||
this.backgroundScaledCompressFileName = backgroundScaledCompressFileName == null ? "" : backgroundScaledCompressFileName; // 防null
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增:压缩图完整路径 Getter/Setter(适配BackgroundSettingsActivity的saveCropBitmap方法)
|
||||
*/
|
||||
public String getBackgroundScaledCompressFilePath() {
|
||||
return backgroundScaledCompressFilePath;
|
||||
}
|
||||
|
||||
public void setBackgroundScaledCompressFilePath(String backgroundScaledCompressFilePath) {
|
||||
this.backgroundScaledCompressFilePath = backgroundScaledCompressFilePath == null ? "" : backgroundScaledCompressFilePath; // 防null,避免路径错误
|
||||
}
|
||||
|
||||
public boolean isUseScaledCompress() {
|
||||
return isUseScaledCompress;
|
||||
}
|
||||
@@ -109,7 +122,7 @@ public class BackgroundBean extends BaseBean {
|
||||
|
||||
/**
|
||||
* 将Bean数据写入JSON(序列化,保存到文件)
|
||||
* 确保所有字段都被写入,无遗漏
|
||||
* 确保所有字段都被写入,无遗漏(新增backgroundScaledCompressFilePath字段)
|
||||
*/
|
||||
@Override
|
||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||
@@ -119,6 +132,7 @@ public class BackgroundBean extends BaseBean {
|
||||
jsonWriter.name("backgroundFileInfo").value(bean.getBackgroundFileInfo());
|
||||
jsonWriter.name("isUseBackgroundFile").value(bean.isUseBackgroundFile());
|
||||
jsonWriter.name("backgroundScaledCompressFileName").value(bean.getBackgroundScaledCompressFileName());
|
||||
jsonWriter.name("backgroundScaledCompressFilePath").value(bean.getBackgroundScaledCompressFilePath()); // 新增字段序列化
|
||||
jsonWriter.name("isUseScaledCompress").value(bean.isUseScaledCompress());
|
||||
jsonWriter.name("backgroundWidth").value(bean.getBackgroundWidth());
|
||||
jsonWriter.name("backgroundHeight").value(bean.getBackgroundHeight());
|
||||
@@ -127,7 +141,7 @@ public class BackgroundBean extends BaseBean {
|
||||
|
||||
/**
|
||||
* 从JSON读取数据到Bean(反序列化,从文件加载)
|
||||
* 确保所有字段都被读取,兼容旧版本(无字段时设默认值)
|
||||
* 确保所有字段都被读取,兼容旧版本(无字段时设默认值,新增字段兼容)
|
||||
*/
|
||||
@Override
|
||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
||||
@@ -148,6 +162,9 @@ public class BackgroundBean extends BaseBean {
|
||||
case "backgroundScaledCompressFileName":
|
||||
bean.setBackgroundScaledCompressFileName(jsonReader.nextString());
|
||||
break;
|
||||
case "backgroundScaledCompressFilePath":
|
||||
bean.setBackgroundScaledCompressFilePath(jsonReader.nextString()); // 新增字段反序列化
|
||||
break;
|
||||
case "isUseScaledCompress":
|
||||
bean.setIsUseScaledCompress(jsonReader.nextBoolean());
|
||||
break;
|
||||
@@ -168,5 +185,32 @@ public class BackgroundBean extends BaseBean {
|
||||
jsonReader.endObject();
|
||||
return bean;
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================== 辅助方法(优化BackgroundSettingsActivity调用体验)======================================
|
||||
/**
|
||||
* 重置背景配置(适配“取消背景”功能,避免残留无效数据)
|
||||
*/
|
||||
public void resetBackgroundConfig() {
|
||||
this.backgroundFileName = "";
|
||||
this.backgroundScaledCompressFileName = "";
|
||||
this.backgroundScaledCompressFilePath = "";
|
||||
this.backgroundFileInfo = "";
|
||||
this.isUseBackgroundFile = false;
|
||||
this.isUseScaledCompress = false;
|
||||
this.backgroundWidth = 100;
|
||||
this.backgroundHeight = 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查背景配置是否有效(适配BackgroundSettingsActivity的预览/保存校验)
|
||||
* @return true-配置有效(可显示背景图),false-配置无效
|
||||
*/
|
||||
public boolean isBackgroundConfigValid() {
|
||||
// 启用背景图时,需确保文件名或完整路径非空
|
||||
if (!isUseBackgroundFile) {
|
||||
return false;
|
||||
}
|
||||
return !((backgroundFileName.isEmpty() && backgroundScaledCompressFileName.isEmpty())
|
||||
|| backgroundScaledCompressFilePath.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<!-- 保留root-path适配特殊机型(如微信分身) -->
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 保留root-path适配特殊机型(如微信分身),谨慎启用(部分机型可能报安全警告) -->
|
||||
<root-path
|
||||
name="root_path"
|
||||
path="" />
|
||||
|
||||
<!-- 核心修复1:替换files-path为external-files-path(对应外部存储应用目录) -->
|
||||
<!-- 适配mfBackgroundDir(BackgroundSource目录):对应BackgroundSourceUtils.getBackgroundSourceDirPath() -->
|
||||
<!-- 核心适配1:BackgroundSourceUtils的背景图片目录(对应mfBackgroundDir) -->
|
||||
<!-- 路径:/Android/data/${applicationId}/files/BackgroundPictureUtils/BackgroundSource/ -->
|
||||
<external-files-path
|
||||
name="background_source"
|
||||
path="BackgroundPictureUtils/BackgroundSource/" /> <!-- 与代码中目录完全一致 -->
|
||||
path="BackgroundPictureUtils/BackgroundSource/" /> <!-- 与BackgroundSourceUtils.initDirs()完全一致 -->
|
||||
|
||||
<!-- 适配mfPictureDir(临时目录):对应App.getTempDirPath() -->
|
||||
<!-- 核心适配2:App的临时目录(对应mfPictureDir = App.getTempDirPath()) -->
|
||||
<!-- 路径:/Android/data/${applicationId}/files/temp/ -->
|
||||
<external-files-path
|
||||
name="temp"
|
||||
path="temp/" /> <!-- 与代码中App.getTempDirPath()的路径后缀一致 -->
|
||||
name="app_temp"
|
||||
path="temp/" /> <!-- 与App.getTempDirPath()的路径后缀严格匹配 -->
|
||||
|
||||
<!-- 保留其他配置适配分享/拍照等场景 -->
|
||||
<!-- 核心适配3:拍照/裁剪临时文件目录(适配mfTakePhoto、_mSourceCropTempFile) -->
|
||||
<!-- 路径:/Android/data/${applicationId}/files/Pictures/(对应BackgroundSettingsActivity的appPrivateDir) -->
|
||||
<external-files-path
|
||||
name="app_private_pictures"
|
||||
path="Pictures/" /> <!-- 适配onCreate中getExternalFilesDir(Environment.DIRECTORY_PICTURES) -->
|
||||
|
||||
<!-- 保留通用配置,适配分享/拍照等场景(多包名自动适配${applicationId}) -->
|
||||
<external-path
|
||||
name="external_storage_root"
|
||||
path="." />
|
||||
@@ -25,7 +32,7 @@
|
||||
path="." />
|
||||
<external-files-path
|
||||
name="external_file_path"
|
||||
path="." />
|
||||
path="." /> <!-- 通用外部文件路径,多包名自动适配 -->
|
||||
<external-files-path
|
||||
name="files_root"
|
||||
path="mimoDownload" />
|
||||
|
||||
Reference in New Issue
Block a user