Compare commits

..

16 Commits

Author SHA1 Message Date
9f4211c83e <powerbell>APK 15.12.12 release Publish. 2025-12-10 20:37:42 +08:00
447a786632 图片尺寸调整函数优化 2025-12-10 20:31:10 +08:00
ff0f239ffc <powerbell>APK 15.12.11 release Publish. 2025-12-10 20:11:13 +08:00
7c59a982fc 使用豆包提供的savedInstanceState 窗体缓存技术,仅限于启动页窗体优化。 2025-12-10 20:09:49 +08:00
895cc4630d <powerbell>APK 15.12.10 release Publish. 2025-12-10 19:31:13 +08:00
851a539364 <powerbell>Start New Stage Version. 2025-12-10 19:30:41 +08:00
d79f2937ba 豆包优化,添加窗体缓存技术。代码优化首次窗体加载速度不多。代码理解难度增加。有可能会回退到上一个提交点。 2025-12-10 19:28:39 +08:00
c524a21429 <powerbell>APK 15.12.9 release Publish. 2025-12-10 18:38:00 +08:00
a148de2ab8 加快图片加载速度。 2025-12-10 18:36:49 +08:00
de34e823b6 <powerbell>APK 15.12.8 release Publish. 2025-12-10 18:32:41 +08:00
fd0833476e 简化冗余图片加载步骤。 2025-12-10 18:31:36 +08:00
361b533b0d <powerbell>APK 15.12.7 release Publish. 2025-12-10 18:12:34 +08:00
f277f76468 <powerbell>Start New Stage Version. 2025-12-10 18:12:02 +08:00
ec54865a8e 清理图片加载前的调试色调。优化加载速度。 2025-12-10 18:11:10 +08:00
6b3682994e <powerbell>APK 15.12.6 release Publish. 2025-12-10 17:52:12 +08:00
7145bff552 修复图片加载时出现的画面抖动问题。 2025-12-10 17:51:15 +08:00
6 changed files with 837 additions and 655 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Wed Dec 10 17:43:17 HKT 2025 #Wed Dec 10 20:37:42 HKT 2025
stageCount=6 stageCount=13
libraryProject= libraryProject=
baseVersion=15.12 baseVersion=15.12
publishVersion=15.12.5 publishVersion=15.12.12
buildCount=0 buildCount=0
baseBetaVersion=15.12.6 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

@@ -4,9 +4,9 @@ import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ImageView.ScaleType; import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@@ -133,6 +133,8 @@ public class BackgroundView extends RelativeLayout {
return; return;
} }
mIvBackground.setVisibility(View.GONE);
// 计算原图比例 // 计算原图比例
if (!calculateImageAspectRatio(imageFile)) { if (!calculateImageAspectRatio(imageFile)) {
setDefaultTransparentBackground(); setDefaultTransparentBackground();
@@ -209,16 +211,17 @@ 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();
} // }
}, 120); // }, 100);
return; // return;
} // }
if (llWidth != 0 && llHeight != 0) {
// 计算ImageView尺寸保持比例不超出LinearLayout // 计算ImageView尺寸保持比例不超出LinearLayout
int ivWidth, ivHeight; int ivWidth, ivHeight;
if (mImageAspectRatio >= 1.0f) { if (mImageAspectRatio >= 1.0f) {
@@ -235,10 +238,12 @@ public class BackgroundView extends RelativeLayout {
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);
//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() {
mIvBackground.setImageBitmap(null); mIvBackground.setImageBitmap(null);

View File

@@ -6,6 +6,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<!-- 顶部Toolbar首屏核心同步加载保留原有ASupportToolbar -->
<cc.winboll.studio.libaes.views.ASupportToolbar <cc.winboll.studio.libaes.views.ASupportToolbar
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height" android:layout_height="@dimen/toolbar_height"
@@ -13,35 +14,31 @@
android:gravity="center_vertical" android:gravity="center_vertical"
style="@style/DefaultAToolbar"/> style="@style/DefaultAToolbar"/>
<!-- 主内容区优化层级减少冗余RelativeLayout -->
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1.0"> android:layout_weight="1.0">
<!-- 首屏核心容器合并原冗余RelativeLayout减少层级 -->
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/activitymainRelativeLayout1"/> android:id="@+id/activitymainRelativeLayout1">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- 1. 背景视图(首屏核心,同步加载,保留原有) -->
<cc.winboll.studio.powerbell.views.BackgroundView <cc.winboll.studio.powerbell.views.BackgroundView
xmlns:app="http://schemas.android.com/apk/res-auto"
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="#FF7381FF"
android:id="@+id/fragmentmainviewBackgroundView1"/> android:id="@+id/fragmentmainviewBackgroundView1"/>
<!-- 2. 功能控件容器(首屏核心,同步加载,保留原有结构) -->
<LinearLayout <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">
<!-- 服务总开关布局 -->
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -70,6 +67,7 @@
</LinearLayout> </LinearLayout>
<!-- 电量控制核心布局SeekBar+图标) -->
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -84,6 +82,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1.0"> android:layout_weight="1.0">
<!-- 耗电提醒布局 -->
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="50dp" android:layout_width="50dp"
@@ -117,6 +116,7 @@
</LinearLayout> </LinearLayout>
<!-- 耗电提醒数值+图标 -->
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="80dp" android:layout_width="80dp"
@@ -139,6 +139,7 @@
</LinearLayout> </LinearLayout>
<!-- 当前电量数值+图标 -->
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -162,6 +163,7 @@
</LinearLayout> </LinearLayout>
<!-- 充电提醒数值+图标 -->
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="80dp" android:layout_width="80dp"
@@ -184,6 +186,7 @@
</LinearLayout> </LinearLayout>
<!-- 充电提醒布局 -->
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="50dp" android:layout_width="50dp"
@@ -221,6 +224,7 @@
</LinearLayout> </LinearLayout>
<!-- Tips文本 -->
<LinearLayout <LinearLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent"> android:layout_width="match_parent">
@@ -238,13 +242,16 @@
</LinearLayout> </LinearLayout>
</RelativeLayout> <!-- 3. 广告视图关键优化→用ViewStub延迟加载替代原直接加载的ADsBannerView -->
<!-- 首次启动仅占位1px不inflate真实广告视图减少首次耗时 -->
<cc.winboll.studio.libaes.views.ADsBannerView <ViewStub
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/adsbanner" android:id="@+id/stub_ads_banner"
android:layout_alignParentBottom="true"/> android:layout_alignParentBottom="true"
android:layout="@layout/view_ads_banner"/> <!-- 广告视图独立布局文件 -->
</RelativeLayout>
</RelativeLayout> </RelativeLayout>

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"/>