mirror of
https://gitea.winboll.cc/Studio/WinBoLL.git
synced 2026-08-26 10:55:52 +08:00
feat(appbase): 优化快捷方式配置与崩溃日志分享功能
1. 快捷方式改为静态XML配置(仅beta渠道)
- 新增 res/xml/shortcuts.xml 定义静态快捷方式
- AndroidManifest.xml 添加 meta-data 引用
- MainActivity.setupShortcuts() 移除动态注册代码
2. 崩溃日志分享功能增强
- CrashHandleNotifyUtils: 新增 appAPKName/emailTo 参数
- ShareLogActivity: 添加邮件接收者(EXTRA_EMAIL)支持
- 邮件标题格式: {应用名} - 崩溃日志
- 邮件内容添加应用版本号和设备运行环境信息
- 通知按钮名称改为: 发送日志给开发组
3. 调用方适配
- App.java: 传入 APPBase 和 studio@winboll.cc
This commit is contained in:
@@ -10,6 +10,14 @@
|
||||
tools:replace="android:icon"
|
||||
android:icon="@drawable/ic_winboll_beta">
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<meta-data
|
||||
android:name="android.app.shortcuts"
|
||||
android:resource="@xml/shortcuts"/>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -2,5 +2,8 @@
|
||||
<resources>
|
||||
|
||||
<string name="app_name">APPBase+</string>
|
||||
<string name="shortcut_exception_mail_settings_short">邮件设置</string>
|
||||
<string name="shortcut_exception_mail_settings_long">异常邮件接收设置</string>
|
||||
<string name="shortcut_exception_mail_settings_disabled">快捷方式不可用</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<shortcut
|
||||
android:shortcutId="exception_mail_settings"
|
||||
android:shortcutShortLabel="@string/shortcut_exception_mail_settings_short"
|
||||
android:shortcutLongLabel="@string/shortcut_exception_mail_settings_long"
|
||||
android:shortcutDisabledMessage="@string/shortcut_exception_mail_settings_disabled"
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/ic_winboll_beta">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetPackage="cc.winboll.studio.appbase.beta"
|
||||
android:targetClass="cc.winboll.studio.appbase.develop.APPExcetionMailSettingsActivity"/>
|
||||
<categories android:name="android.shortcut.conversation"/>
|
||||
</shortcut>
|
||||
</shortcuts>
|
||||
@@ -55,7 +55,9 @@ public class App extends GlobalApplication {
|
||||
this,
|
||||
getPackageName(),
|
||||
stackTraceStr,
|
||||
CrashActivity.class
|
||||
CrashActivity.class,
|
||||
"APPBase",
|
||||
"studio@winboll.cc"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package cc.winboll.studio.appbase;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.content.pm.ShortcutManager;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
@@ -69,31 +65,11 @@ public class MainActivity extends Activity {
|
||||
/**
|
||||
* 注册桌面图标静态快捷方式
|
||||
* 长按桌面图标后显示快捷菜单,点击可直接打开异常邮件接收设置页面
|
||||
* 静态快捷方式已通过 res/xml/shortcuts.xml 配置,此处无需动态注册
|
||||
*/
|
||||
private void setupShortcuts() {
|
||||
if (!"cc.winboll.studio.appbase.beta".equals(getPackageName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
|
||||
if (shortcutManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, APPExcetionMailSettingsActivity.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
ShortcutInfo shortcut = new ShortcutInfo.Builder(this, "exception_mail_settings")
|
||||
.setShortLabel("邮件设置")
|
||||
.setLongLabel("异常邮件接收设置")
|
||||
.setIcon(Icon.createWithResource(this, R.drawable.ic_winboll))
|
||||
.setIntent(intent)
|
||||
.build();
|
||||
|
||||
shortcutManager.setDynamicShortcuts(
|
||||
java.util.Arrays.asList(shortcut)
|
||||
);
|
||||
// 静态快捷方式仅在 beta 渠道生效,通过 AndroidManifest.xml 中的 meta-data 配置
|
||||
// beta 渠道使用 res/xml/shortcuts.xml 定义快捷方式
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user