转换旧有的应用基础类为libappbase的GlobalApplication基础类。

This commit is contained in:
2026-07-19 14:13:22 +08:00
parent 14ed5d60c5
commit e97c5fe050
4 changed files with 17 additions and 51 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sat Jul 18 15:42:59 HKT 2026
#Sun Jul 19 06:11:23 GMT 2026
stageCount=17
libraryProject=
baseVersion=15.0
publishVersion=15.0.16
buildCount=0
buildCount=5
baseBetaVersion=15.0.17
@@ -1,6 +1,9 @@
package cc.winboll.studio.gallery;
import cc.winboll.studio.gallery.utils.BackgroundUtils;
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
import cc.winboll.studio.libappbase.CrashActivity;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
import java.io.PrintWriter;
@@ -12,7 +15,7 @@ import java.io.StringWriter;
* @Describe 应用全局入口类(继承 GlobalWinBoLLApplication
* 负责应用初始化、全局资源管理与生命周期回调处理,是整个应用的核心入口
*/
public class App extends GlobalWinBoLLApplication {
public class App extends GlobalApplication {
public static final String TAG = "App";
@@ -20,6 +23,11 @@ public class App extends GlobalWinBoLLApplication {
public void onCreate() {
try {
super.onCreate();
WinBoLLActivityManager.init(this);
BackgroundUtils.initFromPreferences(this);
ToastUtils.init(getApplicationContext());
} catch (Throwable e) {
StringWriter sw = new StringWriter();
@@ -1,47 +0,0 @@
package cc.winboll.studio.gallery;
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.gallery.utils.BackgroundUtils;
/**
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @Date 2026/04/24 15:23
*/
public class GlobalWinBoLLApplication extends GlobalApplication {
public static final String TAG = "GlobalWinBoLLApplication";
@Override
public void onCreate() {
super.onCreate();
LogUtils.d(TAG, "onCreate");
setIsDebugging(BuildConfig.DEBUG);
//setIsDebugging(false);
WinBoLLActivityManager.init(this);
BackgroundUtils.initFromPreferences(this);
// 初始化 Toast 框架
ToastUtils.init(this);
// 设置 Toast 布局样式
//ToastUtils.setView(R.layout.view_toast);
//ToastUtils.setStyle(new WhiteToastStyle());
//ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
//CrashHandler.getInstance().registerGlobal(this);
//CrashHandler.getInstance().registerPart(this);
}
@Override
public void onTerminate() {
super.onTerminate();
LogUtils.d(TAG, "onTerminate");
ToastUtils.release();
}
}
@@ -27,9 +27,11 @@ import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import cc.winboll.studio.gallery.AlbumAdapter.OnAlbumClickListener;
import cc.winboll.studio.gallery.App;
import cc.winboll.studio.gallery.utils.BackgroundUtils;
import cc.winboll.studio.libappbase.LogActivity;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.ToastUtils;
import com.a4455jkjh.colorpicker.ColorPickerDialog;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.io.File;
@@ -292,7 +294,10 @@ public class MainActivity extends AppCompatActivity {
getMenuInflater().inflate(R.menu.menu_main, menu);
MenuItem debugItem = menu.findItem(R.id.action_debug);
if (debugItem != null) {
debugItem.setVisible(GlobalWinBoLLApplication.isDebugging());
//debugItem.setVisible(true);
//debugItem.setVisible(false);
debugItem.setVisible(App.isDebugging());
ToastUtils.show(String.format("App.isDebugging() is %s", App.isDebugging()));
}
return true;
}