2020-12-21 V1.0.2

*.[新增]新增微信红包提醒
*.[改进]更全面的识别淘口令。
*.[改进]更全面的识别快递签收提醒。
This commit is contained in:
如果当时 2020-12-21 22:41:00 +08:00
parent 732d4c7c64
commit 36d068baf1
13 changed files with 108 additions and 19 deletions

View File

@ -1,3 +1,8 @@
#### 2020-12-21 V1.0.2
- *.[新增]新增微信红包提醒
- *.[改进]更全面的识别淘口令。
- *.[改进]更全面的识别快递签收提醒。
#### 2020-12-18 V1.0.1
- *.[新增]支持通过wifi名称来判断是否在上班。
- *.[新增]增加游戏模式(尚未完成)。

View File

@ -10,8 +10,8 @@ android {
applicationId "com.itrycn.tellmenotice"
minSdkVersion 23
targetSdkVersion 29
versionCode 2
versionName "1.0.1"
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -33,6 +33,10 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
def qmui_arch_version = '2.0.0-alpha10'
implementation "com.qmuiteam:arch:$qmui_arch_version"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

View File

@ -18,6 +18,7 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name="com.itrycn.tellmenotice.MyApplication"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"

View File

@ -1,25 +1,36 @@
package com.itrycn.tellmenotice;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.itrycn.ta.AccessibilityOperator;
import com.itrycn.ta.OpenAccessibilitySettingHelper;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;
import java.util.Calendar;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MainActivity extends AppCompatActivity {
QMUITopBarLayout mTopBar;
ScreenListener screenlistener;
/**
*
@ -28,7 +39,16 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 沉浸式状态栏
//QMUIStatusBarHelper.translucent(this);
//初始化状态栏
setContentView(R.layout.activity_main);
// 沉浸式状态栏
QMUIStatusBarHelper.translucent(this);
//View root = LayoutInflater.from(this).inflate(R.layout.activity_main, null);
mTopBar =findViewById(R.id.topbar);
//ButterKnife.bind(this, root);
initTopBar();
if(!isNotificationListenersEnabled())
{
gotoNotificationAccessSetting(MainActivity.this);
@ -78,6 +98,26 @@ public class MainActivity extends AppCompatActivity {
}
});
}
private void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(this, R.color.app_color_theme_4));
mTopBar.addRightImageButton(R.drawable.menu,R.id.menu).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//finish();
overridePendingTransition(R.anim.slide_still, R.anim.slide_out_right);
}
});
//mTopBar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// finish();
// overridePendingTransition(R.anim.slide_still, R.anim.slide_out_right);
// }
// });
mTopBar.setTitle(R.string.app_name);
}
@Override
protected void onStart() {
if(!AccessibilityOperator.getInstance().isServiceRunning())

View File

@ -0,0 +1,14 @@
package com.itrycn.tellmenotice;
import android.app.Application;
import com.qmuiteam.qmui.arch.QMUISwipeBackActivityManager;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
//初始化QMUISwipeBackActivityManager否则点击屏幕时就程序就会崩溃
QMUISwipeBackActivityManager.init(this);
}
}

View File

@ -76,6 +76,7 @@ public class NoticeService extends NotificationListenerService {
MP3_Dingding= sp.load(this,R.raw.dingding,1);
MP3_TaoCode= sp.load(this,R.raw.taocode,1);
MP3_Buy0= sp.load(this,R.raw.buy0,1);
MP3_RedPacket= sp.load(this,R.raw.redpacket,1);
//windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
//layoutParams = new WindowManager.LayoutParams();
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@ -100,6 +101,7 @@ public class NoticeService extends NotificationListenerService {
sp.unload(MP3_Dingding);
sp.unload(MP3_TaoCode);
sp.unload(MP3_Buy0);
sp.unload(MP3_RedPacket);
super.onDestroy();
}
@Override
@ -117,6 +119,7 @@ public class NoticeService extends NotificationListenerService {
int MP3_Dingding;
int MP3_TaoCode;
int MP3_Buy0;
int MP3_RedPacket;
String Last_packageName="";
String Last_Title="";
String Last_Content="";
@ -206,7 +209,7 @@ public class NoticeService extends NotificationListenerService {
if(packageName.equals("com.tencent.mm")) //如果是微信
{
//region 微信中有人提到自己
String[] strArr = "鑫之风;大头;凤鑫;风鑫;封信;风兴;奉新;凤兴;阿香;凤新".split(";");
String[] strArr = "鑫之风;大头;凤鑫;风鑫;封信;风兴;奉新;凤兴;阿香;凤新;鑫哥".split(";");
boolean haveInfo=false;
for (int i = 0; i < strArr.length; ++i){
if(Content.contains(strArr[i]))
@ -252,7 +255,7 @@ public class NoticeService extends NotificationListenerService {
//region 淘口令
if(!haveInfo)
{
String[] strArr2 = "tb.cn;淘tao;/宝;".split(";");
CharSequence[] strArr2 = "tb.cn;淘tao;/宝;t~bao;[右]tb[左]".split(";");
for (int i = 0; i < strArr2.length; ++i) {
if (Content.contains(strArr2[i])) {
if(!IsGameMode()) {
@ -269,6 +272,22 @@ public class NoticeService extends NotificationListenerService {
}
}
//endregion
//region 微信红包
if(!haveInfo)
{
if (Content.contains("[微信红包]")) {
if(!IsGameMode()) {
FloatView fv = new FloatView(this);
fv.showFloatingWindow(notice, Title, Content, Color.parseColor("#FF0000"));
}
int hour = c.get(Calendar.HOUR_OF_DAY); //
if(getWifiName().indexOf("当游")<0) {
PlaySound(MP3_RedPacket, 0, false);
}
haveTip=true;
}
}
//endregion
}
else if(packageName.equals("com.xiaomi.smarthome")) //如果是米家app
{
@ -307,7 +326,7 @@ public class NoticeService extends NotificationListenerService {
else if(packageName.equals("com.android.mms")) //如果是短信
{
//region 短信中提取快递获取信息
String[] strArr = "保安室;快递室;派送成功;代收;".split(";");
String[] strArr = "保安室;快递室;收发室;派送成功;代收;".split(";");
for (int i = 0; i < strArr.length; ++i){
if(Title.contains(strArr[i]) || Content.contains(strArr[i]))
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

View File

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.qmuiteam.qmui.widget.QMUITopBarLayout
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="88dp"
android:background="@color/app_color_theme_4"
android:fitsSystemWindows="true" />
<TextView
android:id="@+id/IdState"
android:layout_width="0dp"
android:layout_width="287dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:text="@string/app_state"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.023" />
android:layout_marginTop="95dp"
android:text="@string/app_state" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

Binary file not shown.

View File

@ -7,4 +7,6 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="green">#64AF1A</color>
<color name="app_color_theme_4">#9FD661</color>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<item name="menu" type="id"/>
</resources>

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.TellMeNotice" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.TellMeNotice" parent="QMUI.Compat.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>

View File

@ -5,6 +5,7 @@ TellMeNotice是一款重要通知提醒软件,对于重要通知进行语音和
- 米家app消息优化弹窗,支持按门铃提醒。
- 支持深夜免打扰。
- 支持顺风车软件提醒。
- 针对公司场景特殊优化。
# 运行环境 #
android5.0及以上