Compare commits

...

38 Commits

Author SHA1 Message Date
ae8da772c0 常驻通知栏UI优化。 2025-05-03 20:50:53 +08:00
b2555ebfd3 类库升级,源码编译整理。 2025-05-03 20:48:33 +08:00
82d9aabf33 Merge remote-tracking branch 'origin/appbase' into mymessagemanager 2025-05-03 16:50:15 +08:00
ZhanGSKen
2c91d32e41 在号码识别对比中,兼容当前区域号码。 2025-04-14 16:36:24 +08:00
ZhanGSKen
fa43d43110 <mymessagemanager>APK 15.2.4 release Publish. 2025-04-01 19:55:49 +08:00
ZhanGSKen
8f8e7d98c7 通知调试完成,添加旧通知设置清理按钮。 2025-04-01 19:54:30 +08:00
ZhanGSKen
af39f98a51 通知模块调试ing... 2025-04-01 15:20:02 +08:00
ZhanGSKen
5a1d557683 <mymessagemanager>APK 15.2.3 release Publish. 2025-03-31 20:04:51 +08:00
ZhanGSKen
39116f0912 更新类库,修复调试模式保存问题。 2025-03-31 20:03:40 +08:00
ZhanGSKen
a6b711b38b <mymessagemanager>APK 15.2.2 release Publish. 2025-03-31 02:36:56 +08:00
ZhanGSKen
d1703551f5 更新应用调试模式设置方法 2025-03-31 02:36:15 +08:00
ZhanGSKen
d63f7d3d83 <mymessagemanager>APK 15.2.1 release Publish. 2025-03-31 02:29:38 +08:00
ZhanGSKen
06b399846d Merge remote-tracking branch 'origin/appbase' into mymessagemanager 2025-03-31 02:27:33 +08:00
ZhanGSKen
e06efea08e <mymessagemanager>APK 15.2.0 release Publish. 2025-03-31 02:27:06 +08:00
ZhanGSKen
890ff6eda9 更新类库,添加更新日志查看方式和应用介绍窗口。 2025-03-31 02:24:50 +08:00
ZhanGSKen
e5a5eda9b6 1225 2025-03-29 12:25:04 +08:00
ZhanGSKen
174a052088 更新类库引用次序,预防资源引用次序混乱。 2025-03-29 12:24:14 +08:00
ZhanGSKen
fbd8441264 更新类库解决应用介绍窗口资源引用冲突问题 2025-03-29 12:19:26 +08:00
ZhanGSKen
fb92e9f673 更新类库 2025-03-29 11:53:35 +08:00
ZhanGSKen
d34d1e2796 设置版本号 2025-03-29 10:20:29 +08:00
ZhanGSKen
36fb8b41a4 1017 2025-03-29 10:17:55 +08:00
ZhanGSKen
fe70a18547 Merge branch 'appbase' into mymessagemanager 2025-03-29 09:45:00 +08:00
ZhanGSKen
46e4ee7fb7 <mymessagemanager>APK 15.0.0 release Publish. 2025-03-26 17:54:55 +08:00
ZhanGSKen
b2b959232c 去掉二级窗口分屏模式 2025-03-26 17:52:10 +08:00
ZhanGSKen
b11f814c41 Merge remote-tracking branch 'origin/appbase' into mymessagemanager 2025-03-26 17:49:04 +08:00
ZhanGSKen
1e991aed7e 适配小米15,设置编译参数。 2025-03-25 19:39:21 +08:00
ZhanGSKen
f56125f82a Merge branch 'appbase' into mymessagemanager 2025-03-25 19:29:33 +08:00
ZhanGSKen
33b7b65239 <mymessagemanager>APK 4.1.18 release Publish. 2025-03-01 14:11:49 +08:00
ZhanGSKen
664d14ad84 编译配置修复 2025-03-01 14:09:49 +08:00
ZhanGSKen
47cb393f76 更新短信接收规则设定:
1.启用了只接受通讯录,通讯录里有记录
2.如果不是数字通讯地址,但是在通讯录内
3.通讯地址是数字,并且在短信接收规则内。
以上3种情况就接收,其他一律放到回收站。
2025-03-01 14:01:13 +08:00
ZhanGSKen
6495f1c66e <mymessagemanager>APK 4.1.17 release Publish. 2025-03-01 13:39:17 +08:00
ZhanGSKen
f0c52d1e02 修复格式化通信录地址后的短信浏览BUG。 2025-03-01 13:38:37 +08:00
ZhanGSKen
d948f31331 <mymessagemanager>APK 4.1.16 release Publish. 2025-03-01 13:27:26 +08:00
ZhanGSKen
e1b3087020 格式化通讯地址显示 2025-03-01 13:25:22 +08:00
ZhanGSKen
03e21ab81c <mymessagemanager>APK 4.1.15 release Publish. 2025-02-25 20:51:01 +08:00
ZhanGSKen
ac72132969 添加电话号码前面有+号的检测兼容。 2025-02-25 20:50:03 +08:00
ZhanGSKen
cedb5f521b <mymessagemanager>APK 4.1.14 release Publish. 2025-02-25 20:25:31 +08:00
ZhanGSKen
396df6713c 添加单元测试模块,增加电话号码是否是数字的检测。 2025-02-25 20:19:54 +08:00
56 changed files with 810 additions and 837 deletions

View File

@ -1,81 +0,0 @@
package cc.winboll.studio.appbase;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/28 15:34:16
* @Describe 应用活动窗口基类
*/
import android.app.Activity;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.view.MenuItem;
import cc.winboll.studio.appbase.App;
import cc.winboll.studio.appbase.R;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
import cc.winboll.studio.libappbase.winboll.WinBoLLActivityManager;
public class WinBoLLActivityBase extends Activity implements IWinBoLLActivity {
public static final String TAG = "WinBoLLActivityBase";
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
WinBoLLActivityManager getWinBoLLActivityManager() {
return WinBoLLActivityManager.getInstance(GlobalApplication.getInstance());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWinBoLLActivityManager().add(this);
}
@Override
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onPostCreate(savedInstanceState, persistentState);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
GlobalApplication.getWinBoLLActivityManager().startLogActivity(this);
return true;
} else if(item.getItemId() == cc.winboll.studio.appbase.R.id.item_minimal) {
//moveTaskToBack(true);
exit();
}
// 在switch语句中处理每个ID并在处理完后返回true未处理的情况返回false
return super.onOptionsItemSelected(item);
}
void exit() {
YesNoAlertDialog.show(this, "Exit " + getString(R.string.app_name), "Close all activity and exit?", new YesNoAlertDialog.OnDialogResultListener(){
@Override
public void onYes() {
App.getWinBoLLActivityManager().finishAll();
}
@Override
public void onNo() {
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
getWinBoLLActivityManager().registeRemove(this);
}
}

View File

@ -1,72 +0,0 @@
package cc.winboll.studio.appbase.models;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/02/17 10:05:09
* @Describe APPSOSReportBean
*/
import android.util.JsonReader;
import android.util.JsonWriter;
import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException;
public class WinBoLLNewsBean extends BaseBean {
public static final String TAG = "WinBoLLNewsBean";
protected String message;
public WinBoLLNewsBean() {
this.message = "";
}
public WinBoLLNewsBean(String message) {
this.message = message;
}
public void setMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
@Override
public String getName() {
return WinBoLLNewsBean.class.getName();
}
@Override
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
super.writeThisToJsonWriter(jsonWriter);
jsonWriter.name("message").value(getMessage());
}
@Override
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
if (name.equals("message")) {
setMessage(jsonReader.nextString());
} else {
return false;
}
}
return true;
}
@Override
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String name = jsonReader.nextName();
if (!initObjectsFromJsonReader(jsonReader, name)) {
jsonReader.skipValue();
}
}
// 结束 JSON 对象
jsonReader.endObject();
return this;
}
}

View File

@ -1,36 +0,0 @@
package cc.winboll.studio.apputils;
/**
* @Author ZhanGSKen@QQ.COM
* @Date 2025/01/17 19:50:46
*/
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toolbar;
import cc.winboll.studio.apputils.R;
import cc.winboll.studio.libapputils.views.StringToQrCodeView;
public class TestStringToQRCodeViewActivity extends Activity {
public static final String TAG = "TestStringToQrCodeViewActivity";
StringToQrCodeView mStringToQrCodeView;
//
// @Override
// public Activity getActivity() {
// return this;
// }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_teststringtoqrcodeview);
// 初始化工具栏
Toolbar mToolbar = findViewById(R.id.toolbar);
mToolbar.setSubtitle(TAG);
setActionBar(mToolbar);
mStringToQrCodeView = findViewById(R.id.activityteststringtoqrcodeviewStringToQrCodeView1);
}
}

View File

@ -1,39 +0,0 @@
package cc.winboll.studio.libappbase.sos;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/02 09:54:28
* @Describe WinBoLL 系列应用通用管理类
*/
import android.content.Context;
import android.content.Intent;
import cc.winboll.studio.libappbase.LogUtils;
public class WinBoLL {
public static final String TAG = "WinBoLL";
public static final String ACTION_BIND = WinBoLL.class.getName() + ".ACTION_BIND";
public static final String EXTRA_APPMODEL = "EXTRA_APPMODEL";
public static void bindToAPPBase(Context context, String appMainService) {
LogUtils.d(TAG, "bindToAPPBase(...)");
String toPackage = "cc.winboll.studio.appbase";
startBind(context, toPackage, appMainService);
}
public static void bindToAPPBaseBeta(Context context, String appMainService) {
LogUtils.d(TAG, "bindToAPPBaseBeta(...)");
String toPackage = "cc.winboll.studio.appbase.beta";
startBind(context, toPackage, appMainService);
}
static void startBind(Context context, String toPackage, String appMainService) {
Intent intent = new Intent(ACTION_BIND);
intent.putExtra(EXTRA_APPMODEL, (new APPModel(toPackage, appMainService)).toString());
intent.setPackage(toPackage);
LogUtils.d(TAG, String.format("ACTION_BIND :\nTo Package : %s\nAPP Main Service : %s", toPackage, appMainService));
context.sendBroadcast(intent);
}
}

