Compare commits

...

19 Commits

Author SHA1 Message Date
ZhanGSKen
cdfbb082d2 <powerbell>APK 15.4.12 release Publish. 2025-09-03 20:59:53 +08:00
ZhanGSKen
7e476894a7 电量记录表里添加换行显示功能。 2025-09-03 20:54:48 +08:00
ZhanGSKen
80201e8370 <powerbell>APK 15.4.11 release Publish. 2025-08-31 06:21:48 +08:00
ZhanGSKen
ea0473606a 更新类库 2025-08-31 06:17:41 +08:00
ZhanGSKen
eb61eb7306 <powerbell>APK 15.4.10 release Publish. 2025-08-13 02:46:25 +08:00
ZhanGSKen
31ad66685c 修复信息提示错误问题。 2025-08-13 02:45:05 +08:00
ZhanGSKen
beb561ad6a <powerbell>APK 15.4.9 release Publish. 2025-08-13 02:37:14 +08:00
ZhanGSKen
8869265d60 优化电量清理活动窗口UI显示。 2025-08-13 02:35:36 +08:00
ZhanGSKen
07b5e66875 <powerbell>APK 15.4.8 release Publish. 2025-07-06 12:53:58 +08:00
ZhanGSKen
91f5cf9051 更新应用介绍页 2025-07-06 12:51:50 +08:00
ZhanGSKen
f8944490f8 <powerbell>APK 15.4.7 release Publish. 2025-06-23 20:07:50 +08:00
ZhanGSKen
733af004f6 编译参数修复 2025-06-23 20:07:12 +08:00
ZhanGSKen
c03568e1f5 <powerbell>APK 15.4.6 release Publish. 2025-06-23 20:04:59 +08:00
ZhanGSKen
a0575a5e8b 调整像素拾取窗口、背景图片设置窗口与主窗口的切换逻辑。 2025-06-23 20:03:32 +08:00
ZhanGSKen
0e57ce679e <powerbell>APK 15.4.5 release Publish. 2025-06-23 14:49:46 +08:00
ZhanGSKen
f9211a8eb4 优化背景像素拾取UI 2025-06-23 14:48:24 +08:00
ZhanGSKen
4c31ff9b54 调整窗口切换模式 2025-06-23 14:29:59 +08:00
ZhanGSKen
8cf610962e <powerbell>APK 15.4.4 release Publish. 2025-06-22 16:21:12 +08:00
ZhanGSKen
3071d186ec 添加图片像素拾取并可以设置像素为图片背景 2025-06-22 16:19:24 +08:00
19 changed files with 646 additions and 123 deletions

View File

