Compare commits

..

7 Commits

6 changed files with 835 additions and 650 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Wed Dec 10 18:38:00 HKT 2025 #Wed Dec 10 20:37:42 HKT 2025
stageCount=10 stageCount=13
libraryProject= libraryProject=
baseVersion=15.12 baseVersion=15.12
publishVersion=15.12.9 publishVersion=15.12.12
buildCount=0 buildCount=0
baseBetaVersion=15.12.10 baseBetaVersion=15.12.13

View File

@@ -4,13 +4,14 @@ import android.util.JsonReader;
import android.util.JsonWriter; import android.util.JsonWriter;
import cc.winboll.studio.libappbase.BaseBean; import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable;
/** /**
* @Author ZhanGSKen<zhangsken@qq.com> * @Author ZhanGSKen<zhangsken@qq.com>
* @Date 2024/07/18 11:52:28 * @Date 2024/07/18 11:52:28
* @Describe 应用背景图片数据类(存储正式/预览背景配置支持JSON序列化/反序列化) * @Describe 应用背景图片数据类(存储正式/预览背景配置支持JSON序列化/反序列化)
*/ */
public class BackgroundBean extends BaseBean { public class BackgroundBean extends BaseBean implements Serializable {
public static final String TAG = "BackgroundPictureBean"; public static final String TAG = "BackgroundPictureBean";

View File

@@ -132,7 +132,7 @@ public class BackgroundView extends RelativeLayout {
setDefaultTransparentBackground(); setDefaultTransparentBackground();
return; return;
} }
mIvBackground.setVisibility(View.GONE); mIvBackground.setVisibility(View.GONE);
// 计算原图比例 // 计算原图比例
@@ -211,37 +211,38 @@ public class BackgroundView extends RelativeLayout {
// 获取LinearLayout尺寸 // 获取LinearLayout尺寸
int llWidth = mLlContainer.getWidth(); int llWidth = mLlContainer.getWidth();
int llHeight = mLlContainer.getHeight(); int llHeight = mLlContainer.getHeight();
if (llWidth == 0 || llHeight == 0) { // if (llWidth == 0 || llHeight == 0) {
postDelayed(new Runnable() { // postDelayed(new Runnable() {
@Override // @Override
public void run() { // public void run() {
adjustImageViewSize(); // adjustImageViewSize();
} // }
}, 100); // }, 100);
return; // return;
} // }
// 计算ImageView尺寸保持比例不超出LinearLayout if (llWidth != 0 && llHeight != 0) {
int ivWidth, ivHeight; // 计算ImageView尺寸保持比例不超出LinearLayout
if (mImageAspectRatio >= 1.0f) { int ivWidth, ivHeight;
ivWidth = Math.min((int) (llHeight * mImageAspectRatio), llWidth); if (mImageAspectRatio >= 1.0f) {
ivHeight = (int) (ivWidth / mImageAspectRatio); ivWidth = Math.min((int) (llHeight * mImageAspectRatio), llWidth);
} else { ivHeight = (int) (ivWidth / mImageAspectRatio);
ivHeight = Math.min((int) (llWidth / mImageAspectRatio), llHeight); } else {
ivWidth = (int) (ivHeight * mImageAspectRatio); ivHeight = Math.min((int) (llWidth / mImageAspectRatio), llHeight);
} ivWidth = (int) (ivHeight * mImageAspectRatio);
}
// 应用尺寸 // 应用尺寸
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mIvBackground.getLayoutParams(); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mIvBackground.getLayoutParams();
params.width = ivWidth; params.width = ivWidth;
params.height = ivHeight; params.height = ivHeight;
mIvBackground.setLayoutParams(params); mIvBackground.setLayoutParams(params);
mIvBackground.setScaleType(ScaleType.FIT_CENTER); // 确保居中平铺 mIvBackground.setScaleType(ScaleType.FIT_CENTER); // 确保居中平铺
mIvBackground.setVisibility(View.VISIBLE); mIvBackground.setVisibility(View.VISIBLE);
//LogUtils.d(TAG, "ImageView尺寸" + ivWidth + "x" + ivHeight); //LogUtils.d(TAG, "ImageView尺寸" + ivWidth + "x" + ivHeight);
//LogUtils.d(TAG, "=== adjustImageViewSize 完成 ==="); //LogUtils.d(TAG, "=== adjustImageViewSize 完成 ===");
}
} }
private void setDefaultTransparentBackground() { private void setDefaultTransparentBackground() {

View File

@@ -1,251 +1,259 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" 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:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<cc.winboll.studio.libaes.views.ASupportToolbar <!-- 顶部Toolbar首屏核心同步加载保留原有ASupportToolbar -->
android:layout_width="match_parent" <cc.winboll.studio.libaes.views.ASupportToolbar
android:layout_height="@dimen/toolbar_height" android:layout_width="match_parent"
android:id="@+id/toolbar" android:layout_height="@dimen/toolbar_height"
android:gravity="center_vertical" android:id="@+id/toolbar"
style="@style/DefaultAToolbar"/> android:gravity="center_vertical"
style="@style/DefaultAToolbar"/>
<RelativeLayout <!-- 主内容区(优化层级,减少冗余RelativeLayout -->
android:layout_width="match_parent" <RelativeLayout
android:layout_height="0dp" android:layout_width="match_parent"
android:layout_weight="1.0"> android:layout_height="0dp"
android:layout_weight="1.0">
<RelativeLayout <!-- 首屏核心容器(合并原冗余RelativeLayout,减少层级) -->
android:layout_width="match_parent" <RelativeLayout
android:layout_height="match_parent" android:layout_width="match_parent"
android:id="@+id/activitymainRelativeLayout1"/> android:layout_height="match_parent"
android:id="@+id/activitymainRelativeLayout1">
<RelativeLayout <!-- 1. 背景视图(首屏核心,同步加载,保留原有) -->
xmlns:android="http://schemas.android.com/apk/res/android" <cc.winboll.studio.powerbell.views.BackgroundView
android:orientation="vertical" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="match_parent"> android:id="@+id/fragmentmainviewBackgroundView1"/>
<cc.winboll.studio.powerbell.views.BackgroundView <!-- 2. 功能控件容器(首屏核心,同步加载,保留原有结构) -->
xmlns:app="http://schemas.android.com/apk/res-auto" <LinearLayout
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:id="@+id/fragmentmainviewBackgroundView1"/>
<LinearLayout <!-- 服务总开关布局 -->
android:orientation="vertical" <LinearLayout
android:layout_width="match_parent" android:orientation="vertical"
android:layout_height="match_parent"> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fragmentmainviewLinearLayout3"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/fragmentmainviewLinearLayout3" android:gravity="center_vertical"
android:layout_marginLeft="10dp" android:background="@drawable/bg_frame">
android:layout_marginRight="10dp"
android:layout_marginTop="10dp">
<LinearLayout <Switch
android:orientation="horizontal" android:layout_width="0dp"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:id="@+id/fragmentandroidviewSwitch1"
android:gravity="center_vertical" android:padding="10dp"
android:background="@drawable/bg_frame"> android:layout_weight="1.0"
android:textSize="@dimen/text_title_size"/>
<Switch </LinearLayout>
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/fragmentandroidviewSwitch1"
android:padding="10dp"
android:layout_weight="1.0"
android:textSize="@dimen/text_title_size"/>
</LinearLayout> </LinearLayout>
</LinearLayout> <!-- 电量控制核心布局SeekBar+图标) -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1.0" android:layout_weight="1.0">
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<LinearLayout <!-- 耗电提醒布局 -->
android:orientation="horizontal" <LinearLayout
android:layout_width="match_parent" android:orientation="vertical"
android:layout_height="match_parent" android:layout_width="50dp"
android:layout_weight="1.0"> android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:id="@+id/fragmentmainviewLinearLayout1">
<LinearLayout <ImageView
android:orientation="vertical" android:layout_width="36dp"
android:layout_width="50dp" android:layout_height="36dp"
android:layout_height="match_parent" android:background="@drawable/usege"
android:layout_marginTop="20dp" android:layout_gravity="center_horizontal"
android:layout_marginBottom="20dp" android:layout_marginTop="10dp"/>
android:id="@+id/fragmentmainviewLinearLayout1">
<ImageView <CheckBox
android:layout_width="36dp" android:layout_width="wrap_content"
android:layout_height="36dp" android:layout_height="wrap_content"
android:background="@drawable/usege" android:layout_gravity="center_horizontal"
android:layout_gravity="center_horizontal" android:layout_marginTop="10dp"
android:layout_marginTop="10dp"/> android:id="@+id/fragmentmainviewCheckBox2"/>
<CheckBox <cc.winboll.studio.powerbell.views.VerticalSeekBar
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:id="@+id/fragmentandroidviewVerticalSeekBar2"
android:layout_marginTop="10dp" android:progressTint="@color/colorUsege"
android:id="@+id/fragmentmainviewCheckBox2"/> android:progressBackgroundTint="@color/colorUsege"
android:layout_weight="1.0"
android:layout_margin="10dp"/>
<cc.winboll.studio.powerbell.views.VerticalSeekBar </LinearLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fragmentandroidviewVerticalSeekBar2"
android:progressTint="@color/colorUsege"
android:progressBackgroundTint="@color/colorUsege"
android:layout_weight="1.0"
android:layout_margin="10dp"/>
</LinearLayout> <!-- 耗电提醒数值+图标 -->
<LinearLayout
android:orientation="vertical"
android:layout_width="80dp"
android:layout_height="match_parent">
<LinearLayout <TextView
android:orientation="vertical" android:layout_width="match_parent"
android:layout_width="80dp" android:layout_height="wrap_content"
android:layout_height="match_parent"> android:text="100%"
android:textSize="@dimen/text_title_size"
android:layout_gravity="center_horizontal"
android:id="@+id/fragmentandroidviewTextView3"
android:gravity="center_horizontal"/>
<TextView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="100%" android:id="@+id/fragmentandroidviewImageView2"
android:textSize="@dimen/text_title_size" android:layout_weight="1.0"/>
android:layout_gravity="center_horizontal"
android:id="@+id/fragmentandroidviewTextView3"
android:gravity="center_horizontal"/>
<ImageView </LinearLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fragmentandroidviewImageView2"
android:layout_weight="1.0"/>
</LinearLayout> <!-- 当前电量数值+图标 -->
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1.0">
<LinearLayout <TextView
android:orientation="vertical" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="match_parent" android:text="100%"
android:layout_weight="1.0"> android:textSize="@dimen/text_title_size"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:id="@+id/fragmentandroidviewTextView4"/>
<TextView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="100%" android:id="@+id/fragmentandroidviewImageView1"
android:textSize="@dimen/text_title_size" android:layout_weight="1.0"/>
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:id="@+id/fragmentandroidviewTextView4"/>
<ImageView </LinearLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fragmentandroidviewImageView1"
android:layout_weight="1.0"/>
</LinearLayout> <!-- 充电提醒数值+图标 -->
<LinearLayout
android:orientation="vertical"
android:layout_width="80dp"
android:layout_height="match_parent">
<LinearLayout <TextView
android:orientation="vertical" android:layout_width="match_parent"
android:layout_width="80dp" android:layout_height="wrap_content"
android:layout_height="match_parent"> android:text="100%"
android:textSize="@dimen/text_title_size"
android:layout_gravity="center_horizontal"
android:id="@+id/fragmentandroidviewTextView2"
android:gravity="center_horizontal"/>
<TextView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="100%" android:id="@+id/fragmentandroidviewImageView3"
android:textSize="@dimen/text_title_size" android:layout_weight="1.0"/>
android:layout_gravity="center_horizontal"
android:id="@+id/fragmentandroidviewTextView2"
android:gravity="center_horizontal"/>
<ImageView </LinearLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fragmentandroidviewImageView3"
android:layout_weight="1.0"/>
</LinearLayout> <!-- 充电提醒布局 -->
<LinearLayout
android:orientation="vertical"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:id="@+id/fragmentmainviewLinearLayout2">
<LinearLayout <ImageView
android:orientation="vertical" android:layout_width="36dp"
android:layout_width="50dp" android:layout_height="36dp"
android:layout_height="match_parent" android:background="@drawable/charge"
android:layout_marginBottom="20dp" android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp" android:layout_marginTop="10dp"/>
android:id="@+id/fragmentmainviewLinearLayout2">
<ImageView <CheckBox
android:layout_width="36dp" android:layout_width="wrap_content"
android:layout_height="36dp" android:layout_height="wrap_content"
android:background="@drawable/charge" android:layout_gravity="center_horizontal"
android:layout_gravity="center_horizontal" android:layout_marginTop="10dp"
android:layout_marginTop="10dp"/> android:id="@+id/fragmentmainviewCheckBox1"/>
<CheckBox <cc.winboll.studio.powerbell.views.VerticalSeekBar
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:id="@+id/fragmentandroidviewVerticalSeekBar1"
android:layout_marginTop="10dp" android:progressTint="@color/colorCharge"
android:id="@+id/fragmentmainviewCheckBox1"/> android:progressBackgroundTint="@color/colorCharge"
android:layout_weight="1.0"
android:layout_margin="10dp"/>
<cc.winboll.studio.powerbell.views.VerticalSeekBar </LinearLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fragmentandroidviewVerticalSeekBar1"
android:progressTint="@color/colorCharge"
android:progressBackgroundTint="@color/colorCharge"
android:layout_weight="1.0"
android:layout_margin="10dp"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> <!-- Tips文本 -->
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout <TextView
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_width="match_parent"> android:layout_height="wrap_content"
android:text="Tips"
android:textSize="@dimen/text_content_size"
android:id="@+id/fragmentandroidviewTextView1"
android:background="@drawable/bg_frame"
android:padding="10dp"/>
<TextView </LinearLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Tips"
android:textSize="@dimen/text_content_size"
android:id="@+id/fragmentandroidviewTextView1"
android:background="@drawable/bg_frame"
android:padding="10dp"/>
</LinearLayout> </LinearLayout>
</LinearLayout> <!-- 3. 广告视图关键优化→用ViewStub延迟加载替代原直接加载的ADsBannerView -->
<!-- 首次启动仅占位1px不inflate真实广告视图减少首次耗时 -->
<ViewStub
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/stub_ads_banner"
android:layout_alignParentBottom="true"
android:layout="@layout/view_ads_banner"/> <!-- 广告视图独立布局文件 -->
</RelativeLayout> </RelativeLayout>
<cc.winboll.studio.libaes.views.ADsBannerView </RelativeLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/adsbanner"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 广告视图独立布局供ViewStub延迟加载 -->
<cc.winboll.studio.libaes.views.ADsBannerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/adsbanner"/>