应用类重构
This commit is contained in:
parent
6447bcf924
commit
a96ba362b4
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Thu Jan 23 01:54:33 HKT 2025
|
||||
#Wed Jan 22 18:15:12 GMT 2025
|
||||
stageCount=7
|
||||
libraryProject=libapputils
|
||||
baseVersion=9.2
|
||||
publishVersion=9.2.6
|
||||
buildCount=0
|
||||
buildCount=1
|
||||
baseBetaVersion=9.2.7
|
||||
|
@ -22,7 +22,7 @@ public class App extends GlobalApplication {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
// 初始化 WinBoll 框架
|
||||
WinBollUtils.getInstance(this).init(this);
|
||||
WinBollUtils.init(this);
|
||||
// 初始化 Toast 框架
|
||||
ToastUtils.init(this);
|
||||
// 设置 Toast 布局样式
|
||||
|
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Thu Jan 23 01:54:23 HKT 2025
|
||||
#Wed Jan 22 18:15:12 GMT 2025
|
||||
stageCount=7
|
||||
libraryProject=libapputils
|
||||
baseVersion=9.2
|
||||
publishVersion=9.2.6
|
||||
buildCount=0
|
||||
buildCount=1
|
||||
baseBetaVersion=9.2.7
|
||||
|
@ -171,11 +171,11 @@ public class WinBollActivityManager {
|
||||
//ToastUtils.show("finishAll() activity");
|
||||
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
||||
//ToastUtils.show("activity != null ...");
|
||||
if (WinBollUtils.getInstance(mContext).getWinBollUI_TYPE() == WinBollUtils.WinBollUI_TYPE.Service) {
|
||||
if (WinBollUtils.getWinBollUI_TYPE() == WinBollUtils.WinBollUI_TYPE.Service) {
|
||||
// 结束窗口和最近任务栏, 建议前台服务类应用使用,可以方便用户再次调用 UI 操作。
|
||||
activity.finishAndRemoveTask();
|
||||
//ToastUtils.show("finishAll() activity.finishAndRemoveTask();");
|
||||
} else if (WinBollUtils.getInstance(mContext).getWinBollUI_TYPE() == WinBollUtils.WinBollUI_TYPE.Aplication) {
|
||||
} else if (WinBollUtils.getWinBollUI_TYPE() == WinBollUtils.WinBollUI_TYPE.Aplication) {
|
||||
// 结束窗口保留最近任务栏,建议前台服务类应用使用,可以保持应用的系统自觉性。
|
||||
activity.finish();
|
||||
//ToastUtils.show("finishAll() activity.finish();");
|
||||
|
@ -7,6 +7,7 @@ import cc.winboll.studio.libapputils.bean.DebugBean;
|
||||
import cc.winboll.studio.libapputils.log.LogUtils;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.hjq.toast.style.WhiteToastStyle;
|
||||
import cc.winboll.studio.GlobalApplication;
|
||||
|
||||
public class WinBollUtils {
|
||||
|
||||
@ -16,13 +17,13 @@ public class WinBollUtils {
|
||||
// 单件结构模块
|
||||
//
|
||||
static volatile WinBollUtils _WinBollUtils;
|
||||
Context mContext;
|
||||
WinBollUtils(Context context) {
|
||||
mContext = context;
|
||||
Application mApplication;
|
||||
WinBollUtils(Application application) {
|
||||
mApplication = application;
|
||||
}
|
||||
public static synchronized WinBollUtils getInstance(Context context) {
|
||||
static synchronized WinBollUtils getInstance(Application application) {
|
||||
if (_WinBollUtils == null) {
|
||||
_WinBollUtils = new WinBollUtils(context);
|
||||
_WinBollUtils = new WinBollUtils(application);
|
||||
}
|
||||
return _WinBollUtils;
|
||||
}
|
||||
@ -59,7 +60,7 @@ public class WinBollUtils {
|
||||
//
|
||||
// 获取 WinBoll 应用 UI 类型
|
||||
//
|
||||
public static WinBollUI_TYPE getWinBollUI_TYPE() {
|
||||
public synchronized static WinBollUI_TYPE getWinBollUI_TYPE() {
|
||||
return _mWinBollUI_TYPE;
|
||||
}
|
||||
|
||||
@ -67,13 +68,14 @@ public class WinBollUtils {
|
||||
return mMyActivityLifecycleCallbacks;
|
||||
}
|
||||
|
||||
public void init(Application application) {
|
||||
public static void init(Application application) {
|
||||
WinBollUtils winBollUtils = WinBollUtils.getInstance(application);
|
||||
// 应用环境初始化, 基本调试环境
|
||||
//
|
||||
// 初始化日志模块
|
||||
LogUtils.init(mContext);
|
||||
LogUtils.init(application);
|
||||
// 设置应用调试标志
|
||||
DebugBean debugBean = DebugBean.loadBean(mContext, DebugBean.class);
|
||||
DebugBean debugBean = DebugBean.loadBean(application, DebugBean.class);
|
||||
if (debugBean == null) {
|
||||
//ToastUtils.show("debugBean == null");
|
||||
setIsDebug(false);
|
||||
@ -83,8 +85,8 @@ public class WinBollUtils {
|
||||
}
|
||||
// 应用窗口管理模块参数设置
|
||||
//
|
||||
mMyActivityLifecycleCallbacks = new MyActivityLifecycleCallbacks(application);
|
||||
application.registerActivityLifecycleCallbacks(mMyActivityLifecycleCallbacks);
|
||||
winBollUtils.mMyActivityLifecycleCallbacks = new MyActivityLifecycleCallbacks(application);
|
||||
application.registerActivityLifecycleCallbacks(winBollUtils.mMyActivityLifecycleCallbacks);
|
||||
// 设置默认 WinBoll 应用 UI 类型
|
||||
setWinBollUI_TYPE(WinBollUI_TYPE.Service);
|
||||
//ToastUtils.show("WinBollUI_TYPE " + getWinBollUI_TYPE());
|
||||
|
Loading…
x
Reference in New Issue
Block a user