@@ -45,9 +45,9 @@ android {
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api 'cc.winboll.studio:libaes:15.8.0'
api 'cc.winboll.studio:libapputils:15.8.2'
api 'cc.winboll.studio:libappbase:15.8.2'
api 'cc.winboll.studio:libaes:15.9.3'
api 'cc.winboll.studio:libapputils:15.8.5'
api 'cc.winboll.studio:libappbase:15.9.5'
// 吐司提示库
api 'com.github.getActivity:ToastUtils:10.5'

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Thu Jun 19 21:16:18 HKT 2025
stageCount=4
#Wed Sep 03 20:59:53 HKT 2025
stageCount=13
libraryProject=
baseVersion=15.4
publishVersion=15.4.3
publishVersion=15.4.12
buildCount=0
baseBetaVersion=15.4.4
baseBetaVersion=15.4.13

View File

@@ -121,6 +121,8 @@
<activity android:name="cc.winboll.studio.powerbell.activities.AboutActivity"/>
<activity android:name="cc.winboll.studio.powerbell.activities.PixelPickerActivity"/>
</application>
</manifest>
</manifest>

View File

@@ -1,5 +1,6 @@
package cc.winboll.studio.powerbell;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Intent;
@@ -9,6 +10,7 @@ import android.os.Bundle;
import android.provider.MediaStore;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.RelativeLayout;
import android.widget.Toast;
import cc.winboll.studio.libaes.views.AToolbar;
import cc.winboll.studio.libappbase.LogUtils;
@@ -18,11 +20,12 @@ import cc.winboll.studio.powerbell.activities.BackgroundPictureActivity;
import cc.winboll.studio.powerbell.activities.BatteryReporterActivity;
import cc.winboll.studio.powerbell.activities.ClearRecordActivity;
import cc.winboll.studio.powerbell.activities.WinBoLLActivity;
import cc.winboll.studio.powerbell.beans.BackgroundPictureBean;
import cc.winboll.studio.powerbell.fragments.MainViewFragment;
import android.app.Activity;
import cc.winboll.studio.powerbell.utils.BackgroundPictureUtils;
public class MainActivity extends WinBoLLActivity {
public static final String TAG = "MainActivity";
public static final int BACKGROUND_PICTURE_REQUEST_CODE = 0;
@@ -45,7 +48,7 @@ public class MainActivity extends WinBoLLActivity {
public String getTag() {
return TAG;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
//LogUtils.d(TAG, "onCreate(...)");
@@ -128,8 +131,8 @@ public class MainActivity extends WinBoLLActivity {
super.onResume();
// 回到窗口自动取消提醒消息
//NotificationHelper.cancelRemindNotification(this);
reloadBackground();
setBackgroundColor();
}
// Menu icons are inflated just as they were with actionbar
@@ -206,4 +209,12 @@ public class MainActivity extends WinBoLLActivity {
moveTaskToBack(true);
}
}
void setBackgroundColor() {
BackgroundPictureUtils utils = BackgroundPictureUtils.getInstance(MainActivity.this);
BackgroundPictureBean bean = utils.getBackgroundPictureBean();
int nPixelColor = bean.getPixelColor();
RelativeLayout mainLayout = findViewById(R.id.activitymainRelativeLayout1);
mainLayout.setBackgroundColor(nPixelColor);
}
}

View File

@@ -53,11 +53,11 @@ public class AboutActivity extends Activity {
appInfo.setAppName(getString(R.string.app_name));
appInfo.setAppIcon(R.drawable.ic_launcher);
appInfo.setAppDescription(getString(R.string.app_description));
appInfo.setAppGitName("APP");
appInfo.setAppGitName("APPBase");
appInfo.setAppGitOwner("Studio");
appInfo.setAppGitAPPBranch(szBranchName);
appInfo.setAppGitAPPSubProjectFolder(szBranchName);
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=PowerBell");
appInfo.setAppHomePage("https://discuz.winboll.cc/forum.php?mod=viewthread&tid=1");
appInfo.setAppAPKName("PowerBell");
appInfo.setAppAPKFolderName("PowerBell");
return new AboutView(mContext, appInfo);

View File

@@ -14,6 +14,7 @@ import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import cc.winboll.studio.libaes.views.AToolbar;
@@ -33,7 +34,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class BackgroundPictureActivity extends Activity implements BackgroundPicturePreviewDialog.IOnRecivedPictureListener {
public class BackgroundPictureActivity extends WinBoLLActivity implements BackgroundPicturePreviewDialog.IOnRecivedPictureListener {
public static final String TAG = "BackgroundPictureActivity";
public BackgroundPictureUtils mBackgroundPictureUtils;
@@ -58,6 +59,16 @@ public class BackgroundPictureActivity extends Activity implements BackgroundPic
private int mnPictureCompress = 100;
private static String _RecivedPictureFileName;
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -102,6 +113,8 @@ public class BackgroundPictureActivity extends Activity implements BackgroundPic
findViewById(R.id.activitybackgroundpictureAButton2).setOnClickListener(onSelectPictureClickListener);
findViewById(R.id.activitybackgroundpictureAButton3).setOnClickListener(onCropPictureClickListener);
findViewById(R.id.activitybackgroundpictureAButton6).setOnClickListener(onCropFreePictureClickListener);
findViewById(R.id.activitybackgroundpictureAButton7).setOnClickListener(onPixelPickerClickListener);
findViewById(R.id.activitybackgroundpictureAButton8).setOnClickListener(onCleanPixelClickListener);
updatePreviewBackground();
@@ -154,10 +167,10 @@ public class BackgroundPictureActivity extends Activity implements BackgroundPic
String filePath = utils.getBackgroundDir() + getBackgroundFileName();
Drawable drawable = FileUtils.getImageDrawable(filePath);
if (drawable != null) {
drawable.setAlpha(120);
//drawable.setAlpha(120);
ivPreviewBackground.setImageDrawable(drawable);
}
ToastUtils.show("背景图片已更新");
//ToastUtils.show("背景图片已更新");
} catch (IOException e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
ToastUtils.show("背景图片加载失败");
@@ -252,6 +265,30 @@ public class BackgroundPictureActivity extends Activity implements BackgroundPic
}
};
private View.OnClickListener onPixelPickerClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
// 从文件路径启动像素拾取活动
//String imagePath = "/storage/emulated/0/DCIM/Camera/sample.jpg";
String imagePath = mfRecivedCropPicture.toString();
Intent intent = new Intent(getApplicationContext(), PixelPickerActivity.class);
intent.putExtra("imagePath", imagePath);
startActivity(intent);
//App.getWinBoLLActivityManager().startWinBoLLActivity(getActivity(), intent, PixelPickerActivity.class);
}
};
private View.OnClickListener onCleanPixelClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
BackgroundPictureUtils utils = BackgroundPictureUtils.getInstance(BackgroundPictureActivity.this);
BackgroundPictureBean bean = utils.getBackgroundPictureBean();
bean.setPixelColor(0);
utils.saveData();
setBackgroundColor();
}
};
/**
* 压缩图片并保存到接收文件
*/
@@ -492,11 +529,11 @@ public class BackgroundPictureActivity extends Activity implements BackgroundPic
LogUtils.e(TAG, "剪裁保存异常" + e);
ToastUtils.show("保存失败:" + e.getMessage());
}/* finally {
// 安全删除临时文件
if (mfTempCropPicture.exists()) {
mfTempCropPicture.delete();
}
}*/
// 安全删除临时文件
if (mfTempCropPicture.exists()) {
mfTempCropPicture.delete();
}
}*/
} else if (resultCode != RESULT_OK) {
LogUtils.d(TAG, "操作取消或失败requestCode: " + requestCode);
ToastUtils.show("操作已取消");
@@ -538,5 +575,19 @@ public class BackgroundPictureActivity extends Activity implements BackgroundPic
}
}
}
void setBackgroundColor() {
BackgroundPictureUtils utils = BackgroundPictureUtils.getInstance(BackgroundPictureActivity.this);
BackgroundPictureBean bean = utils.getBackgroundPictureBean();
int nPixelColor = bean.getPixelColor();
RelativeLayout mainLayout = findViewById(R.id.activitybackgroundpictureRelativeLayout1);
mainLayout.setBackgroundColor(nPixelColor);
}
@Override
protected void onResume() {
super.onResume();
setBackgroundColor();
}
}

