mirror of
https://github.com/pppscn/SmsForwarder
synced 2025-08-03 09:27:41 +08:00
重新梳理代码
This commit is contained in:
parent
99718c0b5e
commit
c2d2beb8ef
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,6 +3,7 @@
|
|||||||
.git
|
.git
|
||||||
build
|
build
|
||||||
local.properties
|
local.properties
|
||||||
|
gradle.properties
|
||||||
*.iml
|
*.iml
|
||||||
*.project
|
*.project
|
||||||
*/*.project
|
*/*.project
|
||||||
@ -11,4 +12,6 @@ local.properties
|
|||||||
.settings/*
|
.settings/*
|
||||||
*/.settings/*
|
*/.settings/*
|
||||||
/app/pppscn.jks
|
/app/pppscn.jks
|
||||||
|
/app/release/*
|
||||||
|
/app/build/*
|
||||||
/psd
|
/psd
|
||||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "keystore"]
|
||||||
|
path = keystore
|
||||||
|
url = https://github.com/pppscn/keystore.git
|
116
app/build.gradle
116
app/build.gradle
@ -1,10 +1,21 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
//apply plugin: 'kotlin-android-extensions'
|
def keyProps = new Properties()
|
||||||
apply from: 'version.gradle'
|
def keyPropsFile = rootProject.file('keystore/keystore.properties')
|
||||||
|
if (keyPropsFile.exists()) {
|
||||||
|
keyProps.load(new FileInputStream(keyPropsFile))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取version.properties
|
||||||
|
def versionProps = new Properties()
|
||||||
|
def versionPropsFile = rootProject.file('version.properties')
|
||||||
|
if (versionPropsFile.exists()) {
|
||||||
|
versionProps.load(new FileInputStream(versionPropsFile))
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
buildToolsVersion '30.0.3'
|
||||||
|
compileSdkVersion 30
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility 1.8
|
sourceCompatibility 1.8
|
||||||
targetCompatibility 1.8
|
targetCompatibility 1.8
|
||||||
@ -12,74 +23,115 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.idormy.sms.forwarder"
|
applicationId "com.idormy.sms.forwarder"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode appVersionCode
|
versionCode versionProps['versionCode'].toInteger()
|
||||||
versionName appVersionName
|
versionName versionProps['versionName']
|
||||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||||
}
|
}
|
||||||
lintOptions {
|
lintOptions {
|
||||||
checkReleaseBuilds false
|
checkReleaseBuilds false
|
||||||
}
|
}
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
//签名信息保存在 C:\Users\<Username>\.gradle\gradle.properties
|
|
||||||
release {
|
release {
|
||||||
storeFile file(RELEASE_STORE_FILE)
|
keyAlias keyProps['keyAlias']
|
||||||
keyAlias RELEASE_KEY_ALIAS
|
keyPassword keyProps['keyPassword']
|
||||||
storePassword RELEASE_KEY_PASSWORD
|
storeFile keyProps['storeFile'] ? file(keyProps['storeFile']) : null
|
||||||
keyPassword RELEASE_STORE_PASSWORD
|
storePassword keyProps['storePassword']
|
||||||
|
}
|
||||||
|
debug {
|
||||||
|
keyAlias keyProps['keyAlias']
|
||||||
|
keyPassword keyProps['keyPassword']
|
||||||
|
storeFile keyProps['storeFile'] ? file(keyProps['storeFile']) : null
|
||||||
|
storePassword keyProps['storePassword']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
}
|
}
|
||||||
|
|
||||||
debug {
|
debug {
|
||||||
signingConfig signingConfigs.release
|
minifyEnabled true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//apk file name
|
//apk file name
|
||||||
android.applicationVariants.all { variant ->
|
/* android.applicationVariants.all { variant ->
|
||||||
variant.outputs.all {
|
variant.outputs.all {
|
||||||
//def date = new Date().format("yyyyMMdd" , TimeZone.getTimeZone("Asia/Shanghai"))
|
//def date = new Date().format("yyyyMMdd" , TimeZone.getTimeZone("Asia/Shanghai"))
|
||||||
def date = new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08"))
|
def date = new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08"))
|
||||||
if (variant.buildType.name.equals('debug')) {
|
if (variant.buildType.name == 'debug') {
|
||||||
outputFileName = "SmsForwarder_debug_${date}_${versionName}.apk"
|
outputFileName = "SmsForwarder_debug_${date}_${versionName}.apk"
|
||||||
}
|
}
|
||||||
if (variant.buildType.name.equals('release')) {
|
if (variant.buildType.name == 'release') {
|
||||||
outputFileName = "SmsForwarder_release_${date}_${versionName}.apk"
|
outputFileName = "SmsForwarder_release_${date}_${versionName}.apk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
task upgradeVersion {
|
||||||
|
group 'help'
|
||||||
|
description '构建新版本'
|
||||||
|
doLast {
|
||||||
|
println("---自动升级版本号---\n")
|
||||||
|
String oldVersionCode = versionProps['versionCode']
|
||||||
|
String oldVersionName = versionProps['versionName']
|
||||||
|
if (oldVersionCode == null || oldVersionName == null ||
|
||||||
|
oldVersionCode.isEmpty() || oldVersionName.isEmpty()) {
|
||||||
|
println("error:版本号不能为空")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
versionProps['versionCode'] = String.valueOf(versionProps['versionCode'].toInteger() + 1)
|
||||||
|
String str = versionProps['versionName'].toString()
|
||||||
|
versionProps['versionName'] = str.substring(0, str.lastIndexOf('.') + 1) +
|
||||||
|
(str.substring(str.lastIndexOf('.') + 1).toInteger() + 1)
|
||||||
|
String tip =
|
||||||
|
"版本号从$oldVersionName($oldVersionCode)升级到${versionProps['versionName']}(${versionProps['versionCode']})"
|
||||||
|
println(tip)
|
||||||
|
|
||||||
|
def writer = new FileWriter(versionPropsFile)
|
||||||
|
versionProps.store(writer, null)
|
||||||
|
writer.flush()
|
||||||
|
writer.close()
|
||||||
|
def tag = "v${versionProps['versionName']}"
|
||||||
|
cmdExecute("git pull")
|
||||||
|
cmdExecute("git add version.properties")
|
||||||
|
cmdExecute("git commit -m \"版本号升级为:$tag\"")
|
||||||
|
cmdExecute("git push origin")
|
||||||
|
cmdExecute("git tag $tag")
|
||||||
|
cmdExecute("git push origin $tag")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmdExecute(String cmd) {
|
||||||
|
println "\n执行$cmd"
|
||||||
|
println cmd.execute().text
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
//testImplementation 'junit:junit:4.12'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
//androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
//androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
|
|
||||||
|
|
||||||
//okhttp
|
//okhttp
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||||
implementation 'com.squareup.okio:okio:2.10.0'
|
implementation 'com.squareup.okio:okio:2.10.0'
|
||||||
|
|
||||||
//fastjson
|
//fastjson
|
||||||
implementation "com.alibaba:fastjson:1.2.75"
|
implementation "com.alibaba:fastjson:1.2.78"
|
||||||
|
|
||||||
//android8.0以上需要使用到反射获取隐藏的系统api和动态代理隐藏的抽象类回调
|
|
||||||
//其中动态代理抽象类回调需要使用ProxyBuilder类,故依赖一个库
|
|
||||||
//implementation 'com.linkedin.dexmaker:dexmaker-mockito:2.12.1'
|
|
||||||
|
|
||||||
// 友盟统计SDK
|
// 友盟统计SDK
|
||||||
implementation 'com.umeng.umsdk:common:9.4.4'// 必选
|
implementation 'com.umeng.umsdk:common:9.4.4'// 必选
|
||||||
implementation 'com.umeng.umsdk:asms:1.4.1'// 必选
|
implementation 'com.umeng.umsdk:asms:1.4.1'// 必选
|
||||||
implementation 'com.umeng.umsdk:apm:1.4.2' // 错误分析升级为独立SDK,看crash数据请一定集成,可选
|
implementation 'com.umeng.umsdk:apm:1.4.2' // 错误分析升级为独立SDK,看crash数据请一定集成,可选
|
||||||
implementation 'com.umeng.umsdk:abtest:1.0.0'//使用U-App中ABTest能力,可选
|
|
||||||
|
|
||||||
//XUpdate
|
//XUpdate
|
||||||
implementation 'com.github.xuexiangjys:XUpdate:2.1.0'
|
implementation 'com.github.xuexiangjys:XUpdate:2.1.0'
|
||||||
@ -88,8 +140,6 @@ dependencies {
|
|||||||
|
|
||||||
//EmailKit
|
//EmailKit
|
||||||
implementation 'com.github.mailhu:emailkit:4.2.2'
|
implementation 'com.github.mailhu:emailkit:4.2.2'
|
||||||
implementation 'androidx.test.ext:junit-ktx:1.1.2'
|
|
||||||
testImplementation 'junit:junit:4.12'
|
|
||||||
|
|
||||||
//Lombok
|
//Lombok
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.20'
|
compileOnly 'org.projectlombok:lombok:1.18.20'
|
||||||
|
1
app/proguard-rules.pro
vendored
1
app/proguard-rules.pro
vendored
@ -19,3 +19,4 @@
|
|||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
|
-keep class com.idormy.sms.forwarder.model.**{*;}
|
||||||
|
@ -16,7 +16,7 @@ class ExampleInstrumentedTest {
|
|||||||
@Test
|
@Test
|
||||||
fun useAppContext() {
|
fun useAppContext() {
|
||||||
// Context of the app under test.
|
// Context of the app under test.
|
||||||
val appContext = InstrumentationRegistry.getTargetContext()
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
assertEquals("com.idormy.sms.forwarder", appContext.packageName)
|
assertEquals("com.idormy.sms.forwarder", appContext.packageName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.idormy.sms.forwarder">
|
package="com.idormy.sms.forwarder">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<!-- 授予应用程序访问系统开机事件的权限 -->
|
<!-- 授予应用程序访问系统开机事件的权限 -->
|
||||||
@ -10,16 +11,21 @@
|
|||||||
tools:ignore="ProtectedPermissions" />
|
tools:ignore="ProtectedPermissions" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
|
tools:ignore="ScopedStorage" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_SMS" />
|
<uses-permission android:name="android.permission.RECEIVE_SMS" />
|
||||||
<uses-permission android:name="android.permission.READ_SMS" />
|
<uses-permission android:name="android.permission.READ_SMS" />
|
||||||
<uses-permission android:name="android.permission.SEND_SMS" />
|
<uses-permission android:name="android.permission.SEND_SMS" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
|
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
|
||||||
|
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||||
|
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||||
<!--Android 9(API 级别 28)或更高版本并使用前台服务,则其必须请求 FOREGROUND_SERVICE 权限-->
|
<!--Android 9(API 级别 28)或更高版本并使用前台服务,则其必须请求 FOREGROUND_SERVICE 权限-->
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
<uses-permission android:name="android.permission.BATTERY_STATS"
|
<uses-permission
|
||||||
|
android:name="android.permission.BATTERY_STATS"
|
||||||
tools:ignore="ProtectedPermissions" />
|
tools:ignore="ProtectedPermissions" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
@ -31,7 +37,8 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true"
|
||||||
|
android:fullBackupContent="@xml/backup_descriptor">
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="UPDATE_APP_KEY"
|
android:name="UPDATE_APP_KEY"
|
||||||
@ -43,16 +50,20 @@
|
|||||||
android:name="UMENG_CHANNEL"
|
android:name="UMENG_CHANNEL"
|
||||||
android:value="Umeng" />
|
android:value="Umeng" />
|
||||||
|
|
||||||
<activity android:name=".MainActivity">
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
tools:ignore="IntentFilterExportedReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<!--协议部分,随便设置-->
|
<!--协议部分,随便设置-->
|
||||||
<data android:scheme="forwarder" android:host="main"/>
|
<data
|
||||||
|
android:scheme="forwarder"
|
||||||
|
android:host="main" />
|
||||||
<!--下面这几行也必须得设置-->
|
<!--下面这几行也必须得设置-->
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.BROWSABLE"/>
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
@ -68,21 +79,34 @@
|
|||||||
android:name=".SenderActivity"
|
android:name=".SenderActivity"
|
||||||
android:label="发送方" />
|
android:label="发送方" />
|
||||||
|
|
||||||
<receiver android:name=".BroadCastReceiver.RebootBroadcastReceiver">
|
<receiver
|
||||||
|
android:name=".receiver.RebootBroadcastReceiver"
|
||||||
|
tools:ignore="IntentFilterExportedReceiver">
|
||||||
<intent-filter android:priority="2147483647">
|
<intent-filter android:priority="2147483647">
|
||||||
<!--重启广播-->
|
<!--重启广播-->
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".BroadCastReceiver.SmsForwarderBroadcastReceiver"
|
android:name=".receiver.SmsForwarderBroadcastReceiver"
|
||||||
android:permission="android.permission.BROADCAST_SMS">
|
android:permission="android.permission.BROADCAST_SMS"
|
||||||
|
tools:ignore="IntentFilterExportedReceiver">
|
||||||
<intent-filter android:priority="2147483647">
|
<intent-filter android:priority="2147483647">
|
||||||
<!--短信广播-->
|
<!--短信广播-->
|
||||||
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
|
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name=".receiver.PhoneStateReceiver"
|
||||||
|
tools:ignore="IntentFilterExportedReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.PHONE_STATE" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
<service android:name=".service.FrontService" />
|
<service android:name=".service.FrontService" />
|
||||||
|
<service android:name=".service.BatteryService" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder;
|
package com.idormy.sms.forwarder;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -8,16 +9,14 @@ import android.content.pm.PackageManager;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.BroadCastReceiver.RebootBroadcastReceiver;
|
import com.idormy.sms.forwarder.receiver.RebootBroadcastReceiver;
|
||||||
import com.idormy.sms.forwarder.utils.CacheUtil;
|
import com.idormy.sms.forwarder.utils.CacheUtil;
|
||||||
import com.idormy.sms.forwarder.utils.Define;
|
import com.idormy.sms.forwarder.utils.Define;
|
||||||
import com.idormy.sms.forwarder.utils.aUtil;
|
import com.idormy.sms.forwarder.utils.aUtil;
|
||||||
@ -25,13 +24,14 @@ import com.xuexiang.xupdate.easy.EasyUpdate;
|
|||||||
import com.xuexiang.xupdate.proxy.impl.DefaultUpdateChecker;
|
import com.xuexiang.xupdate.proxy.impl.DefaultUpdateChecker;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("SpellCheckingInspection")
|
||||||
public class AboutActivity extends AppCompatActivity {
|
public class AboutActivity extends AppCompatActivity {
|
||||||
private String TAG = "com.idormy.sms.forwarder.AboutActivity";
|
private final String TAG = "com.idormy.sms.forwarder.AboutActivity";
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
Log.d(TAG, "oncreate");
|
Log.d(TAG, "onCreate");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
context = AboutActivity.this;
|
context = AboutActivity.this;
|
||||||
@ -39,138 +39,112 @@ public class AboutActivity extends AppCompatActivity {
|
|||||||
setContentView(R.layout.activity_about);
|
setContentView(R.layout.activity_about);
|
||||||
Log.d(TAG, "onCreate: " + RebootBroadcastReceiver.class.getName());
|
Log.d(TAG, "onCreate: " + RebootBroadcastReceiver.class.getName());
|
||||||
|
|
||||||
Switch check_with_reboot = (Switch) findViewById(R.id.switch_with_reboot);
|
@SuppressLint("UseSwitchCompatOrMaterialCode") Switch check_with_reboot = findViewById(R.id.switch_with_reboot);
|
||||||
checkWithReboot(check_with_reboot);
|
checkWithReboot(check_with_reboot);
|
||||||
|
|
||||||
Switch switch_help_tip = (Switch) findViewById(R.id.switch_help_tip);
|
@SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_help_tip = findViewById(R.id.switch_help_tip);
|
||||||
SwitchHelpTip(switch_help_tip);
|
SwitchHelpTip(switch_help_tip);
|
||||||
|
|
||||||
final TextView version_now = (TextView) findViewById(R.id.version_now);
|
final TextView version_now = findViewById(R.id.version_now);
|
||||||
Button check_version_now = (Button) findViewById(R.id.check_version_now);
|
Button check_version_now = findViewById(R.id.check_version_now);
|
||||||
try {
|
try {
|
||||||
version_now.setText(aUtil.getVersionName(AboutActivity.this));
|
version_now.setText(aUtil.getVersionName(AboutActivity.this));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
check_version_now.setOnClickListener(new View.OnClickListener() {
|
check_version_now.setOnClickListener(v -> {
|
||||||
@Override
|
try {
|
||||||
public void onClick(View v) {
|
String updateUrl = "https://xupdate.bms.ink/update/checkVersion?appKey=com.idormy.sms.forwarder&versionCode=";
|
||||||
//checkNewVersion();
|
updateUrl += aUtil.getVersionCode(AboutActivity.this);
|
||||||
try {
|
|
||||||
String updateUrl = "https://xupdate.bms.ink/update/checkVersion?appKey=com.idormy.sms.forwarder&versionCode=";
|
|
||||||
updateUrl += aUtil.getVersionCode(AboutActivity.this);
|
|
||||||
|
|
||||||
EasyUpdate.create(AboutActivity.this, updateUrl)
|
EasyUpdate.create(AboutActivity.this, updateUrl)
|
||||||
.updateChecker(new DefaultUpdateChecker() {
|
.updateChecker(new DefaultUpdateChecker() {
|
||||||
@Override
|
@Override
|
||||||
public void onBeforeCheck() {
|
public void onBeforeCheck() {
|
||||||
super.onBeforeCheck();
|
super.onBeforeCheck();
|
||||||
Toast.makeText(AboutActivity.this, "查询中...", Toast.LENGTH_LONG).show();
|
Toast.makeText(AboutActivity.this, "查询中...", Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAfterCheck() {
|
public void noNewVersion(Throwable throwable) {
|
||||||
super.onAfterCheck();
|
super.noNewVersion(throwable);
|
||||||
}
|
// 没有最新版本的处理
|
||||||
|
Toast.makeText(AboutActivity.this, "已是最新版本!", Toast.LENGTH_LONG).show();
|
||||||
@Override
|
}
|
||||||
public void noNewVersion(Throwable throwable) {
|
})
|
||||||
super.noNewVersion(throwable);
|
.update();
|
||||||
// 没有最新版本的处理
|
} catch (Exception e) {
|
||||||
Toast.makeText(AboutActivity.this, "已是最新版本!", Toast.LENGTH_LONG).show();
|
e.printStackTrace();
|
||||||
}
|
|
||||||
})
|
|
||||||
.update();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final TextView cache_size = (TextView) findViewById(R.id.cache_size);
|
final TextView cache_size = findViewById(R.id.cache_size);
|
||||||
try {
|
try {
|
||||||
cache_size.setText(CacheUtil.getTotalCacheSize(AboutActivity.this));
|
cache_size.setText(CacheUtil.getTotalCacheSize(AboutActivity.this));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Button clear_all_cache = (Button) findViewById(R.id.clear_all_cache);
|
Button clear_all_cache = findViewById(R.id.clear_all_cache);
|
||||||
clear_all_cache.setOnClickListener(new View.OnClickListener() {
|
clear_all_cache.setOnClickListener(v -> {
|
||||||
@Override
|
CacheUtil.clearAllCache(AboutActivity.this);
|
||||||
public void onClick(View v) {
|
try {
|
||||||
CacheUtil.clearAllCache(AboutActivity.this);
|
cache_size.setText(CacheUtil.getTotalCacheSize(AboutActivity.this));
|
||||||
try {
|
} catch (Exception e) {
|
||||||
cache_size.setText(CacheUtil.getTotalCacheSize(AboutActivity.this));
|
e.printStackTrace();
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Toast.makeText(AboutActivity.this, "缓存清理完成", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
}
|
||||||
|
Toast.makeText(AboutActivity.this, "缓存清理完成", Toast.LENGTH_LONG).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
Button join_qq_group = (Button) findViewById(R.id.join_qq_group);
|
Button join_qq_group = findViewById(R.id.join_qq_group);
|
||||||
join_qq_group.setOnClickListener(new View.OnClickListener() {
|
join_qq_group.setOnClickListener(v -> {
|
||||||
@Override
|
String key = "HvroJRfvK7GGfnQgaIQ4Rh1un9O83N7M";
|
||||||
public void onClick(View v) {
|
joinQQGroup(key);
|
||||||
String key = "HvroJRfvK7GGfnQgaIQ4Rh1un9O83N7M";
|
|
||||||
joinQQGroup(key);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查重启广播接受器状态并设置
|
//检查重启广播接受器状态并设置
|
||||||
private void checkWithReboot(Switch withrebootSwitch) {
|
private void checkWithReboot(@SuppressLint("UseSwitchCompatOrMaterialCode") Switch withrebootSwitch) {
|
||||||
//获取组件
|
//获取组件
|
||||||
final ComponentName cm = new ComponentName(this.getPackageName(), RebootBroadcastReceiver.class.getName());
|
final ComponentName cm = new ComponentName(this.getPackageName(), RebootBroadcastReceiver.class.getName());
|
||||||
|
|
||||||
final PackageManager pm = getPackageManager();
|
final PackageManager pm = getPackageManager();
|
||||||
int state = pm.getComponentEnabledSetting(cm);
|
int state = pm.getComponentEnabledSetting(cm);
|
||||||
if (state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
withrebootSwitch.setChecked(state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||||
&& state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) {
|
&& state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER);
|
||||||
withrebootSwitch.setChecked(true);
|
withrebootSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
} else {
|
int newState = isChecked ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||||
withrebootSwitch.setChecked(false);
|
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
|
||||||
}
|
pm.setComponentEnabledSetting(cm, newState, PackageManager.DONT_KILL_APP);
|
||||||
withrebootSwitch.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
|
Log.d(TAG, "onCheckedChanged:" + isChecked);
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
int newState = (Boolean) isChecked ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
|
||||||
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
|
|
||||||
pm.setComponentEnabledSetting(cm, newState, PackageManager.DONT_KILL_APP);
|
|
||||||
Log.d(TAG, "onCheckedChanged:" + isChecked);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//页面帮助提示
|
//页面帮助提示
|
||||||
private void SwitchHelpTip(Switch switchHelpTip) {
|
private void SwitchHelpTip(@SuppressLint("UseSwitchCompatOrMaterialCode") Switch switchHelpTip) {
|
||||||
switchHelpTip.setChecked(MyApplication.showHelpTip);
|
switchHelpTip.setChecked(MyApplication.showHelpTip);
|
||||||
|
|
||||||
switchHelpTip.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
|
switchHelpTip.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
@Override
|
MyApplication.showHelpTip = isChecked;
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
SharedPreferences sp = context.getSharedPreferences(Define.SP_CONFIG, Context.MODE_PRIVATE);
|
||||||
MyApplication.showHelpTip = isChecked;
|
sp.edit().putBoolean(Define.SP_CONFIG_SWITCH_HELP_TIP, isChecked).apply();
|
||||||
SharedPreferences sp = context.getSharedPreferences(Define.SP_CONFIG, Context.MODE_PRIVATE);
|
Log.d(TAG, "onCheckedChanged:" + isChecked);
|
||||||
sp.edit().putBoolean(Define.SP_CONFIG_SWITCH_HELP_TIP, isChecked).apply();
|
|
||||||
Log.d(TAG, "onCheckedChanged:" + isChecked);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//发起添加群流程
|
//发起添加群流程
|
||||||
public boolean joinQQGroup(String key) {
|
public void joinQQGroup(String key) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26jump_from%3Dwebapi%26k%3D" + key));
|
intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26jump_from%3Dwebapi%26k%3D" + key));
|
||||||
// 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面
|
// 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面
|
||||||
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
try {
|
try {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 未安装手Q或安装的版本不支持
|
// 未安装手Q或安装的版本不支持
|
||||||
Toast.makeText(AboutActivity.this, "未安装手Q或安装的版本不支持!", Toast.LENGTH_LONG).show();
|
Toast.makeText(AboutActivity.this, "未安装手Q或安装的版本不支持!", Toast.LENGTH_LONG).show();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,27 +1,21 @@
|
|||||||
package com.idormy.sms.forwarder;
|
package com.idormy.sms.forwarder;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.BroadCastReceiver.SmsForwarderBroadcastReceiver;
|
|
||||||
import com.idormy.sms.forwarder.adapter.LogAdapter;
|
import com.idormy.sms.forwarder.adapter.LogAdapter;
|
||||||
import com.idormy.sms.forwarder.model.vo.LogVo;
|
import com.idormy.sms.forwarder.model.vo.LogVo;
|
||||||
import com.idormy.sms.forwarder.utils.LogUtil;
|
import com.idormy.sms.forwarder.utils.LogUtil;
|
||||||
@ -29,30 +23,13 @@ import com.idormy.sms.forwarder.utils.NetUtil;
|
|||||||
import com.idormy.sms.forwarder.utils.PhoneUtils;
|
import com.idormy.sms.forwarder.utils.PhoneUtils;
|
||||||
import com.idormy.sms.forwarder.utils.SmsUtil;
|
import com.idormy.sms.forwarder.utils.SmsUtil;
|
||||||
import com.idormy.sms.forwarder.utils.aUtil;
|
import com.idormy.sms.forwarder.utils.aUtil;
|
||||||
import com.umeng.analytics.MobclickAgent;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements ReFlashListView.IReflashListener {
|
public class MainActivity extends AppCompatActivity implements ReFlashListView.IRefreshListener {
|
||||||
|
|
||||||
ServiceConnection conn = new ServiceConnection() {
|
private final String TAG = "MainActivity";
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onServiceDisconnected(ComponentName name) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
|
||||||
// 当service绑定成功时,会调用次方法,可以在此申请权限
|
|
||||||
PackageManager pm = getPackageManager();
|
|
||||||
PhoneUtils.CheckPermission(pm, MainActivity.this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private IntentFilter intentFilter;
|
|
||||||
private SmsForwarderBroadcastReceiver smsBroadcastReceiver;
|
|
||||||
private String TAG = "MainActivity";
|
|
||||||
// logVoList用于存储数据
|
// logVoList用于存储数据
|
||||||
private List<LogVo> logVos = new ArrayList<>();
|
private List<LogVo> logVos = new ArrayList<>();
|
||||||
private LogAdapter adapter;
|
private LogAdapter adapter;
|
||||||
@ -62,7 +39,7 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
LogUtil.init(this);
|
LogUtil.init(this);
|
||||||
Log.d(TAG, "oncreate");
|
Log.d(TAG, "onCreate");
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
@ -94,52 +71,50 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
|
|||||||
|
|
||||||
// 为ListView注册一个监听器,当用户点击了ListView中的任何一个子项时,就会回调onItemClick()方法
|
// 为ListView注册一个监听器,当用户点击了ListView中的任何一个子项时,就会回调onItemClick()方法
|
||||||
// 在这个方法中可以通过position参数判断出用户点击的是那一个子项
|
// 在这个方法中可以通过position参数判断出用户点击的是那一个子项
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listView.setOnItemClickListener((parent, view, position, id) -> {
|
||||||
@Override
|
if (position <= 0) return;
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
if (position <= 0) return;
|
|
||||||
|
|
||||||
LogVo logVo = logVos.get(position - 1);
|
LogVo logVo = logVos.get(position - 1);
|
||||||
logDetail(logVo);
|
logDetail(logVo);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
listView.setOnItemLongClickListener((parent, view, position, id) -> {
|
||||||
@Override
|
if (position <= 0) return false;
|
||||||
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
|
|
||||||
if (position <= 0) return false;
|
|
||||||
|
|
||||||
//定义AlertDialog.Builder对象,当长按列表项的时候弹出确认删除对话框
|
//定义AlertDialog.Builder对象,当长按列表项的时候弹出确认删除对话框
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
builder.setMessage("确定删除?");
|
builder.setMessage("确定删除?");
|
||||||
builder.setTitle("提示");
|
builder.setTitle("提示");
|
||||||
|
|
||||||
//添加AlertDialog.Builder对象的setPositiveButton()方法
|
//添加AlertDialog.Builder对象的setPositiveButton()方法
|
||||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
builder.setPositiveButton("确定", (dialog, which) -> {
|
||||||
@Override
|
Long id1 = logVos.get(position - 1).getId();
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
Log.d(TAG, "id = " + id1);
|
||||||
Long id = logVos.get(position - 1).getId();
|
LogUtil.delLog(id1, null);
|
||||||
Log.d(TAG, "id = " + id);
|
initTLogs(); //初始化数据
|
||||||
LogUtil.delLog(id, null);
|
showList(logVos);
|
||||||
initTLogs(); //初始化数据
|
Toast.makeText(getBaseContext(), "删除列表项", Toast.LENGTH_SHORT).show();
|
||||||
showList(logVos);
|
});
|
||||||
Toast.makeText(getBaseContext(), "删除列表项", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//添加AlertDialog.Builder对象的setNegativeButton()方法
|
//添加AlertDialog.Builder对象的setNegativeButton()方法
|
||||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
builder.setNegativeButton("取消", (dialog, which) -> {
|
||||||
@Override
|
});
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
//第一次打开,未授权无法获取SIM信息,尝试在此重新获取
|
||||||
|
if (MyApplication.SimInfoList.isEmpty()) {
|
||||||
|
MyApplication.SimInfoList = PhoneUtils.getSimMultiInfo();
|
||||||
|
}
|
||||||
|
Log.d(TAG, "SimInfoList = " + MyApplication.SimInfoList.size());
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
private void initTLogs() {
|
private void initTLogs() {
|
||||||
logVos = LogUtil.getLog(null, null);
|
logVos = LogUtil.getLog(null, null);
|
||||||
@ -160,35 +135,19 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReflash() {
|
public void onRefresh() {
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
handler.postDelayed(new Runnable() {
|
handler.postDelayed(() -> {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
@Override
|
//获取最新数据
|
||||||
public void run() {
|
initTLogs();
|
||||||
// TODO Auto-generated method stub
|
//通知界面显示
|
||||||
//获取最新数据
|
showList(logVos);
|
||||||
initTLogs();
|
//通知listview 刷新数据完毕;
|
||||||
//通知界面显示
|
listView.refreshComplete();
|
||||||
showList(logVos);
|
|
||||||
//通知listview 刷新数据完毕;
|
|
||||||
listView.reflashComplete();
|
|
||||||
}
|
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
Log.d(TAG, "onDestroy");
|
|
||||||
super.onDestroy();
|
|
||||||
//取消注册广播
|
|
||||||
try {
|
|
||||||
if (smsBroadcastReceiver != null)
|
|
||||||
unregisterReceiver(smsBroadcastReceiver);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "unregisterReceiver fail:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logDetail(LogVo logVo) {
|
public void logDetail(LogVo logVo) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
@ -200,29 +159,22 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
|
|||||||
builder.setMessage(logVo.getFrom() + "\n\n" + logVo.getContent() + "\n\n" + logVo.getRule() + "\n\n" + aUtil.utc2Local(logVo.getTime()) + "\n\nResponse:" + logVo.getForwardResponse());
|
builder.setMessage(logVo.getFrom() + "\n\n" + logVo.getContent() + "\n\n" + logVo.getRule() + "\n\n" + aUtil.utc2Local(logVo.getTime()) + "\n\nResponse:" + logVo.getForwardResponse());
|
||||||
}
|
}
|
||||||
//重发
|
//重发
|
||||||
builder.setPositiveButton("重发", new DialogInterface.OnClickListener() {
|
builder.setPositiveButton("重发", (dialog, which) -> {
|
||||||
@Override
|
Long id = logVo.getId();
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
Log.d(TAG, "id = " + id);
|
||||||
System.out.println(logVo.toString());
|
Log.d(TAG, logVo.toString());
|
||||||
Long id = logVo.getId();
|
Toast.makeText(MainActivity.this, "你确定要重发吗?", Toast.LENGTH_SHORT).show();
|
||||||
Log.d(TAG, "id = " + id);
|
dialog.dismiss();
|
||||||
Log.d(TAG, logVo.toString());
|
|
||||||
Toast.makeText(MainActivity.this, "你确定要重发吗?", Toast.LENGTH_SHORT).show();
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
//删除
|
//删除
|
||||||
builder.setNegativeButton("删除", new DialogInterface.OnClickListener() {
|
builder.setNegativeButton("删除", (dialog, which) -> {
|
||||||
@Override
|
Long id = logVo.getId();
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
Log.d(TAG, "id = " + id);
|
||||||
Long id = logVo.getId();
|
LogUtil.delLog(id, null);
|
||||||
Log.d(TAG, "id = " + id);
|
initTLogs(); //初始化数据
|
||||||
LogUtil.delLog(id, null);
|
showList(logVos);
|
||||||
initTLogs(); //初始化数据
|
Toast.makeText(MainActivity.this, "已删除该条记录", Toast.LENGTH_SHORT).show();
|
||||||
showList(logVos);
|
dialog.dismiss();
|
||||||
Toast.makeText(MainActivity.this, "已删除该条记录", Toast.LENGTH_SHORT).show();
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
@ -250,16 +202,11 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
|
|||||||
public void cleanLog(View view) {
|
public void cleanLog(View view) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
builder.setTitle("确定要清空转发记录吗?")
|
builder.setTitle("确定要清空转发记录吗?")
|
||||||
.setPositiveButton("清空", new DialogInterface.OnClickListener() {// 积极
|
.setPositiveButton("清空", (dialog, which) -> {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
@Override
|
LogUtil.delLog(null, null);
|
||||||
public void onClick(DialogInterface dialog,
|
initTLogs();
|
||||||
int which) {
|
adapter.add(logVos);
|
||||||
// TODO Auto-generated method stub
|
|
||||||
LogUtil.delLog(null, null);
|
|
||||||
initTLogs();
|
|
||||||
adapter.add(logVos);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
@ -273,6 +220,7 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NonConstantResourceId")
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
// Handle item selection
|
// Handle item selection
|
||||||
@ -296,21 +244,4 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
MobclickAgent.onResume(this);
|
|
||||||
//第一次打开,申请权限前无法获取SIM信息,尝试在此重新获取
|
|
||||||
if (MyApplication.SimInfoList.isEmpty()) {
|
|
||||||
MyApplication.SimInfoList = PhoneUtils.getSimMultiInfo();
|
|
||||||
}
|
|
||||||
Log.d(TAG, "SimInfoList = " + MyApplication.SimInfoList.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
MobclickAgent.onPause(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ public class MyApplication extends Application {
|
|||||||
* android:value="Umeng">
|
* android:value="Umeng">
|
||||||
* </meta-data>
|
* </meta-data>
|
||||||
*
|
*
|
||||||
* @param ctx
|
* @param ctx 上下文
|
||||||
* @return
|
* @return 渠道名称
|
||||||
*/
|
*/
|
||||||
// 获取渠道工具函数
|
// 获取渠道工具函数
|
||||||
public static String getChannelName(Context ctx) {
|
public static String getChannelName(Context ctx) {
|
||||||
@ -52,10 +52,8 @@ public class MyApplication extends Application {
|
|||||||
if (packageManager != null) {
|
if (packageManager != null) {
|
||||||
//注意此处为ApplicationInfo 而不是 ActivityInfo,因为友盟设置的meta-data是在application标签中,而不是activity标签中,所以用ApplicationInfo
|
//注意此处为ApplicationInfo 而不是 ActivityInfo,因为友盟设置的meta-data是在application标签中,而不是activity标签中,所以用ApplicationInfo
|
||||||
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(ctx.getPackageName(), PackageManager.GET_META_DATA);
|
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(ctx.getPackageName(), PackageManager.GET_META_DATA);
|
||||||
if (applicationInfo != null) {
|
if (applicationInfo.metaData != null) {
|
||||||
if (applicationInfo.metaData != null) {
|
channelName = applicationInfo.metaData.get("UMENG_CHANNEL") + "";
|
||||||
channelName = applicationInfo.metaData.get("UMENG_CHANNEL") + "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
@ -84,7 +82,7 @@ public class MyApplication extends Application {
|
|||||||
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.LEGACY_MANUAL);
|
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.LEGACY_MANUAL);
|
||||||
//pro close log
|
//pro close log
|
||||||
UMConfigure.setLogEnabled(true);
|
UMConfigure.setLogEnabled(true);
|
||||||
Log.i(TAG, "uminit");
|
|
||||||
Intent intent = new Intent(this, FrontService.class);
|
Intent intent = new Intent(this, FrontService.class);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
startForegroundService(intent);
|
startForegroundService(intent);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder;
|
package com.idormy.sms.forwarder;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -20,11 +21,12 @@ import java.util.Locale;
|
|||||||
/**
|
/**
|
||||||
* 自定义listview
|
* 自定义listview
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"CommentedOutCode", "unused"})
|
||||||
public class ReFlashListView extends ListView implements AbsListView.OnScrollListener {
|
public class ReFlashListView extends ListView implements AbsListView.OnScrollListener {
|
||||||
private static final String TAG = "ReFlashListView";
|
//private static final String TAG = "ReFlashListView";
|
||||||
final int NONE = 0;// 正常状态;
|
final int NONE = 0;// 正常状态;
|
||||||
final int PULL = 1;// 提示下拉状态;
|
final int PULL = 1;// 提示下拉状态;
|
||||||
final int RELESE = 2;// 提示释放状态;
|
final int RELEASE = 2;// 提示释放状态;
|
||||||
final int REFLASHING = 3;// 刷新状态;
|
final int REFLASHING = 3;// 刷新状态;
|
||||||
View header;// 顶部布局文件;
|
View header;// 顶部布局文件;
|
||||||
int headerHeight;// 顶部布局文件的高度;
|
int headerHeight;// 顶部布局文件的高度;
|
||||||
@ -33,7 +35,7 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
boolean isRemark;// 标记,当前是在listview最顶端摁下的;
|
boolean isRemark;// 标记,当前是在listview最顶端摁下的;
|
||||||
int startY;// 摁下时的Y值;
|
int startY;// 摁下时的Y值;
|
||||||
int state;// 当前的状态;
|
int state;// 当前的状态;
|
||||||
IReflashListener iReflashListener;//刷新数据的接口
|
IRefreshListener iRefreshListener;//刷新数据的接口
|
||||||
|
|
||||||
public ReFlashListView(Context context) {
|
public ReFlashListView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -55,9 +57,8 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化界面,添加顶部布局文件到 listview
|
* 初始化界面,添加顶部布局文件到 listview
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressLint("InflateParams")
|
||||||
private void initView(Context context) {
|
private void initView(Context context) {
|
||||||
LayoutInflater inflater = LayoutInflater.from(context);
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
header = inflater.inflate(R.layout.header, null);
|
header = inflater.inflate(R.layout.header, null);
|
||||||
@ -71,8 +72,6 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知父布局,占用的宽,高;
|
* 通知父布局,占用的宽,高;
|
||||||
*
|
|
||||||
* @param view
|
|
||||||
*/
|
*/
|
||||||
private void measureView(View view) {
|
private void measureView(View view) {
|
||||||
ViewGroup.LayoutParams p = view.getLayoutParams();
|
ViewGroup.LayoutParams p = view.getLayoutParams();
|
||||||
@ -94,8 +93,6 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置header 布局 上边距;
|
* 设置header 布局 上边距;
|
||||||
*
|
|
||||||
* @param topPadding
|
|
||||||
*/
|
*/
|
||||||
private void topPadding(int topPadding) {
|
private void topPadding(int topPadding) {
|
||||||
header.setPadding(header.getPaddingLeft(), topPadding,
|
header.setPadding(header.getPaddingLeft(), topPadding,
|
||||||
@ -116,6 +113,7 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
this.scrollState = scrollState;
|
this.scrollState = scrollState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent ev) {
|
public boolean onTouchEvent(MotionEvent ev) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
@ -131,23 +129,23 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
onMove(ev);
|
onMove(ev);
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
if (state == RELESE || state == PULL) {
|
if (state == RELEASE || state == PULL) {
|
||||||
state = REFLASHING;
|
state = REFLASHING;
|
||||||
// 加载最新数据;
|
// 加载最新数据;
|
||||||
reflashViewByState();
|
refreshViewByState();
|
||||||
iReflashListener.onReflash();
|
iRefreshListener.onRefresh();
|
||||||
}
|
}
|
||||||
// if (state == RELESE) {
|
// if (state == RELEASE) {
|
||||||
// Log.d(TAG, "onTouchEvent: up release");
|
// Log.d(TAG, "onTouchEvent: up release");
|
||||||
// state = REFLASHING;
|
// state = REFLASHING;
|
||||||
// // 加载最新数据;
|
// // 加载最新数据;
|
||||||
// reflashViewByState();
|
// refreshViewByState();
|
||||||
// iReflashListener.onReflash();
|
// iRefreshListener.onRefresh();
|
||||||
// } else if (state == PULL) {
|
// } else if (state == PULL) {
|
||||||
// Log.d(TAG, "onTouchEvent: up pull");
|
// Log.d(TAG, "onTouchEvent: up pull");
|
||||||
// state = NONE;
|
// state = NONE;
|
||||||
// isRemark = false;
|
// isRemark = false;
|
||||||
// reflashViewByState();
|
// refreshViewByState();
|
||||||
// }
|
// }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -156,8 +154,6 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断移动过程操作;
|
* 判断移动过程操作;
|
||||||
*
|
|
||||||
* @param ev
|
|
||||||
*/
|
*/
|
||||||
private void onMove(MotionEvent ev) {
|
private void onMove(MotionEvent ev) {
|
||||||
if (!isRemark) {
|
if (!isRemark) {
|
||||||
@ -170,26 +166,26 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
case NONE:
|
case NONE:
|
||||||
if (space > 0) {
|
if (space > 0) {
|
||||||
state = PULL;
|
state = PULL;
|
||||||
reflashViewByState();
|
refreshViewByState();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PULL:
|
case PULL:
|
||||||
topPadding(topPadding);
|
topPadding(topPadding);
|
||||||
if (space > headerHeight + 30
|
if (space > headerHeight + 30
|
||||||
&& scrollState == SCROLL_STATE_TOUCH_SCROLL) {
|
&& scrollState == SCROLL_STATE_TOUCH_SCROLL) {
|
||||||
state = RELESE;
|
state = RELEASE;
|
||||||
reflashViewByState();
|
refreshViewByState();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RELESE:
|
case RELEASE:
|
||||||
topPadding(topPadding);
|
topPadding(topPadding);
|
||||||
if (space < headerHeight + 30) {
|
if (space < headerHeight + 30) {
|
||||||
state = PULL;
|
state = PULL;
|
||||||
reflashViewByState();
|
refreshViewByState();
|
||||||
} else if (space <= 0) {
|
} else if (space <= 0) {
|
||||||
state = NONE;
|
state = NONE;
|
||||||
isRemark = false;
|
isRemark = false;
|
||||||
reflashViewByState();
|
refreshViewByState();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -198,10 +194,10 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
/**
|
/**
|
||||||
* 根据当前状态,改变界面显示;
|
* 根据当前状态,改变界面显示;
|
||||||
*/
|
*/
|
||||||
private void reflashViewByState() {
|
private void refreshViewByState() {
|
||||||
TextView tip = (TextView) header.findViewById(R.id.tip);
|
TextView tip = header.findViewById(R.id.tip);
|
||||||
ImageView arrow = (ImageView) header.findViewById(R.id.arrow);
|
ImageView arrow = header.findViewById(R.id.arrow);
|
||||||
ProgressBar progress = (ProgressBar) header.findViewById(R.id.progress);
|
ProgressBar progress = header.findViewById(R.id.progress);
|
||||||
RotateAnimation anim = new RotateAnimation(0, 180,
|
RotateAnimation anim = new RotateAnimation(0, 180,
|
||||||
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
|
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
|
||||||
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
|
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
|
||||||
@ -225,7 +221,7 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
arrow.clearAnimation();
|
arrow.clearAnimation();
|
||||||
arrow.setAnimation(anim1);
|
arrow.setAnimation(anim1);
|
||||||
break;
|
break;
|
||||||
case RELESE:
|
case RELEASE:
|
||||||
arrow.setVisibility(View.VISIBLE);
|
arrow.setVisibility(View.VISIBLE);
|
||||||
progress.setVisibility(View.GONE);
|
progress.setVisibility(View.GONE);
|
||||||
tip.setText("松开可以刷新!");
|
tip.setText("松开可以刷新!");
|
||||||
@ -245,19 +241,19 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
/**
|
/**
|
||||||
* 获取完数据;
|
* 获取完数据;
|
||||||
*/
|
*/
|
||||||
public void reflashComplete() {
|
public void refreshComplete() {
|
||||||
state = NONE;
|
state = NONE;
|
||||||
isRemark = false;
|
isRemark = false;
|
||||||
reflashViewByState();
|
refreshViewByState();
|
||||||
TextView lastupdatetime = (TextView) header
|
TextView lastUpdateTime = header
|
||||||
.findViewById(R.id.lastupdate_time);
|
.findViewById(R.id.lastUpdateTime);
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
||||||
String time = sdf.format(new java.util.Date());
|
String time = sdf.format(new java.util.Date());
|
||||||
lastupdatetime.setText(time);
|
lastUpdateTime.setText(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInterface(IReflashListener iReflashListener) {
|
public void setInterface(IRefreshListener iRefreshListener) {
|
||||||
this.iReflashListener = iReflashListener;
|
this.iRefreshListener = iRefreshListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -265,7 +261,7 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
|
|||||||
*
|
*
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
public interface IReflashListener {
|
public interface IRefreshListener {
|
||||||
public void onReflash();
|
void onRefresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,18 +1,17 @@
|
|||||||
package com.idormy.sms.forwarder;
|
package com.idormy.sms.forwarder;
|
||||||
|
|
||||||
|
import static com.idormy.sms.forwarder.SenderActivity.NOTIFY;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.RadioButton;
|
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -34,32 +33,28 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.idormy.sms.forwarder.SenderActivity.NOTIFY;
|
@SuppressWarnings("deprecation")
|
||||||
|
|
||||||
public class RuleActivity extends AppCompatActivity {
|
public class RuleActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private String TAG = "RuleActivity";
|
private final String TAG = "RuleActivity";
|
||||||
// 用于存储数据
|
// 用于存储数据
|
||||||
private List<RuleModel> ruleModels = new ArrayList<>();
|
private List<RuleModel> ruleModels = new ArrayList<>();
|
||||||
private RuleAdapter adapter;
|
private RuleAdapter adapter;
|
||||||
private Long selectSenderId = 0l;
|
|
||||||
private String selectSenderName = "";
|
|
||||||
|
|
||||||
//消息处理者,创建一个Handler的子类对象,目的是重写Handler的处理消息的方法(handleMessage())
|
//消息处理者,创建一个Handler的子类对象,目的是重写Handler的处理消息的方法(handleMessage())
|
||||||
private Handler handler = new Handler() {
|
@SuppressLint("HandlerLeak")
|
||||||
|
private final Handler handler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
switch (msg.what) {
|
if (msg.what == NOTIFY) {
|
||||||
case NOTIFY:
|
Toast.makeText(RuleActivity.this, msg.getData().getString("DATA"), Toast.LENGTH_LONG).show();
|
||||||
Toast.makeText(RuleActivity.this, msg.getData().getString("DATA"), Toast.LENGTH_LONG).show();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Log.d(TAG, "oncreate");
|
Log.d(TAG, "onCreate");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_rule);
|
setContentView(R.layout.activity_rule);
|
||||||
RuleUtil.init(RuleActivity.this);
|
RuleUtil.init(RuleActivity.this);
|
||||||
@ -85,46 +80,33 @@ public class RuleActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
// 为ListView注册一个监听器,当用户点击了ListView中的任何一个子项时,就会回调onItemClick()方法
|
// 为ListView注册一个监听器,当用户点击了ListView中的任何一个子项时,就会回调onItemClick()方法
|
||||||
// 在这个方法中可以通过position参数判断出用户点击的是那一个子项
|
// 在这个方法中可以通过position参数判断出用户点击的是那一个子项
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listView.setOnItemClickListener((parent, view, position, id) -> {
|
||||||
@Override
|
RuleModel ruleModel = ruleModels.get(position);
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
Log.d(TAG, "onItemClick: " + ruleModel);
|
||||||
RuleModel ruleModel = ruleModels.get(position);
|
setRule(ruleModel);
|
||||||
Log.d(TAG, "onItemClick: " + ruleModel);
|
|
||||||
setRule(ruleModel);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
listView.setOnItemLongClickListener((parent, view, position, id) -> {
|
||||||
@Override
|
//定义AlertDialog.Builder对象,当长按列表项的时候弹出确认删除对话框
|
||||||
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
|
AlertDialog.Builder builder = new AlertDialog.Builder(RuleActivity.this);
|
||||||
//定义AlertDialog.Builder对象,当长按列表项的时候弹出确认删除对话框
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(RuleActivity.this);
|
|
||||||
|
|
||||||
builder.setMessage("确定删除?");
|
builder.setMessage("确定删除?");
|
||||||
builder.setTitle("提示");
|
builder.setTitle("提示");
|
||||||
|
|
||||||
//添加AlertDialog.Builder对象的setPositiveButton()方法
|
//添加AlertDialog.Builder对象的setPositiveButton()方法
|
||||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
builder.setPositiveButton("确定", (dialog, which) -> {
|
||||||
@Override
|
RuleUtil.delRule(ruleModels.get(position).getId());
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
initRules();
|
||||||
RuleUtil.delRule(ruleModels.get(position).getId());
|
adapter.del(ruleModels);
|
||||||
initRules();
|
Toast.makeText(getBaseContext(), "删除列表项", Toast.LENGTH_SHORT).show();
|
||||||
adapter.del(ruleModels);
|
});
|
||||||
Toast.makeText(getBaseContext(), "删除列表项", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//添加AlertDialog.Builder对象的setNegativeButton()方法
|
//添加AlertDialog.Builder对象的setNegativeButton()方法
|
||||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
builder.setNegativeButton("取消", (dialog, which) -> {
|
||||||
|
|
||||||
@Override
|
});
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
}
|
builder.create().show();
|
||||||
});
|
return true;
|
||||||
|
|
||||||
builder.create().show();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,11 +123,11 @@ public class RuleActivity extends AppCompatActivity {
|
|||||||
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(RuleActivity.this);
|
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(RuleActivity.this);
|
||||||
final View view1 = View.inflate(RuleActivity.this, R.layout.alert_dialog_setview_rule, null);
|
final View view1 = View.inflate(RuleActivity.this, R.layout.alert_dialog_setview_rule, null);
|
||||||
|
|
||||||
final RadioGroup radioGroupRuleFiled = (RadioGroup) view1.findViewById(R.id.radioGroupRuleFiled);
|
final RadioGroup radioGroupRuleFiled = view1.findViewById(R.id.radioGroupRuleFiled);
|
||||||
if (ruleModel != null) radioGroupRuleFiled.check(ruleModel.getRuleFiledCheckId());
|
if (ruleModel != null) radioGroupRuleFiled.check(ruleModel.getRuleFiledCheckId());
|
||||||
|
|
||||||
final RadioGroup radioGroupRuleCheck = (RadioGroup) view1.findViewById(R.id.radioGroupRuleCheck);
|
final RadioGroup radioGroupRuleCheck = view1.findViewById(R.id.radioGroupRuleCheck);
|
||||||
final RadioGroup radioGroupRuleCheck2 = (RadioGroup) view1.findViewById(R.id.radioGroupRuleCheck2);
|
final RadioGroup radioGroupRuleCheck2 = view1.findViewById(R.id.radioGroupRuleCheck2);
|
||||||
if (ruleModel != null) {
|
if (ruleModel != null) {
|
||||||
int ruleCheckCheckId = ruleModel.getRuleCheckCheckId();
|
int ruleCheckCheckId = ruleModel.getRuleCheckCheckId();
|
||||||
if (ruleCheckCheckId == R.id.btnIs || ruleCheckCheckId == R.id.btnNotContain || ruleCheckCheckId == R.id.btnContain) {
|
if (ruleCheckCheckId == R.id.btnIs || ruleCheckCheckId == R.id.btnNotContain || ruleCheckCheckId == R.id.btnContain) {
|
||||||
@ -157,25 +139,22 @@ public class RuleActivity extends AppCompatActivity {
|
|||||||
radioGroupRuleCheck.check(R.id.btnIs);
|
radioGroupRuleCheck.check(R.id.btnIs);
|
||||||
}
|
}
|
||||||
|
|
||||||
final RadioGroup radioGroupSimSlot = (RadioGroup) view1.findViewById(R.id.radioGroupSimSlot);
|
final RadioGroup radioGroupSimSlot = view1.findViewById(R.id.radioGroupSimSlot);
|
||||||
if (ruleModel != null) radioGroupSimSlot.check(ruleModel.getRuleSimSlotCheckId());
|
if (ruleModel != null) radioGroupSimSlot.check(ruleModel.getRuleSimSlotCheckId());
|
||||||
|
|
||||||
final TextView tv_mu_rule_tips = (TextView) view1.findViewById(R.id.tv_mu_rule_tips);
|
final TextView tv_mu_rule_tips = view1.findViewById(R.id.tv_mu_rule_tips);
|
||||||
final TextView ruleSenderTv = (TextView) view1.findViewById(R.id.ruleSenderTv);
|
final TextView ruleSenderTv = view1.findViewById(R.id.ruleSenderTv);
|
||||||
if (ruleModel != null && ruleModel.getSenderId() != null) {
|
if (ruleModel != null && ruleModel.getSenderId() != null) {
|
||||||
List<SenderModel> getSeners = SenderUtil.getSender(ruleModel.getSenderId(), null);
|
List<SenderModel> getSenders = SenderUtil.getSender(ruleModel.getSenderId(), null);
|
||||||
if (!getSeners.isEmpty()) {
|
if (!getSenders.isEmpty()) {
|
||||||
ruleSenderTv.setText(getSeners.get(0).getName());
|
ruleSenderTv.setText(getSenders.get(0).getName());
|
||||||
ruleSenderTv.setTag(getSeners.get(0).getId());
|
ruleSenderTv.setTag(getSenders.get(0).getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Button btSetRuleSender = (Button) view1.findViewById(R.id.btSetRuleSender);
|
final Button btSetRuleSender = view1.findViewById(R.id.btSetRuleSender);
|
||||||
btSetRuleSender.setOnClickListener(new View.OnClickListener() {
|
btSetRuleSender.setOnClickListener(view -> {
|
||||||
@Override
|
//Toast.makeText(RuleActivity.this, "selectSender", Toast.LENGTH_LONG).show();
|
||||||
public void onClick(View view) {
|
selectSender(ruleSenderTv);
|
||||||
//Toast.makeText(RuleActivity.this, "selectSender", Toast.LENGTH_LONG).show();
|
|
||||||
selectSender(ruleSenderTv);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final EditText editTextRuleValue = view1.findViewById(R.id.editTextRuleValue);
|
final EditText editTextRuleValue = view1.findViewById(R.id.editTextRuleValue);
|
||||||
@ -183,92 +162,83 @@ public class RuleActivity extends AppCompatActivity {
|
|||||||
editTextRuleValue.setText(ruleModel.getValue());
|
editTextRuleValue.setText(ruleModel.getValue());
|
||||||
|
|
||||||
//当更新选择的字段的时候,更新之下各个选项的状态
|
//当更新选择的字段的时候,更新之下各个选项的状态
|
||||||
final LinearLayout matchTypeLayout = (LinearLayout) view1.findViewById(R.id.matchTypeLayout);
|
final LinearLayout matchTypeLayout = view1.findViewById(R.id.matchTypeLayout);
|
||||||
final LinearLayout matchValueLayout = (LinearLayout) view1.findViewById(R.id.matchValueLayout);
|
final LinearLayout matchValueLayout = view1.findViewById(R.id.matchValueLayout);
|
||||||
refreshSelectRadioGroupRuleFiled(radioGroupRuleFiled, radioGroupRuleCheck, radioGroupRuleCheck2, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
|
refreshSelectRadioGroupRuleFiled(radioGroupRuleFiled, radioGroupRuleCheck, radioGroupRuleCheck2, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
|
||||||
|
|
||||||
Button buttonruleok = view1.findViewById(R.id.buttonruleok);
|
Button buttonRuleOk = view1.findViewById(R.id.buttonRuleOk);
|
||||||
Button buttonruledel = view1.findViewById(R.id.buttonruledel);
|
Button buttonRuleDel = view1.findViewById(R.id.buttonRuleDel);
|
||||||
Button buttonruletest = view1.findViewById(R.id.buttonruletest);
|
Button buttonRuleTest = view1.findViewById(R.id.buttonRuleTest);
|
||||||
alertDialog71
|
alertDialog71
|
||||||
.setTitle(R.string.setrule)
|
.setTitle(R.string.setrule)
|
||||||
//.setIcon(R.drawable.ic_sms_forwarder)
|
//.setIcon(R.drawable.ic_sms_forwarder)
|
||||||
.setView(view1)
|
.setView(view1)
|
||||||
.create();
|
.create();
|
||||||
final AlertDialog show = alertDialog71.show();
|
final AlertDialog show = alertDialog71.show();
|
||||||
buttonruleok.setOnClickListener(new View.OnClickListener() {
|
buttonRuleOk.setOnClickListener(view -> {
|
||||||
@Override
|
Object senderId = ruleSenderTv.getTag();
|
||||||
public void onClick(View view) {
|
int radioGroupRuleCheckId = Math.max(radioGroupRuleCheck.getCheckedRadioButtonId(), radioGroupRuleCheck2.getCheckedRadioButtonId());
|
||||||
Object senderId = ruleSenderTv.getTag();
|
Log.d(TAG, radioGroupRuleCheck.getCheckedRadioButtonId() + " " + radioGroupRuleCheck2.getCheckedRadioButtonId() + " " + radioGroupRuleCheckId);
|
||||||
|
if (ruleModel == null) {
|
||||||
|
RuleModel newRuleModel = new RuleModel();
|
||||||
|
newRuleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
|
||||||
|
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
|
||||||
|
newRuleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
|
||||||
|
newRuleModel.setValue(editTextRuleValue.getText().toString());
|
||||||
|
if (senderId != null) {
|
||||||
|
newRuleModel.setSenderId(Long.valueOf(senderId.toString()));
|
||||||
|
}
|
||||||
|
RuleUtil.addRule(newRuleModel);
|
||||||
|
initRules();
|
||||||
|
adapter.add(ruleModels);
|
||||||
|
} else {
|
||||||
|
ruleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
|
||||||
|
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
|
||||||
|
ruleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
|
||||||
|
ruleModel.setValue(editTextRuleValue.getText().toString());
|
||||||
|
if (senderId != null) {
|
||||||
|
ruleModel.setSenderId(Long.valueOf(senderId.toString()));
|
||||||
|
}
|
||||||
|
RuleUtil.updateRule(ruleModel);
|
||||||
|
initRules();
|
||||||
|
adapter.update(ruleModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
show.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonRuleDel.setOnClickListener(view -> {
|
||||||
|
if (ruleModel != null) {
|
||||||
|
RuleUtil.delRule(ruleModel.getId());
|
||||||
|
initRules();
|
||||||
|
adapter.del(ruleModels);
|
||||||
|
}
|
||||||
|
show.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonRuleTest.setOnClickListener(view -> {
|
||||||
|
Object senderId = ruleSenderTv.getTag();
|
||||||
|
if (senderId == null) {
|
||||||
|
Toast.makeText(RuleActivity.this, "请先创建选择发送方", Toast.LENGTH_LONG).show();
|
||||||
|
} else {
|
||||||
int radioGroupRuleCheckId = Math.max(radioGroupRuleCheck.getCheckedRadioButtonId(), radioGroupRuleCheck2.getCheckedRadioButtonId());
|
int radioGroupRuleCheckId = Math.max(radioGroupRuleCheck.getCheckedRadioButtonId(), radioGroupRuleCheck2.getCheckedRadioButtonId());
|
||||||
Log.d(TAG, "XXXX " + radioGroupRuleCheck.getCheckedRadioButtonId() + " " + radioGroupRuleCheck2.getCheckedRadioButtonId() + " " + radioGroupRuleCheckId);
|
|
||||||
if (ruleModel == null) {
|
if (ruleModel == null) {
|
||||||
RuleModel newRuleModel = new RuleModel();
|
RuleModel newRuleModel = new RuleModel();
|
||||||
newRuleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
|
newRuleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
|
||||||
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
|
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
|
||||||
newRuleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
|
newRuleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
|
||||||
newRuleModel.setValue(editTextRuleValue.getText().toString());
|
newRuleModel.setValue(editTextRuleValue.getText().toString());
|
||||||
if (senderId != null) {
|
newRuleModel.setSenderId(Long.valueOf(senderId.toString()));
|
||||||
newRuleModel.setSenderId(Long.valueOf(senderId.toString()));
|
|
||||||
}
|
testRule(newRuleModel, Long.valueOf(senderId.toString()));
|
||||||
RuleUtil.addRule(newRuleModel);
|
|
||||||
initRules();
|
|
||||||
adapter.add(ruleModels);
|
|
||||||
} else {
|
} else {
|
||||||
ruleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
|
ruleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
|
||||||
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
|
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
|
||||||
ruleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
|
ruleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
|
||||||
ruleModel.setValue(editTextRuleValue.getText().toString());
|
ruleModel.setValue(editTextRuleValue.getText().toString());
|
||||||
if (senderId != null) {
|
ruleModel.setSenderId(Long.valueOf(senderId.toString()));
|
||||||
ruleModel.setSenderId(Long.valueOf(senderId.toString()));
|
|
||||||
}
|
|
||||||
RuleUtil.updateRule(ruleModel);
|
|
||||||
initRules();
|
|
||||||
adapter.update(ruleModels);
|
|
||||||
}
|
|
||||||
|
|
||||||
show.dismiss();
|
testRule(ruleModel, Long.valueOf(senderId.toString()));
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonruledel.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
if (ruleModel != null) {
|
|
||||||
RuleUtil.delRule(ruleModel.getId());
|
|
||||||
initRules();
|
|
||||||
adapter.del(ruleModels);
|
|
||||||
}
|
|
||||||
show.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonruletest.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Object senderId = ruleSenderTv.getTag();
|
|
||||||
if (senderId == null) {
|
|
||||||
Toast.makeText(RuleActivity.this, "请先创建选择发送方", Toast.LENGTH_LONG).show();
|
|
||||||
} else {
|
|
||||||
int radioGroupRuleCheckId = Math.max(radioGroupRuleCheck.getCheckedRadioButtonId(), radioGroupRuleCheck2.getCheckedRadioButtonId());
|
|
||||||
if (ruleModel == null) {
|
|
||||||
RuleModel newRuleModel = new RuleModel();
|
|
||||||
newRuleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
|
|
||||||
newRuleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
|
|
||||||
newRuleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
|
|
||||||
newRuleModel.setValue(editTextRuleValue.getText().toString());
|
|
||||||
newRuleModel.setSenderId(Long.valueOf(senderId.toString()));
|
|
||||||
|
|
||||||
testRule(newRuleModel, Long.valueOf(senderId.toString()));
|
|
||||||
} else {
|
|
||||||
ruleModel.setFiled(RuleModel.getRuleFiledFromCheckId(radioGroupRuleFiled.getCheckedRadioButtonId()));
|
|
||||||
ruleModel.setCheck(RuleModel.getRuleCheckFromCheckId(radioGroupRuleCheckId));
|
|
||||||
ruleModel.setSimSlot(RuleModel.getRuleSimSlotFromCheckId(radioGroupSimSlot.getCheckedRadioButtonId()));
|
|
||||||
ruleModel.setValue(editTextRuleValue.getText().toString());
|
|
||||||
ruleModel.setSenderId(Long.valueOf(senderId.toString()));
|
|
||||||
|
|
||||||
testRule(ruleModel, Long.valueOf(senderId.toString()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -281,53 +251,43 @@ public class RuleActivity extends AppCompatActivity {
|
|||||||
private void refreshSelectRadioGroupRuleFiled(RadioGroup radioGroupRuleFiled, final RadioGroup radioGroupRuleCheck, final RadioGroup radioGroupRuleCheck2, final EditText editTextRuleValue, final TextView tv_mu_rule_tips, final LinearLayout matchTypeLayout, final LinearLayout matchValueLayout) {
|
private void refreshSelectRadioGroupRuleFiled(RadioGroup radioGroupRuleFiled, final RadioGroup radioGroupRuleCheck, final RadioGroup radioGroupRuleCheck2, final EditText editTextRuleValue, final TextView tv_mu_rule_tips, final LinearLayout matchTypeLayout, final LinearLayout matchValueLayout) {
|
||||||
refreshSelectRadioGroupRuleFiledAction(radioGroupRuleFiled.getCheckedRadioButtonId(), radioGroupRuleCheck, radioGroupRuleCheck2, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
|
refreshSelectRadioGroupRuleFiledAction(radioGroupRuleFiled.getCheckedRadioButtonId(), radioGroupRuleCheck, radioGroupRuleCheck2, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
|
||||||
|
|
||||||
radioGroupRuleCheck.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
radioGroupRuleCheck.setOnCheckedChangeListener((group, checkedId) -> {
|
||||||
@SuppressLint("ResourceType")
|
Log.d(TAG, String.valueOf(group));
|
||||||
@Override
|
Log.d(TAG, String.valueOf(checkedId));
|
||||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
if (group != null && checkedId > 0) {
|
||||||
Log.d(TAG, String.valueOf(group));
|
|
||||||
Log.d(TAG, String.valueOf(checkedId));
|
|
||||||
if (group != null && checkedId > 0) {
|
|
||||||
if (group == radioGroupRuleCheck) {
|
|
||||||
radioGroupRuleCheck2.clearCheck();
|
|
||||||
} else if (group == radioGroupRuleCheck2) {
|
|
||||||
radioGroupRuleCheck.clearCheck();
|
|
||||||
}
|
|
||||||
group.check(checkedId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
radioGroupRuleCheck2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
||||||
@SuppressLint("ResourceType")
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
||||||
Log.d(TAG, String.valueOf(group));
|
|
||||||
Log.d(TAG, String.valueOf(checkedId));
|
|
||||||
if (group != null && checkedId > 0) {
|
|
||||||
if (group == radioGroupRuleCheck) {
|
|
||||||
radioGroupRuleCheck2.clearCheck();
|
|
||||||
} else if (group == radioGroupRuleCheck2) {
|
|
||||||
radioGroupRuleCheck.clearCheck();
|
|
||||||
}
|
|
||||||
group.check(checkedId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
radioGroupRuleFiled.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
||||||
Log.d(TAG, String.valueOf(group));
|
|
||||||
Log.d(TAG, String.valueOf(checkedId));
|
|
||||||
if (group == radioGroupRuleCheck) {
|
if (group == radioGroupRuleCheck) {
|
||||||
radioGroupRuleCheck2.clearCheck();
|
radioGroupRuleCheck2.clearCheck();
|
||||||
} else if (group == radioGroupRuleCheck2) {
|
} else if (group == radioGroupRuleCheck2) {
|
||||||
radioGroupRuleCheck.clearCheck();
|
radioGroupRuleCheck.clearCheck();
|
||||||
}
|
}
|
||||||
refreshSelectRadioGroupRuleFiledAction(checkedId, radioGroupRuleCheck, radioGroupRuleCheck2, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
|
group.check(checkedId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
radioGroupRuleCheck2.setOnCheckedChangeListener((group, checkedId) -> {
|
||||||
|
Log.d(TAG, String.valueOf(group));
|
||||||
|
Log.d(TAG, String.valueOf(checkedId));
|
||||||
|
if (group != null && checkedId > 0) {
|
||||||
|
if (group == radioGroupRuleCheck) {
|
||||||
|
radioGroupRuleCheck2.clearCheck();
|
||||||
|
} else if (group == radioGroupRuleCheck2) {
|
||||||
|
radioGroupRuleCheck.clearCheck();
|
||||||
|
}
|
||||||
|
group.check(checkedId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
radioGroupRuleFiled.setOnCheckedChangeListener((group, checkedId) -> {
|
||||||
|
Log.d(TAG, String.valueOf(group));
|
||||||
|
Log.d(TAG, String.valueOf(checkedId));
|
||||||
|
if (group == radioGroupRuleCheck) {
|
||||||
|
radioGroupRuleCheck2.clearCheck();
|
||||||
|
} else if (group == radioGroupRuleCheck2) {
|
||||||
|
radioGroupRuleCheck.clearCheck();
|
||||||
|
}
|
||||||
|
refreshSelectRadioGroupRuleFiledAction(checkedId, radioGroupRuleCheck, radioGroupRuleCheck2, editTextRuleValue, tv_mu_rule_tips, matchTypeLayout, matchValueLayout);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NonConstantResourceId")
|
||||||
private void refreshSelectRadioGroupRuleFiledAction(int checkedRuleFiledId, final RadioGroup radioGroupRuleCheck, final RadioGroup radioGroupRuleCheck2, final EditText editTextRuleValue, final TextView tv_mu_rule_tips, final LinearLayout matchTypeLayout, final LinearLayout matchValueLayout) {
|
private void refreshSelectRadioGroupRuleFiledAction(int checkedRuleFiledId, final RadioGroup radioGroupRuleCheck, final RadioGroup radioGroupRuleCheck2, final EditText editTextRuleValue, final TextView tv_mu_rule_tips, final LinearLayout matchTypeLayout, final LinearLayout matchValueLayout) {
|
||||||
tv_mu_rule_tips.setVisibility(View.GONE);
|
tv_mu_rule_tips.setVisibility(View.GONE);
|
||||||
matchTypeLayout.setVisibility(View.VISIBLE);
|
matchTypeLayout.setVisibility(View.VISIBLE);
|
||||||
@ -336,10 +296,10 @@ public class RuleActivity extends AppCompatActivity {
|
|||||||
switch (checkedRuleFiledId) {
|
switch (checkedRuleFiledId) {
|
||||||
case R.id.btnTranspondAll:
|
case R.id.btnTranspondAll:
|
||||||
for (int i = 0; i < radioGroupRuleCheck.getChildCount(); i++) {
|
for (int i = 0; i < radioGroupRuleCheck.getChildCount(); i++) {
|
||||||
((RadioButton) radioGroupRuleCheck.getChildAt(i)).setEnabled(false);
|
radioGroupRuleCheck.getChildAt(i).setEnabled(false);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < radioGroupRuleCheck2.getChildCount(); i++) {
|
for (int i = 0; i < radioGroupRuleCheck2.getChildCount(); i++) {
|
||||||
((RadioButton) radioGroupRuleCheck2.getChildAt(i)).setEnabled(false);
|
radioGroupRuleCheck2.getChildAt(i).setEnabled(false);
|
||||||
}
|
}
|
||||||
editTextRuleValue.setEnabled(false);
|
editTextRuleValue.setEnabled(false);
|
||||||
matchTypeLayout.setVisibility(View.GONE);
|
matchTypeLayout.setVisibility(View.GONE);
|
||||||
@ -347,10 +307,10 @@ public class RuleActivity extends AppCompatActivity {
|
|||||||
break;
|
break;
|
||||||
case R.id.btnMultiMatch:
|
case R.id.btnMultiMatch:
|
||||||
for (int i = 0; i < radioGroupRuleCheck.getChildCount(); i++) {
|
for (int i = 0; i < radioGroupRuleCheck.getChildCount(); i++) {
|
||||||
((RadioButton) radioGroupRuleCheck.getChildAt(i)).setEnabled(false);
|
radioGroupRuleCheck.getChildAt(i).setEnabled(false);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < radioGroupRuleCheck2.getChildCount(); i++) {
|
for (int i = 0; i < radioGroupRuleCheck2.getChildCount(); i++) {
|
||||||
((RadioButton) radioGroupRuleCheck2.getChildAt(i)).setEnabled(false);
|
radioGroupRuleCheck2.getChildAt(i).setEnabled(false);
|
||||||
}
|
}
|
||||||
editTextRuleValue.setEnabled(true);
|
editTextRuleValue.setEnabled(true);
|
||||||
matchTypeLayout.setVisibility(View.GONE);
|
matchTypeLayout.setVisibility(View.GONE);
|
||||||
@ -358,10 +318,10 @@ public class RuleActivity extends AppCompatActivity {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
for (int i = 0; i < radioGroupRuleCheck.getChildCount(); i++) {
|
for (int i = 0; i < radioGroupRuleCheck.getChildCount(); i++) {
|
||||||
((RadioButton) radioGroupRuleCheck.getChildAt(i)).setEnabled(true);
|
radioGroupRuleCheck.getChildAt(i).setEnabled(true);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < radioGroupRuleCheck2.getChildCount(); i++) {
|
for (int i = 0; i < radioGroupRuleCheck2.getChildCount(); i++) {
|
||||||
((RadioButton) radioGroupRuleCheck2.getChildAt(i)).setEnabled(true);
|
radioGroupRuleCheck2.getChildAt(i).setEnabled(true);
|
||||||
}
|
}
|
||||||
editTextRuleValue.setEnabled(true);
|
editTextRuleValue.setEnabled(true);
|
||||||
break;
|
break;
|
||||||
@ -380,47 +340,42 @@ public class RuleActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(RuleActivity.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(RuleActivity.this);
|
||||||
builder.setTitle("选择发送方");
|
builder.setTitle("选择发送方");
|
||||||
builder.setItems(senderNames, new DialogInterface.OnClickListener() {//添加列表
|
//添加列表
|
||||||
@Override
|
builder.setItems(senderNames, (dialogInterface, which) -> {
|
||||||
public void onClick(DialogInterface dialogInterface, int which) {
|
Toast.makeText(RuleActivity.this, senderNames[which], Toast.LENGTH_LONG).show();
|
||||||
Toast.makeText(RuleActivity.this, senderNames[which], Toast.LENGTH_LONG).show();
|
showTv.setText(senderNames[which]);
|
||||||
showTv.setText(senderNames[which]);
|
showTv.setTag(senderModels.get(which).getId());
|
||||||
showTv.setTag(senderModels.get(which).getId());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRule(final RuleModel ruleModel, final Long senderId) {
|
public void testRule(final RuleModel ruleModel, final Long senderId) {
|
||||||
final View view = View.inflate(RuleActivity.this, R.layout.alert_dialog_setview_rule_test, null);
|
final View view = View.inflate(RuleActivity.this, R.layout.alert_dialog_setview_rule_test, null);
|
||||||
final RadioGroup radioGroupTestSimSlot = (RadioGroup) view.findViewById(R.id.radioGroupTestSimSlot);
|
final RadioGroup radioGroupTestSimSlot = view.findViewById(R.id.radioGroupTestSimSlot);
|
||||||
final EditText editTextTestPhone = (EditText) view.findViewById(R.id.editTextTestPhone);
|
final EditText editTextTestPhone = view.findViewById(R.id.editTextTestPhone);
|
||||||
final EditText editTextTestMsgContent = (EditText) view.findViewById(R.id.editTextTestMsgContent);
|
final EditText editTextTestMsgContent = view.findViewById(R.id.editTextTestMsgContent);
|
||||||
Button buttonruletest = view.findViewById(R.id.buttonruletest);
|
Button buttonRuleTest = view.findViewById(R.id.buttonRuleTest);
|
||||||
AlertDialog.Builder ad1 = new AlertDialog.Builder(RuleActivity.this);
|
AlertDialog.Builder ad1 = new AlertDialog.Builder(RuleActivity.this);
|
||||||
ad1.setTitle("测试规则");
|
ad1.setTitle("测试规则");
|
||||||
ad1.setIcon(android.R.drawable.ic_dialog_email);
|
ad1.setIcon(android.R.drawable.ic_dialog_email);
|
||||||
ad1.setView(view);
|
ad1.setView(view);
|
||||||
buttonruletest.setOnClickListener(new View.OnClickListener() {
|
buttonRuleTest.setOnClickListener(v -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
Log.i("editTextTestPhone", editTextTestPhone.getText().toString());
|
Log.i("editTextTestPhone", editTextTestPhone.getText().toString());
|
||||||
Log.i("editTextTestMsgContent", editTextTestMsgContent.getText().toString());
|
Log.i("editTextTestMsgContent", editTextTestMsgContent.getText().toString());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String simSlot = RuleModel.getRuleSimSlotFromCheckId(radioGroupTestSimSlot.getCheckedRadioButtonId());
|
String simSlot = RuleModel.getRuleSimSlotFromCheckId(radioGroupTestSimSlot.getCheckedRadioButtonId());
|
||||||
String simInfo = "";
|
String simInfo;
|
||||||
if (simSlot.equals("SIM2")) {
|
if (simSlot.equals("SIM2")) {
|
||||||
simInfo = simSlot + "_" + SettingUtil.getAddExtraSim2();
|
simInfo = simSlot + "_" + SettingUtil.getAddExtraSim2();
|
||||||
} else {
|
} else {
|
||||||
simInfo = simSlot + "_" + SettingUtil.getAddExtraSim1();
|
simInfo = simSlot + "_" + SettingUtil.getAddExtraSim1();
|
||||||
}
|
|
||||||
SmsVo testSmsVo = new SmsVo(editTextTestPhone.getText().toString(), editTextTestMsgContent.getText().toString(), new Date(), simInfo);
|
|
||||||
SendUtil.sendMsgByRuleModelSenderId(handler, ruleModel, testSmsVo, senderId);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Toast.makeText(RuleActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
}
|
||||||
|
SmsVo testSmsVo = new SmsVo(editTextTestPhone.getText().toString(), editTextTestMsgContent.getText().toString(), new Date(), simInfo);
|
||||||
|
SendUtil.sendMsgByRuleModelSenderId(handler, ruleModel, testSmsVo, senderId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toast.makeText(RuleActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ad1.show();// 显示对话框
|
ad1.show();// 显示对话框
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
|||||||
package com.idormy.sms.forwarder;
|
package com.idormy.sms.forwarder;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CompoundButton;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
@ -18,61 +18,58 @@ import com.idormy.sms.forwarder.utils.SettingUtil;
|
|||||||
|
|
||||||
|
|
||||||
public class SettingActivity extends AppCompatActivity {
|
public class SettingActivity extends AppCompatActivity {
|
||||||
private String TAG = "SettingActivity";
|
private final String TAG = "SettingActivity";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
Log.d(TAG, "oncreate");
|
Log.d(TAG, "onCreate");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_setting);
|
setContentView(R.layout.activity_setting);
|
||||||
|
|
||||||
Switch switch_add_extra = (Switch) findViewById(R.id.switch_add_extra);
|
@SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_add_extra = findViewById(R.id.switch_add_extra);
|
||||||
switchAddExtra(switch_add_extra);
|
switchAddExtra(switch_add_extra);
|
||||||
|
|
||||||
EditText et_add_extra_device_mark = (EditText) findViewById(R.id.et_add_extra_device_mark);
|
EditText et_add_extra_device_mark = findViewById(R.id.et_add_extra_device_mark);
|
||||||
editAddExtraDeviceMark(et_add_extra_device_mark);
|
editAddExtraDeviceMark(et_add_extra_device_mark);
|
||||||
|
|
||||||
EditText et_add_extra_sim1 = (EditText) findViewById(R.id.et_add_extra_sim1);
|
EditText et_add_extra_sim1 = findViewById(R.id.et_add_extra_sim1);
|
||||||
editAddExtraSim1(et_add_extra_sim1);
|
editAddExtraSim1(et_add_extra_sim1);
|
||||||
|
|
||||||
EditText et_add_extra_sim2 = (EditText) findViewById(R.id.et_add_extra_sim2);
|
EditText et_add_extra_sim2 = findViewById(R.id.et_add_extra_sim2);
|
||||||
editAddExtraSim2(et_add_extra_sim2);
|
editAddExtraSim2(et_add_extra_sim2);
|
||||||
|
|
||||||
EditText et_battery_level_alarm = (EditText) findViewById(R.id.et_battery_level_alarm);
|
EditText et_battery_level_alarm = findViewById(R.id.et_battery_level_alarm);
|
||||||
editBatteryLevelAlarm(et_battery_level_alarm);
|
editBatteryLevelAlarm(et_battery_level_alarm);
|
||||||
|
|
||||||
EditText et_retry_delay_time1 = (EditText) findViewById(R.id.et_retry_delay_time1);
|
EditText et_retry_delay_time1 = findViewById(R.id.et_retry_delay_time1);
|
||||||
editRetryDelayTime(et_retry_delay_time1, 1);
|
editRetryDelayTime(et_retry_delay_time1, 1);
|
||||||
EditText et_retry_delay_time2 = (EditText) findViewById(R.id.et_retry_delay_time2);
|
EditText et_retry_delay_time2 = findViewById(R.id.et_retry_delay_time2);
|
||||||
editRetryDelayTime(et_retry_delay_time2, 2);
|
editRetryDelayTime(et_retry_delay_time2, 2);
|
||||||
EditText et_retry_delay_time3 = (EditText) findViewById(R.id.et_retry_delay_time3);
|
EditText et_retry_delay_time3 = findViewById(R.id.et_retry_delay_time3);
|
||||||
editRetryDelayTime(et_retry_delay_time3, 3);
|
editRetryDelayTime(et_retry_delay_time3, 3);
|
||||||
EditText et_retry_delay_time4 = (EditText) findViewById(R.id.et_retry_delay_time4);
|
EditText et_retry_delay_time4 = findViewById(R.id.et_retry_delay_time4);
|
||||||
editRetryDelayTime(et_retry_delay_time4, 4);
|
editRetryDelayTime(et_retry_delay_time4, 4);
|
||||||
EditText et_retry_delay_time5 = (EditText) findViewById(R.id.et_retry_delay_time5);
|
EditText et_retry_delay_time5 = findViewById(R.id.et_retry_delay_time5);
|
||||||
editRetryDelayTime(et_retry_delay_time5, 5);
|
editRetryDelayTime(et_retry_delay_time5, 5);
|
||||||
|
|
||||||
Switch switch_sms_template = (Switch) findViewById(R.id.switch_sms_template);
|
@SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_sms_template = findViewById(R.id.switch_sms_template);
|
||||||
switchSmsTemplate(switch_sms_template);
|
switchSmsTemplate(switch_sms_template);
|
||||||
|
|
||||||
EditText textSmsTemplate = (EditText) findViewById(R.id.text_sms_template);
|
EditText textSmsTemplate = findViewById(R.id.text_sms_template);
|
||||||
editSmsTemplate(textSmsTemplate);
|
editSmsTemplate(textSmsTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置转发附加信息
|
//设置转发附加信息
|
||||||
private void switchAddExtra(Switch switch_add_extra) {
|
private void switchAddExtra(@SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_add_extra) {
|
||||||
switch_add_extra.setChecked(SettingUtil.getSwitchAddExtra());
|
switch_add_extra.setChecked(SettingUtil.getSwitchAddExtra());
|
||||||
|
|
||||||
switch_add_extra.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
|
switch_add_extra.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
@Override
|
SettingUtil.switchAddExtra(isChecked);
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
Log.d(TAG, "onCheckedChanged:" + isChecked);
|
||||||
SettingUtil.switchAddExtra(isChecked);
|
|
||||||
Log.d(TAG, "onCheckedChanged:" + isChecked);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置转发附加信息devicemark
|
//设置转发附加信息deviceMark
|
||||||
private void editAddExtraDeviceMark(final EditText et_add_extra_device_mark) {
|
private void editAddExtraDeviceMark(final EditText et_add_extra_device_mark) {
|
||||||
et_add_extra_device_mark.setText(SettingUtil.getAddExtraDeviceMark());
|
et_add_extra_device_mark.setText(SettingUtil.getAddExtraDeviceMark());
|
||||||
|
|
||||||
@ -94,7 +91,7 @@ public class SettingActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置转发附加信息devicemark
|
//设置转发附加信息deviceMark
|
||||||
private void editAddExtraSim1(final EditText et_add_extra_sim1) {
|
private void editAddExtraSim1(final EditText et_add_extra_sim1) {
|
||||||
et_add_extra_sim1.setText(SettingUtil.getAddExtraSim1());
|
et_add_extra_sim1.setText(SettingUtil.getAddExtraSim1());
|
||||||
|
|
||||||
@ -116,7 +113,7 @@ public class SettingActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置转发附加信息devicemark
|
//设置转发附加信息deviceMark
|
||||||
private void editAddExtraSim2(final EditText et_add_extra_sim2) {
|
private void editAddExtraSim2(final EditText et_add_extra_sim2) {
|
||||||
et_add_extra_sim2.setText(SettingUtil.getAddExtraSim2());
|
et_add_extra_sim2.setText(SettingUtil.getAddExtraSim2());
|
||||||
|
|
||||||
@ -180,28 +177,25 @@ public class SettingActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//设置转发时启用自定义模版
|
//设置转发时启用自定义模版
|
||||||
private void switchSmsTemplate(Switch switch_sms_template) {
|
private void switchSmsTemplate(@SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_sms_template) {
|
||||||
boolean isOn = SettingUtil.getSwitchSmsTemplate();
|
boolean isOn = SettingUtil.getSwitchSmsTemplate();
|
||||||
switch_sms_template.setChecked(isOn);
|
switch_sms_template.setChecked(isOn);
|
||||||
|
|
||||||
final LinearLayout layout_sms_template = (LinearLayout) findViewById(R.id.layout_sms_template);
|
final LinearLayout layout_sms_template = findViewById(R.id.layout_sms_template);
|
||||||
layout_sms_template.setVisibility(isOn ? View.VISIBLE : View.GONE);
|
layout_sms_template.setVisibility(isOn ? View.VISIBLE : View.GONE);
|
||||||
final EditText textSmsTemplate = (EditText) findViewById(R.id.text_sms_template);
|
final EditText textSmsTemplate = findViewById(R.id.text_sms_template);
|
||||||
|
|
||||||
switch_sms_template.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
|
switch_sms_template.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
@Override
|
Log.d(TAG, "onCheckedChanged:" + isChecked);
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
layout_sms_template.setVisibility(isChecked ? View.VISIBLE : View.GONE);
|
||||||
Log.d(TAG, "onCheckedChanged:" + isChecked);
|
SettingUtil.switchSmsTemplate(isChecked);
|
||||||
layout_sms_template.setVisibility(isChecked ? View.VISIBLE : View.GONE);
|
if (!isChecked) {
|
||||||
SettingUtil.switchSmsTemplate(isChecked);
|
textSmsTemplate.setText("{{来源号码}}\n{{短信内容}}\n{{卡槽信息}}\n{{接收时间}}\n{{设备名称}}");
|
||||||
if (!isChecked) {
|
|
||||||
textSmsTemplate.setText("{{来源号码}}\n{{短信内容}}\n{{卡槽信息}}\n{{接收时间}}\n{{设备名称}}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置转发附加信息devicemark
|
//设置转发附加信息deviceMark
|
||||||
private void editSmsTemplate(final EditText textSmsTemplate) {
|
private void editSmsTemplate(final EditText textSmsTemplate) {
|
||||||
textSmsTemplate.setText(SettingUtil.getSmsTemplate());
|
textSmsTemplate.setText(SettingUtil.getSmsTemplate());
|
||||||
|
|
||||||
@ -224,17 +218,15 @@ public class SettingActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//插入标签
|
//插入标签
|
||||||
|
@SuppressLint("NonConstantResourceId")
|
||||||
public void toInsertLabel(View v) {
|
public void toInsertLabel(View v) {
|
||||||
EditText textSmsTemplate = (EditText) findViewById(R.id.text_sms_template);
|
EditText textSmsTemplate = findViewById(R.id.text_sms_template);
|
||||||
textSmsTemplate.setFocusable(true);
|
textSmsTemplate.setFocusable(true);
|
||||||
textSmsTemplate.requestFocus();
|
textSmsTemplate.requestFocus();
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.bt_insert_sender:
|
case R.id.bt_insert_sender:
|
||||||
textSmsTemplate.append("{{来源号码}}");
|
textSmsTemplate.append("{{来源号码}}");
|
||||||
return;
|
return;
|
||||||
/*case R.id.bt_insert_receiver:
|
|
||||||
textSmsTemplate.append("{{接收号码}}");
|
|
||||||
return;*/
|
|
||||||
case R.id.bt_insert_content:
|
case R.id.bt_insert_content:
|
||||||
textSmsTemplate.append("{{短信内容}}");
|
textSmsTemplate.append("{{短信内容}}");
|
||||||
return;
|
return;
|
||||||
@ -248,33 +240,32 @@ public class SettingActivity extends AppCompatActivity {
|
|||||||
textSmsTemplate.append("{{设备名称}}");
|
textSmsTemplate.append("{{设备名称}}");
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//恢复初始化配置
|
//恢复初始化配置
|
||||||
public void initSetting(View v) {
|
public void initSetting(View view) {
|
||||||
Switch switch_add_extra = (Switch) findViewById(R.id.switch_add_extra);
|
@SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_add_extra = findViewById(R.id.switch_add_extra);
|
||||||
switch_add_extra.setChecked(false);
|
switch_add_extra.setChecked(false);
|
||||||
switchAddExtra(switch_add_extra);
|
switchAddExtra(switch_add_extra);
|
||||||
|
|
||||||
EditText et_add_extra_device_mark = (EditText) findViewById(R.id.et_add_extra_device_mark);
|
EditText et_add_extra_device_mark = findViewById(R.id.et_add_extra_device_mark);
|
||||||
et_add_extra_device_mark.setText("");
|
et_add_extra_device_mark.setText("");
|
||||||
editAddExtraDeviceMark(et_add_extra_device_mark);
|
editAddExtraDeviceMark(et_add_extra_device_mark);
|
||||||
|
|
||||||
EditText et_add_extra_sim1 = (EditText) findViewById(R.id.et_add_extra_sim1);
|
EditText et_add_extra_sim1 = findViewById(R.id.et_add_extra_sim1);
|
||||||
et_add_extra_sim1.setText("");
|
et_add_extra_sim1.setText("");
|
||||||
editAddExtraSim1(et_add_extra_sim1);
|
editAddExtraSim1(et_add_extra_sim1);
|
||||||
|
|
||||||
EditText et_add_extra_sim2 = (EditText) findViewById(R.id.et_add_extra_sim2);
|
EditText et_add_extra_sim2 = findViewById(R.id.et_add_extra_sim2);
|
||||||
et_add_extra_sim2.setText("");
|
et_add_extra_sim2.setText("");
|
||||||
editAddExtraSim2(et_add_extra_sim2);
|
editAddExtraSim2(et_add_extra_sim2);
|
||||||
|
|
||||||
Switch switch_sms_template = (Switch) findViewById(R.id.switch_sms_template);
|
@SuppressLint("UseSwitchCompatOrMaterialCode") Switch switch_sms_template = findViewById(R.id.switch_sms_template);
|
||||||
switch_sms_template.setChecked(false);
|
switch_sms_template.setChecked(false);
|
||||||
switchSmsTemplate(switch_sms_template);
|
switchSmsTemplate(switch_sms_template);
|
||||||
|
|
||||||
EditText textSmsTemplate = (EditText) findViewById(R.id.text_sms_template);
|
EditText textSmsTemplate = findViewById(R.id.text_sms_template);
|
||||||
textSmsTemplate.setText("{{来源号码}}\n{{短信内容}}\n{{卡槽信息}}\n{{接收时间}}\n{{设备名称}}");
|
textSmsTemplate.setText("{{来源号码}}\n{{短信内容}}\n{{卡槽信息}}\n{{接收时间}}\n{{设备名称}}");
|
||||||
editSmsTemplate(textSmsTemplate);
|
editSmsTemplate(textSmsTemplate);
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.adapter;
|
package com.idormy.sms.forwarder.adapter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -15,8 +14,9 @@ import com.idormy.sms.forwarder.utils.aUtil;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class LogAdapter extends ArrayAdapter<LogVo> {
|
public class LogAdapter extends ArrayAdapter<LogVo> {
|
||||||
private int resourceId;
|
private final int resourceId;
|
||||||
private List<LogVo> list;
|
private List<LogVo> list;
|
||||||
|
|
||||||
// 适配器的构造函数,把要适配的数据传入这里
|
// 适配器的构造函数,把要适配的数据传入这里
|
||||||
@ -112,7 +112,7 @@ public class LogAdapter extends ArrayAdapter<LogVo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 定义一个内部类,用于对控件的实例进行缓存
|
// 定义一个内部类,用于对控件的实例进行缓存
|
||||||
class ViewHolder {
|
static class ViewHolder {
|
||||||
TextView tLogFrom;
|
TextView tLogFrom;
|
||||||
TextView tLogContent;
|
TextView tLogContent;
|
||||||
TextView tLogRule;
|
TextView tLogRule;
|
||||||
|
@ -16,7 +16,7 @@ import com.idormy.sms.forwarder.sender.SenderUtil;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RuleAdapter extends ArrayAdapter<RuleModel> {
|
public class RuleAdapter extends ArrayAdapter<RuleModel> {
|
||||||
private int resourceId;
|
private final int resourceId;
|
||||||
private List<RuleModel> list;
|
private List<RuleModel> list;
|
||||||
|
|
||||||
// 适配器的构造函数,把要适配的数据传入这里
|
// 适配器的构造函数,把要适配的数据传入这里
|
||||||
@ -108,7 +108,7 @@ public class RuleAdapter extends ArrayAdapter<RuleModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 定义一个内部类,用于对控件的实例进行缓存
|
// 定义一个内部类,用于对控件的实例进行缓存
|
||||||
class ViewHolder {
|
static class ViewHolder {
|
||||||
TextView ruleMatch;
|
TextView ruleMatch;
|
||||||
TextView ruleSender;
|
TextView ruleSender;
|
||||||
ImageView ruleSenderImage;
|
ImageView ruleSenderImage;
|
||||||
|
@ -13,8 +13,9 @@ import com.idormy.sms.forwarder.model.SenderModel;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class SenderAdapter extends ArrayAdapter<SenderModel> {
|
public class SenderAdapter extends ArrayAdapter<SenderModel> {
|
||||||
private int resourceId;
|
private final int resourceId;
|
||||||
private List<SenderModel> list;
|
private List<SenderModel> list;
|
||||||
|
|
||||||
// 适配器的构造函数,把要适配的数据传入这里
|
// 适配器的构造函数,把要适配的数据传入这里
|
||||||
@ -120,7 +121,7 @@ public class SenderAdapter extends ArrayAdapter<SenderModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 定义一个内部类,用于对控件的实例进行缓存
|
// 定义一个内部类,用于对控件的实例进行缓存
|
||||||
class ViewHolder {
|
static class ViewHolder {
|
||||||
ImageView senderImage;
|
ImageView senderImage;
|
||||||
TextView senderName;
|
TextView senderName;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.idormy.sms.forwarder.model;
|
package com.idormy.sms.forwarder.model;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -17,6 +19,7 @@ public class LogModel {
|
|||||||
this.ruleId = ruleId;
|
this.ruleId = ruleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "LogModel{" +
|
return "LogModel{" +
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.idormy.sms.forwarder.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PhoneBookEntity {
|
||||||
|
private String name;
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
public PhoneBookEntity(String name, String phoneNumber) {
|
||||||
|
this.name = name;
|
||||||
|
this.phoneNumber = phoneNumber;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,10 @@
|
|||||||
package com.idormy.sms.forwarder.model;
|
package com.idormy.sms.forwarder.model;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.R;
|
import com.idormy.sms.forwarder.R;
|
||||||
import com.idormy.sms.forwarder.model.vo.SmsVo;
|
import com.idormy.sms.forwarder.model.vo.SmsVo;
|
||||||
import com.idormy.sms.forwarder.utils.RuleLineUtils;
|
import com.idormy.sms.forwarder.utils.RuleLineUtils;
|
||||||
@ -14,13 +17,14 @@ import java.util.regex.PatternSyntaxException;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@SuppressWarnings({"unused", "LoopStatementThatDoesntLoop"})
|
||||||
@Data
|
@Data
|
||||||
public class RuleModel {
|
public class RuleModel {
|
||||||
public static final String FILED_TRANSPOND_ALL = "transpond_all";
|
public static final String FILED_TRANSPOND_ALL = "transpond_all";
|
||||||
public static final String FILED_PHONE_NUM = "phone_num";
|
public static final String FILED_PHONE_NUM = "phone_num";
|
||||||
public static final String FILED_MSG_CONTENT = "msg_content";
|
public static final String FILED_MSG_CONTENT = "msg_content";
|
||||||
public static final String FILED_MULTI_MATCH = "multi_match";
|
public static final String FILED_MULTI_MATCH = "multi_match";
|
||||||
public static final Map<String, String> FILED_MAP = new HashMap<String, String>();
|
public static final Map<String, String> FILED_MAP = new HashMap<>();
|
||||||
public static final String CHECK_IS = "is";
|
public static final String CHECK_IS = "is";
|
||||||
public static final String CHECK_CONTAIN = "contain";
|
public static final String CHECK_CONTAIN = "contain";
|
||||||
public static final String CHECK_NOT_CONTAIN = "notcontain";
|
public static final String CHECK_NOT_CONTAIN = "notcontain";
|
||||||
@ -28,11 +32,11 @@ public class RuleModel {
|
|||||||
public static final String CHECK_END_WITH = "endwith";
|
public static final String CHECK_END_WITH = "endwith";
|
||||||
public static final String CHECK_NOT_IS = "notis";
|
public static final String CHECK_NOT_IS = "notis";
|
||||||
public static final String CHECK_REGEX = "regex";
|
public static final String CHECK_REGEX = "regex";
|
||||||
public static final Map<String, String> CHECK_MAP = new HashMap<String, String>();
|
public static final Map<String, String> CHECK_MAP = new HashMap<>();
|
||||||
public static final String CHECK_SIM_SLOT_ALL = "ALL";
|
public static final String CHECK_SIM_SLOT_ALL = "ALL";
|
||||||
public static final String CHECK_SIM_SLOT_1 = "SIM1";
|
public static final String CHECK_SIM_SLOT_1 = "SIM1";
|
||||||
public static final String CHECK_SIM_SLOT_2 = "SIM2";
|
public static final String CHECK_SIM_SLOT_2 = "SIM2";
|
||||||
public static final Map<String, String> SIM_SLOT_MAP = new HashMap<String, String>();
|
public static final Map<String, String> SIM_SLOT_MAP = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
FILED_MAP.put("transpond_all", "全部转发");
|
FILED_MAP.put("transpond_all", "全部转发");
|
||||||
@ -75,6 +79,7 @@ public class RuleModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NonConstantResourceId")
|
||||||
public static String getRuleFiledFromCheckId(int id) {
|
public static String getRuleFiledFromCheckId(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case R.id.btnContent:
|
case R.id.btnContent:
|
||||||
@ -88,6 +93,7 @@ public class RuleModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NonConstantResourceId")
|
||||||
public static String getRuleCheckFromCheckId(int id) {
|
public static String getRuleCheckFromCheckId(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case R.id.btnContain:
|
case R.id.btnContain:
|
||||||
@ -105,6 +111,7 @@ public class RuleModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NonConstantResourceId")
|
||||||
public static String getRuleSimSlotFromCheckId(int id) {
|
public static String getRuleSimSlotFromCheckId(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case R.id.btnSimSlot1:
|
case R.id.btnSimSlot1:
|
||||||
@ -191,7 +198,6 @@ public class RuleModel {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (PatternSyntaxException e) {
|
} catch (PatternSyntaxException e) {
|
||||||
checked = false;
|
|
||||||
Log.d(TAG, "PatternSyntaxException: ");
|
Log.d(TAG, "PatternSyntaxException: ");
|
||||||
Log.d(TAG, "Description: " + e.getDescription());
|
Log.d(TAG, "Description: " + e.getDescription());
|
||||||
Log.d(TAG, "Index: " + e.getIndex());
|
Log.d(TAG, "Index: " + e.getIndex());
|
||||||
@ -265,6 +271,7 @@ public class RuleModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "RuleModel{" +
|
return "RuleModel{" +
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.idormy.sms.forwarder.model;
|
package com.idormy.sms.forwarder.model;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.R;
|
import com.idormy.sms.forwarder.R;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Data
|
@Data
|
||||||
public class SenderModel {
|
public class SenderModel {
|
||||||
public static final int STATUS_ON = 1;
|
public static final int STATUS_ON = 1;
|
||||||
@ -98,6 +101,7 @@ public class SenderModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SenderModel{" +
|
return "SenderModel{" +
|
||||||
|
@ -8,9 +8,6 @@ import lombok.Data;
|
|||||||
public class BarkSettingVo implements Serializable {
|
public class BarkSettingVo implements Serializable {
|
||||||
private String server;
|
private String server;
|
||||||
|
|
||||||
public BarkSettingVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public BarkSettingVo(String server) {
|
public BarkSettingVo(String server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
}
|
}
|
||||||
|
@ -8,16 +8,13 @@ import lombok.Data;
|
|||||||
public class DingDingSettingVo implements Serializable {
|
public class DingDingSettingVo implements Serializable {
|
||||||
private String token;
|
private String token;
|
||||||
private String secret;
|
private String secret;
|
||||||
private String atMobils;
|
private String atMobiles;
|
||||||
private Boolean atAll;
|
private Boolean atAll;
|
||||||
|
|
||||||
public DingDingSettingVo() {
|
public DingDingSettingVo(String token, String secret, String atMobiles, Boolean atAll) {
|
||||||
}
|
|
||||||
|
|
||||||
public DingDingSettingVo(String token, String secret, String atMobils, Boolean atAll) {
|
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.secret = secret;
|
this.secret = secret;
|
||||||
this.atMobils = atMobils;
|
this.atMobiles = atMobiles;
|
||||||
this.atAll = atAll;
|
this.atAll = atAll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,15 +8,12 @@ import lombok.Data;
|
|||||||
public class EmailSettingVo implements Serializable {
|
public class EmailSettingVo implements Serializable {
|
||||||
private String host;
|
private String host;
|
||||||
private String port;
|
private String port;
|
||||||
private Boolean ssl = true;
|
private Boolean ssl;
|
||||||
private String fromEmail;
|
private String fromEmail;
|
||||||
private String nickname;
|
private String nickname;
|
||||||
private String pwd;
|
private String pwd;
|
||||||
private String toEmail;
|
private String toEmail;
|
||||||
|
|
||||||
public EmailSettingVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public EmailSettingVo(String host, String port, Boolean ssl, String fromEmail, String nickname, String pwd, String toEmail) {
|
public EmailSettingVo(String host, String port, Boolean ssl, String fromEmail, String nickname, String pwd, String toEmail) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
|
@ -9,9 +9,6 @@ public class FeiShuSettingVo implements Serializable {
|
|||||||
private String webhook;
|
private String webhook;
|
||||||
private String secret;
|
private String secret;
|
||||||
|
|
||||||
public FeiShuSettingVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public FeiShuSettingVo(String webhook, String secret) {
|
public FeiShuSettingVo(String webhook, String secret) {
|
||||||
this.webhook = webhook;
|
this.webhook = webhook;
|
||||||
this.secret = secret;
|
this.secret = secret;
|
||||||
|
@ -16,9 +16,6 @@ public class LogVo {
|
|||||||
private int forwardStatus;
|
private int forwardStatus;
|
||||||
private String forwardResponse;
|
private String forwardResponse;
|
||||||
|
|
||||||
public LogVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public LogVo(Long id, String from, String content, String simInfo, String time, String rule, int senderImageId, int forwardStatus, String forwardResponse) {
|
public LogVo(Long id, String from, String content, String simInfo, String time, String rule, int senderImageId, int forwardStatus, String forwardResponse) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.from = from;
|
this.from = from;
|
||||||
@ -33,7 +30,7 @@ public class LogVo {
|
|||||||
|
|
||||||
public int getSimImageId() {
|
public int getSimImageId() {
|
||||||
if (this.simInfo != null && !this.simInfo.isEmpty()
|
if (this.simInfo != null && !this.simInfo.isEmpty()
|
||||||
&& this.simInfo.replace("-", "").substring(0, 4).equals("SIM2")) {
|
&& this.simInfo.replace("-", "").startsWith("SIM2")) {
|
||||||
return R.mipmap.sim2;
|
return R.mipmap.sim2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,9 +12,6 @@ public class QYWXAppSettingVo implements Serializable {
|
|||||||
private String toUser;
|
private String toUser;
|
||||||
private Boolean atAll;
|
private Boolean atAll;
|
||||||
|
|
||||||
public QYWXAppSettingVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public QYWXAppSettingVo(String corpID, String agentID, String secret, String toUser, Boolean atAll) {
|
public QYWXAppSettingVo(String corpID, String agentID, String secret, String toUser, Boolean atAll) {
|
||||||
this.corpID = corpID;
|
this.corpID = corpID;
|
||||||
this.agentID = agentID;
|
this.agentID = agentID;
|
||||||
|
@ -8,9 +8,6 @@ import lombok.Data;
|
|||||||
public class QYWXGroupRobotSettingVo implements Serializable {
|
public class QYWXGroupRobotSettingVo implements Serializable {
|
||||||
private String webHook;
|
private String webHook;
|
||||||
|
|
||||||
public QYWXGroupRobotSettingVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public QYWXGroupRobotSettingVo(String webHook) {
|
public QYWXGroupRobotSettingVo(String webHook) {
|
||||||
this.webHook = webHook;
|
this.webHook = webHook;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.idormy.sms.forwarder.model.vo;
|
package com.idormy.sms.forwarder.model.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
public class RuleVo {
|
public class RuleVo {
|
||||||
private String matchStr;
|
private String matchStr;
|
||||||
private String senderStr;
|
private String senderStr;
|
||||||
|
@ -8,9 +8,6 @@ import lombok.Data;
|
|||||||
public class ServerChanSettingVo implements Serializable {
|
public class ServerChanSettingVo implements Serializable {
|
||||||
private String sendKey;
|
private String sendKey;
|
||||||
|
|
||||||
public ServerChanSettingVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerChanSettingVo(String sendKey) {
|
public ServerChanSettingVo(String sendKey) {
|
||||||
this.sendKey = sendKey;
|
this.sendKey = sendKey;
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,6 @@ public class SmsSettingVo implements Serializable {
|
|||||||
private String mobiles;
|
private String mobiles;
|
||||||
private Boolean onlyNoNetwork;
|
private Boolean onlyNoNetwork;
|
||||||
|
|
||||||
public SmsSettingVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public SmsSettingVo(int simSlot, String mobiles, Boolean onlyNoNetwork) {
|
public SmsSettingVo(int simSlot, String mobiles, Boolean onlyNoNetwork) {
|
||||||
this.simSlot = simSlot;
|
this.simSlot = simSlot;
|
||||||
this.mobiles = mobiles;
|
this.mobiles = mobiles;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package com.idormy.sms.forwarder.model.vo;
|
package com.idormy.sms.forwarder.model.vo;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.utils.SettingUtil;
|
import com.idormy.sms.forwarder.utils.SettingUtil;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -13,10 +17,7 @@ public class SmsVo implements Serializable {
|
|||||||
String mobile;
|
String mobile;
|
||||||
String content;
|
String content;
|
||||||
Date date;
|
Date date;
|
||||||
String simInfo = "SIM1_unknown_unknown";
|
String simInfo;
|
||||||
|
|
||||||
public SmsVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public SmsVo(String mobile, String content, Date date, String simInfo) {
|
public SmsVo(String mobile, String content, Date date, String simInfo) {
|
||||||
this.mobile = mobile;
|
this.mobile = mobile;
|
||||||
@ -25,6 +26,7 @@ public class SmsVo implements Serializable {
|
|||||||
this.simInfo = simInfo;
|
this.simInfo = simInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
public String getSmsVoForSend() {
|
public String getSmsVoForSend() {
|
||||||
boolean switchAddExtra = SettingUtil.getSwitchAddExtra();
|
boolean switchAddExtra = SettingUtil.getSwitchAddExtra();
|
||||||
boolean switchSmsTemplate = SettingUtil.getSwitchSmsTemplate();
|
boolean switchSmsTemplate = SettingUtil.getSwitchSmsTemplate();
|
||||||
@ -46,6 +48,7 @@ public class SmsVo implements Serializable {
|
|||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SmsVo{" +
|
return "SmsVo{" +
|
||||||
|
@ -9,9 +9,6 @@ public class TelegramSettingVo implements Serializable {
|
|||||||
private String apiToken;
|
private String apiToken;
|
||||||
private String chatId;
|
private String chatId;
|
||||||
|
|
||||||
public TelegramSettingVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public TelegramSettingVo(String apiToken, String chatId) {
|
public TelegramSettingVo(String apiToken, String chatId) {
|
||||||
this.apiToken = apiToken;
|
this.apiToken = apiToken;
|
||||||
this.chatId = chatId;
|
this.chatId = chatId;
|
||||||
|
@ -13,9 +13,6 @@ public class WebNotifySettingVo implements Serializable {
|
|||||||
private String method;
|
private String method;
|
||||||
private String webParams;
|
private String webParams;
|
||||||
|
|
||||||
public WebNotifySettingVo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public WebNotifySettingVo(String webServer, String secret, String method, String webParams) {
|
public WebNotifySettingVo(String webServer, String secret, String method, String webParams) {
|
||||||
this.webServer = webServer;
|
this.webServer = webServer;
|
||||||
this.secret = secret;
|
this.secret = secret;
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.idormy.sms.forwarder.receiver;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.idormy.sms.forwarder.R;
|
||||||
|
import com.idormy.sms.forwarder.model.PhoneBookEntity;
|
||||||
|
import com.idormy.sms.forwarder.model.vo.SmsVo;
|
||||||
|
import com.idormy.sms.forwarder.sender.SendUtil;
|
||||||
|
import com.idormy.sms.forwarder.utils.ContactHelper;
|
||||||
|
import com.idormy.sms.forwarder.utils.SettingUtil;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PhoneStateReceiver extends BroadcastReceiver {
|
||||||
|
private TelephonyManager mTelephonyManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (!SettingUtil.getSwitchEnablePhone()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String action = intent.getAction();
|
||||||
|
if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) {
|
||||||
|
String phoneNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
|
||||||
|
if (mTelephonyManager == null) {
|
||||||
|
mTelephonyManager =
|
||||||
|
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
}
|
||||||
|
int state = mTelephonyManager.getCallState();
|
||||||
|
Log.d("PhoneStateReceiver", "onReceive state=" + state + " phoneNumber = " + phoneNumber);
|
||||||
|
switch (state) {
|
||||||
|
case TelephonyManager.CALL_STATE_RINGING:
|
||||||
|
if (!TextUtils.isEmpty(phoneNumber)) {
|
||||||
|
sendReceiveCallMsg(context, phoneNumber);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TelephonyManager.CALL_STATE_IDLE:
|
||||||
|
case TelephonyManager.CALL_STATE_OFFHOOK:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendReceiveCallMsg(Context context, String phoneNumber) {
|
||||||
|
List<PhoneBookEntity> contacts = ContactHelper.getInstance().getContactByNumber(context, phoneNumber);
|
||||||
|
String name = "";
|
||||||
|
if (contacts != null && contacts.size() > 0) {
|
||||||
|
PhoneBookEntity phoneBookEntity = contacts.get(0);
|
||||||
|
name = phoneBookEntity.getName();
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(name)) {
|
||||||
|
name = context.getString(R.string.unknown_number);
|
||||||
|
}
|
||||||
|
SmsVo smsVo = new SmsVo(phoneNumber, name + context.getString(R.string.calling), new Date(), name);
|
||||||
|
Log.d("PhoneStateReceiver", "send_msg" + smsVo.toString());
|
||||||
|
SendUtil.send_msg(context, smsVo, 1);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.idormy.sms.forwarder.BroadCastReceiver;
|
package com.idormy.sms.forwarder.receiver;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -10,15 +10,13 @@ import com.idormy.sms.forwarder.service.FrontService;
|
|||||||
import com.idormy.sms.forwarder.utils.InitUtil;
|
import com.idormy.sms.forwarder.utils.InitUtil;
|
||||||
|
|
||||||
public class RebootBroadcastReceiver extends BroadcastReceiver {
|
public class RebootBroadcastReceiver extends BroadcastReceiver {
|
||||||
private String TAG = "RebootBroadcastReceiver";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String receiveAction = intent.getAction();
|
String receiveAction = intent.getAction();
|
||||||
|
String TAG = "RebootBroadcastReceiver";
|
||||||
Log.d(TAG, "onReceive intent " + receiveAction);
|
Log.d(TAG, "onReceive intent " + receiveAction);
|
||||||
if (receiveAction.equals("android.intent.action.BOOT_COMPLETED")) {
|
if (receiveAction.equals("android.intent.action.BOOT_COMPLETED")) {
|
||||||
Log.d(TAG, "BOOT_COMPLETED");
|
|
||||||
|
|
||||||
InitUtil.init(context);
|
InitUtil.init(context);
|
||||||
Intent frontServiceIntent = new Intent(context, FrontService.class);
|
Intent frontServiceIntent = new Intent(context, FrontService.class);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
@ -26,9 +24,6 @@ public class RebootBroadcastReceiver extends BroadcastReceiver {
|
|||||||
} else {
|
} else {
|
||||||
context.startService(frontServiceIntent);
|
context.startService(frontServiceIntent);
|
||||||
}
|
}
|
||||||
//监控当前电量
|
|
||||||
//Intent batteryServiceIntent = new Intent(context, BatteryService.class);
|
|
||||||
//context.startService(batteryServiceIntent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.idormy.sms.forwarder.BroadCastReceiver;
|
package com.idormy.sms.forwarder.receiver;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -20,14 +20,12 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class SmsForwarderBroadcastReceiver extends BroadcastReceiver {
|
public class SmsForwarderBroadcastReceiver extends BroadcastReceiver {
|
||||||
private String TAG = "SmsForwarderBroadcastReceiver";
|
|
||||||
private int intLevel;
|
|
||||||
private int intScale;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
|
||||||
String receiveAction = intent.getAction();
|
String receiveAction = intent.getAction();
|
||||||
|
String TAG = "SmsForwarderBroadcastReceiver";
|
||||||
Log.d(TAG, "onReceive intent " + receiveAction);
|
Log.d(TAG, "onReceive intent " + receiveAction);
|
||||||
if ("android.provider.Telephony.SMS_RECEIVED".equals(receiveAction)) {
|
if ("android.provider.Telephony.SMS_RECEIVED".equals(receiveAction)) {
|
||||||
try {
|
try {
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.sender;
|
package com.idormy.sms.forwarder.sender;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -19,10 +20,12 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@SuppressWarnings({"SynchronizeOnNonFinalField", "unused", "MismatchedQueryAndUpdateOfCollection"})
|
||||||
public class SendHistory {
|
public class SendHistory {
|
||||||
static String TAG = "SendHistory";
|
static final String TAG = "SendHistory";
|
||||||
static Boolean hasInit = false;
|
static Boolean hasInit = false;
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
static Context context;
|
static Context context;
|
||||||
static DbHelper dbHelper;
|
static DbHelper dbHelper;
|
||||||
static SQLiteDatabase db;
|
static SQLiteDatabase db;
|
||||||
@ -37,16 +40,17 @@ public class SendHistory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MutatingSharedPrefs")
|
||||||
public static void addHistory(String msg) {
|
public static void addHistory(String msg) {
|
||||||
//不保存转发消息
|
//不保存转发消息
|
||||||
if (!SettingUtil.saveMsgHistory()) return;
|
if (SettingUtil.saveMsgHistory()) return;
|
||||||
//保存
|
//保存
|
||||||
SharedPreferences sp = context.getSharedPreferences(Define.SP_MSG, Context.MODE_PRIVATE);
|
SharedPreferences sp = context.getSharedPreferences(Define.SP_MSG, Context.MODE_PRIVATE);
|
||||||
Set<String> msg_set_default = new HashSet<>();
|
Set<String> msg_set_default = new HashSet<>();
|
||||||
Set<String> msg_set;
|
Set<String> msg_set;
|
||||||
msg_set = sp.getStringSet(Define.SP_MSG_SET_KEY, msg_set_default);
|
msg_set = sp.getStringSet(Define.SP_MSG_SET_KEY, msg_set_default);
|
||||||
Log.d(TAG, "msg_set:" + msg_set.toString());
|
Log.d(TAG, "msg_set:" + msg_set.toString());
|
||||||
Log.d(TAG, "msg_set:" + Integer.toString(msg_set.size()));
|
Log.d(TAG, "msg_set_size:" + msg_set.size());
|
||||||
msg_set.add(msg);
|
msg_set.add(msg);
|
||||||
sp.edit().putStringSet(Define.SP_MSG_SET_KEY, msg_set).apply();
|
sp.edit().putStringSet(Define.SP_MSG_SET_KEY, msg_set).apply();
|
||||||
}
|
}
|
||||||
@ -56,16 +60,16 @@ public class SendHistory {
|
|||||||
Set<String> msg_set = new HashSet<>();
|
Set<String> msg_set = new HashSet<>();
|
||||||
msg_set = sp.getStringSet(Define.SP_MSG_SET_KEY, msg_set);
|
msg_set = sp.getStringSet(Define.SP_MSG_SET_KEY, msg_set);
|
||||||
Log.d(TAG, "msg_set.toString()" + msg_set.toString());
|
Log.d(TAG, "msg_set.toString()" + msg_set.toString());
|
||||||
String getMsg = "";
|
StringBuilder getMsg = new StringBuilder();
|
||||||
for (String str : msg_set) {
|
for (String str : msg_set) {
|
||||||
getMsg += str + "\n";
|
getMsg.append(str).append("\n");
|
||||||
}
|
}
|
||||||
return getMsg;
|
return getMsg.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long addHistoryDb(LogModel logModel) {
|
public static long addHistoryDb(LogModel logModel) {
|
||||||
//不保存转发消息
|
//不保存转发消息
|
||||||
if (!SettingUtil.saveMsgHistory()) return 0;
|
if (SettingUtil.saveMsgHistory()) return 0;
|
||||||
|
|
||||||
// Gets the data repository in write mode
|
// Gets the data repository in write mode
|
||||||
SQLiteDatabase db = dbHelper.getWritableDatabase();
|
SQLiteDatabase db = dbHelper.getWritableDatabase();
|
||||||
@ -101,7 +105,7 @@ public class SendHistory {
|
|||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
}
|
}
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
// Issue SQL statement.
|
// Issue SQL statement.
|
||||||
return db.delete(LogTable.LogEntry.TABLE_NAME, selection, selectionArgs);
|
return db.delete(LogTable.LogEntry.TABLE_NAME, selection, selectionArgs);
|
||||||
|
|
||||||
@ -134,7 +138,7 @@ public class SendHistory {
|
|||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
}
|
}
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
|
|
||||||
// How you want the results sorted in the resulting Cursor
|
// How you want the results sorted in the resulting Cursor
|
||||||
String sortOrder =
|
String sortOrder =
|
||||||
@ -161,11 +165,11 @@ public class SendHistory {
|
|||||||
Set<String> msg_set = new HashSet<>();
|
Set<String> msg_set = new HashSet<>();
|
||||||
msg_set = sp.getStringSet(Define.SP_MSG_SET_KEY, msg_set);
|
msg_set = sp.getStringSet(Define.SP_MSG_SET_KEY, msg_set);
|
||||||
Log.d(TAG, "msg_set.toString()" + msg_set.toString());
|
Log.d(TAG, "msg_set.toString()" + msg_set.toString());
|
||||||
String getMsg = "";
|
StringBuilder getMsg = new StringBuilder();
|
||||||
for (String str : msg_set) {
|
for (String str : msg_set) {
|
||||||
getMsg += str + "\n";
|
getMsg.append(str).append("\n");
|
||||||
}
|
}
|
||||||
return getMsg;
|
return getMsg.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ import com.idormy.sms.forwarder.utils.RuleUtil;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SendUtil {
|
public class SendUtil {
|
||||||
private static String TAG = "SendUtil";
|
private static final String TAG = "SendUtil";
|
||||||
|
|
||||||
public static void send_msg_list(Context context, List<SmsVo> smsVoList, int simId) {
|
public static void send_msg_list(Context context, List<SmsVo> smsVoList, int simId) {
|
||||||
Log.i(TAG, "send_msg_list size: " + smsVoList.size());
|
Log.i(TAG, "send_msg_list size: " + smsVoList.size());
|
||||||
@ -52,10 +52,10 @@ public class SendUtil {
|
|||||||
LogUtil.init(context);
|
LogUtil.init(context);
|
||||||
|
|
||||||
String key = "SIM" + simId;
|
String key = "SIM" + simId;
|
||||||
List<RuleModel> rulelist = RuleUtil.getRule(null, key);
|
List<RuleModel> ruleList = RuleUtil.getRule(null, key);
|
||||||
if (!rulelist.isEmpty()) {
|
if (!ruleList.isEmpty()) {
|
||||||
SenderUtil.init(context);
|
SenderUtil.init(context);
|
||||||
for (RuleModel ruleModel : rulelist) {
|
for (RuleModel ruleModel : ruleList) {
|
||||||
//规则匹配发现需要发送
|
//规则匹配发现需要发送
|
||||||
try {
|
try {
|
||||||
if (ruleModel.checkMsg(smsVo)) {
|
if (ruleModel.checkMsg(smsVo)) {
|
||||||
@ -114,7 +114,7 @@ public class SendUtil {
|
|||||||
DingDingSettingVo dingDingSettingVo = JSON.parseObject(senderModel.getJsonSetting(), DingDingSettingVo.class);
|
DingDingSettingVo dingDingSettingVo = JSON.parseObject(senderModel.getJsonSetting(), DingDingSettingVo.class);
|
||||||
if (dingDingSettingVo != null) {
|
if (dingDingSettingVo != null) {
|
||||||
try {
|
try {
|
||||||
SenderDingdingMsg.sendMsg(logId, handError, dingDingSettingVo.getToken(), dingDingSettingVo.getSecret(), dingDingSettingVo.getAtMobils(), dingDingSettingVo.getAtAll(), smsVo.getSmsVoForSend());
|
SenderDingdingMsg.sendMsg(logId, handError, dingDingSettingVo.getToken(), dingDingSettingVo.getSecret(), dingDingSettingVo.getAtMobiles(), dingDingSettingVo.getAtAll(), smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Log.e(TAG, "senderSendMsg: dingding error " + e.getMessage());
|
Log.e(TAG, "senderSendMsg: dingding error " + e.getMessage());
|
||||||
@ -235,7 +235,7 @@ public class SendUtil {
|
|||||||
SmsSettingVo smsSettingVo = JSON.parseObject(senderModel.getJsonSetting(), SmsSettingVo.class);
|
SmsSettingVo smsSettingVo = JSON.parseObject(senderModel.getJsonSetting(), SmsSettingVo.class);
|
||||||
if (smsSettingVo != null) {
|
if (smsSettingVo != null) {
|
||||||
//仅当无网络时启用
|
//仅当无网络时启用
|
||||||
if (true == smsSettingVo.getOnlyNoNetwork() && 0 != NetUtil.getNetWorkStatus()) {
|
if (smsSettingVo.getOnlyNoNetwork() && 0 != NetUtil.getNetWorkStatus()) {
|
||||||
String msg = "仅当无网络时启用,当前网络状态:" + NetUtil.getNetWorkStatus();
|
String msg = "仅当无网络时启用,当前网络状态:" + NetUtil.getNetWorkStatus();
|
||||||
LogUtil.updateLog(logId, 0, msg);
|
LogUtil.updateLog(logId, 0, msg);
|
||||||
Log.d(TAG, msg);
|
Log.d(TAG, msg);
|
||||||
|
@ -3,11 +3,14 @@ package com.idormy.sms.forwarder.sender;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.utils.LogUtil;
|
import com.idormy.sms.forwarder.utils.LogUtil;
|
||||||
import com.idormy.sms.forwarder.utils.SettingUtil;
|
import com.idormy.sms.forwarder.utils.SettingUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -20,9 +23,10 @@ import okhttp3.OkHttpClient;
|
|||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
public class SenderBarkMsg extends SenderBaseMsg {
|
public class SenderBarkMsg extends SenderBaseMsg {
|
||||||
|
|
||||||
static String TAG = "SenderBarkMsg";
|
static final String TAG = "SenderBarkMsg";
|
||||||
|
|
||||||
public static void sendMsg(final long logId, final Handler handError, String barkServer, String from, String content, String groupName) throws Exception {
|
public static void sendMsg(final long logId, final Handler handError, String barkServer, String from, String content, String groupName) throws Exception {
|
||||||
Log.i(TAG, "sendMsg barkServer:" + barkServer + " from:" + from + " content:" + content);
|
Log.i(TAG, "sendMsg barkServer:" + barkServer + " from:" + from + " content:" + content);
|
||||||
@ -61,15 +65,15 @@ public class SenderBarkMsg extends SenderBaseMsg {
|
|||||||
Call call = client.newCall(request);
|
Call call = client.newCall(request);
|
||||||
call.enqueue(new Callback() {
|
call.enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, final IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull final IOException e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
||||||
emitter.onError(new RuntimeException("请求接口异常..."));
|
emitter.onError(new RuntimeException("请求接口异常..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
final String responseStr = response.body().string();
|
final String responseStr = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
||||||
Toast(handError, TAG, "发送状态:" + responseStr);
|
Toast(handError, TAG, "发送状态:" + responseStr);
|
||||||
|
|
||||||
|
@ -5,16 +5,20 @@ import android.text.TextUtils;
|
|||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.idormy.sms.forwarder.utils.LogUtil;
|
import com.idormy.sms.forwarder.utils.LogUtil;
|
||||||
import com.idormy.sms.forwarder.utils.SettingUtil;
|
import com.idormy.sms.forwarder.utils.SettingUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
@ -30,9 +34,10 @@ import okhttp3.Request;
|
|||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
@SuppressWarnings({"ResultOfMethodCallIgnored", "rawtypes", "unchecked", "deprecation"})
|
||||||
public class SenderDingdingMsg extends SenderBaseMsg {
|
public class SenderDingdingMsg extends SenderBaseMsg {
|
||||||
|
|
||||||
static String TAG = "SenderDingdingMsg";
|
static final String TAG = "SenderDingdingMsg";
|
||||||
|
|
||||||
public static void sendMsg(final long logId, final Handler handError, String token, String secret, String atMobiles, Boolean atAll, String content) throws Exception {
|
public static void sendMsg(final long logId, final Handler handError, String token, String secret, String atMobiles, Boolean atAll, String content) throws Exception {
|
||||||
Log.i(TAG, "sendMsg token:" + token + " secret:" + secret + " atMobiles:" + atMobiles + " atAll:" + atAll + " content:" + content);
|
Log.i(TAG, "sendMsg token:" + token + " secret:" + secret + " atMobiles:" + atMobiles + " atAll:" + atAll + " content:" + content);
|
||||||
@ -45,8 +50,8 @@ public class SenderDingdingMsg extends SenderBaseMsg {
|
|||||||
Long timestamp = System.currentTimeMillis();
|
Long timestamp = System.currentTimeMillis();
|
||||||
String stringToSign = timestamp + "\n" + secret;
|
String stringToSign = timestamp + "\n" + secret;
|
||||||
Mac mac = Mac.getInstance("HmacSHA256");
|
Mac mac = Mac.getInstance("HmacSHA256");
|
||||||
mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256"));
|
mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
|
||||||
byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8"));
|
byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8));
|
||||||
String sign = URLEncoder.encode(new String(Base64.encode(signData, Base64.NO_WRAP)), "UTF-8");
|
String sign = URLEncoder.encode(new String(Base64.encode(signData, Base64.NO_WRAP)), "UTF-8");
|
||||||
token += "×tamp=" + timestamp + "&sign=" + sign;
|
token += "×tamp=" + timestamp + "&sign=" + sign;
|
||||||
Log.i(TAG, "token:" + token);
|
Log.i(TAG, "token:" + token);
|
||||||
@ -103,15 +108,15 @@ public class SenderDingdingMsg extends SenderBaseMsg {
|
|||||||
Call call = client.newCall(request);
|
Call call = client.newCall(request);
|
||||||
call.enqueue(new Callback() {
|
call.enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, final IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull final IOException e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
||||||
emitter.onError(new RuntimeException("请求接口异常..."));
|
emitter.onError(new RuntimeException("请求接口异常..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
final String responseStr = response.body().string();
|
final String responseStr = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
||||||
Toast(handError, TAG, "发送状态:" + responseStr);
|
Toast(handError, TAG, "发送状态:" + responseStr);
|
||||||
|
|
||||||
|
@ -4,14 +4,18 @@ import android.os.Handler;
|
|||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.idormy.sms.forwarder.utils.LogUtil;
|
import com.idormy.sms.forwarder.utils.LogUtil;
|
||||||
import com.idormy.sms.forwarder.utils.SettingUtil;
|
import com.idormy.sms.forwarder.utils.SettingUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
@ -27,9 +31,10 @@ import okhttp3.Request;
|
|||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
@SuppressWarnings({"ResultOfMethodCallIgnored", "rawtypes", "unchecked", "deprecation"})
|
||||||
public class SenderFeishuMsg extends SenderBaseMsg {
|
public class SenderFeishuMsg extends SenderBaseMsg {
|
||||||
|
|
||||||
static String TAG = "SenderFeishuMsg";
|
static final String TAG = "SenderFeishuMsg";
|
||||||
|
|
||||||
public static void sendMsg(final long logId, final Handler handError, String webhook, String secret, String content) throws Exception {
|
public static void sendMsg(final long logId, final Handler handError, String webhook, String secret, String content) throws Exception {
|
||||||
Log.i(TAG, "sendMsg webhook:" + webhook + " secret:" + secret + " content:" + content);
|
Log.i(TAG, "sendMsg webhook:" + webhook + " secret:" + secret + " content:" + content);
|
||||||
@ -45,8 +50,8 @@ public class SenderFeishuMsg extends SenderBaseMsg {
|
|||||||
Long timestamp = System.currentTimeMillis();
|
Long timestamp = System.currentTimeMillis();
|
||||||
String stringToSign = timestamp + "\n" + secret;
|
String stringToSign = timestamp + "\n" + secret;
|
||||||
Mac mac = Mac.getInstance("HmacSHA256");
|
Mac mac = Mac.getInstance("HmacSHA256");
|
||||||
mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256"));
|
mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
|
||||||
byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8"));
|
byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8));
|
||||||
String sign = URLEncoder.encode(new String(Base64.encode(signData, Base64.NO_WRAP)), "UTF-8");
|
String sign = URLEncoder.encode(new String(Base64.encode(signData, Base64.NO_WRAP)), "UTF-8");
|
||||||
textMsgMap.put("timestamp", timestamp);
|
textMsgMap.put("timestamp", timestamp);
|
||||||
textMsgMap.put("sign", sign);
|
textMsgMap.put("sign", sign);
|
||||||
@ -78,15 +83,15 @@ public class SenderFeishuMsg extends SenderBaseMsg {
|
|||||||
Call call = client.newCall(request);
|
Call call = client.newCall(request);
|
||||||
call.enqueue(new Callback() {
|
call.enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, final IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull final IOException e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
||||||
emitter.onError(new RuntimeException("请求接口异常..."));
|
emitter.onError(new RuntimeException("请求接口异常..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
final String responseStr = response.body().string();
|
final String responseStr = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
||||||
Toast(handError, TAG, "发送状态:" + responseStr);
|
Toast(handError, TAG, "发送状态:" + responseStr);
|
||||||
|
|
||||||
|
@ -14,12 +14,13 @@ import io.reactivex.rxjava3.core.Observable;
|
|||||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
public class SenderMailMsg extends SenderBaseMsg {
|
public class SenderMailMsg extends SenderBaseMsg {
|
||||||
private static String TAG = "SenderMailMsg";
|
private static final String TAG = "SenderMailMsg";
|
||||||
|
|
||||||
public static void sendEmail(final long logId, final Handler handError, final String host, final String port, final boolean ssl, final String fromemail, final String nickname, final String pwd, final String toAdd, final String title, final String content) {
|
public static void sendEmail(final long logId, final Handler handError, final String host, final String port, final boolean ssl, final String fromEmail, final String nickname, final String pwd, final String toAdd, final String title, final String content) {
|
||||||
|
|
||||||
Log.d(TAG, "sendEmail: host:" + host + " port:" + port + " ssl:" + ssl + " fromemail:" + fromemail + " nickname:" + nickname + " pwd:" + pwd + " toAdd:" + toAdd);
|
Log.d(TAG, "sendEmail: host:" + host + " port:" + port + " ssl:" + ssl + " fromEmail:" + fromEmail + " nickname:" + nickname + " pwd:" + pwd + " toAdd:" + toAdd);
|
||||||
|
|
||||||
Observable
|
Observable
|
||||||
.create((ObservableEmitter<Object> emitter) -> {
|
.create((ObservableEmitter<Object> emitter) -> {
|
||||||
@ -31,7 +32,7 @@ public class SenderMailMsg extends SenderBaseMsg {
|
|||||||
//配置发件人邮件服务器参数
|
//配置发件人邮件服务器参数
|
||||||
EmailKit.Config config = new EmailKit.Config()
|
EmailKit.Config config = new EmailKit.Config()
|
||||||
.setSMTP(host, Integer.parseInt(port), ssl) //设置SMTP服务器主机地址、端口和是否开启ssl
|
.setSMTP(host, Integer.parseInt(port), ssl) //设置SMTP服务器主机地址、端口和是否开启ssl
|
||||||
.setAccount(fromemail) //发件人邮箱
|
.setAccount(fromEmail) //发件人邮箱
|
||||||
.setPassword(pwd); //密码或授权码
|
.setPassword(pwd); //密码或授权码
|
||||||
|
|
||||||
//设置一封草稿邮件
|
//设置一封草稿邮件
|
||||||
|
@ -7,6 +7,8 @@ import android.os.Handler;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.idormy.sms.forwarder.MyApplication;
|
import com.idormy.sms.forwarder.MyApplication;
|
||||||
@ -16,6 +18,7 @@ import com.idormy.sms.forwarder.utils.SettingUtil;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
@ -28,9 +31,10 @@ import okhttp3.Request;
|
|||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked", "deprecation", "ResultOfMethodCallIgnored"})
|
||||||
public class SenderQyWxAppMsg extends SenderBaseMsg {
|
public class SenderQyWxAppMsg extends SenderBaseMsg {
|
||||||
|
|
||||||
static String TAG = "SenderQyWxAppMsg";
|
static final String TAG = "SenderQyWxAppMsg";
|
||||||
|
|
||||||
public static void sendMsg(final long logId, final Handler handError, String corpID, String agentID, String secret, String toUser, String content, boolean forceRefresh) throws Exception {
|
public static void sendMsg(final long logId, final Handler handError, String corpID, String agentID, String secret, String toUser, String content, boolean forceRefresh) throws Exception {
|
||||||
Log.i(TAG, "sendMsg corpID:" + corpID + " agentID:" + agentID + " secret:" + secret + " toUser:" + toUser + " content:" + content + " forceRefresh:" + forceRefresh);
|
Log.i(TAG, "sendMsg corpID:" + corpID + " agentID:" + agentID + " secret:" + secret + " toUser:" + toUser + " content:" + content + " forceRefresh:" + forceRefresh);
|
||||||
@ -40,20 +44,20 @@ public class SenderQyWxAppMsg extends SenderBaseMsg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO:判断access_token是否失效
|
//TODO:判断access_token是否失效
|
||||||
if (forceRefresh == true
|
if (forceRefresh
|
||||||
|| MyApplication.QyWxAccessToken == null || MyApplication.QyWxAccessToken.isEmpty()
|
|| MyApplication.QyWxAccessToken == null || MyApplication.QyWxAccessToken.isEmpty()
|
||||||
|| System.currentTimeMillis() > MyApplication.QyWxAccessTokenExpiresIn) {
|
|| System.currentTimeMillis() > MyApplication.QyWxAccessTokenExpiresIn) {
|
||||||
String gettokenUrl = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?";
|
String getTokenUrl = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?";
|
||||||
gettokenUrl += "corpid=" + corpID;
|
getTokenUrl += "corpid=" + corpID;
|
||||||
gettokenUrl += "&corpsecret=" + secret;
|
getTokenUrl += "&corpsecret=" + secret;
|
||||||
Log.d(TAG, "gettokenUrl:" + gettokenUrl);
|
Log.d(TAG, "getTokenUrl:" + getTokenUrl);
|
||||||
|
|
||||||
OkHttpClient client = new OkHttpClient();
|
OkHttpClient client = new OkHttpClient();
|
||||||
final Request request = new Request.Builder().url(gettokenUrl).get().build();
|
final Request request = new Request.Builder().url(getTokenUrl).get().build();
|
||||||
Call call = client.newCall(request);
|
Call call = client.newCall(request);
|
||||||
call.enqueue(new Callback() {
|
call.enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, final IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull final IOException e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Log.d(TAG, "onFailure:" + e.getMessage());
|
Log.d(TAG, "onFailure:" + e.getMessage());
|
||||||
if (handError != null) {
|
if (handError != null) {
|
||||||
@ -67,14 +71,14 @@ public class SenderQyWxAppMsg extends SenderBaseMsg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
final String json = response.body().string();
|
final String json = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "Code:" + response.code() + " Response: " + json);
|
Log.d(TAG, "Code:" + response.code() + " Response: " + json);
|
||||||
JSONObject jsonObject = JSON.parseObject(json);
|
JSONObject jsonObject = JSON.parseObject(json);
|
||||||
int errcode = jsonObject.getInteger("errcode");
|
int errcode = jsonObject.getInteger("errcode");
|
||||||
if (errcode == 0) {
|
if (errcode == 0) {
|
||||||
MyApplication.QyWxAccessToken = jsonObject.getString("access_token");
|
MyApplication.QyWxAccessToken = jsonObject.getString("access_token");
|
||||||
MyApplication.QyWxAccessTokenExpiresIn = System.currentTimeMillis() + (jsonObject.getInteger("expires_in") - 120) * 1000; //提前2分钟过期
|
MyApplication.QyWxAccessTokenExpiresIn = System.currentTimeMillis() + (jsonObject.getInteger("expires_in") - 120) * 1000L; //提前2分钟过期
|
||||||
Log.d(TAG, "access_token:" + MyApplication.QyWxAccessToken);
|
Log.d(TAG, "access_token:" + MyApplication.QyWxAccessToken);
|
||||||
Log.d(TAG, "expires_in:" + MyApplication.QyWxAccessTokenExpiresIn);
|
Log.d(TAG, "expires_in:" + MyApplication.QyWxAccessTokenExpiresIn);
|
||||||
|
|
||||||
@ -133,15 +137,15 @@ public class SenderQyWxAppMsg extends SenderBaseMsg {
|
|||||||
Call call = client.newCall(request);
|
Call call = client.newCall(request);
|
||||||
call.enqueue(new Callback() {
|
call.enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, final IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull final IOException e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
||||||
emitter.onError(new RuntimeException("请求接口异常..."));
|
emitter.onError(new RuntimeException("请求接口异常..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
final String responseStr = response.body().string();
|
final String responseStr = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
||||||
Toast(handError, TAG, "发送状态:" + responseStr);
|
Toast(handError, TAG, "发送状态:" + responseStr);
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ package com.idormy.sms.forwarder.sender;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.idormy.sms.forwarder.utils.LogUtil;
|
import com.idormy.sms.forwarder.utils.LogUtil;
|
||||||
import com.idormy.sms.forwarder.utils.SettingUtil;
|
import com.idormy.sms.forwarder.utils.SettingUtil;
|
||||||
@ -10,6 +12,7 @@ import com.idormy.sms.forwarder.utils.SettingUtil;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
@ -22,9 +25,10 @@ import okhttp3.Request;
|
|||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked", "deprecation", "ResultOfMethodCallIgnored"})
|
||||||
public class SenderQyWxGroupRobotMsg extends SenderBaseMsg {
|
public class SenderQyWxGroupRobotMsg extends SenderBaseMsg {
|
||||||
|
|
||||||
static String TAG = "SenderQyWxGroupRobotMsg";
|
static final String TAG = "SenderQyWxGroupRobotMsg";
|
||||||
|
|
||||||
public static void sendMsg(final long logId, final Handler handError, String webHook, String from, String content) throws Exception {
|
public static void sendMsg(final long logId, final Handler handError, String webHook, String from, String content) throws Exception {
|
||||||
Log.i(TAG, "sendMsg webHook:" + webHook + " from:" + from + " content:" + content);
|
Log.i(TAG, "sendMsg webHook:" + webHook + " from:" + from + " content:" + content);
|
||||||
@ -59,15 +63,15 @@ public class SenderQyWxGroupRobotMsg extends SenderBaseMsg {
|
|||||||
Call call = client.newCall(request);
|
Call call = client.newCall(request);
|
||||||
call.enqueue(new Callback() {
|
call.enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, final IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull final IOException e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
||||||
emitter.onError(new RuntimeException("请求接口异常..."));
|
emitter.onError(new RuntimeException("请求接口异常..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
final String responseStr = response.body().string();
|
final String responseStr = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
||||||
Toast(handError, TAG, "发送状态:" + responseStr);
|
Toast(handError, TAG, "发送状态:" + responseStr);
|
||||||
|
|
||||||
|
@ -3,10 +3,13 @@ package com.idormy.sms.forwarder.sender;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.utils.LogUtil;
|
import com.idormy.sms.forwarder.utils.LogUtil;
|
||||||
import com.idormy.sms.forwarder.utils.SettingUtil;
|
import com.idormy.sms.forwarder.utils.SettingUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
@ -19,9 +22,10 @@ import okhttp3.Request;
|
|||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
public class SenderServerChanMsg extends SenderBaseMsg {
|
public class SenderServerChanMsg extends SenderBaseMsg {
|
||||||
|
|
||||||
static String TAG = "SenderServerChanMsg";
|
static final String TAG = "SenderServerChanMsg";
|
||||||
|
|
||||||
public static void sendMsg(final long logId, final Handler handError, final String sendKey, final String title, final String desp) throws Exception {
|
public static void sendMsg(final long logId, final Handler handError, final String sendKey, final String title, final String desp) throws Exception {
|
||||||
Log.i(TAG, "sendMsg sendKey:" + sendKey + " title:" + title + " desp:" + desp);
|
Log.i(TAG, "sendMsg sendKey:" + sendKey + " title:" + title + " desp:" + desp);
|
||||||
@ -50,15 +54,15 @@ public class SenderServerChanMsg extends SenderBaseMsg {
|
|||||||
Call call = client.newCall(request);
|
Call call = client.newCall(request);
|
||||||
call.enqueue(new Callback() {
|
call.enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, final IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull final IOException e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
||||||
emitter.onError(new RuntimeException("请求接口异常..."));
|
emitter.onError(new RuntimeException("请求接口异常..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
final String responseStr = response.body().string();
|
final String responseStr = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
||||||
Toast(handError, TAG, "发送状态:" + responseStr);
|
Toast(handError, TAG, "发送状态:" + responseStr);
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import io.reactivex.rxjava3.core.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||||
|
|
||||||
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
public class SenderSmsMsg extends SenderBaseMsg {
|
public class SenderSmsMsg extends SenderBaseMsg {
|
||||||
|
|
||||||
static String TAG = "SenderSmsMsg";
|
static final String TAG = "SenderSmsMsg";
|
||||||
|
|
||||||
public static void sendMsg(final long logId, final Handler handError, int simSlot, String mobiles, Boolean onlyNoNetwork, String from, String text) throws Exception {
|
public static void sendMsg(final long logId, final Handler handError, int simSlot, String mobiles, Boolean onlyNoNetwork, String from, String text) throws Exception {
|
||||||
Log.i(TAG, "sendMsg simSlot:" + simSlot + " mobiles:" + mobiles + " onlyNoNetwork:" + onlyNoNetwork + " from:" + from + " text:" + text);
|
Log.i(TAG, "sendMsg simSlot:" + simSlot + " mobiles:" + mobiles + " onlyNoNetwork:" + onlyNoNetwork + " from:" + from + " text:" + text);
|
||||||
|
@ -3,6 +3,8 @@ package com.idormy.sms.forwarder.sender;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.idormy.sms.forwarder.utils.LogUtil;
|
import com.idormy.sms.forwarder.utils.LogUtil;
|
||||||
import com.idormy.sms.forwarder.utils.SettingUtil;
|
import com.idormy.sms.forwarder.utils.SettingUtil;
|
||||||
@ -10,6 +12,7 @@ import com.idormy.sms.forwarder.utils.SettingUtil;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
@ -22,9 +25,10 @@ import okhttp3.Request;
|
|||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked", "deprecation", "ResultOfMethodCallIgnored"})
|
||||||
public class SenderTelegramMsg extends SenderBaseMsg {
|
public class SenderTelegramMsg extends SenderBaseMsg {
|
||||||
|
|
||||||
static String TAG = "SenderTelegramMsg";
|
static final String TAG = "SenderTelegramMsg";
|
||||||
|
|
||||||
public static void sendMsg(final long logId, final Handler handError, String apiToken, String chatId, String from, String text) throws Exception {
|
public static void sendMsg(final long logId, final Handler handError, String apiToken, String chatId, String from, String text) throws Exception {
|
||||||
Log.i(TAG, "sendMsg apiToken:" + apiToken + " chatId:" + chatId + " text:" + text);
|
Log.i(TAG, "sendMsg apiToken:" + apiToken + " chatId:" + chatId + " text:" + text);
|
||||||
@ -62,15 +66,15 @@ public class SenderTelegramMsg extends SenderBaseMsg {
|
|||||||
Call call = client.newCall(request);
|
Call call = client.newCall(request);
|
||||||
call.enqueue(new Callback() {
|
call.enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, final IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull final IOException e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
||||||
emitter.onError(new RuntimeException("请求接口异常..."));
|
emitter.onError(new RuntimeException("请求接口异常..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
final String responseStr = response.body().string();
|
final String responseStr = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
||||||
Toast(handError, TAG, "发送状态:" + responseStr);
|
Toast(handError, TAG, "发送状态:" + responseStr);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.sender;
|
package com.idormy.sms.forwarder.sender;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
@ -14,10 +15,12 @@ import com.idormy.sms.forwarder.utils.DbHelper;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings({"SynchronizeOnNonFinalField", "UnusedReturnValue", "unused"})
|
||||||
public class SenderUtil {
|
public class SenderUtil {
|
||||||
static String TAG = "SenderUtil";
|
static final String TAG = "SenderUtil";
|
||||||
static Boolean hasInit = false;
|
static Boolean hasInit = false;
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
static Context context;
|
static Context context;
|
||||||
static DbHelper dbHelper;
|
static DbHelper dbHelper;
|
||||||
static SQLiteDatabase db;
|
static SQLiteDatabase db;
|
||||||
@ -76,7 +79,7 @@ public class SenderUtil {
|
|||||||
selectionArgList.add(String.valueOf(id));
|
selectionArgList.add(String.valueOf(id));
|
||||||
|
|
||||||
}
|
}
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
// Issue SQL statement.
|
// Issue SQL statement.
|
||||||
return db.delete(SenderTable.SenderEntry.TABLE_NAME, selection, selectionArgs);
|
return db.delete(SenderTable.SenderEntry.TABLE_NAME, selection, selectionArgs);
|
||||||
|
|
||||||
@ -111,7 +114,7 @@ public class SenderUtil {
|
|||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
}
|
}
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
|
|
||||||
// How you want the results sorted in the resulting Cursor
|
// How you want the results sorted in the resulting Cursor
|
||||||
String sortOrder =
|
String sortOrder =
|
||||||
@ -174,7 +177,7 @@ public class SenderUtil {
|
|||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
}
|
}
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
|
|
||||||
// How you want the results sorted in the resulting Cursor
|
// How you want the results sorted in the resulting Cursor
|
||||||
|
|
||||||
|
@ -4,12 +4,16 @@ import android.os.Handler;
|
|||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.utils.CertUtils;
|
import com.idormy.sms.forwarder.utils.CertUtils;
|
||||||
import com.idormy.sms.forwarder.utils.LogUtil;
|
import com.idormy.sms.forwarder.utils.LogUtil;
|
||||||
import com.idormy.sms.forwarder.utils.SettingUtil;
|
import com.idormy.sms.forwarder.utils.SettingUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
@ -26,9 +30,10 @@ import okhttp3.Request;
|
|||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
@SuppressWarnings({"deprecation", "ResultOfMethodCallIgnored"})
|
||||||
public class SenderWebNotifyMsg extends SenderBaseMsg {
|
public class SenderWebNotifyMsg extends SenderBaseMsg {
|
||||||
|
|
||||||
static String TAG = "SenderWebNotifyMsg";
|
static final String TAG = "SenderWebNotifyMsg";
|
||||||
|
|
||||||
public static void sendMsg(final long logId, final Handler handError, String webServer, String webParams, String secret, String method, String from, String content) throws Exception {
|
public static void sendMsg(final long logId, final Handler handError, String webServer, String webParams, String secret, String method, String from, String content) throws Exception {
|
||||||
Log.i(TAG, "sendMsg webServer:" + webServer + " webParams:" + webParams + " from:" + from + " content:" + content);
|
Log.i(TAG, "sendMsg webServer:" + webServer + " webParams:" + webParams + " from:" + from + " content:" + content);
|
||||||
@ -42,8 +47,8 @@ public class SenderWebNotifyMsg extends SenderBaseMsg {
|
|||||||
if (secret != null && !secret.isEmpty()) {
|
if (secret != null && !secret.isEmpty()) {
|
||||||
String stringToSign = timestamp + "\n" + secret;
|
String stringToSign = timestamp + "\n" + secret;
|
||||||
Mac mac = Mac.getInstance("HmacSHA256");
|
Mac mac = Mac.getInstance("HmacSHA256");
|
||||||
mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256"));
|
mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
|
||||||
byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8"));
|
byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8));
|
||||||
sign = URLEncoder.encode(new String(Base64.encode(signData, Base64.NO_WRAP)), "UTF-8");
|
sign = URLEncoder.encode(new String(Base64.encode(signData, Base64.NO_WRAP)), "UTF-8");
|
||||||
Log.i(TAG, "sign:" + sign);
|
Log.i(TAG, "sign:" + sign);
|
||||||
}
|
}
|
||||||
@ -102,15 +107,15 @@ public class SenderWebNotifyMsg extends SenderBaseMsg {
|
|||||||
Call call = client.newCall(request);
|
Call call = client.newCall(request);
|
||||||
call.enqueue(new Callback() {
|
call.enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, final IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull final IOException e) {
|
||||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||||
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
Toast(handError, TAG, "发送失败:" + e.getMessage());
|
||||||
emitter.onError(new RuntimeException("请求接口异常..."));
|
emitter.onError(new RuntimeException("请求接口异常..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
final String responseStr = response.body().string();
|
final String responseStr = Objects.requireNonNull(response.body()).string();
|
||||||
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
Log.d(TAG, "Response:" + response.code() + "," + responseStr);
|
||||||
Toast(handError, TAG, "发送状态:" + responseStr);
|
Toast(handError, TAG, "发送状态:" + responseStr);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.service;
|
package com.idormy.sms.forwarder.service;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -11,6 +12,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class BatteryService extends Service {
|
public class BatteryService extends Service {
|
||||||
|
|
||||||
private static final String TAG = "BatteryReceiver";
|
private static final String TAG = "BatteryReceiver";
|
||||||
@ -24,9 +26,9 @@ public class BatteryService extends Service {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
Log.i(TAG, "onCreate--------------");
|
Log.i(TAG, "onCreate--------------");
|
||||||
IntentFilter batteryfilter = new IntentFilter();
|
IntentFilter batteryFilter = new IntentFilter();
|
||||||
batteryfilter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
batteryFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||||
registerReceiver(batteryReceiver, batteryfilter);
|
registerReceiver(batteryReceiver, batteryFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -49,7 +51,8 @@ public class BatteryService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 接收电池信息更新的广播
|
// 接收电池信息更新的广播
|
||||||
private BroadcastReceiver batteryReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver batteryReceiver = new BroadcastReceiver() {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.i(TAG, "BatteryReceiver--------------");
|
Log.i(TAG, "BatteryReceiver--------------");
|
||||||
@ -96,7 +99,7 @@ public class BatteryService extends Service {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss:SSS ");
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss:SSS ");
|
||||||
String date = sDateFormat.format(new java.util.Date());
|
String date = sDateFormat.format(new java.util.Date());
|
||||||
|
|
||||||
Log.i(TAG, "battery: date=" + date + ",status " + statusString
|
Log.i(TAG, "battery: date=" + date + ",status " + statusString
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.service;
|
package com.idormy.sms.forwarder.service;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
@ -39,6 +40,7 @@ public class FrontService extends Service {
|
|||||||
private static final String CHANNEL_ONE_ID = "com.idormy.sms.forwarder";
|
private static final String CHANNEL_ONE_ID = "com.idormy.sms.forwarder";
|
||||||
private static final String CHANNEL_ONE_NAME = "com.idormy.sms.forwarderName";
|
private static final String CHANNEL_ONE_NAME = "com.idormy.sms.forwarderName";
|
||||||
|
|
||||||
|
@SuppressLint("IconColors")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
@ -48,11 +50,11 @@ public class FrontService extends Service {
|
|||||||
OSUtils.ROM_TYPE romType = OSUtils.getRomType();
|
OSUtils.ROM_TYPE romType = OSUtils.getRomType();
|
||||||
//Log.d(TAG, "onCreate: " + romType);
|
//Log.d(TAG, "onCreate: " + romType);
|
||||||
if (romType == OSUtils.ROM_TYPE.MIUI_ROM) {
|
if (romType == OSUtils.ROM_TYPE.MIUI_ROM) {
|
||||||
builder.setContentTitle("短信转发器");
|
builder.setContentTitle(getString(R.string.app_name));
|
||||||
}
|
}
|
||||||
builder.setContentText("根据规则转发到钉钉/微信/邮箱/bark/Server酱/Telegram/webhook等");
|
builder.setContentText(getString(R.string.notification_content));
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivity
|
@SuppressLint("UnspecifiedImmutableFlag") PendingIntent pendingIntent = PendingIntent.getActivity
|
||||||
(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
builder.setContentIntent(pendingIntent);
|
builder.setContentIntent(pendingIntent);
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import java.util.Map;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
public class BuildProperties {
|
public class BuildProperties {
|
||||||
private static BuildProperties ourInstance;
|
private static BuildProperties ourInstance;
|
||||||
private final Properties properties;
|
private final Properties properties;
|
||||||
|
@ -10,11 +10,10 @@ public class CacheUtil {
|
|||||||
/**
|
/**
|
||||||
* 获取缓存大小
|
* 获取缓存大小
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context 上下文
|
||||||
* @return
|
* @return 缓存大小
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static String getTotalCacheSize(Context context) throws Exception {
|
public static String getTotalCacheSize(Context context) {
|
||||||
long cacheSize = getFolderSize(context.getCacheDir());
|
long cacheSize = getFolderSize(context.getCacheDir());
|
||||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||||
cacheSize += getFolderSize(context.getExternalCacheDir());
|
cacheSize += getFolderSize(context.getExternalCacheDir());
|
||||||
@ -24,7 +23,7 @@ public class CacheUtil {
|
|||||||
|
|
||||||
/***
|
/***
|
||||||
* 清理所有缓存
|
* 清理所有缓存
|
||||||
* @param context
|
* @param context 上下文
|
||||||
*/
|
*/
|
||||||
public static void clearAllCache(Context context) {
|
public static void clearAllCache(Context context) {
|
||||||
deleteDir(context.getCacheDir());
|
deleteDir(context.getCacheDir());
|
||||||
@ -36,29 +35,32 @@ public class CacheUtil {
|
|||||||
private static boolean deleteDir(File dir) {
|
private static boolean deleteDir(File dir) {
|
||||||
if (dir != null && dir.isDirectory()) {
|
if (dir != null && dir.isDirectory()) {
|
||||||
String[] children = dir.list();
|
String[] children = dir.list();
|
||||||
for (int i = 0; i < children.length; i++) {
|
assert children != null;
|
||||||
boolean success = deleteDir(new File(dir, children[i]));
|
for (String child : children) {
|
||||||
|
boolean success = deleteDir(new File(dir, child));
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert dir != null;
|
||||||
return dir.delete();
|
return dir.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取文件
|
// 获取文件
|
||||||
//Context.getExternalFilesDir() --> SDCard/Android/data/你的应用的包名/files/ 目录,一般放一些长时间保存的数据
|
//Context.getExternalFilesDir() --> SDCard/Android/data/你的应用的包名/files/ 目录,一般放一些长时间保存的数据
|
||||||
//Context.getExternalCacheDir() --> SDCard/Android/data/你的应用包名/cache/目录,一般存放临时缓存数据
|
//Context.getExternalCacheDir() --> SDCard/Android/data/你的应用包名/cache/目录,一般存放临时缓存数据
|
||||||
public static long getFolderSize(File file) throws Exception {
|
public static long getFolderSize(File file) {
|
||||||
long size = 0;
|
long size = 0;
|
||||||
try {
|
try {
|
||||||
File[] fileList = file.listFiles();
|
File[] fileList = file.listFiles();
|
||||||
for (int i = 0; i < fileList.length; i++) {
|
assert fileList != null;
|
||||||
|
for (File value : fileList) {
|
||||||
// 如果下面还有文件
|
// 如果下面还有文件
|
||||||
if (fileList[i].isDirectory()) {
|
if (value.isDirectory()) {
|
||||||
size = size + getFolderSize(fileList[i]);
|
size = size + getFolderSize(value);
|
||||||
} else {
|
} else {
|
||||||
size = size + fileList[i].length();
|
size = size + value.length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -70,8 +72,8 @@ public class CacheUtil {
|
|||||||
/**
|
/**
|
||||||
* 格式化单位
|
* 格式化单位
|
||||||
*
|
*
|
||||||
* @param size
|
* @param size 文件大小
|
||||||
* @return
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static String getFormatSize(double size) {
|
public static String getFormatSize(double size) {
|
||||||
double kiloByte = size / 1024;
|
double kiloByte = size / 1024;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
@ -29,10 +31,12 @@ public class CertUtils {
|
|||||||
private static TrustManager[] getTrustManager() {
|
private static TrustManager[] getTrustManager() {
|
||||||
return new TrustManager[]{
|
return new TrustManager[]{
|
||||||
new X509TrustManager() {
|
new X509TrustManager() {
|
||||||
|
@SuppressLint("TrustAllX509TrustManager")
|
||||||
@Override
|
@Override
|
||||||
public void checkClientTrusted(X509Certificate[] chain, String authType) {
|
public void checkClientTrusted(X509Certificate[] chain, String authType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("TrustAllX509TrustManager")
|
||||||
@Override
|
@Override
|
||||||
public void checkServerTrusted(X509Certificate[] chain, String authType) {
|
public void checkServerTrusted(X509Certificate[] chain, String authType) {
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,191 @@
|
|||||||
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.provider.ContactsContract;
|
||||||
|
|
||||||
|
import com.idormy.sms.forwarder.model.PhoneBookEntity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取联系人工具类
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class ContactHelper {
|
||||||
|
|
||||||
|
private static final String[] PROJECTION = new String[]{
|
||||||
|
ContactsContract.Contacts.DISPLAY_NAME,
|
||||||
|
ContactsContract.CommonDataKinds.Phone.NUMBER
|
||||||
|
};
|
||||||
|
|
||||||
|
private final List<PhoneBookEntity> contacts = new ArrayList<>();
|
||||||
|
|
||||||
|
private ContactHelper() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ContactHelper getInstance() {
|
||||||
|
return InstanceHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class InstanceHolder {
|
||||||
|
private static final ContactHelper INSTANCE = new ContactHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有联系人
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @return 联系人集合
|
||||||
|
*/
|
||||||
|
public List<PhoneBookEntity> getContacts(Context context) {
|
||||||
|
contacts.clear();
|
||||||
|
ContentResolver cr = context.getContentResolver();
|
||||||
|
try (Cursor cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION, null, null, "sort_key")) {
|
||||||
|
if (cursor != null) {
|
||||||
|
final int displayNameIndex = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
|
||||||
|
final int mobileNoIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
|
||||||
|
String mobileNo, displayName;
|
||||||
|
while (cursor.moveToNext()) {
|
||||||
|
mobileNo = cursor.getString(mobileNoIndex);
|
||||||
|
displayName = cursor.getString(displayNameIndex);
|
||||||
|
contacts.add(new PhoneBookEntity(displayName, mobileNo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return contacts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过姓名获取联系人
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param contactName 联系人姓名
|
||||||
|
* @return 联系人集合
|
||||||
|
*/
|
||||||
|
public List<PhoneBookEntity> getContactByName(Context context, String contactName) {
|
||||||
|
contacts.clear();
|
||||||
|
|
||||||
|
ContentResolver cr = context.getContentResolver();
|
||||||
|
String selection = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " like ? ";
|
||||||
|
String[] selectionArgs = new String[]{"%" + contactName + "%"};
|
||||||
|
try (Cursor cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION, selection, selectionArgs, "sort_key")) {
|
||||||
|
if (cursor != null) {
|
||||||
|
final int displayNameIndex = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
|
||||||
|
final int mobileNoIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
|
||||||
|
String mobileNo, displayName;
|
||||||
|
while (cursor.moveToNext()) {
|
||||||
|
mobileNo = cursor.getString(mobileNoIndex);
|
||||||
|
displayName = cursor.getString(displayNameIndex);
|
||||||
|
contacts.add(new PhoneBookEntity(displayName, mobileNo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return contacts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过手机号获取联系人
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param phoneNum 手机号码
|
||||||
|
* @return 联系人集合
|
||||||
|
*/
|
||||||
|
public List<PhoneBookEntity> getContactByNumber(Context context, String phoneNum) {
|
||||||
|
contacts.clear();
|
||||||
|
Cursor cursor = null;
|
||||||
|
if (phoneNum.length() < 11) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ContentResolver cr = context.getContentResolver();
|
||||||
|
String selection = ContactsContract.CommonDataKinds.Phone.NUMBER + " in(?,?,?) ";
|
||||||
|
String phone1 = phoneNum.subSequence(0, 3) + " " + phoneNum.substring(3, 7) +
|
||||||
|
" " + phoneNum.substring(7, 11);
|
||||||
|
String phone2 = phoneNum.subSequence(0, 3) + "-" + phoneNum.substring(3, 7) +
|
||||||
|
"-" + phoneNum.substring(7, 11);
|
||||||
|
|
||||||
|
String[] selectionArgs = new String[]{phoneNum, phone1, phone2};
|
||||||
|
|
||||||
|
cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION, selection, selectionArgs, "sort_key");
|
||||||
|
if (cursor != null) {
|
||||||
|
final int displayNameIndex = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
|
||||||
|
final int mobileNoIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
|
||||||
|
String mobileNo, displayName;
|
||||||
|
while (cursor.moveToNext()) {
|
||||||
|
mobileNo = cursor.getString(mobileNoIndex);
|
||||||
|
displayName = cursor.getString(displayNameIndex);
|
||||||
|
contacts.add(new PhoneBookEntity(displayName, mobileNo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (cursor != null) {
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return contacts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询联系人
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param page 页数
|
||||||
|
* @param pageSize 每页数据量
|
||||||
|
* @return 联系人集合
|
||||||
|
*/
|
||||||
|
public List<PhoneBookEntity> getContactsByPage(Context context, int page, int pageSize) {
|
||||||
|
contacts.clear();
|
||||||
|
|
||||||
|
Cursor cursor = null;
|
||||||
|
ContentResolver cr = context.getContentResolver();
|
||||||
|
try {
|
||||||
|
String sortOrder = "_id limit " + page + "," + pageSize;
|
||||||
|
cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION, null, null, sortOrder);
|
||||||
|
if (cursor != null) {
|
||||||
|
final int displayNameIndex = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
|
||||||
|
final int mobileNoIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
|
||||||
|
String mobileNo, displayName;
|
||||||
|
while (cursor.moveToNext()) {
|
||||||
|
mobileNo = cursor.getString(mobileNoIndex);
|
||||||
|
displayName = cursor.getString(displayNameIndex);
|
||||||
|
contacts.add(new PhoneBookEntity(displayName, mobileNo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (cursor != null) {
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return contacts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取联系人总数
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @return 数量
|
||||||
|
*/
|
||||||
|
public int getContactCount(Context context) {
|
||||||
|
ContentResolver cr = context.getContentResolver();
|
||||||
|
try (Cursor cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION, null, null, "sort_key")) {
|
||||||
|
if (cursor != null) {
|
||||||
|
return cursor.getCount();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ import com.idormy.sms.forwarder.model.SenderTable;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class DbHelper extends SQLiteOpenHelper {
|
public class DbHelper extends SQLiteOpenHelper {
|
||||||
// If you change the database schema, you must increment the database version.
|
// If you change the database schema, you must increment the database version.
|
||||||
public static final String TAG = "DbHelper";
|
public static final String TAG = "DbHelper";
|
||||||
|
@ -1,22 +1,24 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
public class Define {
|
public class Define {
|
||||||
public static String SP_CONFIG = "forwarder_config";
|
public static final String SP_CONFIG = "forwarder_config";
|
||||||
public static String SP_CONFIG_SWITCH_HELP_TIP = "forwarder_config_switch_help_tip";
|
public static final String SP_CONFIG_SWITCH_HELP_TIP = "forwarder_config_switch_help_tip";
|
||||||
|
|
||||||
public static String SP_MSG_KEY_SWITCH_ADD_EXTRA = "tsms_msg_key_switch_add_extra";
|
public static final String SP_MSG_KEY_SWITCH_ADD_EXTRA = "tsms_msg_key_switch_add_extra";
|
||||||
public static String SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_MARK = "tsms_msg_key_string_add_extra_device_mark";
|
public static final String SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_NAME = "tsms_msg_key_switch_add_extra_device_name";
|
||||||
public static String SP_MSG_KEY_STRING_ADD_EXTRA_SIM1 = "tsms_msg_key_string_add_extra_sim1";
|
public static final String SP_MSG_KEY_STRING_ENABLE_PHONE = "tsms_msg_key_switch_enable_phone";
|
||||||
public static String SP_MSG_KEY_STRING_ADD_EXTRA_SIM2 = "tsms_msg_key_string_add_extra_sim2";
|
public static final String SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_MARK = "tsms_msg_key_string_add_extra_device_mark";
|
||||||
public static String SP_MSG_KEY_SWITCH_SMS_TEMPLATE = "tsms_msg_key_switch_sms_template";
|
public static final String SP_MSG_KEY_STRING_ADD_EXTRA_SIM1 = "tsms_msg_key_string_add_extra_sim1";
|
||||||
public static String SP_MSG_KEY_STRING_SMS_TEMPLATE = "tsms_msg_key_string_sms_template";
|
public static final String SP_MSG_KEY_STRING_ADD_EXTRA_SIM2 = "tsms_msg_key_string_add_extra_sim2";
|
||||||
public static String SP_MSG_KEY_STRING_BATTERY_LEVEL_ALARM = "tsms_msg_key_string_battery_level_alarm";
|
public static final String SP_MSG_KEY_SWITCH_SMS_TEMPLATE = "tsms_msg_key_switch_sms_template";
|
||||||
public static String SP_MSG_KEY_STRING_RETRY_DELAY_TIME1 = "tsms_msg_key_string_retry_delay_time1";
|
public static final String SP_MSG_KEY_STRING_SMS_TEMPLATE = "tsms_msg_key_string_sms_template";
|
||||||
public static String SP_MSG_KEY_STRING_RETRY_DELAY_TIME2 = "tsms_msg_key_string_retry_delay_time2";
|
public static final String SP_MSG_KEY_STRING_BATTERY_LEVEL_ALARM = "tsms_msg_key_string_battery_level_alarm";
|
||||||
public static String SP_MSG_KEY_STRING_RETRY_DELAY_TIME3 = "tsms_msg_key_string_retry_delay_time3";
|
public static final String SP_MSG_KEY_STRING_RETRY_DELAY_TIME1 = "tsms_msg_key_string_retry_delay_time1";
|
||||||
public static String SP_MSG_KEY_STRING_RETRY_DELAY_TIME4 = "tsms_msg_key_string_retry_delay_time4";
|
public static final String SP_MSG_KEY_STRING_RETRY_DELAY_TIME2 = "tsms_msg_key_string_retry_delay_time2";
|
||||||
public static String SP_MSG_KEY_STRING_RETRY_DELAY_TIME5 = "tsms_msg_key_string_retry_delay_time5";
|
public static final String SP_MSG_KEY_STRING_RETRY_DELAY_TIME3 = "tsms_msg_key_string_retry_delay_time3";
|
||||||
|
public static final String SP_MSG_KEY_STRING_RETRY_DELAY_TIME4 = "tsms_msg_key_string_retry_delay_time4";
|
||||||
|
public static final String SP_MSG_KEY_STRING_RETRY_DELAY_TIME5 = "tsms_msg_key_string_retry_delay_time5";
|
||||||
|
|
||||||
public static String SP_MSG = "forwarder_msg";
|
public static final String SP_MSG = "forwarder_msg";
|
||||||
public static String SP_MSG_SET_KEY = "forwarder_msg_set_key";
|
public static final String SP_MSG_SET_KEY = "forwarder_msg_set_key";
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* app版本更新接口
|
* app版本更新接口
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public interface HttpI extends Serializable {
|
public interface HttpI extends Serializable {
|
||||||
/**
|
/**
|
||||||
* 异步get
|
* 异步get
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@SuppressWarnings("SynchronizeOnNonFinalField")
|
||||||
public class InitUtil {
|
public class InitUtil {
|
||||||
static Boolean hasInit = false;
|
static Boolean hasInit = false;
|
||||||
private static String TAG = "InitUtil";
|
private static final String TAG = "InitUtil";
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
private static Context context = null;
|
private static Context context = null;
|
||||||
|
|
||||||
public static void init(Context context1) {
|
public static void init(Context context1) {
|
||||||
Log.d(TAG, "TMSG init");
|
Log.d(TAG, "SmsForwarder init");
|
||||||
|
//noinspection SynchronizeOnNonFinalField
|
||||||
synchronized (hasInit) {
|
synchronized (hasInit) {
|
||||||
if (hasInit) return;
|
if (hasInit) return;
|
||||||
hasInit = true;
|
hasInit = true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -15,7 +16,7 @@ public class KeepAliveUtils {
|
|||||||
|
|
||||||
public static boolean isIgnoreBatteryOptimization(Activity activity) {
|
public static boolean isIgnoreBatteryOptimization(Activity activity) {
|
||||||
PowerManager powerManager = (PowerManager) activity.getSystemService(Context.POWER_SERVICE);
|
PowerManager powerManager = (PowerManager) activity.getSystemService(Context.POWER_SERVICE);
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M && powerManager != null) {
|
if (powerManager != null) {
|
||||||
return powerManager.isIgnoringBatteryOptimizations(activity.getPackageName());
|
return powerManager.isIgnoringBatteryOptimizations(activity.getPackageName());
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -26,7 +27,7 @@ public class KeepAliveUtils {
|
|||||||
if (isIgnoreBatteryOptimization(activity)) {
|
if (isIgnoreBatteryOptimization(activity)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
@SuppressLint("BatteryLife") Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
||||||
intent.setData(Uri.parse("package:" + activity.getPackageName()));
|
intent.setData(Uri.parse("package:" + activity.getPackageName()));
|
||||||
ResolveInfo resolveInfo = activity.getPackageManager().resolveActivity(intent, 0);
|
ResolveInfo resolveInfo = activity.getPackageManager().resolveActivity(intent, 0);
|
||||||
if (resolveInfo != null) {
|
if (resolveInfo != null) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
@ -19,15 +20,18 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
public class LogUtil {
|
public class LogUtil {
|
||||||
static String TAG = "LogUtil";
|
static final String TAG = "LogUtil";
|
||||||
static Boolean hasInit = false;
|
static Boolean hasInit = false;
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
static Context context;
|
static Context context;
|
||||||
static DbHelper dbHelper;
|
static DbHelper dbHelper;
|
||||||
static SQLiteDatabase db;
|
static SQLiteDatabase db;
|
||||||
|
|
||||||
public static void init(Context context1) {
|
public static void init(Context context1) {
|
||||||
|
//noinspection SynchronizeOnNonFinalField
|
||||||
synchronized (hasInit) {
|
synchronized (hasInit) {
|
||||||
if (hasInit) return;
|
if (hasInit) return;
|
||||||
hasInit = true;
|
hasInit = true;
|
||||||
@ -56,7 +60,7 @@ public class LogUtil {
|
|||||||
return db.insert(LogTable.LogEntry.TABLE_NAME, null, values);
|
return db.insert(LogTable.LogEntry.TABLE_NAME, null, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int delLog(Long id, String key) {
|
public static void delLog(Long id, String key) {
|
||||||
// Define 'where' part of query.
|
// Define 'where' part of query.
|
||||||
String selection = " 1 ";
|
String selection = " 1 ";
|
||||||
// Specify arguments in placeholder order.
|
// Specify arguments in placeholder order.
|
||||||
@ -66,7 +70,6 @@ public class LogUtil {
|
|||||||
selection += " and " + LogTable.LogEntry._ID + " = ? ";
|
selection += " and " + LogTable.LogEntry._ID + " = ? ";
|
||||||
// Specify arguments in placeholder order.
|
// Specify arguments in placeholder order.
|
||||||
selectionArgList.add(String.valueOf(id));
|
selectionArgList.add(String.valueOf(id));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
@ -76,9 +79,9 @@ public class LogUtil {
|
|||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
}
|
}
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
// Issue SQL statement.
|
// Issue SQL statement.
|
||||||
return db.delete(LogTable.LogEntry.TABLE_NAME, selection, selectionArgs);
|
db.delete(LogTable.LogEntry.TABLE_NAME, selection, selectionArgs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +96,7 @@ public class LogUtil {
|
|||||||
values.put(LogTable.LogEntry.COLUMN_NAME_FORWARD_STATUS, forward_status);
|
values.put(LogTable.LogEntry.COLUMN_NAME_FORWARD_STATUS, forward_status);
|
||||||
values.put(LogTable.LogEntry.COLUMN_NAME_FORWARD_RESPONSE, forward_response);
|
values.put(LogTable.LogEntry.COLUMN_NAME_FORWARD_RESPONSE, forward_response);
|
||||||
|
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
return db.update(LogTable.LogEntry.TABLE_NAME, values, selection, selectionArgs);
|
return db.update(LogTable.LogEntry.TABLE_NAME, values, selection, selectionArgs);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -134,7 +137,7 @@ public class LogUtil {
|
|||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
}
|
}
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
|
|
||||||
// How you want the results sorted in the resulting Cursor
|
// How you want the results sorted in the resulting Cursor
|
||||||
String sortOrder =
|
String sortOrder =
|
||||||
@ -160,9 +163,9 @@ public class LogUtil {
|
|||||||
Log.d(TAG, "getLog: itemId cursor" + Arrays.toString(cursor.getColumnNames()));
|
Log.d(TAG, "getLog: itemId cursor" + Arrays.toString(cursor.getColumnNames()));
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
try {
|
try {
|
||||||
Long itemid = cursor.getLong(
|
Long itemId = cursor.getLong(
|
||||||
cursor.getColumnIndexOrThrow(BaseColumns._ID));
|
cursor.getColumnIndexOrThrow(BaseColumns._ID));
|
||||||
String itemfrom = cursor.getString(
|
String itemFrom = cursor.getString(
|
||||||
cursor.getColumnIndexOrThrow(LogTable.LogEntry.COLUMN_NAME_FROM));
|
cursor.getColumnIndexOrThrow(LogTable.LogEntry.COLUMN_NAME_FROM));
|
||||||
String content = cursor.getString(
|
String content = cursor.getString(
|
||||||
cursor.getColumnIndexOrThrow(LogTable.LogEntry.COLUMN_NAME_CONTENT));
|
cursor.getColumnIndexOrThrow(LogTable.LogEntry.COLUMN_NAME_CONTENT));
|
||||||
@ -184,14 +187,14 @@ public class LogUtil {
|
|||||||
cursor.getColumnIndexOrThrow(RuleTable.RuleEntry.COLUMN_NAME_SIM_SLOT));
|
cursor.getColumnIndexOrThrow(RuleTable.RuleEntry.COLUMN_NAME_SIM_SLOT));
|
||||||
String senderName = cursor.getString(
|
String senderName = cursor.getString(
|
||||||
cursor.getColumnIndexOrThrow(SenderTable.SenderEntry.COLUMN_NAME_NAME));
|
cursor.getColumnIndexOrThrow(SenderTable.SenderEntry.COLUMN_NAME_NAME));
|
||||||
Integer senderType = cursor.getInt(
|
int senderType = cursor.getInt(
|
||||||
cursor.getColumnIndexOrThrow(SenderTable.SenderEntry.COLUMN_NAME_TYPE));
|
cursor.getColumnIndexOrThrow(SenderTable.SenderEntry.COLUMN_NAME_TYPE));
|
||||||
|
|
||||||
String rule = RuleModel.getRuleMatch(ruleFiled, ruleCheck, ruleValue, ruleSimSlot);
|
String rule = RuleModel.getRuleMatch(ruleFiled, ruleCheck, ruleValue, ruleSimSlot);
|
||||||
if (senderName != null) rule += senderName.trim();
|
if (senderName != null) rule += senderName.trim();
|
||||||
|
|
||||||
int senderImageId = SenderModel.getImageId(senderType);
|
int senderImageId = SenderModel.getImageId(senderType);
|
||||||
LogVo logVo = new LogVo(itemid, itemfrom, content, simInfo, time, rule, senderImageId, forwardStatus, forwardResponse);
|
LogVo logVo = new LogVo(itemId, itemFrom, content, simInfo, time, rule, senderImageId, forwardStatus, forwardResponse);
|
||||||
LogVos.add(logVo);
|
LogVos.add(logVo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "getLog e:" + e.getMessage());
|
Log.e(TAG, "getLog e:" + e.getMessage());
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
@ -11,13 +12,15 @@ public class NetUtil {
|
|||||||
//移动网络
|
//移动网络
|
||||||
private static final int NETWORK_MOBILE = 1;
|
private static final int NETWORK_MOBILE = 1;
|
||||||
//无线网络
|
//无线网络
|
||||||
private static final int NETWORW_WIFI = 2;
|
private static final int NETWORK_WIFI = 2;
|
||||||
|
|
||||||
static Boolean hasInit = false;
|
static Boolean hasInit = false;
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
static Context context;
|
static Context context;
|
||||||
|
|
||||||
|
|
||||||
public static void init(Context context1) {
|
public static void init(Context context1) {
|
||||||
|
//noinspection SynchronizeOnNonFinalField
|
||||||
synchronized (hasInit) {
|
synchronized (hasInit) {
|
||||||
if (hasInit) return;
|
if (hasInit) return;
|
||||||
hasInit = true;
|
hasInit = true;
|
||||||
@ -37,7 +40,7 @@ public class NetUtil {
|
|||||||
if (activeNetworkInfo.getType() == (ConnectivityManager.TYPE_WIFI)) {
|
if (activeNetworkInfo.getType() == (ConnectivityManager.TYPE_WIFI)) {
|
||||||
//返回无线网络
|
//返回无线网络
|
||||||
Toast.makeText(context, "当前处于无线网络", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "当前处于无线网络", Toast.LENGTH_SHORT).show();
|
||||||
return NETWORW_WIFI;
|
return NETWORK_WIFI;
|
||||||
//判断是否移动网络
|
//判断是否移动网络
|
||||||
} else if (activeNetworkInfo.getType() == (ConnectivityManager.TYPE_MOBILE)) {
|
} else if (activeNetworkInfo.getType() == (ConnectivityManager.TYPE_MOBILE)) {
|
||||||
Toast.makeText(context, "当前处于移动网络", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "当前处于移动网络", Toast.LENGTH_SHORT).show();
|
||||||
|
@ -53,18 +53,16 @@ public class OSUtils {
|
|||||||
//EMUI标识
|
//EMUI标识
|
||||||
private static final String KEY_EMUI_VERSION_CODE = "ro.build.version.emui";
|
private static final String KEY_EMUI_VERSION_CODE = "ro.build.version.emui";
|
||||||
//Flyme标识
|
//Flyme标识
|
||||||
private static final String KEY_FLYME_ID_FALG_KEY = "ro.build.display.id";
|
private static final String KEY_FLYME_ID_FLAG_KEY = "ro.build.display.id";
|
||||||
private static final String KEY_FLYME_ID_FALG_VALUE_KEYWORD = "Flyme";
|
private static final String KEY_FLYME_ID_FLAG_VALUE_KEYWORD = "Flyme";
|
||||||
private static final String KEY_FLYME_ICON_FALG = "persist.sys.use.flyme.icon";
|
private static final String KEY_FLYME_ICON_FLAG = "persist.sys.use.flyme.icon";
|
||||||
private static final String KEY_FLYME_SETUP_FALG = "ro.meizu.setupwizard.flyme";
|
private static final String KEY_FLYME_SETUP_FLAG = "ro.meizu.setupwizard.flyme";
|
||||||
private static final String KEY_FLYME_PUBLISH_FALG = "ro.flyme.published";
|
private static final String KEY_FLYME_PUBLISH_FLAG = "ro.flyme.published";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param
|
* 获取ROM类型,MIUI_ROM, *FLYME_ROM, * EMUI_ROM, * OTHER_ROM
|
||||||
|
*
|
||||||
* @return ROM_TYPE ROM类型的枚举
|
* @return ROM_TYPE ROM类型的枚举
|
||||||
* @datecreate at 2016/5/11 0011 9:46
|
|
||||||
* @mehtodgetRomType
|
|
||||||
* @description获取ROM类型,MIUI_ROM, *FLYME_ROM, * EMUI_ROM, * OTHER_ROM
|
|
||||||
*/
|
*/
|
||||||
public static ROM_TYPE getRomType() {
|
public static ROM_TYPE getRomType() {
|
||||||
ROM_TYPE rom_type = ROM_TYPE.OTHER_ROM;
|
ROM_TYPE rom_type = ROM_TYPE.OTHER_ROM;
|
||||||
@ -76,12 +74,12 @@ public class OSUtils {
|
|||||||
if (buildProperties.containsKey(KEY_MIUI_VERSION_CODE) || buildProperties.containsKey(KEY_MIUI_VERSION_NAME)) {
|
if (buildProperties.containsKey(KEY_MIUI_VERSION_CODE) || buildProperties.containsKey(KEY_MIUI_VERSION_NAME)) {
|
||||||
return ROM_TYPE.MIUI_ROM;
|
return ROM_TYPE.MIUI_ROM;
|
||||||
}
|
}
|
||||||
if (buildProperties.containsKey(KEY_FLYME_ICON_FALG) || buildProperties.containsKey(KEY_FLYME_SETUP_FALG) || buildProperties.containsKey(KEY_FLYME_PUBLISH_FALG)) {
|
if (buildProperties.containsKey(KEY_FLYME_ICON_FLAG) || buildProperties.containsKey(KEY_FLYME_SETUP_FLAG) || buildProperties.containsKey(KEY_FLYME_PUBLISH_FLAG)) {
|
||||||
return ROM_TYPE.FLYME_ROM;
|
return ROM_TYPE.FLYME_ROM;
|
||||||
}
|
}
|
||||||
if (buildProperties.containsKey(KEY_FLYME_ID_FALG_KEY)) {
|
if (buildProperties.containsKey(KEY_FLYME_ID_FLAG_KEY)) {
|
||||||
String romName = buildProperties.getProperty(KEY_FLYME_ID_FALG_KEY);
|
String romName = buildProperties.getProperty(KEY_FLYME_ID_FLAG_KEY);
|
||||||
if (!TextUtils.isEmpty(romName) && romName.contains(KEY_FLYME_ID_FALG_VALUE_KEYWORD)) {
|
if (!TextUtils.isEmpty(romName) && romName.contains(KEY_FLYME_ID_FLAG_VALUE_KEYWORD)) {
|
||||||
return ROM_TYPE.FLYME_ROM;
|
return ROM_TYPE.FLYME_ROM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,15 +24,17 @@ import java.io.File;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@SuppressWarnings({"deprecation", "rawtypes", "unchecked", "CommentedOutCode", "SynchronizeOnNonFinalField", "unused", "SameReturnValue"})
|
||||||
public class PhoneUtils {
|
public class PhoneUtils {
|
||||||
static Boolean hasInit = false;
|
static Boolean hasInit = false;
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
static Context context;
|
static Context context;
|
||||||
private static String TAG = "PhoneUtils";
|
private static final String TAG = "PhoneUtils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造类
|
* 构造类
|
||||||
@ -109,7 +111,7 @@ public class PhoneUtils {
|
|||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return getUniquePsuedoID();
|
return getUniquePseudoID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,7 +120,7 @@ public class PhoneUtils {
|
|||||||
*
|
*
|
||||||
* @return 伪唯一ID
|
* @return 伪唯一ID
|
||||||
*/
|
*/
|
||||||
public static String getUniquePsuedoID() {
|
public static String getUniquePseudoID() {
|
||||||
String m_szDevIDShort = "35" +
|
String m_szDevIDShort = "35" +
|
||||||
Build.BOARD.length() % 10 + Build.BRAND.length() % 10 +
|
Build.BOARD.length() % 10 + Build.BRAND.length() % 10 +
|
||||||
Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 +
|
Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 +
|
||||||
@ -130,7 +132,7 @@ public class PhoneUtils {
|
|||||||
|
|
||||||
String serial;
|
String serial;
|
||||||
try {
|
try {
|
||||||
serial = android.os.Build.class.getField("SERIAL").get(null).toString();
|
serial = Objects.requireNonNull(Build.class.getField("SERIAL").get(null)).toString();
|
||||||
return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
|
return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//获取失败,使用AndroidId
|
//获取失败,使用AndroidId
|
||||||
@ -217,10 +219,10 @@ public class PhoneUtils {
|
|||||||
public static String getSimSerialNumber() {
|
public static String getSimSerialNumber() {
|
||||||
try {
|
try {
|
||||||
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
String serialNumber = tm != null ? tm.getSimSerialNumber() : null;
|
@SuppressLint("HardwareIds") String serialNumber = tm != null ? tm.getSimSerialNumber() : null;
|
||||||
|
|
||||||
return serialNumber != null ? serialNumber : "";
|
return serialNumber != null ? serialNumber : "";
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
@ -247,7 +249,7 @@ public class PhoneUtils {
|
|||||||
*
|
*
|
||||||
* @return 电话号码
|
* @return 电话号码
|
||||||
*/
|
*/
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint({"MissingPermission", "HardwareIds"})
|
||||||
public static String getPhoneNumber() {
|
public static String getPhoneNumber() {
|
||||||
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
try {
|
try {
|
||||||
@ -280,7 +282,7 @@ public class PhoneUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
count = Integer.parseInt(getReflexMethod(context, "getPhoneCount"));
|
count = Integer.parseInt(getReflexMethod(context));
|
||||||
} catch (MethodNotFoundException ignored) {
|
} catch (MethodNotFoundException ignored) {
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
@ -334,9 +336,7 @@ public class PhoneUtils {
|
|||||||
List<SubscriptionInfo> activeSubscriptionInfoList = null;
|
List<SubscriptionInfo> activeSubscriptionInfoList = null;
|
||||||
if (mSubscriptionManager != null) {
|
if (mSubscriptionManager != null) {
|
||||||
try {
|
try {
|
||||||
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
|
ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE);
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
activeSubscriptionInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();
|
activeSubscriptionInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
@ -414,10 +414,10 @@ public class PhoneUtils {
|
|||||||
String imsi = null;
|
String imsi = null;
|
||||||
try {
|
try {
|
||||||
imsi = getReflexMethodWithId(context, "getSubscriberId", String.valueOf(i));
|
imsi = getReflexMethodWithId(context, "getSubscriberId", String.valueOf(i));
|
||||||
} catch (MethodNotFoundException ignored) {
|
} catch (MethodNotFoundException e) {
|
||||||
Log.d(TAG, String.valueOf(ignored));
|
Log.d(TAG, String.valueOf(e));
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(imsi) && !imsi.equals(getIMSI())) {
|
if (!TextUtils.isEmpty(imsi) && !Objects.equals(imsi, getIMSI())) {
|
||||||
return imsi;
|
return imsi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -456,23 +456,22 @@ public class PhoneUtils {
|
|||||||
/**
|
/**
|
||||||
* 通过反射调取@hide的方法
|
* 通过反射调取@hide的方法
|
||||||
*
|
*
|
||||||
* @param predictedMethodName 方法名
|
|
||||||
* @return 返回方法调用的结果
|
* @return 返回方法调用的结果
|
||||||
* @throws MethodNotFoundException 方法没有找到
|
* @throws MethodNotFoundException 方法没有找到
|
||||||
*/
|
*/
|
||||||
private static String getReflexMethod(Context context, String predictedMethodName) throws MethodNotFoundException {
|
private static String getReflexMethod(Context context) throws MethodNotFoundException {
|
||||||
String result = null;
|
String result = null;
|
||||||
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
try {
|
try {
|
||||||
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
|
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
|
||||||
Method getSimID = telephonyClass.getMethod(predictedMethodName);
|
Method getSimID = telephonyClass.getMethod("getPhoneCount");
|
||||||
Object ob_phone = getSimID.invoke(telephony);
|
Object ob_phone = getSimID.invoke(telephony);
|
||||||
if (ob_phone != null) {
|
if (ob_phone != null) {
|
||||||
result = ob_phone.toString();
|
result = ob_phone.toString();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d(TAG, String.valueOf(e.fillInStackTrace()));
|
Log.d(TAG, String.valueOf(e.fillInStackTrace()));
|
||||||
throw new MethodNotFoundException(predictedMethodName);
|
throw new MethodNotFoundException("getPhoneCount");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -517,8 +516,7 @@ public class PhoneUtils {
|
|||||||
public static List removeDuplicateWithOrder(List list) {
|
public static List removeDuplicateWithOrder(List list) {
|
||||||
Set set = new HashSet();
|
Set set = new HashSet();
|
||||||
List newList = new ArrayList();
|
List newList = new ArrayList();
|
||||||
for (Iterator iter = list.iterator(); iter.hasNext(); ) {
|
for (Object element : list) {
|
||||||
Object element = iter.next();
|
|
||||||
if (set.add(element))
|
if (set.add(element))
|
||||||
newList.add(element);
|
newList.add(element);
|
||||||
}
|
}
|
||||||
@ -601,15 +599,13 @@ public class PhoneUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过 IMEI 判断是否相等
|
* 通过 IMEI 判断是否相等
|
||||||
*
|
|
||||||
* @param obj
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return obj != null && obj instanceof SimInfo && (TextUtils.isEmpty(((SimInfo) obj).mImei) || ((SimInfo) obj).mImei.equals(mImei));
|
return obj instanceof SimInfo && (TextUtils.isEmpty(((SimInfo) obj).mImei) || ((SimInfo) obj).mImei.equals(mImei));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SimInfo{" +
|
return "SimInfo{" +
|
||||||
|
@ -3,6 +3,8 @@ package com.idormy.sms.forwarder.utils;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.model.vo.SmsVo;
|
import com.idormy.sms.forwarder.model.vo.SmsVo;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -10,6 +12,7 @@ import java.util.List;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.regex.PatternSyntaxException;
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
class RuleLine {
|
class RuleLine {
|
||||||
public static final String CONJUNCTION_AND = "并且";
|
public static final String CONJUNCTION_AND = "并且";
|
||||||
public static final String CONJUNCTION_OR = "或者";
|
public static final String CONJUNCTION_OR = "或者";
|
||||||
@ -23,11 +26,11 @@ class RuleLine {
|
|||||||
public static final String CHECK_START_WITH = "开头";
|
public static final String CHECK_START_WITH = "开头";
|
||||||
public static final String CHECK_END_WITH = "结尾";
|
public static final String CHECK_END_WITH = "结尾";
|
||||||
public static final String CHECK_REGEX = "正则";
|
public static final String CHECK_REGEX = "正则";
|
||||||
public static List<String> CONJUNCTION_LIST = new ArrayList<String>();
|
public static final List<String> CONJUNCTION_LIST = new ArrayList<>();
|
||||||
public static List<String> FILED_LIST = new ArrayList<String>();
|
public static final List<String> FILED_LIST = new ArrayList<>();
|
||||||
public static List<String> SURE_LIST = new ArrayList<String>();
|
public static final List<String> SURE_LIST = new ArrayList<>();
|
||||||
public static List<String> CHECK_LIST = new ArrayList<String>();
|
public static final List<String> CHECK_LIST = new ArrayList<>();
|
||||||
static String TAG = "RuleLine";
|
static final String TAG = "RuleLine";
|
||||||
static Boolean STARTLOG = true;
|
static Boolean STARTLOG = true;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -71,8 +74,8 @@ class RuleLine {
|
|||||||
String check;
|
String check;
|
||||||
String value;
|
String value;
|
||||||
|
|
||||||
public RuleLine(String line, int linenum, RuleLine beforeRuleLine) throws Exception {
|
public RuleLine(String line, int lineNum, RuleLine beforeRuleLine) throws Exception {
|
||||||
logg("----------" + linenum + "-----------------");
|
logg("----------" + lineNum + "-----------------");
|
||||||
logg(line);
|
logg(line);
|
||||||
//规则检验:
|
//规则检验:
|
||||||
//并且 是 手机号 相等 10086
|
//并且 是 手机号 相等 10086
|
||||||
@ -85,7 +88,7 @@ class RuleLine {
|
|||||||
|
|
||||||
//标记3个阶段
|
//标记3个阶段
|
||||||
boolean isCountHeading = false;
|
boolean isCountHeading = false;
|
||||||
boolean isDealMiddel = false;
|
boolean isDealMiddle = false;
|
||||||
boolean isDealValue = false;
|
boolean isDealValue = false;
|
||||||
|
|
||||||
//用于保存4个中间体: 并且, 是, 内容, 包含
|
//用于保存4个中间体: 并且, 是, 内容, 包含
|
||||||
@ -107,44 +110,41 @@ class RuleLine {
|
|||||||
isCountHeading = true;
|
isCountHeading = true;
|
||||||
} else {
|
} else {
|
||||||
//直接进入处理中间体阶段
|
//直接进入处理中间体阶段
|
||||||
isCountHeading = false;
|
isDealMiddle = true;
|
||||||
isDealMiddel = true;
|
logg("start to isDealMiddle:");
|
||||||
logg("start to isDealMiddel:");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//正在数空格头,但是遇到非空格,阶段变更:由处理空头阶段 变为 处理 中间体阶段
|
//正在数空格头,但是遇到非空格,阶段变更:由处理空头阶段 变为 处理 中间体阶段
|
||||||
if (isCountHeading && (!" ".equals(w))) {
|
if (isCountHeading && (!" ".equals(w))) {
|
||||||
logg("isCountHeading to isDealMiddel:");
|
logg("isCountHeading to isDealMiddle:");
|
||||||
|
|
||||||
isCountHeading = false;
|
isCountHeading = false;
|
||||||
isDealMiddel = true;
|
isDealMiddle = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//正在处理中间体,中间体数量够了,阶段变更:由处理中间体 变为 处理 value
|
//正在处理中间体,中间体数量够了,阶段变更:由处理中间体 变为 处理 value
|
||||||
if (isDealMiddel && middleList.size() == 4) {
|
if (isDealMiddle && middleList.size() == 4) {
|
||||||
logg("isDealMiddel done middleList:" + middleList);
|
logg("isDealMiddle done middleList:" + middleList);
|
||||||
logg("isDealMiddel to isDealValue:");
|
logg("isDealMiddle to isDealValue:");
|
||||||
isDealMiddel = false;
|
isDealMiddle = false;
|
||||||
isDealValue = true;
|
isDealValue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
logg("isCountHeading:" + isCountHeading);
|
logg("isCountHeading:" + isCountHeading);
|
||||||
logg("isDealMiddel:" + isDealMiddel);
|
logg("isDealMiddle:" + isDealMiddle);
|
||||||
logg("isDealValue:" + isDealValue);
|
logg("isDealValue:" + isDealValue);
|
||||||
|
|
||||||
if (isCountHeading) {
|
if (isCountHeading) {
|
||||||
if (" ".equals(w)) {
|
logg("headSpaceNum++:" + headSpaceNum);
|
||||||
logg("headSpaceNum++:" + headSpaceNum);
|
headSpaceNum++;
|
||||||
headSpaceNum++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDealMiddel) {
|
if (isDealMiddle) {
|
||||||
//遇到空格
|
//遇到空格
|
||||||
if (" ".equals(w)) {
|
if (" ".equals(w)) {
|
||||||
if (buildMiddleWord.length() == 0) {
|
if (buildMiddleWord.length() == 0) {
|
||||||
throw new Exception(linenum + "行:语法错误不允许出现连续空格!");
|
throw new Exception(lineNum + "行:语法错误不允许出现连续空格!");
|
||||||
} else {
|
} else {
|
||||||
//生成了一个中间体
|
//生成了一个中间体
|
||||||
middleList.add(buildMiddleWord.toString());
|
middleList.add(buildMiddleWord.toString());
|
||||||
@ -170,7 +170,7 @@ class RuleLine {
|
|||||||
|
|
||||||
|
|
||||||
if (middleList.size() != 4) {
|
if (middleList.size() != 4) {
|
||||||
throw new Exception(linenum + "行配置错误:每行必须有4段组成,例如: 并且 手机号 是 相等 ");
|
throw new Exception(lineNum + "行配置错误:每行必须有4段组成,例如: 并且 手机号 是 相等 ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -232,19 +232,19 @@ class RuleLine {
|
|||||||
this.value = valueBuilder.toString();
|
this.value = valueBuilder.toString();
|
||||||
|
|
||||||
if (!CONJUNCTION_LIST.contains(this.conjunction)) {
|
if (!CONJUNCTION_LIST.contains(this.conjunction)) {
|
||||||
throw new Exception(linenum + "行配置错误:连接词只支持:" + CONJUNCTION_LIST + " 但提供了" + this.conjunction);
|
throw new Exception(lineNum + "行配置错误:连接词只支持:" + CONJUNCTION_LIST + " 但提供了" + this.conjunction);
|
||||||
}
|
}
|
||||||
if (!FILED_LIST.contains(this.field)) {
|
if (!FILED_LIST.contains(this.field)) {
|
||||||
throw new Exception(linenum + "行配置错误:字段只支持:" + FILED_LIST + " 但提供了" + this.field);
|
throw new Exception(lineNum + "行配置错误:字段只支持:" + FILED_LIST + " 但提供了" + this.field);
|
||||||
}
|
}
|
||||||
if (!SURE_LIST.contains(this.sure)) {
|
if (!SURE_LIST.contains(this.sure)) {
|
||||||
throw new Exception(linenum + "行配置错误 " + this.sure + " 确认词只支持:" + SURE_LIST + " 但提供了" + this.sure);
|
throw new Exception(lineNum + "行配置错误 " + this.sure + " 确认词只支持:" + SURE_LIST + " 但提供了" + this.sure);
|
||||||
}
|
}
|
||||||
if (!CHECK_LIST.contains(this.check)) {
|
if (!CHECK_LIST.contains(this.check)) {
|
||||||
throw new Exception(linenum + "行配置错误:比较词只支持:" + CHECK_LIST + " 但提供了" + this.check);
|
throw new Exception(lineNum + "行配置错误:比较词只支持:" + CHECK_LIST + " 但提供了" + this.check);
|
||||||
}
|
}
|
||||||
|
|
||||||
logg("----------" + linenum + "==" + this);
|
logg("----------" + lineNum + "==" + this);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -282,7 +282,6 @@ class RuleLine {
|
|||||||
//整合肯定词
|
//整合肯定词
|
||||||
switch (this.sure) {
|
switch (this.sure) {
|
||||||
case SURE_YES:
|
case SURE_YES:
|
||||||
mixChecked = mixChecked;
|
|
||||||
break;
|
break;
|
||||||
case SURE_NOT:
|
case SURE_NOT:
|
||||||
mixChecked = !mixChecked;
|
mixChecked = !mixChecked;
|
||||||
@ -311,6 +310,11 @@ class RuleLine {
|
|||||||
checked = msgValue.contains(this.value);
|
checked = msgValue.contains(this.value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CHECK_NOT_CONTAIN:
|
||||||
|
if (msgValue != null) {
|
||||||
|
checked = !msgValue.contains(this.value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CHECK_START_WITH:
|
case CHECK_START_WITH:
|
||||||
if (msgValue != null) {
|
if (msgValue != null) {
|
||||||
checked = msgValue.startsWith(this.value);
|
checked = msgValue.startsWith(this.value);
|
||||||
@ -326,7 +330,6 @@ class RuleLine {
|
|||||||
try {
|
try {
|
||||||
checked = Pattern.matches(this.value, msgValue);
|
checked = Pattern.matches(this.value, msgValue);
|
||||||
} catch (PatternSyntaxException e) {
|
} catch (PatternSyntaxException e) {
|
||||||
checked = false;
|
|
||||||
logg("PatternSyntaxException: ");
|
logg("PatternSyntaxException: ");
|
||||||
logg("Description: " + e.getDescription());
|
logg("Description: " + e.getDescription());
|
||||||
logg("Index: " + e.getIndex());
|
logg("Index: " + e.getIndex());
|
||||||
@ -344,6 +347,7 @@ class RuleLine {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "RuleLine{" +
|
return "RuleLine{" +
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import static com.idormy.sms.forwarder.utils.RuleLine.CONJUNCTION_AND;
|
||||||
|
import static com.idormy.sms.forwarder.utils.RuleLine.CONJUNCTION_OR;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.idormy.sms.forwarder.model.vo.SmsVo;
|
import com.idormy.sms.forwarder.model.vo.SmsVo;
|
||||||
@ -7,11 +10,9 @@ import com.idormy.sms.forwarder.model.vo.SmsVo;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
import static com.idormy.sms.forwarder.utils.RuleLine.CONJUNCTION_AND;
|
@SuppressWarnings("unused")
|
||||||
import static com.idormy.sms.forwarder.utils.RuleLine.CONJUNCTION_OR;
|
|
||||||
|
|
||||||
public class RuleLineUtils {
|
public class RuleLineUtils {
|
||||||
static String TAG = "RuleLineUtils";
|
static final String TAG = "RuleLineUtils";
|
||||||
static Boolean STARTLOG = false;
|
static Boolean STARTLOG = false;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
@ -41,16 +42,16 @@ public class RuleLineUtils {
|
|||||||
|
|
||||||
Scanner scanner = new Scanner(RuleLines);
|
Scanner scanner = new Scanner(RuleLines);
|
||||||
|
|
||||||
int linenum = 0;
|
int lineNum = 0;
|
||||||
RuleLine headRuleLine = null;
|
RuleLine headRuleLine = null;
|
||||||
|
|
||||||
RuleLine beforeRuleLine = null;
|
RuleLine beforeRuleLine = null;
|
||||||
|
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
String line = scanner.nextLine();
|
String line = scanner.nextLine();
|
||||||
logg(linenum + " : " + line);
|
logg(lineNum + " : " + line);
|
||||||
//第一行
|
//第一行
|
||||||
if (linenum == 0) {
|
if (lineNum == 0) {
|
||||||
//第一行不允许缩进
|
//第一行不允许缩进
|
||||||
if (line.startsWith(" ")) {
|
if (line.startsWith(" ")) {
|
||||||
throw new Exception("第一行不允许缩进");
|
throw new Exception("第一行不允许缩进");
|
||||||
@ -60,14 +61,15 @@ public class RuleLineUtils {
|
|||||||
// process the line
|
// process the line
|
||||||
|
|
||||||
|
|
||||||
beforeRuleLine = RuleLineUtils.generateRuleTree(line, linenum, beforeRuleLine);
|
beforeRuleLine = RuleLineUtils.generateRuleTree(line, lineNum, beforeRuleLine);
|
||||||
if (linenum == 0) {
|
if (lineNum == 0) {
|
||||||
headRuleLine = beforeRuleLine;
|
headRuleLine = beforeRuleLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
linenum++;
|
lineNum++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert headRuleLine != null;
|
||||||
return checkRuleTree(msg, headRuleLine);
|
return checkRuleTree(msg, headRuleLine);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
@ -13,9 +14,11 @@ import com.idormy.sms.forwarder.model.RuleTable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings({"UnusedReturnValue", "SynchronizeOnNonFinalField"})
|
||||||
public class RuleUtil {
|
public class RuleUtil {
|
||||||
static String TAG = "RuleUtil";
|
static final String TAG = "RuleUtil";
|
||||||
static Boolean hasInit = false;
|
static Boolean hasInit = false;
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
static Context context;
|
static Context context;
|
||||||
static DbHelper dbHelper;
|
static DbHelper dbHelper;
|
||||||
static SQLiteDatabase db;
|
static SQLiteDatabase db;
|
||||||
@ -75,7 +78,7 @@ public class RuleUtil {
|
|||||||
selectionArgList.add(String.valueOf(id));
|
selectionArgList.add(String.valueOf(id));
|
||||||
|
|
||||||
}
|
}
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
// Issue SQL statement.
|
// Issue SQL statement.
|
||||||
return db.delete(RuleTable.RuleEntry.TABLE_NAME, selection, selectionArgs);
|
return db.delete(RuleTable.RuleEntry.TABLE_NAME, selection, selectionArgs);
|
||||||
|
|
||||||
@ -114,7 +117,7 @@ public class RuleUtil {
|
|||||||
// Specify arguments in placeholder order.
|
// Specify arguments in placeholder order.
|
||||||
selectionArgList.add(key);
|
selectionArgList.add(key);
|
||||||
}
|
}
|
||||||
String[] selectionArgs = selectionArgList.toArray(new String[selectionArgList.size()]);
|
String[] selectionArgs = selectionArgList.toArray(new String[0]);
|
||||||
|
|
||||||
// How you want the results sorted in the resulting Cursor
|
// How you want the results sorted in the resulting Cursor
|
||||||
String sortOrder =
|
String sortOrder =
|
||||||
|
@ -5,10 +5,12 @@ import android.content.SharedPreferences;
|
|||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@SuppressWarnings({"SynchronizeOnNonFinalField", "unused"})
|
||||||
public class SettingUtil {
|
public class SettingUtil {
|
||||||
static Boolean hasInit = false;
|
static Boolean hasInit = false;
|
||||||
private static String TAG = "SettingUtil";
|
private static final String TAG = "SettingUtil";
|
||||||
private static SharedPreferences sp_setting = null;
|
private static SharedPreferences sp_setting = null;
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
private static Context context = null;
|
private static Context context = null;
|
||||||
|
|
||||||
public static void init(Context context1) {
|
public static void init(Context context1) {
|
||||||
@ -32,6 +34,27 @@ public class SettingUtil {
|
|||||||
return sp_setting.getBoolean(Define.SP_MSG_KEY_SWITCH_ADD_EXTRA, false);
|
return sp_setting.getBoolean(Define.SP_MSG_KEY_SWITCH_ADD_EXTRA, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void switchAddDeviceName(Boolean switchAddDeviceName) {
|
||||||
|
Log.d(TAG, "switchAddDeviceName :" + switchAddDeviceName);
|
||||||
|
sp_setting.edit()
|
||||||
|
.putBoolean(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_NAME, switchAddDeviceName)
|
||||||
|
.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean getSwitchAddDeviceName() {
|
||||||
|
return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_NAME, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void switchEnablePhone(Boolean enable) {
|
||||||
|
sp_setting.edit()
|
||||||
|
.putBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PHONE, enable)
|
||||||
|
.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean getSwitchEnablePhone() {
|
||||||
|
return sp_setting.getBoolean(Define.SP_MSG_KEY_STRING_ENABLE_PHONE, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static void switchSmsTemplate(Boolean switchSmsTemplate) {
|
public static void switchSmsTemplate(Boolean switchSmsTemplate) {
|
||||||
Log.d(TAG, "switchSmsTemplate :" + switchSmsTemplate);
|
Log.d(TAG, "switchSmsTemplate :" + switchSmsTemplate);
|
||||||
sp_setting.edit()
|
sp_setting.edit()
|
||||||
@ -100,8 +123,7 @@ public class SettingUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getBatteryLevelAlarm() {
|
public static String getBatteryLevelAlarm() {
|
||||||
String res = sp_setting.getString(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ALARM, "");
|
return sp_setting.getString(Define.SP_MSG_KEY_STRING_BATTERY_LEVEL_ALARM, "");
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBatteryLevelAlarm(String battery_level) {
|
public static void setBatteryLevelAlarm(String battery_level) {
|
||||||
@ -112,7 +134,7 @@ public class SettingUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean saveMsgHistory() {
|
public static boolean saveMsgHistory() {
|
||||||
return sp_setting.getBoolean("option_save_history_on", false);
|
return !sp_setting.getBoolean("option_save_history_on", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//接口请求失败重试
|
//接口请求失败重试
|
||||||
|
@ -6,8 +6,9 @@ import android.util.Log;
|
|||||||
import com.idormy.sms.forwarder.MyApplication;
|
import com.idormy.sms.forwarder.MyApplication;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class SimUtil {
|
public class SimUtil {
|
||||||
private static String TAG = "SimUtil";
|
private static final String TAG = "SimUtil";
|
||||||
|
|
||||||
//获取卡槽信息ID
|
//获取卡槽信息ID
|
||||||
public static int getSimId(Bundle bundle) {
|
public static int getSimId(Bundle bundle) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -7,10 +8,13 @@ import android.telephony.SmsManager;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@SuppressWarnings("SynchronizeOnNonFinalField")
|
||||||
public class SmsUtil {
|
public class SmsUtil {
|
||||||
static String TAG = "SmsUtil";
|
static final String TAG = "SmsUtil";
|
||||||
static Boolean hasInit = false;
|
static Boolean hasInit = false;
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
static Context context;
|
static Context context;
|
||||||
|
|
||||||
|
|
||||||
@ -28,11 +32,11 @@ public class SmsUtil {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(subId);
|
SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(subId);
|
||||||
PendingIntent sendPI = PendingIntent.getBroadcast(context, 0, new Intent(Context.TELEPHONY_SUBSCRIPTION_SERVICE), PendingIntent.FLAG_ONE_SHOT);
|
@SuppressLint("UnspecifiedImmutableFlag") PendingIntent sendPI = PendingIntent.getBroadcast(context, 0, new Intent(Context.TELEPHONY_SUBSCRIPTION_SERVICE), PendingIntent.FLAG_ONE_SHOT);
|
||||||
PendingIntent deliverPI = PendingIntent.getBroadcast(context, 0, new Intent("DELIVERED_SMS_ACTION"), 0);
|
@SuppressLint("UnspecifiedImmutableFlag") PendingIntent deliverPI = PendingIntent.getBroadcast(context, 0, new Intent("DELIVERED_SMS_ACTION"), 0);
|
||||||
|
|
||||||
ArrayList<PendingIntent> sentPendingIntents = new ArrayList<PendingIntent>();
|
ArrayList<PendingIntent> sentPendingIntents = new ArrayList<>();
|
||||||
ArrayList<PendingIntent> deliveredPendingIntents = new ArrayList<PendingIntent>();
|
ArrayList<PendingIntent> deliveredPendingIntents = new ArrayList<>();
|
||||||
ArrayList<String> divideContents = smsManager.divideMessage(message);
|
ArrayList<String> divideContents = smsManager.divideMessage(message);
|
||||||
|
|
||||||
for (int i = 0; i < divideContents.size(); i++) {
|
for (int i = 0; i < divideContents.size(); i++) {
|
||||||
@ -43,7 +47,7 @@ public class SmsUtil {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, e.getMessage());
|
Log.e(TAG, Objects.requireNonNull(e.getMessage()));
|
||||||
return e.getMessage();
|
return e.getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.idormy.sms.forwarder.utils;
|
package com.idormy.sms.forwarder.utils;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@ -15,15 +16,13 @@ import java.util.Properties;
|
|||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
public class aUtil {
|
public class aUtil {
|
||||||
private static String TAG = "aUtil";
|
|
||||||
|
|
||||||
private static Context context = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否为MIUI系统,参考http://blog.csdn.net/xx326664162/article/details/52438706
|
* 判断是否为MIUI系统,参考http://blog.csdn.net/xx326664162/article/details/52438706
|
||||||
*
|
*
|
||||||
* @return
|
* @return 返回结果
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static boolean isMIUI() {
|
public static boolean isMIUI() {
|
||||||
try {
|
try {
|
||||||
String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code";
|
String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code";
|
||||||
@ -45,8 +44,7 @@ public class aUtil {
|
|||||||
PackageManager packageManager = context.getPackageManager();
|
PackageManager packageManager = context.getPackageManager();
|
||||||
// getPackageName()是你当前类的包名,0代表是获取版本信息
|
// getPackageName()是你当前类的包名,0代表是获取版本信息
|
||||||
PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
|
PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
|
||||||
String version = packInfo.versionName;
|
return packInfo.versionName;
|
||||||
return version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getVersionCode(Context context) throws Exception {
|
public static Integer getVersionCode(Context context) throws Exception {
|
||||||
@ -54,15 +52,14 @@ public class aUtil {
|
|||||||
PackageManager packageManager = context.getPackageManager();
|
PackageManager packageManager = context.getPackageManager();
|
||||||
// getPackageName()是你当前类的包名,0代表是获取版本信息
|
// getPackageName()是你当前类的包名,0代表是获取版本信息
|
||||||
PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
|
PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
|
||||||
Integer versionCode = packInfo.versionCode;
|
return packInfo.versionCode;
|
||||||
return versionCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//友好时间显示
|
//友好时间显示
|
||||||
public static String friendlyTime(String utcTime) {
|
public static String friendlyTime(String utcTime) {
|
||||||
SimpleDateFormat utcFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat utcFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
utcFormater.setTimeZone(TimeZone.getTimeZone("UTC"));//时区定义并进行时间获取
|
utcFormater.setTimeZone(TimeZone.getTimeZone("UTC"));//时区定义并进行时间获取
|
||||||
Date utcDate = null;
|
Date utcDate;
|
||||||
try {
|
try {
|
||||||
utcDate = utcFormater.parse(utcTime);
|
utcDate = utcFormater.parse(utcTime);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
@ -71,6 +68,7 @@ public class aUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取utcDate距离当前的秒数
|
//获取utcDate距离当前的秒数
|
||||||
|
assert utcDate != null;
|
||||||
int ct = (int) ((System.currentTimeMillis() - utcDate.getTime()) / 1000);
|
int ct = (int) ((System.currentTimeMillis() - utcDate.getTime()) / 1000);
|
||||||
|
|
||||||
if (ct == 0) {
|
if (ct == 0) {
|
||||||
@ -107,10 +105,10 @@ public class aUtil {
|
|||||||
public static String utc2Local(String utcTime) {
|
public static String utc2Local(String utcTime) {
|
||||||
String utcTimePatten = "yyyy-MM-dd HH:mm:ss";
|
String utcTimePatten = "yyyy-MM-dd HH:mm:ss";
|
||||||
String localTimePatten = "yyyy-MM-dd HH:mm:ss";
|
String localTimePatten = "yyyy-MM-dd HH:mm:ss";
|
||||||
SimpleDateFormat utcFormater = new SimpleDateFormat(utcTimePatten);
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat utcFormater = new SimpleDateFormat(utcTimePatten);
|
||||||
utcFormater.setTimeZone(TimeZone.getTimeZone("UTC"));//时区定义并进行时间获取
|
utcFormater.setTimeZone(TimeZone.getTimeZone("UTC"));//时区定义并进行时间获取
|
||||||
|
|
||||||
Date utcDate = null;
|
Date utcDate;
|
||||||
try {
|
try {
|
||||||
utcDate = utcFormater.parse(utcTime);
|
utcDate = utcFormater.parse(utcTime);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
@ -118,10 +116,10 @@ public class aUtil {
|
|||||||
return utcTime;
|
return utcTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleDateFormat localFormater = new SimpleDateFormat(localTimePatten);
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat localFormater = new SimpleDateFormat(localTimePatten);
|
||||||
localFormater.setTimeZone(TimeZone.getDefault());
|
localFormater.setTimeZone(TimeZone.getDefault());
|
||||||
String localTime = localFormater.format(utcDate.getTime());
|
assert utcDate != null;
|
||||||
return localTime;
|
return localFormater.format(utcDate.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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">
|
||||||
|
|
||||||
@ -18,7 +19,7 @@
|
|||||||
android:padding="15dp">
|
android:padding="15dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -67,7 +68,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3"
|
android:layout_weight="3"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -93,7 +95,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3"
|
android:layout_weight="3"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -119,7 +122,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3"
|
android:layout_weight="3"
|
||||||
android:autoLink="web"
|
android:autoLink="web"
|
||||||
android:gravity="right"
|
android:gravity="end"
|
||||||
android:text="https://github.com/pppscn/SmsForwarder/releases"
|
android:text="https://github.com/pppscn/SmsForwarder/releases"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -135,7 +138,7 @@
|
|||||||
android:padding="15dp">
|
android:padding="15dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -171,7 +174,7 @@
|
|||||||
android:padding="15dp">
|
android:padding="15dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
android:id="@+id/bt_refresh_log"
|
android:id="@+id/bt_refresh_log"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
@ -47,7 +47,7 @@
|
|||||||
android:id="@+id/bt_rule_set"
|
android:id="@+id/bt_rule_set"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
android:textColor="@color/colorPrimary" />
|
android:textColor="@color/colorPrimary" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btaddrule"
|
android:id="@+id/bt_add_rule"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
|
@ -28,11 +28,13 @@
|
|||||||
android:id="@+id/et_add_extra_device_mark"
|
android:id="@+id/et_add_extra_device_mark"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ems="16"
|
android:ems="16"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
tools:ignore="LabelFor"
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -61,18 +63,19 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:text="运营商_手机号"
|
android:text="运营商_手机号"
|
||||||
android:textSize="9dp" />
|
android:textSize="9sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_add_extra_sim1"
|
android:id="@+id/et_add_extra_sim1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ems="16"
|
android:ems="16"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -101,18 +104,19 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:text="运营商_手机号"
|
android:text="运营商_手机号"
|
||||||
android:textSize="9dp" />
|
android:textSize="9sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_add_extra_sim2"
|
android:id="@+id/et_add_extra_sim2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ems="16"
|
android:ems="16"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -141,18 +145,19 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:text="取值范围:0-100,留空或0禁用"
|
android:text="取值范围:0-100,留空或0禁用"
|
||||||
android:textSize="9dp" />
|
android:textSize="9sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_battery_level_alarm"
|
android:id="@+id/et_battery_level_alarm"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ems="16"
|
android:ems="16"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -181,7 +186,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:text="接口请求失败后将重试5次"
|
android:text="接口请求失败后将重试5次"
|
||||||
android:textSize="9dp" />
|
android:textSize="9sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -193,56 +198,61 @@
|
|||||||
android:id="@+id/et_retry_delay_time1"
|
android:id="@+id/et_retry_delay_time1"
|
||||||
android:layout_width="42dp"
|
android:layout_width="42dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ems="16"
|
android:ems="16"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_retry_delay_time2"
|
android:id="@+id/et_retry_delay_time2"
|
||||||
android:layout_width="42dp"
|
android:layout_width="42dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ems="16"
|
android:ems="16"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_retry_delay_time3"
|
android:id="@+id/et_retry_delay_time3"
|
||||||
android:layout_width="42dp"
|
android:layout_width="42dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ems="16"
|
android:ems="16"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_retry_delay_time4"
|
android:id="@+id/et_retry_delay_time4"
|
||||||
android:layout_width="42dp"
|
android:layout_width="42dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ems="16"
|
android:ems="16"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_retry_delay_time5"
|
android:id="@+id/et_retry_delay_time5"
|
||||||
android:layout_width="42dp"
|
android:layout_width="42dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:ems="16"
|
android:ems="16"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -267,10 +277,62 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3"
|
android:layout_weight="3"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="15dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:text="转发时附加设备名称"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/switch_add_device_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:gravity="end"
|
||||||
|
android:textSize="18sp"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:padding="15dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="转发来电"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/switch_enable_phone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:checked="true"
|
||||||
|
android:gravity="end"
|
||||||
|
android:textSize="18sp"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -293,7 +355,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3"
|
android:layout_weight="3"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -322,17 +385,18 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:text="Tip:按需插入内容标签;留空使用默认模版"
|
android:text="Tip:按需插入内容标签;留空使用默认模版"
|
||||||
android:textSize="11dp" />
|
android:textSize="11sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/text_sms_template"
|
android:id="@+id/text_sms_template"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -368,7 +432,7 @@
|
|||||||
android:id="@+id/bt_insert_content"
|
android:id="@+id/bt_insert_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
@ -380,7 +444,7 @@
|
|||||||
android:id="@+id/bt_insert_extra"
|
android:id="@+id/bt_insert_extra"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
@ -392,7 +456,7 @@
|
|||||||
android:id="@+id/bt_insert_time"
|
android:id="@+id/bt_insert_time"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
@ -404,7 +468,7 @@
|
|||||||
android:id="@+id/bt_insert_device_name"
|
android:id="@+id/bt_insert_device_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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">
|
||||||
|
|
||||||
@ -24,10 +25,12 @@
|
|||||||
android:id="@+id/editTextBarkName"
|
android:id="@+id/editTextBarkName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="11"
|
android:ems="11"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
tools:ignore="LabelFor"
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -47,8 +50,10 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints=""
|
||||||
|
tools:ignore="LabelFor" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -68,7 +73,7 @@
|
|||||||
android:id="@+id/buttonBarkDel"
|
android:id="@+id/buttonBarkDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
@ -76,7 +81,7 @@
|
|||||||
android:id="@+id/buttonBarkTest"
|
android:id="@+id/buttonBarkTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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">
|
||||||
|
|
||||||
@ -24,10 +25,11 @@
|
|||||||
android:id="@+id/editTextDingdingName"
|
android:id="@+id/editTextDingdingName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="11"
|
android:ems="11"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -48,7 +50,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
@ -70,7 +73,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -90,8 +94,9 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -111,7 +116,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:checked="false"
|
android:checked="false"
|
||||||
android:ems="14" />
|
android:ems="14"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -121,25 +127,25 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttondingdingok"
|
android:id="@+id/buttonDingdingOk"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/ok" />
|
android:text="@string/ok" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttondingdingdel"
|
android:id="@+id/buttonDingdingDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttondingdingtest"
|
android:id="@+id/buttonDingdingTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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">
|
||||||
|
|
||||||
@ -24,10 +25,11 @@
|
|||||||
android:id="@+id/editTextEmailName"
|
android:id="@+id/editTextEmailName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="11"
|
android:ems="11"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -46,10 +48,11 @@
|
|||||||
android:id="@+id/editTextEmailHost"
|
android:id="@+id/editTextEmailHost"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -68,10 +71,11 @@
|
|||||||
android:id="@+id/editTextEmailPort"
|
android:id="@+id/editTextEmailPort"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="5"
|
android:ems="5"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -82,7 +86,8 @@
|
|||||||
android:id="@+id/switchEmailSSl"
|
android:id="@+id/switchEmailSSl"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:checked="true" />
|
android:checked="true"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -101,10 +106,11 @@
|
|||||||
android:id="@+id/editTextEmailFromAdd"
|
android:id="@+id/editTextEmailFromAdd"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -123,10 +129,11 @@
|
|||||||
android:id="@+id/editTextEmailNickname"
|
android:id="@+id/editTextEmailNickname"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -145,10 +152,11 @@
|
|||||||
android:id="@+id/editTextEmailPsw"
|
android:id="@+id/editTextEmailPsw"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -167,10 +175,11 @@
|
|||||||
android:id="@+id/editTextEmailToAdd"
|
android:id="@+id/editTextEmailToAdd"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -180,25 +189,25 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonemailok"
|
android:id="@+id/buttonEmailOk"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/ok" />
|
android:text="@string/ok" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonemaildel"
|
android:id="@+id/buttonEmailDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonemailtest"
|
android:id="@+id/buttonEmailTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
android:id="@+id/editTextFeishuName"
|
android:id="@+id/editTextFeishuName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="11"
|
android:ems="11"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -47,8 +48,9 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
@ -70,7 +72,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -80,25 +83,25 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonfeishuok"
|
android:id="@+id/buttonFeishuOk"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/ok" />
|
android:text="@string/ok" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonfeishudel"
|
android:id="@+id/buttonFeishuDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonfeishutest"
|
android:id="@+id/buttonFeishuTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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">
|
||||||
|
|
||||||
@ -18,7 +19,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right"
|
android:gravity="end"
|
||||||
android:text="设置名称"
|
android:text="设置名称"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -26,9 +27,10 @@
|
|||||||
android:id="@+id/editTextQYWXAppName"
|
android:id="@+id/editTextQYWXAppName"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -41,7 +43,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right"
|
android:gravity="end"
|
||||||
android:text="企业ID"
|
android:text="企业ID"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -49,9 +51,10 @@
|
|||||||
android:id="@+id/editTextQYWXAppCorpID"
|
android:id="@+id/editTextQYWXAppCorpID"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text="@string/wechat_id"
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -64,7 +67,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right"
|
android:gravity="end"
|
||||||
android:text="AgentID"
|
android:text="AgentID"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -72,9 +75,10 @@
|
|||||||
android:id="@+id/editTextQYWXAppAgentID"
|
android:id="@+id/editTextQYWXAppAgentID"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text="@string/Agent_ID"
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
@ -88,7 +92,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right"
|
android:gravity="end"
|
||||||
android:text="Secret"
|
android:text="Secret"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -96,9 +100,10 @@
|
|||||||
android:id="@+id/editTextQYWXAppSecret"
|
android:id="@+id/editTextQYWXAppSecret"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:text="" />
|
android:text="@string/App_Secret"
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -111,7 +116,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right"
|
android:gravity="end"
|
||||||
android:text="是否@all"
|
android:text="是否@all"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -119,7 +124,8 @@
|
|||||||
android:id="@+id/switchQYWXAppAtAll"
|
android:id="@+id/switchQYWXAppAtAll"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:checked="false" />
|
android:checked="false"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -138,7 +144,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right"
|
android:gravity="end"
|
||||||
android:text="指定成员"
|
android:text="指定成员"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -146,9 +152,10 @@
|
|||||||
android:id="@+id/editTextQYWXAppToUser"
|
android:id="@+id/editTextQYWXAppToUser"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -176,7 +183,7 @@
|
|||||||
android:id="@+id/buttonQYWXAppDel"
|
android:id="@+id/buttonQYWXAppDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
@ -184,7 +191,7 @@
|
|||||||
android:id="@+id/buttonQYWXAppTest"
|
android:id="@+id/buttonQYWXAppTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
android:id="@+id/editTextQYWXGroupRobotName"
|
android:id="@+id/editTextQYWXGroupRobotName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="11"
|
android:ems="11"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -47,8 +48,9 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -68,7 +70,7 @@
|
|||||||
android:id="@+id/buttonQyWxGroupRobotDel"
|
android:id="@+id/buttonQyWxGroupRobotDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
@ -76,7 +78,7 @@
|
|||||||
android:id="@+id/buttonQyWxGroupRobotTest"
|
android:id="@+id/buttonQyWxGroupRobotTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:text="设置匹配的卡槽"
|
android:text="设置匹配的卡槽"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -49,14 +49,14 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:text="设置匹配的字段"
|
android:text="设置匹配的字段"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -93,14 +93,14 @@
|
|||||||
android:id="@+id/matchTypeLayout"
|
android:id="@+id/matchTypeLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:text="设置匹配的模式"
|
android:text="设置匹配的模式"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -152,7 +152,7 @@
|
|||||||
android:id="@+id/matchValueLayout"
|
android:id="@+id/matchValueLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -168,8 +168,9 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_mu_rule_tips"
|
android:id="@+id/tv_mu_rule_tips"
|
||||||
@ -191,7 +192,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -219,7 +220,7 @@
|
|||||||
android:id="@+id/ruleSenderTv"
|
android:id="@+id/ruleSenderTv"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:text="" />
|
android:text="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -233,25 +234,25 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonruleok"
|
android:id="@+id/buttonRuleOk"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/ok" />
|
android:text="@string/ok" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonruledel"
|
android:id="@+id/buttonRuleDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonruletest"
|
android:id="@+id/buttonRuleTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="3dp"
|
android:layout_margin="3dp"
|
||||||
android:gravity="left|center_vertical"
|
android:gravity="start|center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
@ -56,8 +56,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="3dp"
|
android:layout_margin="3dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -72,14 +73,15 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="3dp"
|
android:layout_margin="3dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonruletest"
|
android:id="@+id/buttonRuleTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_margin="3dp"
|
android:layout_margin="3dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
android:id="@+id/editTextServerChanName"
|
android:id="@+id/editTextServerChanName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="11"
|
android:ems="11"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -48,7 +49,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -68,7 +70,7 @@
|
|||||||
android:id="@+id/buttonServerChanDel"
|
android:id="@+id/buttonServerChanDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
@ -76,7 +78,7 @@
|
|||||||
android:id="@+id/buttonServerChanTest"
|
android:id="@+id/buttonServerChanTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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">
|
||||||
|
|
||||||
@ -24,10 +25,11 @@
|
|||||||
android:id="@+id/editTextSmsName"
|
android:id="@+id/editTextSmsName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -47,7 +49,7 @@
|
|||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/radioGroupSmsSimSlot"
|
android:id="@+id/radioGroupSmsSimSlot"
|
||||||
style="@style/rg_style"
|
style="@style/rg_style"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
@ -86,9 +88,10 @@
|
|||||||
android:id="@+id/editTextSmsMobiles"
|
android:id="@+id/editTextSmsMobiles"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -108,7 +111,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:checked="false"
|
android:checked="false"
|
||||||
android:ems="14" />
|
android:ems="14"
|
||||||
|
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -128,7 +132,7 @@
|
|||||||
android:id="@+id/buttonSmsDel"
|
android:id="@+id/buttonSmsDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
@ -136,7 +140,7 @@
|
|||||||
android:id="@+id/buttonSmsTest"
|
android:id="@+id/buttonSmsTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
android:id="@+id/editTextTelegramName"
|
android:id="@+id/editTextTelegramName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="11"
|
android:ems="11"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -48,7 +49,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -68,8 +70,9 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -89,7 +92,7 @@
|
|||||||
android:id="@+id/buttonTelegramDel"
|
android:id="@+id/buttonTelegramDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
@ -97,7 +100,7 @@
|
|||||||
android:id="@+id/buttonTelegramTest"
|
android:id="@+id/buttonTelegramTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
android:id="@+id/editTextWebNotifyName"
|
android:id="@+id/editTextWebNotifyName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:ems="11"
|
android:ems="11"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -47,7 +48,7 @@
|
|||||||
android:id="@+id/radioGroupWebNotifyMethod"
|
android:id="@+id/radioGroupWebNotifyMethod"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginStart="3dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
@ -84,8 +85,9 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -105,8 +107,9 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType=""
|
android:inputType="text"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -127,7 +130,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="14"
|
android:ems="14"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:text="" />
|
android:text=""
|
||||||
|
android:autofillHints="" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -137,25 +141,25 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonbebnotifyok"
|
android:id="@+id/buttonWebNotifyOk"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/ok" />
|
android:text="@string/ok" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonbebnotifydel"
|
android:id="@+id/buttonWebNotifyDel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/del" />
|
android:text="@string/del" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonbebnotifytest"
|
android:id="@+id/buttonWebNotifyTest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/test" />
|
android:text="@string/test" />
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -25,7 +26,7 @@
|
|||||||
android:text="下拉可以刷新!" />
|
android:text="下拉可以刷新!" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/lastupdate_time"
|
android:id="@+id/lastUpdateTime"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -34,17 +35,18 @@
|
|||||||
android:id="@+id/arrow"
|
android:id="@+id/arrow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="20dip"
|
android:layout_marginEnd="20dip"
|
||||||
android:layout_toLeftOf="@id/layout"
|
android:layout_toStartOf="@id/layout"
|
||||||
android:src="@android:drawable/ic_popup_sync" />
|
android:src="@android:drawable/ic_popup_sync"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progress"
|
android:id="@+id/progress"
|
||||||
style="?android:attr/progressBarStyleSmall"
|
style="?android:attr/progressBarStyleSmall"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="20dip"
|
android:layout_marginEnd="20dip"
|
||||||
android:layout_toLeftOf="@id/layout"
|
android:layout_toStartOf="@id/layout"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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">
|
||||||
|
|
||||||
@ -7,27 +8,29 @@
|
|||||||
android:layout_width="34dp"
|
android:layout_width="34dp"
|
||||||
android:layout_height="34dp"
|
android:layout_height="34dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/tlog_sender_image"
|
android:id="@+id/tlog_sender_image"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="32dp" />
|
android:layout_height="32dp"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/tlog_status_image"
|
android:id="@+id/tlog_status_image"
|
||||||
android:layout_width="16dp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
android:layout_marginLeft="18dp"
|
android:layout_marginStart="18dp"
|
||||||
android:layout_marginTop="-14dp" />
|
android:layout_marginTop="-14dp"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
@ -54,13 +57,14 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginRight="24dp" />
|
android:layout_marginEnd="24dp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/tlog_sim_image"
|
android:id="@+id/tlog_sim_image"
|
||||||
android:layout_width="16dp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
android:layout_alignParentEnd="true" />
|
android:layout_alignParentEnd="true"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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">
|
||||||
|
|
||||||
@ -8,19 +9,20 @@
|
|||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_margin="5dp" />
|
android:layout_margin="5dp"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/rule_match"
|
android:id="@+id/rule_match"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginLeft="5dp" />
|
android:layout_marginStart="5dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/rule_sender"
|
android:id="@+id/rule_sender"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginLeft="5dp" />
|
android:layout_marginStart="5dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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">
|
||||||
|
|
||||||
@ -7,12 +8,13 @@
|
|||||||
android:id="@+id/sender_image"
|
android:id="@+id/sender_image"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:layout_margin="5dp" />
|
android:layout_margin="5dp"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/sender_name"
|
android:id="@+id/sender_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginLeft="10dp" />
|
android:layout_marginStart="10dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -1,7 +1,8 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">短信转发器</string>
|
<string name="app_name">短信转发器</string>
|
||||||
<string name="dingdingok">确认</string>
|
<string name="notification_content">根据规则转发到钉钉/微信/邮箱/bark/Server酱/Telegram/webhook等</string>
|
||||||
<string name="ok">确认</string>
|
<string name="ok">确认</string>
|
||||||
|
<string name="cancel">取消</string>
|
||||||
<string name="del">删除</string>
|
<string name="del">删除</string>
|
||||||
<string name="test">测试</string>
|
<string name="test">测试</string>
|
||||||
<string name="setdingdingtitle">设置钉钉机器人</string>
|
<string name="setdingdingtitle">设置钉钉机器人</string>
|
||||||
@ -22,6 +23,11 @@
|
|||||||
<string name="log_tips">提示:置顶下拉刷新,长按删除单条记录</string>
|
<string name="log_tips">提示:置顶下拉刷新,长按删除单条记录</string>
|
||||||
<string name="rule_tips">提示:新建规则点击“添加”,长按删除/点击编辑已有</string>
|
<string name="rule_tips">提示:新建规则点击“添加”,长按删除/点击编辑已有</string>
|
||||||
<string name="sender_tips">提示:新建发送方点击“添加”,长按删除/点击编辑已有</string>
|
<string name="sender_tips">提示:新建发送方点击“添加”,长按删除/点击编辑已有</string>
|
||||||
|
<string name="unknown_number">未知号码</string>
|
||||||
|
<string name="calling">来电</string>
|
||||||
<string name="unsupport">您的手机不支持此设置</string>
|
<string name="unsupport">您的手机不支持此设置</string>
|
||||||
<string name="isIgnored">已设置成功!</string>
|
<string name="isIgnored">已设置成功!</string>
|
||||||
|
<string name="wechat_id" />
|
||||||
|
<string name="Agent_ID" />
|
||||||
|
<string name="App_Secret" />
|
||||||
</resources>
|
</resources>
|
||||||
|
14
app/src/main/res/xml/backup_descriptor.xml
Normal file
14
app/src/main/res/xml/backup_descriptor.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<full-backup-content>
|
||||||
|
<!-- TODO Remove the following "exclude" elements to make them a part of the auto backup -->
|
||||||
|
<exclude
|
||||||
|
domain="database"
|
||||||
|
path="sms_forwarder.db" />
|
||||||
|
<!-- Exclude the shared preferences file that contains the GCM registrationId -->
|
||||||
|
<exclude
|
||||||
|
domain="sharedpref"
|
||||||
|
path="forwarder_config.xml" />
|
||||||
|
<exclude
|
||||||
|
domain="sharedpref"
|
||||||
|
path="forwarder_msg.xml" />
|
||||||
|
</full-backup-content>
|
@ -1,18 +1,13 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
// maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
|
|
||||||
maven { url 'https://repo1.maven.org/maven2/' }
|
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.0.2'
|
classpath 'com.android.tools.build:gradle:7.0.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
classpath 'com.chenenyu:img-optimizer:1.2.0' //图片压缩
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,8 +15,6 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
// maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
|
|
||||||
maven { url 'https://repo1.maven.org/maven2/' }
|
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
version.properties
Normal file
3
version.properties
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#Fri Jul 16 10:33:23 CST 2021
|
||||||
|
versionName=2.0.0
|
||||||
|
versionCode=26
|
Loading…
x
Reference in New Issue
Block a user