改进图片像素背景的绘图方法。

This commit is contained in:
2025-12-24 12:19:48 +08:00
parent 2ffdb26f69
commit 72794dc6e5
5 changed files with 20 additions and 19 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Tue Dec 23 16:04:47 GMT 2025
#Wed Dec 24 04:12:51 GMT 2025
stageCount=28
libraryProject=
baseVersion=15.14
publishVersion=15.14.27
buildCount=2
buildCount=7
baseBetaVersion=15.14.28

View File

@@ -271,7 +271,7 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
break;
case MSG_LOAD_BACKGROUND:
sMainActivity.reloadBackground();
sMainActivity.setMainLayoutBackgroundColor();
//sMainActivity.setMainLayoutBackgroundColor();
break;
case MSG_UPDATE_SERVICE_SWITCH:
sMainActivity.updateServiceSwitchUI();
@@ -409,18 +409,18 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
}
}
private void setMainLayoutBackgroundColor() {
LogUtils.d(TAG, "setMainLayoutBackgroundColor()");
if (isFinishing() || isDestroyed() || mMainContentView == null || mBgSourceUtils == null) {
LogUtils.e(TAG, "setMainLayoutBackgroundColor: 上下文无效,设置失败");
return;
}
BackgroundBean currentBgBean = mBgSourceUtils.getCurrentBackgroundBean();
if (currentBgBean != null) {
mMainContentView.mainLayout.setBackgroundColor(currentBgBean.getPixelColor());
LogUtils.d(TAG, "setMainLayoutBackgroundColor: 主布局背景色设置完成 | color=" + currentBgBean.getPixelColor());
}
}
// private void setMainLayoutBackgroundColor() {
// LogUtils.d(TAG, "setMainLayoutBackgroundColor()");
// if (isFinishing() || isDestroyed() || mMainContentView == null || mBgSourceUtils == null) {
// LogUtils.e(TAG, "setMainLayoutBackgroundColor: 上下文无效,设置失败");
// return;
// }
// BackgroundBean currentBgBean = mBgSourceUtils.getCurrentBackgroundBean();
// if (currentBgBean != null) {
// mMainContentView.mainLayout.setBackgroundColor(currentBgBean.getPixelColor());
// LogUtils.d(TAG, "setMainLayoutBackgroundColor: 主布局背景色设置完成 | color=" + currentBgBean.getPixelColor2());
// }
// }
private void updateServiceSwitchUI() {
LogUtils.d(TAG, "updateServiceSwitchUI()");

View File

@@ -404,7 +404,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
mBgSourceUtils.loadSettings();
BackgroundBean previewBean = mBgSourceUtils.getPreviewBackgroundBean();
mBackgroundView.loadByBackgroundBean(previewBean, true);
mBackgroundView.setBackgroundColor(previewBean.getPixelColor());
//mBackgroundView.setBackgroundColor(previewBean.getPixelColor());
LogUtils.d(TAG, "【双重刷新】第一重完成");
} catch (Exception e) {
LogUtils.e(TAG, "【双重刷新】第一重异常:" + e.getMessage());
@@ -420,7 +420,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
mBgSourceUtils.loadSettings();
BackgroundBean previewBean = mBgSourceUtils.getPreviewBackgroundBean();
mBackgroundView.loadByBackgroundBean(previewBean, true);
mBackgroundView.setBackgroundColor(previewBean.getPixelColor());
//mBackgroundView.setBackgroundColor(previewBean.getPixelColor());
LogUtils.d(TAG, "【双重刷新】第二重完成");
} catch (Exception e) {
LogUtils.e(TAG, "【双重刷新】第二重异常:" + e.getMessage());

View File

@@ -243,7 +243,7 @@ public class MainUnitTest2Activity extends AppCompatActivity {
// 第一重刷新
try {
mMemoryCachedBackgroundView.loadByBackgroundBean(mPreviewBackgroundBean, true);
mMemoryCachedBackgroundView.setBackgroundColor(mPreviewBackgroundBean.getPixelColor());
//mMemoryCachedBackgroundView.setBackgroundColor(mPreviewBackgroundBean.getPixelColor());
LogUtils.d(TAG, "doubleRefreshPreview【双重刷新】第一重完成");
} catch (Exception e) {
LogUtils.e(TAG, String.format("doubleRefreshPreview【双重刷新】第一重异常 | %s", e.getMessage()));
@@ -257,7 +257,7 @@ public class MainUnitTest2Activity extends AppCompatActivity {
if (mMemoryCachedBackgroundView != null && !isFinishing()) {
try {
mMemoryCachedBackgroundView.loadByBackgroundBean(mPreviewBackgroundBean, true);
mMemoryCachedBackgroundView.setBackgroundColor(mPreviewBackgroundBean.getPixelColor());
//mMemoryCachedBackgroundView.setBackgroundColor(mPreviewBackgroundBean.getPixelColor());
LogUtils.d(TAG, "doubleRefreshPreview【双重刷新】第二重完成");
} catch (Exception e) {
LogUtils.e(TAG, String.format("doubleRefreshPreview【双重刷新】第二重异常 | %s", e.getMessage()));

View File

@@ -149,6 +149,7 @@ public class BackgroundView extends RelativeLayout {
}
// 加载图片
loadImage(targetPath);
setBackgroundColor(bean.getPixelColor());
LogUtils.d(TAG, "=== loadByBackgroundBean 完成 ===");
}