View File

@@ -16,6 +16,7 @@ import cc.winboll.studio.powerbell.receivers.ControlCenterServiceReceiver;
import cc.winboll.studio.powerbell.utils.AppCacheUtils;
import cc.winboll.studio.powerbell.utils.StringUtils;
import java.util.ArrayList;
import android.widget.Switch;
public class ClearRecordActivity extends Activity {
@@ -24,6 +25,7 @@ public class ClearRecordActivity extends Activity {
AToolbar mAToolbar;
TextView mtvRecordText;
App mApplication;
boolean mIsShowRecordWithEnter = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -47,7 +49,7 @@ public class ClearRecordActivity extends Activity {
finish();
}
});
// 设置滑动清理控件
//
// 初始化发送拉动控件
@@ -79,7 +81,18 @@ public class ClearRecordActivity extends Activity {
void initRecordText() {
ArrayList<BatteryInfoBean> listBatteryInfo = AppCacheUtils.getInstance(this).getArrayListBatteryInfo();
String szRecordText = StringUtils.formatPCMListString(listBatteryInfo);
mtvRecordText.setText(szRecordText);
if (mIsShowRecordWithEnter) {
String szRecordText = StringUtils.formatPCMListStringWithEnter(listBatteryInfo);
mtvRecordText.setText(szRecordText);
} else {
String szRecordText = StringUtils.formatPCMListString(listBatteryInfo);
mtvRecordText.setText(szRecordText);
}
}
public void onShowRecordWithEnter(View view) {
Switch swShowRecordWithEnter = (Switch)view;
mIsShowRecordWithEnter = swShowRecordWithEnter.isChecked();
initRecordText();
}
}

