2020-12-21 V1.0.2
*.[新增]新增微信红包提醒 *.[改进]更全面的识别淘口令。 *.[改进]更全面的识别快递签收提醒。
This commit is contained in:
parent
732d4c7c64
commit
36d068baf1
|
@ -1,3 +1,8 @@
|
||||||
|
#### 2020-12-21 V1.0.2
|
||||||
|
- *.[新增]新增微信红包提醒
|
||||||
|
- *.[改进]更全面的识别淘口令。
|
||||||
|
- *.[改进]更全面的识别快递签收提醒。
|
||||||
|
|
||||||
#### 2020-12-18 V1.0.1
|
#### 2020-12-18 V1.0.1
|
||||||
- *.[新增]支持通过wifi名称来判断是否在上班。
|
- *.[新增]支持通过wifi名称来判断是否在上班。
|
||||||
- *.[新增]增加游戏模式(尚未完成)。
|
- *.[新增]增加游戏模式(尚未完成)。
|
||||||
|
|
|
@ -10,8 +10,8 @@ android {
|
||||||
applicationId "com.itrycn.tellmenotice"
|
applicationId "com.itrycn.tellmenotice"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 2
|
versionCode 3
|
||||||
versionName "1.0.1"
|
versionName "1.0.2"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,10 @@ dependencies {
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'com.google.android.material:material:1.2.1'
|
implementation 'com.google.android.material:material:1.2.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.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.+'
|
testImplementation 'junit:junit:4.+'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
android:name="com.itrycn.tellmenotice.MyApplication"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
|
|
|
@ -1,25 +1,36 @@
|
||||||
package com.itrycn.tellmenotice;
|
package com.itrycn.tellmenotice;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.itrycn.ta.AccessibilityOperator;
|
import com.itrycn.ta.AccessibilityOperator;
|
||||||
import com.itrycn.ta.OpenAccessibilitySettingHelper;
|
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 java.util.Calendar;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
QMUITopBarLayout mTopBar;
|
||||||
ScreenListener screenlistener;
|
ScreenListener screenlistener;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -28,7 +39,16 @@ public class MainActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
// 沉浸式状态栏
|
||||||
|
//QMUIStatusBarHelper.translucent(this);
|
||||||
|
//初始化状态栏
|
||||||
setContentView(R.layout.activity_main);
|
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())
|
if(!isNotificationListenersEnabled())
|
||||||
{
|
{
|
||||||
gotoNotificationAccessSetting(MainActivity.this);
|
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
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
if(!AccessibilityOperator.getInstance().isServiceRunning())
|
if(!AccessibilityOperator.getInstance().isServiceRunning())
|
||||||
|
|
14
app/src/main/java/com/itrycn/tellmenotice/MyApplication.java
Normal file
14
app/src/main/java/com/itrycn/tellmenotice/MyApplication.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -76,6 +76,7 @@ public class NoticeService extends NotificationListenerService {
|
||||||
MP3_Dingding= sp.load(this,R.raw.dingding,1);
|
MP3_Dingding= sp.load(this,R.raw.dingding,1);
|
||||||
MP3_TaoCode= sp.load(this,R.raw.taocode,1);
|
MP3_TaoCode= sp.load(this,R.raw.taocode,1);
|
||||||
MP3_Buy0= sp.load(this,R.raw.buy0,1);
|
MP3_Buy0= sp.load(this,R.raw.buy0,1);
|
||||||
|
MP3_RedPacket= sp.load(this,R.raw.redpacket,1);
|
||||||
//windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
//windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
||||||
//layoutParams = new WindowManager.LayoutParams();
|
//layoutParams = new WindowManager.LayoutParams();
|
||||||
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
//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_Dingding);
|
||||||
sp.unload(MP3_TaoCode);
|
sp.unload(MP3_TaoCode);
|
||||||
sp.unload(MP3_Buy0);
|
sp.unload(MP3_Buy0);
|
||||||
|
sp.unload(MP3_RedPacket);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -117,6 +119,7 @@ public class NoticeService extends NotificationListenerService {
|
||||||
int MP3_Dingding;
|
int MP3_Dingding;
|
||||||
int MP3_TaoCode;
|
int MP3_TaoCode;
|
||||||
int MP3_Buy0;
|
int MP3_Buy0;
|
||||||
|
int MP3_RedPacket;
|
||||||
String Last_packageName="";
|
String Last_packageName="";
|
||||||
String Last_Title="";
|
String Last_Title="";
|
||||||
String Last_Content="";
|
String Last_Content="";
|
||||||
|
@ -206,7 +209,7 @@ public class NoticeService extends NotificationListenerService {
|
||||||
if(packageName.equals("com.tencent.mm")) //如果是微信
|
if(packageName.equals("com.tencent.mm")) //如果是微信
|
||||||
{
|
{
|
||||||
//region 微信中有人提到自己
|
//region 微信中有人提到自己
|
||||||
String[] strArr = "鑫之风;大头;凤鑫;风鑫;封信;风兴;奉新;凤兴;阿香;凤新".split(";");
|
String[] strArr = "鑫之风;大头;凤鑫;风鑫;封信;风兴;奉新;凤兴;阿香;凤新;鑫哥".split(";");
|
||||||
boolean haveInfo=false;
|
boolean haveInfo=false;
|
||||||
for (int i = 0; i < strArr.length; ++i){
|
for (int i = 0; i < strArr.length; ++i){
|
||||||
if(Content.contains(strArr[i]))
|
if(Content.contains(strArr[i]))
|
||||||
|
@ -252,7 +255,7 @@ public class NoticeService extends NotificationListenerService {
|
||||||
//region 淘口令
|
//region 淘口令
|
||||||
if(!haveInfo)
|
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) {
|
for (int i = 0; i < strArr2.length; ++i) {
|
||||||
if (Content.contains(strArr2[i])) {
|
if (Content.contains(strArr2[i])) {
|
||||||
if(!IsGameMode()) {
|
if(!IsGameMode()) {
|
||||||
|
@ -269,6 +272,22 @@ public class NoticeService extends NotificationListenerService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//endregion
|
//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
|
else if(packageName.equals("com.xiaomi.smarthome")) //如果是米家app
|
||||||
{
|
{
|
||||||
|
@ -307,7 +326,7 @@ public class NoticeService extends NotificationListenerService {
|
||||||
else if(packageName.equals("com.android.mms")) //如果是短信
|
else if(packageName.equals("com.android.mms")) //如果是短信
|
||||||
{
|
{
|
||||||
//region 短信中提取快递获取信息
|
//region 短信中提取快递获取信息
|
||||||
String[] strArr = "保安室;快递室;派送成功;代收;".split(";");
|
String[] strArr = "保安室;快递室;收发室;派送成功;代收;".split(";");
|
||||||
for (int i = 0; i < strArr.length; ++i){
|
for (int i = 0; i < strArr.length; ++i){
|
||||||
if(Title.contains(strArr[i]) || Content.contains(strArr[i]))
|
if(Title.contains(strArr[i]) || Content.contains(strArr[i]))
|
||||||
{
|
{
|
||||||
|
|
BIN
app/src/main/res/drawable/menu.png
Normal file
BIN
app/src/main/res/drawable/menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 195 B |
|
@ -1,23 +1,23 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".MainActivity">
|
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
|
<TextView
|
||||||
android:id="@+id/IdState"
|
android:id="@+id/IdState"
|
||||||
android:layout_width="0dp"
|
android:layout_width="287dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="20dp"
|
||||||
android:layout_marginRight="20dp"
|
android:layout_marginTop="95dp"
|
||||||
android:text="@string/app_state"
|
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" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
|
BIN
app/src/main/res/raw/redpacket.mp3
Normal file
BIN
app/src/main/res/raw/redpacket.mp3
Normal file
Binary file not shown.
|
@ -7,4 +7,6 @@
|
||||||
<color name="teal_700">#FF018786</color>
|
<color name="teal_700">#FF018786</color>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="green">#64AF1A</color>
|
||||||
|
<color name="app_color_theme_4">#9FD661</color>
|
||||||
</resources>
|
</resources>
|
3
app/src/main/res/values/ids.xml
Normal file
3
app/src/main/res/values/ids.xml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<resources>
|
||||||
|
<item name="menu" type="id"/>
|
||||||
|
</resources>
|
|
@ -1,6 +1,6 @@
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.TellMeNotice" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.TellMeNotice" parent="QMUI.Compat.NoActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_500</item>
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user