20251226_002506_076 正在调试设置窗口返回时的界面刷新。。。

This commit is contained in:
2025-12-26 00:25:50 +08:00
parent fd2d1d17ed
commit 78a2d85150
4 changed files with 51 additions and 7 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Thu Dec 25 20:10:33 HKT 2025
#Thu Dec 25 16:23:58 GMT 2025
stageCount=34
libraryProject=
baseVersion=15.14
publishVersion=15.14.33
buildCount=0
buildCount=11
baseBetaVersion=15.14.34

View File

@@ -48,6 +48,7 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
// ======================== 静态常量(置顶统一,抽离魔法值)========================
public static final String TAG = "MainActivity";
private static final int REQUEST_BACKGROUND_SETTINGS_ACTIVITY = 1001;
public static final String EXTRA_ISRELOAD_BACKGROUNDVIEW = "EXTRA_ISRELOAD_BACKGROUNDVIEW";
private static final long DELAY_LOAD_NON_CRITICAL = 500L;
public static final int MSG_RELOAD_APPCONFIG = 0;
public static final int MSG_CURRENTVALUEBATTERY = 1;
@@ -98,14 +99,45 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
initCriticalView();
initCoreUtilsAsync();
loadNonCriticalViewDelayed();
// 处理首次启动的参数
handleReloadBackgroundParam(getIntent());
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// 关键:将新 Intent 赋值给 Activity 的 Intent确保后续 getIntent() 获取最新值
setIntent(intent);
// 统一处理参数
handleReloadBackgroundParam(intent);
}
/**
* 统一处理刷新背景的参数
* @param intent 启动 MainActivity 的 Intent
*/
private void handleReloadBackgroundParam(Intent intent) {
if (intent == null) {
LogUtils.d(TAG, "handleReloadBackgroundParam: Intent 为空");
return;
}
// 获取传递的参数,默认值为 false
boolean isReloadBackgroundView = intent.getBooleanExtra(EXTRA_ISRELOAD_BACKGROUNDVIEW, false);
if (isReloadBackgroundView) {
LogUtils.d(TAG, "接收到刷新背景视图指令");
// 执行背景刷新逻辑
App.notifyMessage(TAG, "reloadBackgroundView");
reloadBackgroundView();
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
LogUtils.d(TAG, String.format("onPostCreate() | savedInstanceState=%s", savedInstanceState));
mPermissionUtils.startPermissionRequest(this);
LogUtils.d(TAG, "onPostCreate: 发起权限申请");
}
@Override
@@ -304,6 +336,10 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
LogUtils.d(TAG, "initMainContentView: 核心内容视图已初始化");
}
private void reloadBackgroundView() {
mMainContentView.reloadBackgroundView();
}
private void initCriticalView() {
LogUtils.d(TAG, "initCriticalView()");
sMainActivity = this;

View File

@@ -25,6 +25,7 @@ import androidx.core.content.FileProvider;
import cc.winboll.studio.libaes.dialogs.YesNoAlertDialog;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.MainActivity;
import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.dialogs.BackgroundPicturePreviewDialog;
@@ -938,7 +939,10 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
mBgSourceUtils.commitPreviewSourceToCurrent();
isCommitSettings = true;
finish();
startActivity(new Intent(BackgroundSettingsActivity.this, MainActivity.class));
//App.notifyMessage(TAG, "startActivity");
Intent mainIntent = new Intent(BackgroundSettingsActivity.this, MainActivity.class);
mainIntent.putExtra(MainActivity.EXTRA_ISRELOAD_BACKGROUNDVIEW, true);
startActivity(mainIntent);
}
@Override

View File

@@ -156,9 +156,7 @@ public class MainContentView {
backgroundView = App.getInstance().getMemoryCachedBackgroundView().getLastInstance(mContext);
if (backgroundView == null) {
App.sBackgroundSourceUtils.loadSettings();
BackgroundBean backgroundBean = App.sBackgroundSourceUtils.getCurrentBackgroundBean();
backgroundView = App.getInstance().getMemoryCachedBackgroundView().getInstance(mContext, backgroundBean, true);
reloadBackgroundView();
}
if (backgroundView.getParent() != null) {
((ViewGroup) backgroundView.getParent()).removeView(backgroundView);
@@ -196,6 +194,12 @@ public class MainContentView {
if (backgroundView == null) LogUtils.e(TAG, "【bindViews】backgroundView 绑定失败");
LogUtils.d(TAG, "【bindViews】视图绑定完成");
}
public void reloadBackgroundView(){
App.sBackgroundSourceUtils.loadSettings();
BackgroundBean backgroundBean = App.sBackgroundSourceUtils.getCurrentBackgroundBean();
backgroundView = App.getInstance().getMemoryCachedBackgroundView().getInstance(mContext, backgroundBean, true);
}
/**
* 初始化电池 Drawable集成 BatteryDrawable默认能量风格适配小米机型渲染