View File

@@ -0,0 +1,251 @@
package cc.winboll.studio.powerbell.activities;
/**
* @Author ZhanGSKen<zhangsken@188.com>
* @Date 2025/06/22 14:15
*/
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import cc.winboll.studio.libaes.views.AToolbar;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
import cc.winboll.studio.powerbell.MainActivity;
import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.activities.PixelPickerActivity;
import cc.winboll.studio.powerbell.beans.BackgroundPictureBean;
import cc.winboll.studio.powerbell.utils.BackgroundPictureUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class PixelPickerActivity extends WinBoLLActivity implements IWinBoLLActivity {
public static final String TAG = "PixelPickerActivity";
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
private AToolbar mAToolbar;
private ImageView imageView;
private Bitmap originalBitmap;
private TextView infoText;
private ViewGroup imageContainer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pixelpicker);
// 初始化工具栏
mAToolbar = (AToolbar) findViewById(R.id.toolbar);
setActionBar(mAToolbar);
mAToolbar.setSubtitle(R.string.subtitle_activity_pixelpicker);
getActionBar().setDisplayHomeAsUpEnabled(true);
mAToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
imageView = findViewById(R.id.imageView);
infoText = findViewById(R.id.infoText);
imageContainer = findViewById(R.id.imageContainer);
// 从Intent获取图片路径并加载
String imagePath = getIntent().getStringExtra("imagePath");
if (imagePath != null) {
loadImage(imagePath);
} else {
infoText.setText("未找到图片路径");
}
// 设置图片点击事件
imageContainer.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN && originalBitmap != null) {
// 计算点击位置在图片上的实际坐标
float touchX = event.getX();
float touchY = event.getY();
int pixelX = -1, pixelY = -1;
try {
// 获取图片在容器中的实际位置和尺寸
int[] imageLocation = new int[2];
imageView.getLocationInWindow(imageLocation);
int imageWidth = imageView.getWidth();
int imageHeight = imageView.getHeight();
// 计算缩放比例
float scaleX = (float) originalBitmap.getWidth() / imageWidth;
float scaleY = (float) originalBitmap.getHeight() / imageHeight;
// 调整触摸坐标到图片坐标系
float adjustedX = touchX - imageLocation[0];
float adjustedY = touchY - imageLocation[1];
// 检查是否在图片范围内
if (adjustedX >= 0 && adjustedX <= imageWidth && adjustedY >= 0 && adjustedY <= imageHeight) {
// 计算实际像素坐标
pixelX = (int) (adjustedX * scaleX);
pixelY = (int) (adjustedY * scaleY);
// 再次检查像素坐标是否在有效范围内
if (pixelX >= 0 && pixelX < originalBitmap.getWidth() &&
pixelY >= 0 && pixelY < originalBitmap.getHeight()) {
int pixelColor = originalBitmap.getPixel(pixelX, pixelY);
showPixelDialog(pixelColor, pixelX, pixelY);
} else {
Toast.makeText(PixelPickerActivity.this, "像素坐标超出范围", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(PixelPickerActivity.this, "点击位置超出图片显示范围", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(PixelPickerActivity.this, "计算像素位置失败", Toast.LENGTH_SHORT).show();
}
}
return true;
}
});
}
/**
* 加载图片
*/
private void loadImage(String imagePath) {
try {
File file = new File(imagePath);
if (file.exists()) {
// 解码图片
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 1; // 加载原图
originalBitmap = BitmapFactory.decodeStream(new FileInputStream(file), null, options);
if (originalBitmap != null) {
imageView.setImageBitmap(originalBitmap);
infoText.setText("图片已加载,点击获取像素值");
} else {
infoText.setText("图片加载失败");
}
} else {
infoText.setText("图片文件不存在");
}
} catch (FileNotFoundException e) {
e.printStackTrace();
infoText.setText("图片文件未找到");
}
}
/**
* 显示像素对话框
*/
private void showPixelDialog(final int pixelColor, int x, int y) {
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.dialog_pixel);
dialog.setCancelable(true);
// 设置像素颜色视图背景
TextView colorView = dialog.findViewById(R.id.pixelColorView);
colorView.setBackgroundColor(pixelColor);
// 显示颜色信息
TextView infoText = dialog.findViewById(R.id.colorInfoText);
String colorInfo = String.format(
"RGB: (%d, %d, %d)\n" +
"ARGB: #%08X\n" +
"实际像素位置: (%d, %d)",
Color.red(pixelColor),
Color.green(pixelColor),
Color.blue(pixelColor),
pixelColor,
x, y);
infoText.setText(colorInfo);
// 设置确定按钮点击事件
Button confirmButton = dialog.findViewById(R.id.confirmButton);
confirmButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
// 可以在这里添加确定后的回调逻辑
BackgroundPictureUtils utils = BackgroundPictureUtils.getInstance(PixelPickerActivity.this);
BackgroundPictureBean bean = utils.getBackgroundPictureBean();
bean.setPixelColor(pixelColor);
utils.saveData();
Toast.makeText(PixelPickerActivity.this, "已记录像素值", Toast.LENGTH_SHORT).show();
setBackgroundColor();
}
});
dialog.show();
}
@Override
protected void onDestroy() {
super.onDestroy();
// 回收Bitmap资源
if (originalBitmap != null && !originalBitmap.isRecycled()) {
originalBitmap.recycle();
originalBitmap = null;
}
}
void setBackgroundColor() {
BackgroundPictureUtils utils = BackgroundPictureUtils.getInstance(PixelPickerActivity.this);
BackgroundPictureBean bean = utils.getBackgroundPictureBean();
int nPixelColor = bean.getPixelColor();
RelativeLayout mainLayout = findViewById(R.id.activitypixelpickerRelativeLayout1);
mainLayout.setBackgroundColor(nPixelColor);
}
@Override
protected void onResume() {
super.onResume();
setBackgroundColor();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(getApplicationContext(), BackgroundPictureActivity.class);
return true;
}
// 在switch语句中处理每个ID并在处理完后返回true未处理的情况返回false。
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
super.onBackPressed();
GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(getApplicationContext(), BackgroundPictureActivity.class);
}
}

