背景像素拾取功能测试完成
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#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
|
stageCount=2
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.14
|
baseVersion=15.14
|
||||||
publishVersion=15.14.1
|
publishVersion=15.14.1
|
||||||
buildCount=41
|
buildCount=47
|
||||||
baseBetaVersion=15.14.2
|
baseBetaVersion=15.14.2
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
public static final int REQUEST_SELECT_PICTURE = 0;
|
public static final int REQUEST_SELECT_PICTURE = 0;
|
||||||
public static final int REQUEST_TAKE_PHOTO = 1;
|
public static final int REQUEST_TAKE_PHOTO = 1;
|
||||||
public static final int REQUEST_CROP_IMAGE = 2;
|
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;
|
private BackgroundSourceUtils mBgSourceUtils;
|
||||||
@@ -139,6 +139,9 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
break;
|
break;
|
||||||
case REQUEST_CROP_IMAGE:
|
case REQUEST_CROP_IMAGE:
|
||||||
handleCropImageResult(requestCode, resultCode, data);
|
handleCropImageResult(requestCode, resultCode, data);
|
||||||
|
break;
|
||||||
|
case REQUEST_PIXELPICKER:
|
||||||
|
handlePixelPickerResult(requestCode, resultCode, data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogUtils.d(TAG, "【回调忽略】未知requestCode");
|
LogUtils.d(TAG, "【回调忽略】未知requestCode");
|
||||||
@@ -295,10 +298,11 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private View.OnClickListener onPixelPickerClickListener = new View.OnClickListener() {
|
private View.OnClickListener onPixelPickerClickListener = new View.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
LogUtils.d(TAG, "【按钮点击】像素拾取");
|
LogUtils.d(TAG, "【按钮点击】像素拾取");
|
||||||
String targetImagePath = mBgSourceUtils.getCurrentBackgroundBean().getBackgroundFilePath();
|
String targetImagePath = mBgSourceUtils.getPreviewBackgroundBean().getBackgroundFilePath();
|
||||||
File targetFile = new File(targetImagePath);
|
File targetFile = new File(targetImagePath);
|
||||||
if (targetFile == null || !targetFile.exists() || targetFile.length() <= 0) {
|
if (targetFile == null || !targetFile.exists() || targetFile.length() <= 0) {
|
||||||
ToastUtils.show("无有效图片可拾取像素");
|
ToastUtils.show("无有效图片可拾取像素");
|
||||||
@@ -307,7 +311,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
}
|
}
|
||||||
Intent intent = new Intent(getApplicationContext(), PixelPickerActivity.class);
|
Intent intent = new Intent(getApplicationContext(), PixelPickerActivity.class);
|
||||||
intent.putExtra("imagePath", targetImagePath);
|
intent.putExtra("imagePath", targetImagePath);
|
||||||
startActivity(intent);
|
startActivityForResult(intent, REQUEST_PIXELPICKER);
|
||||||
LogUtils.d(TAG, "【像素拾取启动】路径:" + targetImagePath);
|
LogUtils.d(TAG, "【像素拾取启动】路径:" + targetImagePath);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -316,7 +320,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
LogUtils.d(TAG, "【按钮点击】清空像素颜色");
|
LogUtils.d(TAG, "【按钮点击】清空像素颜色");
|
||||||
BackgroundBean bean = mBgSourceUtils.getCurrentBackgroundBean();
|
BackgroundBean bean = mBgSourceUtils.getPreviewBackgroundBean();
|
||||||
int oldColor = bean.getPixelColor();
|
int oldColor = bean.getPixelColor();
|
||||||
bean.setPixelColor(0);
|
bean.setPixelColor(0);
|
||||||
mBgSourceUtils.saveSettings();
|
mBgSourceUtils.saveSettings();
|
||||||
@@ -366,6 +370,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
try {
|
try {
|
||||||
mBgSourceUtils.loadSettings();
|
mBgSourceUtils.loadSettings();
|
||||||
mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean(), true);
|
mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean(), true);
|
||||||
|
mBackgroundView.setBackgroundColor(mBgSourceUtils.getPreviewBackgroundBean().getPixelColor());
|
||||||
LogUtils.d(TAG, "【双重刷新】第一重完成");
|
LogUtils.d(TAG, "【双重刷新】第一重完成");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.e(TAG, "【双重刷新】第一重异常:" + e.getMessage());
|
LogUtils.e(TAG, "【双重刷新】第一重异常:" + e.getMessage());
|
||||||
@@ -380,6 +385,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
try {
|
try {
|
||||||
mBgSourceUtils.loadSettings();
|
mBgSourceUtils.loadSettings();
|
||||||
mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean(), true);
|
mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean(), true);
|
||||||
|
mBackgroundView.setBackgroundColor(mBgSourceUtils.getPreviewBackgroundBean().getPixelColor());
|
||||||
LogUtils.d(TAG, "【双重刷新】第二重完成");
|
LogUtils.d(TAG, "【双重刷新】第二重完成");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.e(TAG, "【双重刷新】第二重异常:" + e.getMessage());
|
LogUtils.e(TAG, "【双重刷新】第二重异常:" + e.getMessage());
|
||||||
@@ -852,5 +858,9 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
handleOperationCancelOrFail();
|
handleOperationCancelOrFail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handlePixelPickerResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
doubleRefreshPreview();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ public class PixelPickerActivity extends WinBoLLActivity implements IWinBoLLActi
|
|||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
// 可以在这里添加确定后的回调逻辑
|
// 可以在这里添加确定后的回调逻辑
|
||||||
BackgroundSourceUtils utils = BackgroundSourceUtils.getInstance(PixelPickerActivity.this);
|
BackgroundSourceUtils utils = BackgroundSourceUtils.getInstance(PixelPickerActivity.this);
|
||||||
BackgroundBean bean = utils.getCurrentBackgroundBean();
|
BackgroundBean bean = utils.getPreviewBackgroundBean();
|
||||||
bean.setPixelColor(pixelColor);
|
bean.setPixelColor(pixelColor);
|
||||||
utils.saveSettings();
|
utils.saveSettings();
|
||||||
Toast.makeText(PixelPickerActivity.this, "已记录像素值", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PixelPickerActivity.this, "已记录像素值", Toast.LENGTH_SHORT).show();
|
||||||
@@ -218,7 +218,7 @@ public class PixelPickerActivity extends WinBoLLActivity implements IWinBoLLActi
|
|||||||
|
|
||||||
void setBackgroundColor() {
|
void setBackgroundColor() {
|
||||||
BackgroundSourceUtils utils = BackgroundSourceUtils.getInstance(PixelPickerActivity.this);
|
BackgroundSourceUtils utils = BackgroundSourceUtils.getInstance(PixelPickerActivity.this);
|
||||||
BackgroundBean bean = utils.getCurrentBackgroundBean();
|
BackgroundBean bean = utils.getPreviewBackgroundBean();
|
||||||
int nPixelColor = bean.getPixelColor();
|
int nPixelColor = bean.getPixelColor();
|
||||||
RelativeLayout mainLayout = findViewById(R.id.activitypixelpickerRelativeLayout1);
|
RelativeLayout mainLayout = findViewById(R.id.activitypixelpickerRelativeLayout1);
|
||||||
mainLayout.setBackgroundColor(nPixelColor);
|
mainLayout.setBackgroundColor(nPixelColor);
|
||||||
@@ -247,9 +247,11 @@ public class PixelPickerActivity extends WinBoLLActivity implements IWinBoLLActi
|
|||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
Intent intent = new Intent();
|
setResult(RESULT_OK);
|
||||||
intent.setClass(this, BackgroundSettingsActivity.class);
|
finish();
|
||||||
startActivity(intent);
|
// Intent intent = new Intent();
|
||||||
|
// intent.setClass(this, BackgroundSettingsActivity.class);
|
||||||
|
// startActivity(intent);
|
||||||
//GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(getApplicationContext(), BackgroundPictureActivity.class);
|
//GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(getApplicationContext(), BackgroundPictureActivity.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:background="#FF28C000">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -32,7 +31,6 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#FF3243E2"
|
|
||||||
android:id="@+id/background_view">
|
android:id="@+id/background_view">
|
||||||
|
|
||||||
</cc.winboll.studio.powerbell.views.BackgroundView>
|
</cc.winboll.studio.powerbell.views.BackgroundView>
|
||||||
@@ -42,8 +40,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="400dp"
|
android:layout_height="400dp">
|
||||||
android:background="#B92FABE6">
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user