View File

@ -1,18 +0,0 @@
package cc.winboll.studio.libappbase.winboll;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/24 08:23:40
* @Describe WinBoLL 活动窗口通用接口
*/
import android.app.Activity;
import android.widget.Toolbar;
public interface IWinBoLLActivity {
public static final String TAG = "IWinBoLLActivity";
// 获取活动窗口
abstract public Activity getActivity();
abstract public String getTag();
}

View File

@ -1,356 +0,0 @@
package cc.winboll.studio.libappbase.winboll;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/24 08:25:43
* @Describe 应用活动窗口管理器
* 参考
* android 类似微信小程序多任务窗口 设置 TaskDescription 修改 icon label
* https://blog.csdn.net/qq_29364417/article/details/109379915?app_version=6.4.2&code=app_1562916241&csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22109379915%22%2C%22source%22%3A%22weixin_38986226%22%7D&uLinkId=usr1mkqgl919blen&utm_source=app
*/
import android.app.ActivityManager;
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class WinBoLLActivityManager {
public static final String TAG = "WinBoLLActivityManager";
public static final String EXTRA_TAG = "EXTRA_TAG";
public static enum WinBoLLUI_TYPE {
Aplication, // 退出应用后保持最近任务栏任务记录主窗口
Service // 退出应用后清理所有最近任务栏任务记录窗口
};
// 应用类型标志
static volatile WinBoLLUI_TYPE _mWinBoLLUI_TYPE = WinBoLLUI_TYPE.Service;
GlobalApplication mGlobalApplication;
static volatile WinBoLLActivityManager _Instance;
static volatile Map<String, IWinBoLLActivity> _mapIWinBoLLList;
volatile IWinBoLLActivity mFirstIWinBoLLActivity;
WinBoLLActivityManager(GlobalApplication application) {
mGlobalApplication = application;
_mapIWinBoLLList = new HashMap<String, IWinBoLLActivity>();
}
public static synchronized WinBoLLActivityManager getInstance(GlobalApplication application) {
LogUtils.d(TAG, "getInstance");
if (_Instance == null) {
LogUtils.d(TAG, "_Instance == null");
_Instance = new WinBoLLActivityManager(application);
}
return _Instance;
}
//
// 设置 WinBoLL 应用 UI 类型
//
public synchronized static void setWinBoLLUI_TYPE(WinBoLLUI_TYPE mWinBoLLUI_TYPE) {
_mWinBoLLUI_TYPE = mWinBoLLUI_TYPE;
}
//
// 获取 WinBoLL 应用 UI 类型
//
public synchronized static WinBoLLUI_TYPE getWinBoLLUI_TYPE() {
return _mWinBoLLUI_TYPE;
}
//
// 把Activity添加到管理中
//
public <T extends IWinBoLLActivity> void add(T iWinBoLL) {
String tag = ((IWinBoLLActivity)iWinBoLL).getTag();
LogUtils.d(TAG, String.format("add(T iWinBoLL) tag is %s", tag));
if (isActive(tag)) {
LogUtils.d(TAG, String.format("isActive(tag) is true, tag : %s.", tag));
} else {
// 设置起始活动窗口以便最后退出时提问
if (mFirstIWinBoLLActivity == null && _mapIWinBoLLList.size() == 0) {
LogUtils.d(TAG, "Set firstIWinBoLLActivity, iWinBoLL.getTag() is %s" + iWinBoLL.getTag());
mFirstIWinBoLLActivity = iWinBoLL;
}
// 添加到活动窗口列表
_mapIWinBoLLList.put(iWinBoLL.getTag(), iWinBoLL);
LogUtils.d(TAG, String.format("Add activity : %s\n_mapActivityList.size() : %d", iWinBoLL.getTag(), _mapIWinBoLLList.size()));
}
}
//
// activity: null
// intent.putExtra 函数 EXTRA_TAG 参数为 tag
// activity: 不为 null
// intent.putExtra 函数 "tag" 参数为 activity.getTag()
//
public <T extends IWinBoLLActivity> void startWinBoLLActivity(Context context, Class<T> clazz) {
try {
// 如果窗口已存在就重启窗口
String tag = ((IWinBoLLActivity)clazz.newInstance()).getTag();
LogUtils.d(TAG, String.format("startWinBoLLActivity(Context context, Class<T> clazz) tag is %s", tag));
if (isActive(tag)) {
resumeActivity(context, tag);
return;
}
//ToastUtils.show("startWinBoLLActivity(Context context, Class<T> clazz)");
// 新建一个任务窗口
Intent intent = new Intent(context, clazz);
//打开多任务窗口 flags
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(EXTRA_TAG, tag);
context.startActivity(intent);
} catch (InstantiationException | IllegalAccessException e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
}
public <T extends IWinBoLLActivity> void startWinBoLLActivity(Context context, Intent intent, Class<T> clazz) {
try {
// 如果窗口已存在就重启窗口
String tag = ((IWinBoLLActivity)clazz.newInstance()).getTag();
LogUtils.d(TAG, String.format("startWinBoLLActivity(Context context, Intent intent, Class<T> clazz) tag is %s", tag));
if (isActive(tag)) {
resumeActivity(context, tag);
return;
}
// 新建一个任务窗口
//Intent intent = new Intent(context, clazz);
//打开多任务窗口 flags
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(EXTRA_TAG, tag);
context.startActivity(intent);
} catch (InstantiationException | IllegalAccessException e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
}
public <T extends IWinBoLLActivity> void startLogActivity(Context context) {
// 如果窗口已存在就重启窗口
String tag = LogActivity.TAG;
if (isActive(tag)) {
resumeActivity(context, tag);
return;
}
// 新建一个任务窗口
Intent intent = new Intent(context, LogActivity.class);
//打开多任务窗口 flags
// Define the bounds.
// Rect bounds = new Rect(0, 0, 800, 200);
// // Set the bounds as an activity option.
// ActivityOptions options = ActivityOptions.makeBasic();
// options.setLaunchBounds(bounds);
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
intent.putExtra(EXTRA_TAG, tag);
//context.startActivity(intent, options.toBundle());
context.startActivity(intent);
}
public boolean isFirstIWinBoLLActivity(IWinBoLLActivity iWinBoLLActivity) {
return mFirstIWinBoLLActivity != null && mFirstIWinBoLLActivity == iWinBoLLActivity;
}
//
// 判断 tag绑定的 MyActivity是否存在
//
public boolean isActive(String tag) {
LogUtils.d(TAG, String.format("isActive(String tag) tag is %s", tag));
//printIWinBoLLListInfo();
IWinBoLLActivity iWinBoLL = getIWinBoLL(tag);
if (iWinBoLL != null) {
//LogUtils.d(TAG, "isActive(...) activity != null tag " + tag);
//ToastUtils.show("activity != null tag " + tag);
//判断是否为 BaseActivity,如果已经销毁则移除
if (iWinBoLL.getActivity().isFinishing() || iWinBoLL.getActivity().isDestroyed()) {
_mapIWinBoLLList.remove(iWinBoLL.getTag());
//_mWinBoLLActivityList.remove(activity);
LogUtils.d(TAG, String.format("isActive(...) remove activity.\ntag : %s", tag));
return false;
} else {
LogUtils.d(TAG, String.format("isActive(...) activity is exist.\ntag : %s", tag));
return true;
}
} else {
LogUtils.d(TAG, String.format("isActive(...) iWinBoLL is null tag by %s", tag));
return false;
}
}
static IWinBoLLActivity getIWinBoLL(String tag) {
LogUtils.d(TAG, String.format("getIWinBoLL(String tag) %s", tag));
return _mapIWinBoLLList.get(tag);
}
//
// 找到tag 绑定的 BaseActivity 通过 getTaskId() 移动到前台
//
public <T extends IWinBoLLActivity> void resumeActivity(Context context, String tag) {
LogUtils.d(TAG, "resumeActivity(Context context, String tag)");
T iWinBoLL = (T)getIWinBoLL(tag);
LogUtils.d(TAG, String.format("iWinBoLL.getTag() %s", iWinBoLL.getTag()));
//LogUtils.d(TAG, "activity " + activity.getTag());
if (iWinBoLL != null && !iWinBoLL.getActivity().isFinishing() && !iWinBoLL.getActivity().isDestroyed()) {
resumeActivity(context, iWinBoLL);
}
}
//
// 找到tag 绑定的 BaseActivity 通过 getTaskId() 移动到前台
//
public <T extends IWinBoLLActivity> void resumeActivity(Context context, T iWinBoLL) {
LogUtils.d(TAG, "resumeActivity(Context context, T iWinBoLL)");
ActivityManager am = (ActivityManager) mGlobalApplication.getSystemService(Context.ACTIVITY_SERVICE);
//返回启动它的根任务home 或者 MainActivity
Intent intent = new Intent(mGlobalApplication, iWinBoLL.getClass());
TaskStackBuilder stackBuilder = TaskStackBuilder.create(mGlobalApplication);
stackBuilder.addNextIntentWithParentStack(intent);
stackBuilder.startActivities();
//moveTaskToFront(YourTaskId, 0);
//ToastUtils.show("resumeActivity am.moveTaskToFront");
LogUtils.d(TAG, String.format("iWinBoLL.getActivity().getTaskId() %d", iWinBoLL.getActivity().getTaskId()));
am.moveTaskToFront(iWinBoLL.getActivity().getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION);
LogUtils.d(TAG, "am.moveTaskToFront");
}
//
// 结束所有 Activity
//
public void finishAll() {
try {
for (String key : _mapIWinBoLLList.keySet()) {
//System.out.println("Key: " + key + ", Value: " + _mapActivityList.get(key));
IWinBoLLActivity iWinBoLL = _mapIWinBoLLList.get(key);
//ToastUtils.show("finishAll() activity");
if (iWinBoLL != null && !iWinBoLL.getActivity().isFinishing() && !iWinBoLL.getActivity().isDestroyed()) {
//ToastUtils.show("activity != null ...");
if (getWinBoLLUI_TYPE() == WinBoLLUI_TYPE.Service) {
// 结束窗口和最近任务栏, 建议前台服务类应用使用可以方便用户再次调用 UI 操作
iWinBoLL.getActivity().finishAndRemoveTask();
//ToastUtils.show("finishAll() activity.finishAndRemoveTask();");
} else if (getWinBoLLUI_TYPE() == WinBoLLUI_TYPE.Aplication) {
// 结束窗口保留最近任务栏建议前台服务类应用使用可以保持应用的系统自觉性
iWinBoLL.getActivity().finish();
//ToastUtils.show("finishAll() activity.finish();");
} else {
LogUtils.d(TAG, "WinBoLLApplication.WinBoLLUI_TYPE error.");
//ToastUtils.show("WinBoLLApplication.WinBoLLUI_TYPE error.");
}
}
}
} catch (Exception e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
}
//
// 结束指定Activity
//
public <T extends IWinBoLLActivity> void finish(T iWinBoLL) {
try {
if (iWinBoLL != null && !iWinBoLL.getActivity().isFinishing() && !iWinBoLL.getActivity().isDestroyed()) {
//根据tag 移除 MyActivity
//String tag= activity.getTag();
//_mWinBoLLActivityList.remove(tag);
//ToastUtils.show("remove");
//ToastUtils.show("_mWinBoLLActivityArrayMap.size() " + Integer.toString(_mWinBoLLActivityArrayMap.size()));
// 窗口回调规则
// [] 当前窗口位置 >> 调度出的窗口位置
// [0] 1 2 3 4 >> 1
// 0 1 [2] 3 4 >> 1
// 0 1 2 [3] 4 >> 2
// 0 1 2 3 [4] >> 3
// [0] >> 直接关闭当前窗口
//LogUtils.d(TAG, "finish no yet.");
IWinBoLLActivity preIWinBoLL = getPreIWinBoLL(iWinBoLL);
iWinBoLL.getActivity().finish();
if (preIWinBoLL != null) {
resumeActivity(mGlobalApplication, preIWinBoLL);
}
}
} catch (Exception e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
}
//
// 获取窗口队列中的前一个窗口
//
IWinBoLLActivity getPreIWinBoLL(IWinBoLLActivity iWinBoLL) {
try {
boolean bingo = false;
IWinBoLLActivity preIWinBoLL = null;
for (Map.Entry<String, IWinBoLLActivity> entity : _mapIWinBoLLList.entrySet()) {
if (entity.getKey().equals(iWinBoLL.getTag())) {
bingo = true;
//LogUtils.d(TAG, "bingo");
break;
}
preIWinBoLL = entity.getValue();
}
if (bingo) {
return preIWinBoLL;
}
} catch (Exception e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
return null;
}
//
// 从管理列表中移除管理项
//
public <T extends IWinBoLLActivity> boolean registeRemove(T activity) {
IWinBoLLActivity iWinBoLLTest = _mapIWinBoLLList.get(activity.getTag());
if (iWinBoLLTest != null) {
_mapIWinBoLLList.remove(activity.getTag());
return true;
}
return false;
}
//
// 打印管理列表项列表里的信息
//
public static void printIWinBoLLListInfo() {
//LogUtils.d(TAG, "printAvtivityListInfo");
if (!_mapIWinBoLLList.isEmpty()) {
StringBuilder sb = new StringBuilder("Map entries : " + Integer.toString(_mapIWinBoLLList.size()));
Iterator<Map.Entry<String, IWinBoLLActivity>> iterator = _mapIWinBoLLList.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, IWinBoLLActivity> entry = iterator.next();
sb.append("\nKey: " + entry.getKey() + ", \nValue: " + entry.getValue().getTag());
//ToastUtils.show("\nKey: " + entry.getKey() + ", Value: " + entry.getValue().getTag());
}
sb.append("\nMap entries end.");
LogUtils.d(TAG, sb.toString());
} else {
LogUtils.d(TAG, "The map is empty.");
}
}
}

View File

@ -18,18 +18,18 @@ def genVersionName(def versionName){
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
compileSdkVersion 32
buildToolsVersion "32.0.0"
defaultConfig {
applicationId "cc.winboll.studio.mymessagemanager"
minSdkVersion 26
minSdkVersion 24
targetSdkVersion 29
versionCode 8
// versionName
// .winboll/winbollBuildProps.properties stageCount=0
// Gradle编译环境下合起来的 versionName "${versionName}.0"
versionName "4.1"
versionName "15.2"
if(true) {
versionName = genVersionName("${versionName}")
}
@ -44,26 +44,27 @@ android {
}
dependencies {
api 'cc.winboll.studio:winboll-shared:1.6.4'
api 'io.github.medyo:android-about-page:2.0.0'
api fileTree(dir: 'libs', include: ['*.jar'])
api 'cc.winboll.studio:libaes:15.6.0'
api 'cc.winboll.studio:libapputils:15.3.4'
api 'cc.winboll.studio:libappbase:15.7.6'
api 'io.github.medyo:android-about-page:2.0.0'
api 'com.github.getActivity:ToastUtils:10.5'
api 'com.jcraft:jsch:0.1.55'
api 'org.jsoup:jsoup:1.13.1'
api 'com.squareup.okhttp3:okhttp:4.4.1'
api 'androidx.appcompat:appcompat:1.0.0'
api 'androidx.fragment:fragment:1.0.0'
api 'com.google.android.material:material:1.0.0'
// https://github.com/getActivity/XXPermissions
api 'com.github.getActivity:XXPermissions:18.63'
api 'com.baoyz.pullrefreshlayout:library:1.2.0'
api 'androidx.appcompat:appcompat:1.0.0'
api 'androidx.fragment:fragment:1.0.0'
// AndroidX
api 'androidx.appcompat:appcompat:1.1.0'
api 'com.google.android.material:material:1.4.0'
//api 'androidx.viewpager:viewpager:1.0.0'
//api 'androidx.vectordrawable:vectordrawable:1.1.0'
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
//api 'androidx.fragment:fragment:1.1.0'
api 'com.google.android.material:material:1.0.0'
api 'cc.winboll.studio:libaes:7.6.0'
api fileTree(dir: 'libs', include: ['*.jar'])
}

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Tue Feb 25 10:52:41 GMT 2025
stageCount=14
#Sat May 03 12:49:28 GMT 2025
stageCount=5
libraryProject=
baseVersion=4.1
publishVersion=4.1.13
buildCount=5
baseBetaVersion=4.1.14
baseVersion=15.2
publishVersion=15.2.4
buildCount=14
baseBetaVersion=15.2.5

View File

@ -53,30 +53,28 @@
</queries>
<application
android:name=".GlobalApplication"
android:name=".App"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:roundIcon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/WinBoll.SupportThemeNoActionBar"
android:theme="@style/MyAppTheme"
android:persistent="true"
android:resizeableActivity="true"
android:supportsRtl="true"
android:requestLegacyExternalStorage="true">
android:requestLegacyExternalStorage="true"
android:networkSecurityConfig="@xml/network_security_config">
<activity
android:name=".activitys.SMSActivity"
android:process=":sms"/>
android:name=".activitys.SMSActivity"/>
<activity
android:name=".activitys.SMSReceiveRuleActivity"
android:process=":smsars">
android:name=".activitys.SMSReceiveRuleActivity">
</activity>
<activity
android:name=".activitys.SharedJSONReceiveActivity"
android:process=":smssjr"
android:exported="true">
<intent-filter>
@ -98,17 +96,14 @@
</activity>
<activity
android:name=".activitys.TTSPlayRuleActivity"
android:process=":ttsrule"/>
android:name=".activitys.TTSPlayRuleActivity"/>
<activity
android:name=".activitys.AboutActivity"
android:process=":about"/>
android:name=".activitys.AboutActivity"/>
<activity
android:name=".activitys.MainActivity"
android:exported="true"
android:process=":main">
android:exported="true">
<intent-filter>
@ -122,8 +117,7 @@
<activity
android:name=".activitys.ComposeSMSActivity"
android:exported="true"
android:process=":csms">
android:exported="true">
<intent-filter>
@ -226,6 +220,8 @@
<activity android:name="cc.winboll.studio.mymessagemanager.activitys.SMSRecycleActivity"/>
<activity android:name="cc.winboll.studio.mymessagemanager.unittest.UnitTestActivity"/>
</application>
</manifest>

View File

@ -6,13 +6,12 @@ package cc.winboll.studio.mymessagemanager;
* @Describe 全局应用类
*/
import android.view.Gravity;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.shared.app.WinBollApplication;
import cc.winboll.studio.shared.log.LogUtils;
import com.hjq.toast.ToastUtils;
import java.io.File;
public class GlobalApplication extends WinBollApplication {
public class App extends GlobalApplication {
public static final String TAG = "GlobalApplication";
@ -30,7 +29,6 @@ public class GlobalApplication extends WinBollApplication {
@Override
public void onCreate() {
super.onCreate();
//setIsDebug(cc.winboll.studio.mymessagemanager.BuildConfig.DEBUG);
// 初始化 Toast 框架
ToastUtils.init(this);
@ -45,8 +43,4 @@ public class GlobalApplication extends WinBollApplication {
_mszConfigUtilPath = _mszAppExternalFilesDir + File.separator + _mszConfigUtilFileName;
_mszSMSReceiveRuleUtilPath = _mszAppExternalFilesDir + File.separator + _mszSMSReceiveRuleUtilFileName;
}
public static void showApplicationMessage(String szMessage) {
LogUtils.i(TAG, szMessage);
}
}

View File

@ -3,72 +3,89 @@ package cc.winboll.studio.mymessagemanager.activitys;
/**
* @Author ZhanGSKen@QQ.COM
* @Date 2024/07/14 13:20:33
* @Describe 应用关于对话窗口
* @Describe 应用介绍窗口
*/
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.shared.app.WinBollActivity;
import cc.winboll.studio.shared.app.WinBollActivityManager;
import com.hjq.toast.ToastUtils;
import cc.winboll.studio.libaes.utils.AESThemeUtil;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libaes.winboll.APPInfo;
import cc.winboll.studio.libaes.winboll.AboutView;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
import cc.winboll.studio.mymessagemanager.App;
import cc.winboll.studio.mymessagemanager.R;
final public class AboutActivity extends WinBollActivity {
public class AboutActivity extends WinBollActivity implements IWinBoLLActivity {
public static final String TAG = "AboutActivity";
Context mContext;
Toolbar mToolbar;
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected boolean isEnableDisplayHomeAsUp() {
return false;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext()));
super.onCreate(savedInstanceState);
mContext = this;
setContentView(R.layout.activity_about);
mContext = getApplicationContext();
mToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
mToolbar.setSubtitle(TAG);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
AboutView aboutView = CreateAboutView();
// Activity onCreate 或其他生命周期方法中调用
// LinearLayout layout = new LinearLayout(this);
// layout.setOrientation(LinearLayout.VERTICAL);
// // 创建布局参数宽度和高度
// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
// ViewGroup.LayoutParams.MATCH_PARENT,
// ViewGroup.LayoutParams.MATCH_PARENT
// );
// addContentView(aboutView, params);
LinearLayout layout = findViewById(R.id.aboutviewroot_ll);
// 创建布局参数宽度和高度
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
);
layout.addView(aboutView, params);
App.getWinBoLLActivityManager().add(this);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
setTitle(mContext.getString(R.string.text_about) + mContext.getString(R.string.app_name));
protected void onDestroy() {
super.onDestroy();
App.getWinBoLLActivityManager().registeRemove(this);
}
@Override
protected boolean isAddWinBollToolBar() {
return false;
}
@Override
protected Toolbar initToolBar() {
return findViewById(R.id.activityaboutASupportToolbar1);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.toolbar_about, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
/*if (item.getItemId() == R.id.item_help) {
ToastUtils.show("R.id.item_help");
} else */if (item.getItemId() == android.R.id.home) {
WinBollActivityManager.getInstance(getApplicationContext()).finish(this);
}
return super.onOptionsItemSelected(item);
public AboutView CreateAboutView() {
String szBranchName = "mymessagemanager";
APPInfo appInfo = new APPInfo();
appInfo.setAppName(getString(R.string.app_name));
appInfo.setAppIcon(cc.winboll.studio.libaes.R.drawable.ic_winboll);
appInfo.setAppDescription(getString(R.string.app_description));
appInfo.setAppGitName("APP");
appInfo.setAppGitOwner("Studio");
appInfo.setAppGitAPPBranch(szBranchName);
appInfo.setAppGitAPPSubProjectFolder(szBranchName);
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=MyMessageManager");
appInfo.setAppAPKName("MyMessageManager");
appInfo.setAppAPKFolderName("MyMessageManager");
return new AboutView(mContext, appInfo);
}
}

View File

@ -17,6 +17,8 @@ import cc.winboll.studio.libaes.views.AToolbar;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.utils.AppConfigUtil;
import cc.winboll.studio.mymessagemanager.utils.PermissionUtil;
import cc.winboll.studio.mymessagemanager.utils.NotificationHelper;
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
public class AppSettingsActivity extends BaseActivity {
@ -96,4 +98,18 @@ public class AppSettingsActivity extends BaseActivity {
Toast.makeText(getApplication(), "应用已获得所需权限。", Toast.LENGTH_SHORT).show();
}
}
public void onCleanOldChannels(View view) {
YesNoAlertDialog.show(this, "通知设置清理", "是否清理旧的通知设置?", new YesNoAlertDialog.OnDialogResultListener(){
@Override
public void onNo() {
}
@Override
public void onYes() {
NotificationHelper notificationHelper = new NotificationHelper(AppSettingsActivity.this);
notificationHelper.cleanOldChannels();
}
});
}
}

View File

@ -1,6 +1,5 @@
package cc.winboll.studio.mymessagemanager.activitys;
import cc.winboll.studio.mymessagemanager.R;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@ -8,9 +7,8 @@ import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import cc.winboll.studio.libaes.utils.AESThemeUtil;
import cc.winboll.studio.shared.log.LogUtils;
import com.hjq.toast.ToastUtils;
import cc.winboll.studio.libaes.beans.AESThemeBean;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.R;
abstract public class BaseActivity extends AppCompatActivity {
@ -103,7 +101,7 @@ abstract public class BaseActivity extends AppCompatActivity {
AESThemeUtil.saveThemeStyleID(this, R.style.MyTaoAESTheme);
recreate();
} else if (R.id.item_defaulttheme == item.getItemId()) {
AESThemeUtil.saveThemeStyleID(this, R.style.MyDefaultAESTheme);
AESThemeUtil.saveThemeStyleID(this, R.style.MyAppTheme);
recreate();
}
//ToastUtils.show("nThemeStyleID " + Integer.toString(nThemeStyleID));

View File

@ -10,7 +10,6 @@ import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.Toolbar;
import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
import cc.winboll.studio.mymessagemanager.R;

View File

@ -10,28 +10,25 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ScrollView;
import cc.winboll.studio.libaes.views.AToolbar;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.mymessagemanager.App;
import cc.winboll.studio.mymessagemanager.BuildConfig;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.MainActivity;
import cc.winboll.studio.mymessagemanager.adapters.PhoneArrayAdapter;
import cc.winboll.studio.mymessagemanager.services.MainService;
import cc.winboll.studio.mymessagemanager.unittest.UnitTestActivity;
import cc.winboll.studio.mymessagemanager.utils.AppConfigUtil;
import cc.winboll.studio.mymessagemanager.utils.AppGoToSettingsUtil;
import cc.winboll.studio.mymessagemanager.utils.NotificationUtil;
import cc.winboll.studio.mymessagemanager.utils.PermissionUtil;
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
import cc.winboll.studio.mymessagemanager.utils.ThemeUtil;
import cc.winboll.studio.mymessagemanager.utils.ViewUtil;
import cc.winboll.studio.mymessagemanager.views.ConfirmSwitchView;
import cc.winboll.studio.mymessagemanager.views.PhoneListViewForScrollView;
import cc.winboll.studio.shared.log.LogUtils;
import cc.winboll.studio.shared.log.LogView;
import com.baoyz.widget.PullRefreshLayout;
import java.util.ArrayList;
import cc.winboll.studio.libaes.utils.AESThemeUtil;
import cc.winboll.studio.libaes.views.ASupportToolbar;
import androidx.appcompat.widget.Toolbar;
public class MainActivity extends BaseActivity {
@ -45,7 +42,7 @@ public class MainActivity extends BaseActivity {
public static final int MY_PERMISSIONS_REQUEST = 0;
static MainActivity _mMainActivity;
LogView mLogView;
//LogView mLogView;
AppConfigUtil mAppConfigUtil;
ConfirmSwitchView msvEnableService;
ConfirmSwitchView msvOnlyReceiveContacts;
@ -121,8 +118,8 @@ public class MainActivity extends BaseActivity {
//
void initView() {
// 设置调试日志
mLogView = findViewById(R.id.logview);
mLogView.start();
// mLogView = findViewById(R.id.logview);
// mLogView.start();
// 设置消息处理函数
setOnActivityMessageReceived(mIOnActivityMessageReceived);
@ -131,12 +128,7 @@ public class MainActivity extends BaseActivity {
mToolbar = findViewById(R.id.activitymainASupportToolbar1);
mToolbar.setSubtitle(getString(R.string.activity_name_main));
setSupportActionBar(mToolbar);
// 创建通知频道
NotificationUtil nu = new NotificationUtil();
nu.createServiceNotificationChannel(MainActivity.this);
nu.createSMSNotificationChannel(MainActivity.this);
boolean isEnableService = mAppConfigUtil.mAppConfigBean.isEnableService();
msvEnableService = findViewById(R.id.activitymainSwitchView1);
msvEnableService.setChecked(isEnableService);
@ -270,7 +262,7 @@ public class MainActivity extends BaseActivity {
protected void onResume() {
super.onResume();
reloadSMS();
mLogView.start();
//mLogView.start();
}
@Override
@ -303,27 +295,33 @@ public class MainActivity extends BaseActivity {
int nItemId = item.getItemId();
if (nItemId == R.id.app_ttsrule) {
Intent i = new Intent(MainActivity.this, TTSPlayRuleActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
} else if (nItemId == R.id.app_smsrule) {
Intent i = new Intent(MainActivity.this, SMSReceiveRuleActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
} else if (nItemId == R.id.app_appsettings) {
Intent i = new Intent(MainActivity.this, AppSettingsActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
} else if (nItemId == R.id.app_crashtest) {
} else if (nItemId == R.id.app_log) {
App.getWinBoLLActivityManager().startLogActivity(this);
} else if (nItemId == R.id.app_unittest) {
Intent i = new Intent(MainActivity.this, UnitTestActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
} else if (nItemId == R.id.app_crashtest) {
for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; i++) {
getString(i);
}
} else if (nItemId == R.id.app_about) {
Intent i = new Intent(MainActivity.this, AboutActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
} else if (nItemId == R.id.app_smsrecycle) {
Intent i = new Intent(MainActivity.this, SMSRecycleActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
}

View File

@ -18,10 +18,10 @@ import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.SMSActivity;
import cc.winboll.studio.mymessagemanager.adapters.SMSArrayAdapter;
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
import cc.winboll.studio.mymessagemanager.utils.ViewUtil;
import cc.winboll.studio.mymessagemanager.views.SMSListViewForScrollView;
import cc.winboll.studio.mymessagemanager.views.SMSView;
import java.lang.ref.WeakReference;
public class SMSActivity extends BaseActivity {
@ -102,7 +102,7 @@ public class SMSActivity extends BaseActivity {
// 初始化标题栏
mToolbar = findViewById(R.id.activitysmsASupportToolbar1);
mToolbar.setSubtitle(getString(R.string.activity_name_smsinphone) + " < Phone : " + mszPhoneTo + " >");
mToolbar.setSubtitle(getString(R.string.activity_name_smsinphone) + " < Phone : " + AddressUtils.getFormattedAddress(mszPhoneTo) + " >");
setActionBar(mToolbar);
// 初始化滚动窗口

View File

@ -21,7 +21,7 @@ import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import cc.winboll.studio.mymessagemanager.GlobalApplication;
import cc.winboll.studio.mymessagemanager.App;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.SMSReceiveRuleActivity;
import cc.winboll.studio.mymessagemanager.adapters.SMSAcceptRuleArrayAdapter;
@ -114,7 +114,7 @@ public class SMSReceiveRuleActivity extends BaseActivity {
}
void initSMSAcceptRuleBeanAdd() {
mSMSAcceptRuleBeanAdd = new SMSAcceptRuleBean(GlobalApplication.USER_ID, "", true, SMSAcceptRuleBean.RuleType.REFUSE, true);
mSMSAcceptRuleBeanAdd = new SMSAcceptRuleBean(App.USER_ID, "", true, SMSAcceptRuleBean.RuleType.REFUSE, true);
}
@Override

View File

@ -8,16 +8,16 @@ package cc.winboll.studio.mymessagemanager.activitys;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.SMSRecycleActivity;
import cc.winboll.studio.mymessagemanager.adapters.SMSRecycleAdapter;
import cc.winboll.studio.mymessagemanager.utils.SMSRecycleUtil;
import cc.winboll.studio.shared.view.YesNoAlertDialog;
import com.baoyz.widget.PullRefreshLayout;
import java.io.File;
import androidx.appcompat.widget.Toolbar;
public class SMSRecycleActivity extends BaseActivity {

View File

@ -0,0 +1,60 @@
package cc.winboll.studio.mymessagemanager.activitys;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/31 01:31:17
* @Describe 应用活动窗口基类
*/
import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import cc.winboll.studio.libaes.beans.AESThemeBean;
import cc.winboll.studio.libaes.utils.AESThemeUtil;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
public class WinBollActivity extends AppCompatActivity implements IWinBoLLActivity {
public static final String TAG = "WinBollActivity";
protected volatile AESThemeBean.ThemeType mThemeType;
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
mThemeType = getThemeType();
setThemeStyle();
super.onCreate(savedInstanceState);
}
AESThemeBean.ThemeType getThemeType() {
/*SharedPreferences sharedPreferences = getSharedPreferences(
SHAREDPREFERENCES_NAME, MODE_PRIVATE);
return AESThemeBean.ThemeType.values()[((sharedPreferences.getInt(DRAWER_THEME_TYPE, AESThemeBean.ThemeType.DEFAULT.ordinal())))];
*/
return AESThemeBean.getThemeStyleType(AESThemeUtil.getThemeTypeID(getApplicationContext()));
}
void setThemeStyle() {
//setTheme(AESThemeBean.getThemeStyle(getThemeType()));
setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext()));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View File

@ -9,13 +9,14 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.SMSActivity;
import cc.winboll.studio.mymessagemanager.beans.PhoneBean;
import cc.winboll.studio.mymessagemanager.beans.SMSBean;
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
import cc.winboll.studio.mymessagemanager.utils.PhoneUtil;
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
import cc.winboll.studio.shared.log.LogUtils;
import java.util.ArrayList;
import java.util.List;
@ -74,9 +75,9 @@ public class PhoneArrayAdapter extends BaseAdapter {
viewHolder = (ViewHolder) convertView.getTag();
}
String szAddress = ((SMSBean)getItem(position)).getAddress();
final String szAddress = ((SMSBean)getItem(position)).getAddress();
viewHolder.tvAddress.setText(szAddress);
viewHolder.tvAddress.setText(AddressUtils.getFormattedAddress(szAddress));
viewHolder.tvName.setText(getName(szAddress));
//Drawable drawableFrame = AppCompatResources.getDrawable(mContext, R.drawable.bg_frame);
@ -87,7 +88,7 @@ public class PhoneArrayAdapter extends BaseAdapter {
//Toast.makeText(mContext, tv.getText(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(mContext, SMSActivity.class);
intent.putExtra(SMSActivity.EXTRA_PHONE, viewHolder.tvAddress.getText());
intent.putExtra(SMSActivity.EXTRA_PHONE, szAddress);
mContext.startActivity(intent);
}

View File

@ -18,7 +18,6 @@ import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.TTSPlayRuleActivity;
import cc.winboll.studio.mymessagemanager.beans.SMSBean;
import cc.winboll.studio.mymessagemanager.dialogs.YesNoAlertDialog;
import cc.winboll.studio.mymessagemanager.utils.NotificationUtil;
import cc.winboll.studio.mymessagemanager.utils.SMSReceiveRuleUtil;
import cc.winboll.studio.mymessagemanager.utils.SMSRecycleUtil;
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
@ -28,6 +27,7 @@ import cc.winboll.studio.mymessagemanager.views.SMSView;
import com.hjq.toast.ToastUtils;
import java.util.ArrayList;
import cc.winboll.studio.mymessagemanager.beans.SMSAcceptRuleBean;
import cc.winboll.studio.mymessagemanager.utils.NotificationHelper;
public class SMSArrayAdapter extends BaseAdapter {
@ -54,7 +54,8 @@ public class SMSArrayAdapter extends BaseAdapter {
public void cancelMessageNotification() {
for (SMSBean bean : mData) {
NotificationUtil.cancelNotification(mContext, bean.getId());
NotificationHelper notificationHelper = new NotificationHelper(mContext);
notificationHelper.cancelNotification(bean.getId());
}
}

View File

@ -34,6 +34,7 @@ import cc.winboll.studio.mymessagemanager.views.DateAgoTextView;
import cc.winboll.studio.mymessagemanager.views.SMSView;
import com.hjq.toast.ToastUtils;
import java.util.ArrayList;
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
public class SMSRecycleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@ -154,7 +155,7 @@ public class SMSRecycleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
final SMSRecycleBean item = mDataList.get(position);
if (holder.getItemViewType() == 0) {
SimpleViewHolder viewHolder = (SimpleViewHolder) holder;
viewHolder.mtvAddress.setText(item.getAddress());
viewHolder.mtvAddress.setText(AddressUtils.getFormattedAddress(item.getAddress()));
viewHolder.mbtnViewBody.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
@ -179,7 +180,7 @@ public class SMSRecycleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
viewHolder.mvRight.setVisibility(View.GONE);
viewHolder.mSMSView.setSMSType(SMSView.SMSType.SEND);
}
viewHolder.mtvAddress.setText(item.getAddress());
viewHolder.mtvAddress.setText(AddressUtils.getFormattedAddress(item.getAddress()));
viewHolder.mdatvDeleteDate.setDate(item.getDeleteDate());
viewHolder.mdatvDate.setDate(item.getDate());
if(mAppConfigUtil.mAppConfigBean.isSMSRecycleProtectMode()) {

View File

@ -7,8 +7,7 @@ package cc.winboll.studio.mymessagemanager.beans;
*/
import android.util.JsonReader;
import android.util.JsonWriter;
import cc.winboll.studio.mymessagemanager.utils.ThemeUtil;
import cc.winboll.studio.shared.app.BaseBean;
import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException;
public class AppConfigBean extends BaseBean {

View File

@ -7,7 +7,7 @@ package cc.winboll.studio.mymessagemanager.beans;
*/
import android.util.JsonReader;
import android.util.JsonWriter;
import cc.winboll.studio.shared.app.BaseBean;
import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException;
public class SMSAcceptRuleBean extends BaseBean {

View File

@ -34,7 +34,7 @@ package cc.winboll.studio.mymessagemanager.beans;
import android.content.ContentValues;
import android.util.JsonReader;
import android.util.JsonWriter;
import cc.winboll.studio.shared.app.BaseBean;
import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException;
import java.text.Collator;
import java.util.ArrayList;

View File

@ -7,7 +7,7 @@ package cc.winboll.studio.mymessagemanager.beans;
*/
import android.util.JsonReader;
import android.util.JsonWriter;
import cc.winboll.studio.shared.app.BaseBean;
import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException;
import java.text.Collator;
import java.util.ArrayList;

View File

@ -7,7 +7,7 @@ package cc.winboll.studio.mymessagemanager.beans;
*/
import android.util.JsonReader;
import android.util.JsonWriter;
import cc.winboll.studio.shared.app.BaseBean;
import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException;
public class TTSPlayRuleBean extends BaseBean {

View File

@ -8,8 +8,8 @@ package cc.winboll.studio.mymessagemanager.beans;
import android.content.Context;
import android.util.JsonReader;
import android.util.JsonWriter;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.utils.FileUtil;
import cc.winboll.studio.shared.log.LogUtils;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;

View File

@ -10,9 +10,9 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.services.MainService;
import cc.winboll.studio.mymessagemanager.utils.AppConfigUtil;
import cc.winboll.studio.shared.log.LogUtils;
public class MainReceiver extends BroadcastReceiver {

View File

@ -4,17 +4,17 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import cc.winboll.studio.mymessagemanager.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.App;
import cc.winboll.studio.mymessagemanager.activitys.SMSActivity;
import cc.winboll.studio.mymessagemanager.beans.SMSBean;
import cc.winboll.studio.mymessagemanager.utils.AppConfigUtil;
import cc.winboll.studio.mymessagemanager.utils.NotificationUtil;
import cc.winboll.studio.mymessagemanager.utils.PhoneUtil;
import cc.winboll.studio.mymessagemanager.utils.SMSReceiveRuleUtil;
import cc.winboll.studio.mymessagemanager.utils.SMSRecycleUtil;
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
import cc.winboll.studio.mymessagemanager.utils.TTSPlayRuleUtil;
import cc.winboll.studio.mymessagemanager.utils.RegexPPiUtils;
import cc.winboll.studio.mymessagemanager.utils.NotificationHelper;
public class SMSRecevier extends BroadcastReceiver {
@ -36,34 +36,20 @@ public class SMSRecevier extends BroadcastReceiver {
String szAction = intent.getAction();
if (szAction.equals(ACTION_SMS_RECEIVED)) {
//LogUtils.d(TAG, "ACTION_SMS_RECEIVED");
LogUtils.d(TAG, "ACTION_SMS_RECEIVED");
String szSmsBody = SMSUtil.getSmsBody(intent);
String szSmsAddress = SMSUtil.getSmsAddress(intent);
PhoneUtil phoneUtil = new PhoneUtil(context);
boolean isPhoneInContacts = phoneUtil.isPhoneInContacts(szSmsAddress);
AppConfigUtil configUtil = AppConfigUtil.getInstance(context);
boolean isOnlyReceiveContacts = configUtil.mAppConfigBean.isEnableOnlyReceiveContacts();
boolean isEnableTTS = configUtil.mAppConfigBean.isEnableTTS();
boolean isEnableTTSAnalyzeMode = configUtil.mAppConfigBean.isEnableTTSRuleMode();
boolean isInSMSAcceptRule = SMSReceiveRuleUtil.getInstance(context, false).checkIsSMSAcceptInRule(context, szSmsBody);
//LogUtils.d(TAG, "isInSMSAcceptRule is : " + Boolean.toString(isInSMSAcceptRule));
if (!isPhoneInContacts) {
GlobalApplication.showApplicationMessage(" The phone number " + szSmsAddress + " is not in contacts.");
if (isOnlyReceiveContacts) {
GlobalApplication.showApplicationMessage("Close the \"Only Receive Contacts\" switch will be receive The " + szSmsAddress + "'s message in future.");
}
}
if ((!isOnlyReceiveContacts)
|| isPhoneInContacts
|| isInSMSAcceptRule) {
if (checkIsSMSOK(context, szSmsBody, szSmsAddress)) {
int nResultId = SMSUtil.saveReceiveSms(context, szSmsAddress, szSmsBody, "0", System.currentTimeMillis(), "inbox");
if (nResultId >= 0) {
NotificationUtil nu = new NotificationUtil();
nu.sendSMSReceivedMessage(context, nResultId, szSmsAddress, szSmsBody);
NotificationHelper notificationHelper = new NotificationHelper(context);
notificationHelper.sendSMSReceivedMessage(nResultId, szSmsAddress, szSmsBody);
LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent(SMSActivity.ACTION_NOTIFY_SMS_CHANGED));
GlobalApplication.showApplicationMessage("<" + szSmsAddress + "> : ( " + szSmsBody + " ) [SAVED]");
LogUtils.d(TAG, "<" + szSmsAddress + "> : ( " + szSmsBody + " ) [SAVED]");
if (isEnableTTS) {
if (isEnableTTSAnalyzeMode) {
TTSPlayRuleUtil ttsPlayRuleUtil = TTSPlayRuleUtil.getInstance(context);
@ -81,12 +67,41 @@ public class SMSRecevier extends BroadcastReceiver {
SMSRecycleUtil.addSMSRecycleItem(context, bean);
}
}
}
//
// 检查短信是否在接收设定规则内
//
public static boolean checkIsSMSOK(Context context, String szSmsBody, String szSmsAddress) {
PhoneUtil phoneUtil = new PhoneUtil(context);
boolean isPhoneInContacts = phoneUtil.isPhoneInContacts(szSmsAddress);
LogUtils.d(TAG, String.format("isPhoneInContacts %s", isPhoneInContacts));
boolean isPhoneByDigit = phoneUtil.isPhoneByDigit(szSmsAddress);
LogUtils.d(TAG, String.format("isPhoneByDigit %s", isPhoneByDigit));
AppConfigUtil configUtil = AppConfigUtil.getInstance(context);
boolean isOnlyReceiveContacts = configUtil.mAppConfigBean.isEnableOnlyReceiveContacts();
LogUtils.d(TAG, String.format("isOnlyReceiveContacts %s", isOnlyReceiveContacts));
boolean isInSMSAcceptRule = SMSReceiveRuleUtil.getInstance(context, false).checkIsSMSAcceptInRule(context, szSmsBody);
LogUtils.d(TAG, String.format("isInSMSAcceptRule %s", isInSMSAcceptRule));
// 启用了只接受通讯录通讯录里有记录
if (isOnlyReceiveContacts && isPhoneInContacts) {
return true;
}
// 如果不是数字通讯地址但是在通讯录内
if (!isPhoneByDigit && isPhoneInContacts) {
return true;
}
// 通讯地址是数字并且在短信接收规则内
if (isPhoneByDigit && isInSMSAcceptRule) {
return true;
}
return false;
}
}

View File

@ -5,6 +5,7 @@ package cc.winboll.studio.mymessagemanager.services;
* @Date 2024/07/19 14:30:57
* @Describe 应用主要服务组件类
*/
import android.app.Notification;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
@ -12,20 +13,24 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.os.IBinder;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.MainActivity;
import cc.winboll.studio.mymessagemanager.beans.MessageNotificationBean;
import cc.winboll.studio.mymessagemanager.receivers.SMSRecevier;
import cc.winboll.studio.mymessagemanager.services.MainService;
import cc.winboll.studio.mymessagemanager.utils.AppConfigUtil;
import cc.winboll.studio.mymessagemanager.utils.NotificationUtil;
import cc.winboll.studio.mymessagemanager.utils.NotificationHelper;
import cc.winboll.studio.mymessagemanager.utils.ServiceUtil;
import cc.winboll.studio.shared.log.LogUtils;
import com.hjq.toast.ToastUtils;
public class MainService extends Service {
public static String TAG = "ManagerService";
// 前台服务通知工具
NotificationHelper mNotificationHelper;
Notification notification;
AppConfigUtil mConfigUtil;
//MyBinder mMyBinder;
MyServiceConnection mMyServiceConnection;
@ -73,17 +78,12 @@ public class MainService extends Service {
mSMSRecevier = new SMSRecevier();
registerReceiver(mSMSRecevier, localIntentFilter);
// 显示前台通知栏
MessageNotificationBean notificationMessage = createNotificationMessage();
NotificationUtil nu = new NotificationUtil();
nu.sendForegroundNotification(MainService.this, notificationMessage);
NotificationHelper helper = new NotificationHelper(this);
Intent intent = new Intent(this, MainActivity.class);
notification = helper.showForegroundNotification(intent, getString(R.string.app_name), getString(R.string.text_aboutservernotification));
startForeground(NotificationHelper.FOREGROUND_NOTIFICATION_ID, notification);
/*if (mConfigUtil.isEnableTTS()) {
TTSPlayRuleUtil.speakText(ManagerService.this, getString(R.string.text_iamhere), 0);
GlobalApplication.showApplicationMessage(getString(R.string.text_iamhere));
}*/
ToastUtils.show("Service is start.");
LogUtils.i(TAG, "Service is start.");
}
@ -101,13 +101,6 @@ public class MainService extends Service {
}
private MessageNotificationBean createNotificationMessage() {
String szTitle = getApplicationContext().getString(R.string.app_name);
String szContent = getString(R.string.text_aboutservernotification);
return new MessageNotificationBean(NotificationUtil.ID_MSG_SERVICE, "", szTitle, szContent);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
//return super.onStartCommand(intent, flags, startId);
@ -116,12 +109,12 @@ public class MainService extends Service {
return mConfigUtil.mAppConfigBean.isEnableService() ? Service.START_STICKY: super.onStartCommand(intent, flags, startId);
}
/*private class MyBinder extends IMyAidlInterface.Stub {
@Override
public String getServiceName() {
return MainService.class.getSimpleName();
}
}*/
/*private class MyBinder extends IMyAidlInterface.Stub {
@Override
public String getServiceName() {
return MainService.class.getSimpleName();
}
}*/
// 主进程与守护进程连接时需要用到此类
//

View File

@ -0,0 +1,28 @@
package cc.winboll.studio.mymessagemanager.unittest;
import android.content.Context;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/01 13:07:32
* @Describe AddressUtils Test
*/
public class AddressUtils_Test {
public static final String TAG = "AddressUtils_Test";
public static void main(Context context) {
String szSmsBody = "无影无迹";
String szSmsAddress = "无名小辈";
LogUtils.d(TAG, String.format("szSmsAddress %s\n getFormattedAddress : %s", szSmsAddress, AddressUtils.getFormattedAddress(szSmsAddress)));
szSmsAddress = "13172887736";
LogUtils.d(TAG, String.format("szSmsAddress %s\n getFormattedAddress : %s", szSmsAddress, AddressUtils.getFormattedAddress(szSmsAddress)));
szSmsAddress = "+8613172887736";
LogUtils.d(TAG, String.format("szSmsAddress %s\n getFormattedAddress : %s", szSmsAddress, AddressUtils.getFormattedAddress(szSmsAddress)));
szSmsAddress = "8613172887736";
LogUtils.d(TAG, String.format("szSmsAddress %s\n getFormattedAddress : %s", szSmsAddress, AddressUtils.getFormattedAddress(szSmsAddress)));
}
}

View File

@ -0,0 +1,56 @@
package cc.winboll.studio.mymessagemanager.unittest;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/02/25 19:02:15
* @Describe SMSRecevier 测试类
*/
import android.content.Context;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.receivers.SMSRecevier;
public class SMSRecevier_Test {
public static final String TAG = "SMSRecevier_Test";
public static void main(Context context) {
String szSmsBody = "无影无迹";
String szSmsAddress = "无名小辈";
test1(context, szSmsBody, szSmsAddress);
szSmsBody = "无影无迹";
szSmsAddress = "淘宝物流";
test1(context, szSmsBody, szSmsAddress);
szSmsBody = "无影无迹";
szSmsAddress = "1?0";
test1(context, szSmsBody, szSmsAddress);
szSmsBody = "无影无迹";
szSmsAddress = "10000";
test1(context, szSmsBody, szSmsAddress);
szSmsBody = "【UC】无影无迹";
szSmsAddress = "无名小辈";
test1(context, szSmsBody, szSmsAddress);
szSmsBody = "【UC】无影无迹";
szSmsAddress = "10000";
test1(context, szSmsBody, szSmsAddress);
szSmsBody = "【UC】无影无迹";
szSmsAddress = "13172887736";
test1(context, szSmsBody, szSmsAddress);
szSmsBody = "【UC】无影无迹";
szSmsAddress = "+8613172887736";
test1(context, szSmsBody, szSmsAddress);
}
public static void test1(Context context, String szSmsBody, String szSmsAddress) {
boolean isSMSOK = SMSRecevier.checkIsSMSOK(context, szSmsBody, szSmsAddress);
LogUtils.d(TAG, String.format("szSmsBody : %s\nszSmsAddress : %s\nisSMSOK : %s", szSmsBody, szSmsAddress, isSMSOK));
}
}

View File

@ -0,0 +1,36 @@
package cc.winboll.studio.mymessagemanager.unittest;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/02/25 19:00:10
* @Describe 应用单元测试窗口
*/
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.mymessagemanager.R;
public class UnitTestActivity extends Activity {
public static final String TAG = "UnitTestActivity";
LogView mLogView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_unittest);
mLogView = findViewById(R.id.logview);
mLogView.start();
}
public void onMain(View view) {
LogUtils.d(TAG, "SMSRecevier_Test");
SMSRecevier_Test.main(this);
LogUtils.d(TAG, "AddressUtils_Test");
AddressUtils_Test.main(this);
}
}

View File

@ -0,0 +1,20 @@
package cc.winboll.studio.mymessagemanager.utils;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/03/01 13:03:16
* @Describe 通信录地址工具
*/
public class AddressUtils {
public static final String TAG = "AddressUtils";
public static String getFormattedAddress(String address) {
if (address != null && address.matches("[+]?\\d+")) {
return address;
} else {
return "" + address + "";
}
}
}

View File

@ -10,7 +10,7 @@ import android.content.Intent;
import android.content.res.AssetManager;
import android.net.Uri;
import androidx.core.content.FileProvider;
import cc.winboll.studio.shared.log.LogUtils;
import cc.winboll.studio.libappbase.LogUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

View File

@ -0,0 +1,202 @@
package cc.winboll.studio.mymessagemanager.utils;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/04/01 14:10:35
* @Describe 应用通知工具类
*/
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.widget.RemoteViews;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.SMSActivity;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class NotificationHelper {
public static final String TAG = "NotificationHelper";
// 渠道ID和名称
private static final String CHANNEL_ID_FOREGROUND = "foreground_channel";
private static final String CHANNEL_NAME_FOREGROUND = "Foreground Service";
private static final String CHANNEL_ID_TEMPORARY = "temporary_channel";
private static final String CHANNEL_NAME_TEMPORARY = "Temporary Notifications";
// 通知ID
public static final int FOREGROUND_NOTIFICATION_ID = 1001;
public static final int TEMPORARY_NOTIFICATION_ID = 2001;
private final Context mContext;
private final NotificationManager mNotificationManager;
// 示例维护当前使用的渠道ID列表
// 渠道ID渠道重要性级别
Map<String, Integer> activeChannelConfigs = new HashMap<>();
public NotificationHelper(Context context) {
mContext = context;
mNotificationManager = context.getSystemService(NotificationManager.class);
// 初始化配置
activeChannelConfigs.put(
CHANNEL_ID_FOREGROUND,
NotificationManager.IMPORTANCE_HIGH
);
activeChannelConfigs.put(
CHANNEL_ID_TEMPORARY,
NotificationManager.IMPORTANCE_DEFAULT
);
createNotificationChannels();
}
@RequiresApi(api = Build.VERSION_CODES.O)
private void createNotificationChannels() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createForegroundChannel();
createTemporaryChannel();
}
}
@RequiresApi(api = Build.VERSION_CODES.O)
private void createForegroundChannel() {
NotificationChannel channel = new NotificationChannel(
CHANNEL_ID_FOREGROUND,
CHANNEL_NAME_FOREGROUND,
NotificationManager.IMPORTANCE_LOW
);
channel.setDescription("Persistent service notifications");
channel.setSound(null, null);
channel.enableVibration(false);
mNotificationManager.createNotificationChannel(channel);
}
@RequiresApi(api = Build.VERSION_CODES.O)
private void createTemporaryChannel() {
NotificationChannel channel = new NotificationChannel(
CHANNEL_ID_TEMPORARY,
CHANNEL_NAME_TEMPORARY,
NotificationManager.IMPORTANCE_HIGH
);
channel.setDescription("Temporary alert notifications");
channel.setSound(null, null);
channel.enableVibration(true);
channel.setVibrationPattern(new long[]{100, 200, 300, 400});
channel.setBypassDnd(true);
mNotificationManager.createNotificationChannel(channel);
}
// 显示常驻通知通常用于前台服务
public Notification showForegroundNotification(Intent intent, String title, String content) {
PendingIntent pendingIntent = createPendingIntent(intent);
Notification notification = new NotificationCompat.Builder(mContext, CHANNEL_ID_FOREGROUND)
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_launcher))
//.setContentTitle(title)
.setContentTitle(content)
//.setContentText(content)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_LOW)
.setOngoing(true)
.build();
mNotificationManager.notify(FOREGROUND_NOTIFICATION_ID, notification);
return notification;
}
// 显示临时通知自动消失
public void showTemporaryNotification(Intent intent, String title, String content) {
showTemporaryNotification(intent, TEMPORARY_NOTIFICATION_ID, title, content);
}
// 显示临时通知自动消失
public void showTemporaryNotification(Intent intent, int notificationID, String title, String content) {
PendingIntent pendingIntent = createPendingIntent(intent);
Notification notification = new NotificationCompat.Builder(mContext, CHANNEL_ID_TEMPORARY)
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_launcher))
.setContentTitle(title)
.setContentText(content)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setAutoCancel(true)
.setVibrate(new long[]{100, 200, 300, 400})
.build();
mNotificationManager.notify(notificationID, notification);
}
// 创建自定义布局通知可扩展
public void showCustomNotification(Intent intent, RemoteViews contentView, RemoteViews bigContentView) {
PendingIntent pendingIntent = createPendingIntent(intent);
Notification notification = new NotificationCompat.Builder(mContext, CHANNEL_ID_TEMPORARY)
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pendingIntent)
.setContent(contentView)
.setCustomBigContentView(bigContentView)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setAutoCancel(true)
.build();
mNotificationManager.notify(TEMPORARY_NOTIFICATION_ID + 1, notification);
}
// 取消所有通知
public void cancelAllNotifications() {
mNotificationManager.cancelAll();
}
// 取消指定通知
public void cancelNotification(int notificationID) {
mNotificationManager.cancel(notificationID);
}
// 创建PendingIntent兼容不同API版本
private PendingIntent createPendingIntent(Intent intent) {
int flags = PendingIntent.FLAG_UPDATE_CURRENT;
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// flags |= PendingIntent.FLAG_IMMUTABLE;
// }
return PendingIntent.getActivity(
mContext,
0,
intent,
flags
);
}
public void sendSMSReceivedMessage(int notificationID, String szPhone, String szBody) {
Intent intent = new Intent(mContext, SMSActivity.class);
intent.putExtra(SMSActivity.EXTRA_PHONE, szPhone);
String szTitle = mContext.getString(R.string.text_smsfrom) + "<" + szPhone + ">";
String szContent = "[ " + szBody + " ]";
showTemporaryNotification(intent, notificationID, szTitle, szContent);
}
public void cleanOldChannels() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
List<NotificationChannel> allChannels = mNotificationManager.getNotificationChannels();
for (NotificationChannel channel : allChannels) {
LogUtils.d(TAG, "Clean channel : " + channel.getId());
if (!activeChannelConfigs.containsKey(channel.getId())) {
// 安全删除渠道
mNotificationManager.deleteNotificationChannel(channel.getId());
LogUtils.d(TAG, String.format("Deleted Channel %s", channel.getId()));
}
}
}
}
}

View File

@ -15,14 +15,14 @@ import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.media.RingtoneManager;
import android.widget.RemoteViews;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.MainActivity;
import cc.winboll.studio.mymessagemanager.activitys.SMSActivity;
import cc.winboll.studio.mymessagemanager.beans.MessageNotificationBean;
import cc.winboll.studio.mymessagemanager.services.MainService;
import cc.winboll.studio.shared.log.LogUtils;
public class NotificationUtil {
public class NotificationUtil_Bck {
public static final String TAG = "NotificationUtil";
public static final int ID_MSG_SERVICE = 10000;

View File

@ -10,9 +10,9 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.BaseActivity;
import cc.winboll.studio.shared.log.LogUtils;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;

View File

@ -10,11 +10,14 @@ import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.beans.PhoneBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PhoneUtil {
@ -59,12 +62,57 @@ public class PhoneUtil {
public boolean isPhoneInContacts(String szPhone) {
List<PhoneBean> listPhoneDto = getPhoneList();
LogUtils.d(TAG, String.format("isPhoneInContacts(...) listPhoneDto.size() %d", listPhoneDto.size()));
for (int i = 0; i < listPhoneDto.size(); i++) {
if (listPhoneDto.get(i).getTelPhone().equals(szPhone)) {
if (isTheSamePhoneNumber(listPhoneDto.get(i).getTelPhone(), szPhone)) {
return true;
}
}
return false;
}
boolean isTheSamePhoneNumber(String szNum1, String szNum2) {
//LogUtils.d(TAG, String.format("szNum1 %s\nszNum2 %s", szNum1, szNum2));
if(szNum1.equals(szNum2)) {
LogUtils.d(TAG, "szNum1.equals(szNum2)");
return true;
}
if(UnitAreaUtils.getInstance(mContext).isCurrentUnitAreaNumber(szNum1)) {
if(szNum1.equals(UnitAreaUtils.getInstance(mContext).genCurrentUnitAreaNumber(szNum2))) {
LogUtils.d(TAG, "szNum1.equals(UnitAreaUtils.genCurrentUnitAreaNumber(szNum2))");
return true;
}
}
if(UnitAreaUtils.getInstance(mContext).isCurrentUnitAreaNumber(szNum2)) {
if(szNum2.equals(UnitAreaUtils.getInstance(mContext).genCurrentUnitAreaNumber(szNum1))) {
LogUtils.d(TAG, "szNum2.equals(UnitAreaUtils.genCurrentUnitAreaNumber(szNum1))");
return true;
}
}
LogUtils.d(TAG, "isTheSamePhoneNumber(...) return false;");
return false;
}
//
// 检验电话号码是否是数字
//
public static boolean isPhoneByDigit(String szPhone) {
if(!RegexPPiUtils.isPPiOK(szPhone)) {
return false;
}
//String text = "这里是一些任意的文本内容";
String regex = "[+]?\\d+";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(szPhone);
LogUtils.d(TAG, String.format("matcher.matches() : %s", matcher.matches()));
/*if (matcher.matches()) {
System.out.println("文本满足该正则表达式模式");
} else {
System.out.println("文本不满足该正则表达式模式");
}*/
return matcher.matches();
}
}

View File

@ -7,9 +7,9 @@ package cc.winboll.studio.mymessagemanager.utils;
*/
import android.content.Context;
import android.util.JsonReader;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.beans.SMSAcceptRuleBean;
import cc.winboll.studio.mymessagemanager.beans.SMSAcceptRuleBean_V1;
import cc.winboll.studio.shared.log.LogUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -18,7 +18,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.nio.channels.AcceptPendingException;
public class SMSReceiveRuleUtil {
@ -194,9 +193,9 @@ public class SMSReceiveRuleUtil {
public ArrayList<SMSAcceptRuleBean> loadConfigData() {
ArrayList<SMSAcceptRuleBean> list = new ArrayList<SMSAcceptRuleBean>();
SMSAcceptRuleBean.loadBeanList(mContext, list, SMSAcceptRuleBean.class);
for (int i = 0; i < list.size(); i++) {
LogUtils.d(TAG, "loadConfigData isEnable : " + Boolean.toString(list.get(i).isEnable()));
}
// for (int i = 0; i < list.size(); i++) {
// LogUtils.d(TAG, "loadConfigData isEnable : " + Boolean.toString(list.get(i).isEnable()));
// }
mDataList.clear();
mDataList.addAll(list);
return mDataList;

View File

@ -6,7 +6,7 @@ package cc.winboll.studio.mymessagemanager.utils;
* @Describe 短信回收站工具类
*/
import android.content.Context;
import cc.winboll.studio.mymessagemanager.GlobalApplication;
import cc.winboll.studio.mymessagemanager.App;
import cc.winboll.studio.mymessagemanager.beans.SMSBean;
import cc.winboll.studio.mymessagemanager.beans.SMSRecycleBean;
import java.util.ArrayList;

View File

@ -17,8 +17,8 @@ import android.os.Bundle;
import android.provider.Telephony;
import android.telephony.gsm.SmsManager;
import android.telephony.gsm.SmsMessage;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.beans.SMSBean;
import cc.winboll.studio.shared.log.LogUtils;
import com.hjq.toast.ToastUtils;
import java.util.ArrayList;

View File

@ -10,6 +10,7 @@ import android.content.Intent;
import android.os.Message;
import android.util.JsonReader;
import android.widget.Toast;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.activitys.TTSPlayRuleActivity;
import cc.winboll.studio.mymessagemanager.beans.TTSPlayRuleBean;
@ -17,7 +18,6 @@ import cc.winboll.studio.mymessagemanager.beans.TTSPlayRuleBean_V1;
import cc.winboll.studio.mymessagemanager.beans.TTSSpeakTextBean;
import cc.winboll.studio.mymessagemanager.dialogs.YesNoAlertDialog;
import cc.winboll.studio.mymessagemanager.services.TTSPlayService;
import cc.winboll.studio.shared.log.LogUtils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;

View File

@ -14,9 +14,9 @@ import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.R;
import cc.winboll.studio.mymessagemanager.beans.TTSSpeakTextBean;
import cc.winboll.studio.shared.log.LogUtils;
import java.util.ArrayList;
public class TextToSpeechUtil {

View File

@ -0,0 +1,47 @@
package cc.winboll.studio.mymessagemanager.utils;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/04/14 15:55:36
* @Describe 电话号码区域管理辅助类
*/
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.beans.AppConfigBean;
import android.content.Context;
public class UnitAreaUtils {
public static final String TAG = "UnitAreaUtils";
static UnitAreaUtils _UnitAreaUtils;
Context mContext;
UnitAreaUtils(Context context) {
mContext = context;
}
public static UnitAreaUtils getInstance(Context context) {
if (_UnitAreaUtils == null) {
_UnitAreaUtils = new UnitAreaUtils(context);
}
return _UnitAreaUtils;
}
public boolean isCurrentUnitAreaNumber(String szPhoneNumer) {
String szUnitArea = getUnitArea();
LogUtils.d(TAG, String.format("szPhoneNumer.substring(1,3) %s", szPhoneNumer.substring(1,3)));
return szPhoneNumer.substring(1,3).equals(szUnitArea);
}
public String genCurrentUnitAreaNumber(String szPhoneNumer) {
String szUnitArea = getUnitArea();
LogUtils.d(TAG, String.format("szUnitArea %s", szUnitArea));
return "+" + szUnitArea + szPhoneNumer;
}
String getUnitArea() {
String szUnitArea = AppConfigUtil.getInstance(mContext).mAppConfigBean.getCountryCode();
LogUtils.d(TAG, String.format("szUnitArea %s", szUnitArea));
return szUnitArea;
}
}

View File

@ -8,8 +8,8 @@ import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Switch;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.mymessagemanager.dialogs.YesNoAlertDialog;
import cc.winboll.studio.shared.log.LogUtils;
public class ConfirmSwitchView extends Switch {

View File

@ -1,29 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activityaboutToolbar1"/>-->
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<cc.winboll.studio.libaes.views.ASupportToolbar
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:id="@+id/activityaboutASupportToolbar1"/>
android:layout_height="wrap_content"
android:id="@+id/toolbar"/>
<cc.winboll.studio.shared.view.AboutView
app:appname="MyMessageManager"
app:appprojectname="MyMessageManager"
app:appdescription="用正则表达式方法自定义短信过滤和语音播报的短信应用。"
app:appicon="@drawable/ic_winboll"
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/activityaboutAboutView1"/>
android:layout_height="0dp"
android:layout_weight="1.0"
android:id="@+id/aboutviewroot_ll"/>
</LinearLayout>

View File

@ -213,6 +213,12 @@
android:text="检查应用权限"
android:onClick="onCheckAndGetAppPermission"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="清理通知设置"
android:onClick="onCleanOldChannels"/>
</LinearLayout>
</LinearLayout>

View File

@ -72,11 +72,5 @@
</com.baoyz.widget.PullRefreshLayout>
<cc.winboll.studio.shared.log.LogView
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="120dp"
android:id="@+id/logview"/>
</LinearLayout>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="500dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test Main"
android:onClick="onMain"
android:textAllCaps="false"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<cc.winboll.studio.shared.log.LogView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:id="@+id/logview"/>
</LinearLayout>

View File

@ -19,6 +19,12 @@
android:title="@string/text_smsrule"/>
<item android:title="@string/app_developoptions">
<menu>
<item
android:id="@+id/app_log"
android:title="@string/app_log"/>
<item
android:id="@+id/app_unittest"
android:title="@string/app_unittest"/>
<item
android:id="@+id/app_crashtest"
android:title="@string/app_crashtest"/>

View File

@ -9,6 +9,7 @@
<string name="app_goldentheme">辉煌历程主题</string>
<string name="app_developoptions">开发选项</string>
<string name="app_default_app_settings">默认应用设置</string>
<string name="app_unittest">单元测试</string>
<string name="app_crashtest">应用异常崩溃处理测试</string>
<string name="app_about">关于应用</string>
<string name="app_smsrecycle">短信回收站</string>

View File

@ -9,6 +9,7 @@
<string name="app_goldentheme">Golden Theme</string>
<string name="app_developoptions">Develop Options</string>
<string name="app_default_app_settings">Default App Settings</string>
<string name="app_unittest">Unit Test</string>
<string name="app_crashtest">Crash Test</string>
<string name="app_about">About APP</string>
<string name="app_smsrecycle">SMS Recycle</string>

View File

@ -1,6 +1,6 @@
<resources>
<style name="MyDefaultAESTheme" parent="DefaultAESTheme">
<style name="MyAppTheme" parent="AESTheme">
<item name="android:textSize">20sp</item>
<item name="attrSMSViewSendColor">@color/colorSMSSendColor</item>
<item name="attrSMSViewInboxColor">@color/colorSMSInboxColor</item>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">winboll.cc</domain>
</domain-config>
</network-security-config>