View File

@@ -1,14 +1,19 @@
package cc.winboll.studio.powerbell.activities;
import android.app.Activity;
import android.os.Bundle;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
/**
* @Author ZhanGSKen<zhangsken@188.com>
* @Date 2025/06/19 20:35
* @Describe 应用窗口基类
*/
import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.MainActivity;
import cc.winboll.studio.powerbell.R;
public abstract class WinBoLLActivity extends Activity implements IWinBoLLActivity {
public static final String TAG = "WinBoLLActivity";
@@ -17,4 +22,32 @@ public abstract class WinBoLLActivity extends Activity implements IWinBoLLActivi
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
GlobalApplication.getWinBoLLActivityManager().add(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
GlobalApplication.getWinBoLLActivityManager().registeRemove(this);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(getApplicationContext(), MainActivity.class);
return true;
}
// 在switch语句中处理每个ID并在处理完后返回true未处理的情况返回false。
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
super.onBackPressed();
GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(getApplicationContext(), MainActivity.class);
}
}

View File

@@ -17,6 +17,8 @@ public class BackgroundPictureBean extends BaseBean {
int backgroundWidth = 100;
int backgroundHeight = 100;
boolean isUseBackgroundFile = false;
// 图片拾取像素颜色
int pixelColor = 0;
public BackgroundPictureBean() {
}
@@ -25,6 +27,14 @@ public class BackgroundPictureBean extends BaseBean {
this.isUseBackgroundFile = isUseBackgroundFile;
}
public void setPixelColor(int pixelColor) {
this.pixelColor = pixelColor;
}
public int getPixelColor() {
return pixelColor;
}
public void setBackgroundWidth(int backgroundWidth) {
this.backgroundWidth = backgroundWidth;
}
@@ -61,6 +71,7 @@ public class BackgroundPictureBean extends BaseBean {
jsonWriter.name("backgroundWidth").value(bean.getBackgroundWidth());
jsonWriter.name("backgroundHeight").value(bean.getBackgroundHeight());
jsonWriter.name("isUseBackgroundFile").value(bean.isUseBackgroundFile());
jsonWriter.name("pixelColor").value(bean.getPixelColor());
}
@Override
@@ -75,6 +86,8 @@ public class BackgroundPictureBean extends BaseBean {
bean.setBackgroundHeight(jsonReader.nextInt());
} else if (name.equals("isUseBackgroundFile")) {
bean.setIsUseBackgroundFile(jsonReader.nextBoolean());
} else if (name.equals("pixelColor")) {
bean.setPixelColor(jsonReader.nextInt());
} else {
jsonReader.skipValue();
}

View File

@@ -311,11 +311,11 @@ public class MainViewFragment extends Fragment {
LogUtils.d(TAG, String.format("fBackgroundFilePath.exists() %s", fBackgroundFilePath.exists()));
if (bean.isUseBackgroundFile() && fBackgroundFilePath.exists()) {
Drawable drawableBackground = Drawable.createFromPath(szBackgroundFilePath);
drawableBackground.setAlpha(120);
//drawableBackground.setAlpha(120);
imageView.setImageDrawable(drawableBackground);
} else {
Drawable drawableBackground = getActivity().getDrawable(R.drawable.blank10x10);
drawableBackground.setAlpha(120);
//drawableBackground.setAlpha(120);
imageView.setImageDrawable(drawableBackground);
}
}

View File

@@ -37,6 +37,15 @@ public class StringUtils {
}
return sz;
}
public static String formatPCMListStringWithEnter(ArrayList<BatteryInfoBean> arrayListBatteryInfo) {
String sz = "";
for (int i = 0; i < arrayListBatteryInfo.size() - 1; i++) {
//LogUtils.d(TAG, "arrayListBatteryInfo.get(i).getBattetyValue() is "+ Integer.toString(arrayListBatteryInfo.get(i).getBattetyValue()));
sz = "\n" + arrayListBatteryInfo.get(i).getBattetyValue() + "%\n " + getTimespanDifference(arrayListBatteryInfo.get(i).getTimeStamp(), arrayListBatteryInfo.get(i + 1).getTimeStamp()) + " " + sz;
}
return sz;
}
// 获取时间之间的时间跨度字符串。
// Get timespan string between times.

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
@@ -12,83 +12,110 @@
android:id="@+id/toolbar"
style="@style/DefaultAToolbar"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/activitybackgroundpictureImageView1"
android:layout_below="@id/toolbar">
</ImageView>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/activitybackgroundpictureRelativeLayout1"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="160dp"
android:layout_height="36dp"
android:text="Origin BG"
android:id="@+id/activitybackgroundpictureAButton5"
android:layout_alignParentLeft="true"
android:layout_margin="5dp"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="160dp"
android:layout_height="36dp"
android:text="Received BG"
android:id="@+id/activitybackgroundpictureAButton4"
android:layout_alignParentRight="true"
android:layout_margin="5dp"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/activitybackgroundpictureImageView1"
android:layout_below="@id/toolbar">
</RelativeLayout>
</ImageView>
<LinearLayout
android:orientation="horizontal"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
android:layout_below="@id/toolbar">
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="◎"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:id="@+id/activitybackgroundpictureAButton1"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text=""
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:id="@+id/activitybackgroundpictureAButton2"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="160dp"
android:layout_height="36dp"
android:text="Origin BG"
android:id="@+id/activitybackgroundpictureAButton5"
android:layout_alignParentLeft="true"
android:layout_margin="5dp"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="[+]"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:id="@+id/activitybackgroundpictureAButton3"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="160dp"
android:layout_height="36dp"
android:text="Received BG"
android:id="@+id/activitybackgroundpictureAButton4"
android:layout_alignParentRight="true"
android:layout_margin="5dp"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="[+~]"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:id="@+id/activitybackgroundpictureAButton6"/>
</RelativeLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="◎"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:id="@+id/activitybackgroundpictureAButton1"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="☑"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:id="@+id/activitybackgroundpictureAButton2"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="[+]"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:id="@+id/activitybackgroundpictureAButton3"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="[+~]"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:id="@+id/activitybackgroundpictureAButton6"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="[◐]"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:id="@+id/activitybackgroundpictureAButton7"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="[○]"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:id="@+id/activitybackgroundpictureAButton8"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>

