diff --git a/powerbell/build.properties b/powerbell/build.properties index 3af435a..2830a65 100644 --- a/powerbell/build.properties +++ b/powerbell/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sat Dec 13 20:16:32 GMT 2025 +#Sat Dec 13 20:44:35 GMT 2025 stageCount=2 libraryProject= baseVersion=15.14 publishVersion=15.14.1 -buildCount=41 +buildCount=47 baseBetaVersion=15.14.2 diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BackgroundSettingsActivity.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BackgroundSettingsActivity.java index 0ffc69c..1331ec8 100644 --- a/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BackgroundSettingsActivity.java +++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BackgroundSettingsActivity.java @@ -48,7 +48,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { public static final int REQUEST_SELECT_PICTURE = 0; public static final int REQUEST_TAKE_PHOTO = 1; public static final int REQUEST_CROP_IMAGE = 2; - private static final int REQUEST_READ_MEDIA = 1001; + private static final int REQUEST_PIXELPICKER = 1001; // ====================== 成员变量 ====================== private BackgroundSourceUtils mBgSourceUtils; @@ -139,6 +139,9 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { break; case REQUEST_CROP_IMAGE: handleCropImageResult(requestCode, resultCode, data); + break; + case REQUEST_PIXELPICKER: + handlePixelPickerResult(requestCode, resultCode, data); break; default: LogUtils.d(TAG, "【回调忽略】未知requestCode"); @@ -295,10 +298,11 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { }; private View.OnClickListener onPixelPickerClickListener = new View.OnClickListener() { + @Override public void onClick(View v) { LogUtils.d(TAG, "【按钮点击】像素拾取"); - String targetImagePath = mBgSourceUtils.getCurrentBackgroundBean().getBackgroundFilePath(); + String targetImagePath = mBgSourceUtils.getPreviewBackgroundBean().getBackgroundFilePath(); File targetFile = new File(targetImagePath); if (targetFile == null || !targetFile.exists() || targetFile.length() <= 0) { ToastUtils.show("无有效图片可拾取像素"); @@ -307,7 +311,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { } Intent intent = new Intent(getApplicationContext(), PixelPickerActivity.class); intent.putExtra("imagePath", targetImagePath); - startActivity(intent); + startActivityForResult(intent, REQUEST_PIXELPICKER); LogUtils.d(TAG, "【像素拾取启动】路径:" + targetImagePath); } }; @@ -316,7 +320,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { @Override public void onClick(View v) { LogUtils.d(TAG, "【按钮点击】清空像素颜色"); - BackgroundBean bean = mBgSourceUtils.getCurrentBackgroundBean(); + BackgroundBean bean = mBgSourceUtils.getPreviewBackgroundBean(); int oldColor = bean.getPixelColor(); bean.setPixelColor(0); mBgSourceUtils.saveSettings(); @@ -366,6 +370,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { try { mBgSourceUtils.loadSettings(); mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean(), true); + mBackgroundView.setBackgroundColor(mBgSourceUtils.getPreviewBackgroundBean().getPixelColor()); LogUtils.d(TAG, "【双重刷新】第一重完成"); } catch (Exception e) { LogUtils.e(TAG, "【双重刷新】第一重异常:" + e.getMessage()); @@ -380,6 +385,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { try { mBgSourceUtils.loadSettings(); mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean(), true); + mBackgroundView.setBackgroundColor(mBgSourceUtils.getPreviewBackgroundBean().getPixelColor()); LogUtils.d(TAG, "【双重刷新】第二重完成"); } catch (Exception e) { LogUtils.e(TAG, "【双重刷新】第二重异常:" + e.getMessage()); @@ -852,5 +858,9 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { handleOperationCancelOrFail(); } } + + private void handlePixelPickerResult(int requestCode, int resultCode, Intent data) { + doubleRefreshPreview(); + } } diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/PixelPickerActivity.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/PixelPickerActivity.java index 73bcc60..5323c8f 100644 --- a/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/PixelPickerActivity.java +++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/PixelPickerActivity.java @@ -194,7 +194,7 @@ public class PixelPickerActivity extends WinBoLLActivity implements IWinBoLLActi dialog.dismiss(); // 可以在这里添加确定后的回调逻辑 BackgroundSourceUtils utils = BackgroundSourceUtils.getInstance(PixelPickerActivity.this); - BackgroundBean bean = utils.getCurrentBackgroundBean(); + BackgroundBean bean = utils.getPreviewBackgroundBean(); bean.setPixelColor(pixelColor); utils.saveSettings(); Toast.makeText(PixelPickerActivity.this, "已记录像素值", Toast.LENGTH_SHORT).show(); @@ -218,7 +218,7 @@ public class PixelPickerActivity extends WinBoLLActivity implements IWinBoLLActi void setBackgroundColor() { BackgroundSourceUtils utils = BackgroundSourceUtils.getInstance(PixelPickerActivity.this); - BackgroundBean bean = utils.getCurrentBackgroundBean(); + BackgroundBean bean = utils.getPreviewBackgroundBean(); int nPixelColor = bean.getPixelColor(); RelativeLayout mainLayout = findViewById(R.id.activitypixelpickerRelativeLayout1); mainLayout.setBackgroundColor(nPixelColor); @@ -247,9 +247,11 @@ public class PixelPickerActivity extends WinBoLLActivity implements IWinBoLLActi @Override public void onBackPressed() { super.onBackPressed(); - Intent intent = new Intent(); - intent.setClass(this, BackgroundSettingsActivity.class); - startActivity(intent); + setResult(RESULT_OK); + finish(); +// Intent intent = new Intent(); +// intent.setClass(this, BackgroundSettingsActivity.class); +// startActivity(intent); //GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(getApplicationContext(), BackgroundPictureActivity.class); } } diff --git a/powerbell/src/main/res/layout/activity_background_settings.xml b/powerbell/src/main/res/layout/activity_background_settings.xml index f144ef9..1f3911c 100644 --- a/powerbell/src/main/res/layout/activity_background_settings.xml +++ b/powerbell/src/main/res/layout/activity_background_settings.xml @@ -20,8 +20,7 @@ + android:layout_height="match_parent"> @@ -42,8 +40,7 @@ + android:layout_height="400dp">