20251226_002506_076 正在调试设置窗口返回时的界面刷新。。。
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#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
|
stageCount=34
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.14
|
baseVersion=15.14
|
||||||
publishVersion=15.14.33
|
publishVersion=15.14.33
|
||||||
buildCount=0
|
buildCount=11
|
||||||
baseBetaVersion=15.14.34
|
baseBetaVersion=15.14.34
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
|||||||
// ======================== 静态常量(置顶统一,抽离魔法值)========================
|
// ======================== 静态常量(置顶统一,抽离魔法值)========================
|
||||||
public static final String TAG = "MainActivity";
|
public static final String TAG = "MainActivity";
|
||||||
private static final int REQUEST_BACKGROUND_SETTINGS_ACTIVITY = 1001;
|
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;
|
private static final long DELAY_LOAD_NON_CRITICAL = 500L;
|
||||||
public static final int MSG_RELOAD_APPCONFIG = 0;
|
public static final int MSG_RELOAD_APPCONFIG = 0;
|
||||||
public static final int MSG_CURRENTVALUEBATTERY = 1;
|
public static final int MSG_CURRENTVALUEBATTERY = 1;
|
||||||
@@ -98,14 +99,45 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
|||||||
initCriticalView();
|
initCriticalView();
|
||||||
initCoreUtilsAsync();
|
initCoreUtilsAsync();
|
||||||
loadNonCriticalViewDelayed();
|
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
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
LogUtils.d(TAG, String.format("onPostCreate() | savedInstanceState=%s", savedInstanceState));
|
LogUtils.d(TAG, String.format("onPostCreate() | savedInstanceState=%s", savedInstanceState));
|
||||||
mPermissionUtils.startPermissionRequest(this);
|
mPermissionUtils.startPermissionRequest(this);
|
||||||
LogUtils.d(TAG, "onPostCreate: 发起权限申请");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -304,6 +336,10 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
|||||||
LogUtils.d(TAG, "initMainContentView: 核心内容视图已初始化");
|
LogUtils.d(TAG, "initMainContentView: 核心内容视图已初始化");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void reloadBackgroundView() {
|
||||||
|
mMainContentView.reloadBackgroundView();
|
||||||
|
}
|
||||||
|
|
||||||
private void initCriticalView() {
|
private void initCriticalView() {
|
||||||
LogUtils.d(TAG, "initCriticalView()");
|
LogUtils.d(TAG, "initCriticalView()");
|
||||||
sMainActivity = this;
|
sMainActivity = this;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import androidx.core.content.FileProvider;
|
|||||||
import cc.winboll.studio.libaes.dialogs.YesNoAlertDialog;
|
import cc.winboll.studio.libaes.dialogs.YesNoAlertDialog;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.ToastUtils;
|
import cc.winboll.studio.libappbase.ToastUtils;
|
||||||
|
import cc.winboll.studio.powerbell.App;
|
||||||
import cc.winboll.studio.powerbell.MainActivity;
|
import cc.winboll.studio.powerbell.MainActivity;
|
||||||
import cc.winboll.studio.powerbell.R;
|
import cc.winboll.studio.powerbell.R;
|
||||||
import cc.winboll.studio.powerbell.dialogs.BackgroundPicturePreviewDialog;
|
import cc.winboll.studio.powerbell.dialogs.BackgroundPicturePreviewDialog;
|
||||||
@@ -938,7 +939,10 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
mBgSourceUtils.commitPreviewSourceToCurrent();
|
mBgSourceUtils.commitPreviewSourceToCurrent();
|
||||||
isCommitSettings = true;
|
isCommitSettings = true;
|
||||||
finish();
|
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
|
@Override
|
||||||
|
|||||||
@@ -156,9 +156,7 @@ public class MainContentView {
|
|||||||
|
|
||||||
backgroundView = App.getInstance().getMemoryCachedBackgroundView().getLastInstance(mContext);
|
backgroundView = App.getInstance().getMemoryCachedBackgroundView().getLastInstance(mContext);
|
||||||
if (backgroundView == null) {
|
if (backgroundView == null) {
|
||||||
App.sBackgroundSourceUtils.loadSettings();
|
reloadBackgroundView();
|
||||||
BackgroundBean backgroundBean = App.sBackgroundSourceUtils.getCurrentBackgroundBean();
|
|
||||||
backgroundView = App.getInstance().getMemoryCachedBackgroundView().getInstance(mContext, backgroundBean, true);
|
|
||||||
}
|
}
|
||||||
if (backgroundView.getParent() != null) {
|
if (backgroundView.getParent() != null) {
|
||||||
((ViewGroup) backgroundView.getParent()).removeView(backgroundView);
|
((ViewGroup) backgroundView.getParent()).removeView(backgroundView);
|
||||||
@@ -197,6 +195,12 @@ public class MainContentView {
|
|||||||
LogUtils.d(TAG, "【bindViews】视图绑定完成");
|
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,默认能量风格,适配小米机型渲染)
|
* 初始化电池 Drawable(集成 BatteryDrawable,默认能量风格,适配小米机型渲染)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user