View File

@@ -25,12 +25,19 @@
</LinearLayout>
<TextView
android:layout_width="wrap_content"
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activityclearrecordTextView1"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"/>
android:gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/activityclearrecordTextView1"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
@@ -40,12 +47,32 @@
android:layout_weight="1.0"
android:background="@drawable/bg_frame">
<TextView
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Record Text"
android:textStyle="bold"
android:gravity="center_horizontal"/>
android:gravity="center_horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Record Text"
android:textStyle="bold"
android:gravity="center_horizontal"
android:layout_weight="1.0"
android:layout_marginLeft="10dp"
android:background="#FFD5D5D5"/>
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="&lt;↲&gt;"
android:id="@+id/activityclearrecordSwitch1"
android:onClick="onShowRecordWithEnter"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"

View File

@@ -2,36 +2,34 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
<cc.winboll.studio.libaes.views.AToolbar
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="@dimen/toolbar_height"
android:id="@+id/toolbar"
android:gravity="center_vertical"
style="@style/DefaultAToolbar"/>
<cc.winboll.studio.libaes.views.AToolbar
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:id="@+id/toolbar"
android:gravity="center_vertical"
style="@style/DefaultAToolbar"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_weight="1.0">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/activitymainRelativeLayout1"
android:background="#FFEE2121"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/activitymainFrameLayout1"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<cc.winboll.studio.libaes.views.AToolbar
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:id="@+id/toolbar"
android:gravity="center_vertical"
style="@style/DefaultAToolbar"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFEE2121"
android:id="@+id/activitypixelpickerRelativeLayout1"/>
<FrameLayout
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"/>
</FrameLayout>
<TextView
android:id="@+id/infoText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="10dp"
android:background="#80000000"
android:textColor="#FFFFFF"
android:text="点击图片获取像素值"/>
</RelativeLayout>
</LinearLayout>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/pixelColorView"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center_horizontal" />
<TextView
android:id="@+id/colorInfoText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:textColor="#333333"
android:textSize="14sp" />
<Button
android:id="@+id/confirmButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@android:color/holo_blue_light"
android:text="确定"
android:textColor="@android:color/white" />
</LinearLayout>

