mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-14 05:27:10 +08:00
Gallery: 添加App入口类,调试菜单动态显隐
- 新增App类继承GlobalWinBoLLApplication,参照appbase添加崩溃处理 - Manifest application节点android:name切换为App类 - MainActivity菜单栏Debug Log项根据GlobalWinBoLLApplication.isDebugging()控制可见性
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat Jul 18 15:20:58 CST 2026
|
#Sun Jul 19 13:43:02 CST 2026
|
||||||
stageCount=16
|
stageCount=16
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.15
|
publishVersion=15.0.15
|
||||||
buildCount=23
|
buildCount=28
|
||||||
baseBetaVersion=15.0.16
|
baseBetaVersion=15.0.16
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/GalleryTheme"
|
android:theme="@style/GalleryTheme"
|
||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true"
|
||||||
android:name=".GlobalWinBoLLApplication"
|
android:name=".App"
|
||||||
android:requestLegacyExternalStorage="true">
|
android:requestLegacyExternalStorage="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package cc.winboll.studio.gallery;
|
||||||
|
|
||||||
|
import cc.winboll.studio.libappbase.CrashActivity;
|
||||||
|
import cc.winboll.studio.libappbase.ToastUtils;
|
||||||
|
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen<zhangsken@qq.com>
|
||||||
|
* @Date 2026/07/19
|
||||||
|
* @Describe 应用全局入口类(继承 GlobalWinBoLLApplication)
|
||||||
|
* 负责应用初始化、全局资源管理与生命周期回调处理,是整个应用的核心入口
|
||||||
|
*/
|
||||||
|
public class App extends GlobalWinBoLLApplication {
|
||||||
|
|
||||||
|
public static final String TAG = "App";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
try {
|
||||||
|
super.onCreate();
|
||||||
|
ToastUtils.init(getApplicationContext());
|
||||||
|
} catch (Throwable e) {
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
PrintWriter pw = new PrintWriter(sw);
|
||||||
|
e.printStackTrace(pw);
|
||||||
|
pw.close();
|
||||||
|
String stackTraceStr = sw.toString();
|
||||||
|
CrashHandleNotifyUtils.handleUncaughtException(
|
||||||
|
this,
|
||||||
|
getPackageName(),
|
||||||
|
stackTraceStr,
|
||||||
|
CrashActivity.class
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTerminate() {
|
||||||
|
super.onTerminate();
|
||||||
|
ToastUtils.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -290,6 +290,10 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||||
|
MenuItem debugItem = menu.findItem(R.id.action_debug);
|
||||||
|
if (debugItem != null) {
|
||||||
|
debugItem.setVisible(GlobalWinBoLLApplication.isDebugging());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user