mirror of
https://gitea.winboll.cc/Studio/WinBoLL.git
synced 2026-08-14 21:47:11 +08:00
合并 APPBase 项目
This commit is contained in:
+16
-2
@@ -33,7 +33,7 @@ android {
|
||||
// versionName 更新后需要手动设置
|
||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||
versionName "15.20"
|
||||
versionName "15.21"
|
||||
if(true) {
|
||||
versionName = genVersionName("${versionName}")
|
||||
}
|
||||
@@ -44,10 +44,24 @@ android {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE.md'
|
||||
exclude 'META-INF/LICENSE.txt'
|
||||
exclude 'META-INF/NOTICE.md'
|
||||
exclude 'META-INF/NOTICE.txt'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(':libappbase')
|
||||
|
||||
|
||||
// WinBoLL库 nexus.winboll.cc 地址
|
||||
//api 'cc.winboll.studio:libappbase:15.20.+'
|
||||
api 'cc.winboll.studio:libaes:15.20.21'
|
||||
api 'androidx.appcompat:appcompat:1.3.1'
|
||||
// JavaMail SMTP (Android兼容版)
|
||||
api 'com.sun.mail:android-mail:1.6.7'
|
||||
api 'com.sun.mail:android-activation:1.6.7'
|
||||
|
||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sun Jun 28 20:55:57 HKT 2026
|
||||
stageCount=35
|
||||
#Tue Jul 21 18:04:08 HKT 2026
|
||||
stageCount=4
|
||||
libraryProject=libappbase
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.34
|
||||
buildCount=0
|
||||
baseBetaVersion=15.20.35
|
||||
baseVersion=15.21
|
||||
publishVersion=15.21.3
|
||||
buildCount=15
|
||||
baseBetaVersion=15.21.4
|
||||
|
||||
Vendored
+4
@@ -73,6 +73,10 @@
|
||||
-dontwarn java.util.function.**
|
||||
|
||||
# ============================== 第三方框架规则 ==============================
|
||||
# JavaMail(libaes SMTPConfigView依赖)
|
||||
-keep class javax.mail.** { *; }
|
||||
-dontwarn javax.mail.**
|
||||
|
||||
# Retrofit + OkHttp
|
||||
-keep class retrofit2.** { *; }
|
||||
-keep interface retrofit2.** { *; }
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" >
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<!-- 拥有完全的网络访问权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application
|
||||
tools:replace="android:icon"
|
||||
tools:replace="android:icon"
|
||||
android:icon="@drawable/ic_winboll_beta">
|
||||
|
||||
<!-- Put flavor specific code here -->
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
</manifest>
|
||||
@@ -22,15 +22,17 @@
|
||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation">
|
||||
|
||||
<intent-filter>
|
||||
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".Main2Activity"
|
||||
android:label="@string/app_name"
|
||||
@@ -52,6 +54,9 @@
|
||||
|
||||
<activity android:name=".AboutActivity"/>
|
||||
|
||||
<activity android:name="cc.winboll.studio.appbase.develop.APPExcetionMailSettingsActivity"
|
||||
android:exported="true"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package cc.winboll.studio.appbase;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import cc.winboll.studio.libappbase.CrashActivity;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.ToastUtils;
|
||||
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
|
||||
import cc.winboll.studio.libappbase.utils.SMTPUtils;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
@@ -18,6 +22,9 @@ public class App extends GlobalApplication {
|
||||
/** 当前应用类的日志 TAG(用于调试输出,标识日志来源) */
|
||||
public static final String TAG = "App";
|
||||
|
||||
/** SMTP配置 SharedPreferences 名称 */
|
||||
private static final String PREF_NAME = "smtp_config";
|
||||
|
||||
/**
|
||||
* 应用创建时回调(全局初始化入口)
|
||||
* 在应用进程启动时执行,仅调用一次,用于初始化全局工具类、第三方库等
|
||||
@@ -41,9 +48,62 @@ public class App extends GlobalApplication {
|
||||
stackTraceStr,
|
||||
CrashActivity.class
|
||||
);
|
||||
sendExceptionMail(stackTraceStr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送异常报告邮件
|
||||
* 读取SMTP配置,若配置完整则在子线程发送异常堆栈邮件
|
||||
* @param stackTraceStr 异常堆栈信息
|
||||
*/
|
||||
private void sendExceptionMail(final String stackTraceStr) {
|
||||
SharedPreferences sp = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
|
||||
final String host = sp.getString("smtp_server", "");
|
||||
final String portStr = sp.getString("smtp_port", "");
|
||||
final String sender = sp.getString("sender_email", "");
|
||||
final String auth = sp.getString("auth_code", "");
|
||||
final String recipient = sp.getString("recipient_email", "");
|
||||
|
||||
if (host.isEmpty() || portStr.isEmpty() || sender.isEmpty()
|
||||
|| auth.isEmpty() || recipient.isEmpty()) {
|
||||
LogUtils.d(TAG, "sendExceptionMail skipped, SMTP config incomplete");
|
||||
return;
|
||||
}
|
||||
|
||||
final int port;
|
||||
try {
|
||||
port = Integer.parseInt(portStr);
|
||||
} catch (NumberFormatException e) {
|
||||
LogUtils.e(TAG, "sendExceptionMail failed, port format error: " + portStr);
|
||||
return;
|
||||
}
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String deviceInfo = "\n\n--- Device Info ---\n"
|
||||
+ "Package: " + getPackageName() + "\n"
|
||||
+ "Time: " + System.currentTimeMillis() + "\n";
|
||||
|
||||
boolean success = SMTPUtils.sendTextMail(
|
||||
recipient,
|
||||
"APPBase 异常报告",
|
||||
stackTraceStr + deviceInfo,
|
||||
sender,
|
||||
auth,
|
||||
host,
|
||||
port);
|
||||
|
||||
if (success) {
|
||||
LogUtils.d(TAG, "sendExceptionMail success");
|
||||
} else {
|
||||
LogUtils.e(TAG, "sendExceptionMail failed");
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用终止时回调(资源释放入口)
|
||||
* 仅在模拟环境(如 Android Studio 模拟器)中可靠触发,真机上可能因系统回收进程不执行
|
||||
@@ -56,4 +116,3 @@ public class App extends GlobalApplication {
|
||||
ToastUtils.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
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;
|
||||
@@ -11,6 +15,7 @@ import android.view.View;
|
||||
import android.widget.Toolbar;
|
||||
import cc.winboll.studio.appbase.R;
|
||||
import cc.winboll.studio.appbase.model.TestBean;
|
||||
import cc.winboll.studio.appbase.develop.APPExcetionMailSettingsActivity;
|
||||
import cc.winboll.studio.libappbase.LogActivity;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.ToastUtils;
|
||||
@@ -45,6 +50,7 @@ public class MainActivity extends Activity {
|
||||
setActionBar(mToolbar); // 将 Toolbar 替代系统默认 ActionBar
|
||||
|
||||
initTestData();
|
||||
setupShortcuts();
|
||||
}
|
||||
|
||||
void initTestData() {
|
||||
@@ -60,6 +66,36 @@ public class MainActivity extends Activity {
|
||||
return "/BaseBaen/"+TestBean.class.getName()+".json";
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册桌面图标静态快捷方式
|
||||
* 长按桌面图标后显示快捷菜单,点击可直接打开异常邮件接收设置页面
|
||||
*/
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建菜单时回调(加载工具栏菜单)
|
||||
* 初始化 ActionBar 菜单,加载自定义菜单布局
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package cc.winboll.studio.appbase.develop;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import cc.winboll.studio.appbase.R;
|
||||
import cc.winboll.studio.libaes.views.SMTPConfigView;
|
||||
|
||||
/**
|
||||
* @Author 豆包&BigPickle&MiMo&ZhanGSKen<zhangsken@qq.com>
|
||||
* @Date 2026/07/21 12:44
|
||||
* @Describe 应用异常信息邮件接收账号设置
|
||||
* 使用libaes的SMTPConfigView控件配置SMTP服务器参数
|
||||
*/
|
||||
public class APPExcetionMailSettingsActivity extends Activity {
|
||||
|
||||
public static final String TAG = "APPExcetionMailSettingsActivity";
|
||||
|
||||
private SMTPConfigView mSMTPConfigView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_appexcetionmailsettings);
|
||||
|
||||
mSMTPConfigView = (SMTPConfigView) findViewById(R.id.smtp_config_view);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Main2Activity"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/gray_900"/>
|
||||
android:textColor="#212121"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FAFAFA">
|
||||
|
||||
<cc.winboll.studio.libaes.views.SMTPConfigView
|
||||
android:id="@+id/smtp_config_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</ScrollView>
|
||||
@@ -9,6 +9,6 @@
|
||||
<item name="colorTittleBackgound">?attr/toolbarBackgroundColor</item>
|
||||
<item name="colorText">?attr/debugTextColor</item>
|
||||
<item name="colorTextBackgound">?attr/mainWindowDarkBackgroundColor</item>
|
||||
<item name="toolbarTextColor">@color/toolbarTextColor</item>
|
||||
<item name="toolbarTextColor">#FF000000</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -9,6 +9,6 @@
|
||||
<item name="colorTittleBackgound">?attr/toolbarBackgroundColor</item>
|
||||
<item name="colorText">?attr/debugTextColor</item>
|
||||
<item name="colorTextBackgound">?attr/mainWindowBackgroundColor</item>
|
||||
<item name="toolbarTextColor">@color/toolbarTextColor</item>
|
||||
<item name="toolbarTextColor">#FF000000</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user