View File

@@ -15,6 +15,7 @@
<string name="texthint_CustomSlideToCleanRecord">Slide Right To Clean Up APP Record.</string>
<string name="subtitle_activity_clearrecord">清理记录</string>
<string name="subtitle_activity_backgroundpicture">更换背景图片</string>
<string name="subtitle_activity_pixelpicker">背景像素拾取</string>
<string name="subtitle_activity_about">关于应用</string>
<string name="msg_AOHPCTCSeekBar_ClearRecord">&gt;&gt;&gt;Seek 100% To Clear Battery Record.&gt;&gt;&gt;</string>
<string name="msg_AOHPCTCSeekBar_ClearRecord">&gt;&gt;&gt;向右滑动100%可以清理电量记录。&gt;&gt;&gt;</string>
</resources>

View File

@@ -18,6 +18,7 @@
<string name="texthint_CustomSlideToCleanRecord">Slide Right To Clean Up APP Record.</string>
<string name="subtitle_activity_clearrecord">Clean Record</string>
<string name="subtitle_activity_backgroundpicture">Background Picture</string>
<string name="subtitle_activity_pixelpicker">Pixel Picker</string>
<string name="subtitle_activity_about">About The APP</string>
<string name="msg_AOHPCTCSeekBar_ClearRecord">&gt;&gt;&gt;Seek 100% To Clear Battery Record.&gt;&gt;&gt;</string>
<string name="msg_AOHPCTCSeekBar_ClearRecord">&gt;&gt;&gt;Seek 100% Right Is Clean Record.&gt;&gt;&gt;</string>
</resources>