diff --git a/app/build.gradle b/app/build.gradle index 0dc03af0..7fce81e8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -139,7 +139,7 @@ dependencies { //noinspection GradleDependency implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' - //implementation 'com.google.android.material:material:1.5.0' + implementation 'com.google.android.material:material:1.5.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' @@ -182,9 +182,6 @@ dependencies { implementation "org.eclipse.jetty:jetty-server:9.2.30.v20200428" implementation "org.eclipse.jetty:jetty-servlet:9.2.30.v20200428" - //FloatingActionButton - implementation 'com.melnykov:floatingactionbutton:1.3.0' - //友盟统计SDK implementation 'com.umeng.umsdk:common:9.4.7'// (必选) implementation 'com.umeng.umsdk:asms:1.6.0'// 必选 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6de906a0..41042573 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -55,7 +55,7 @@ android:networkSecurityConfig="@xml/network_security_config" android:requestLegacyExternalStorage="true" android:supportsRtl="true" - android:theme="@style/AppTheme" + android:theme="@style/Theme.App" android:usesCleartextTraffic="true" tools:ignore="DataExtractionRules,UnusedAttribute"> @@ -66,7 +66,6 @@ diff --git a/app/src/main/java/com/idormy/sms/forwarder/MainActivity.java b/app/src/main/java/com/idormy/sms/forwarder/MainActivity.java index 96566c75..36a1bcbf 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/MainActivity.java +++ b/app/src/main/java/com/idormy/sms/forwarder/MainActivity.java @@ -26,6 +26,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.hjq.permissions.OnPermissionCallback; import com.hjq.permissions.Permission; import com.hjq.permissions.XXPermissions; @@ -50,7 +51,6 @@ import com.idormy.sms.forwarder.utils.SharedPreferencesHelper; import com.idormy.sms.forwarder.utils.SmsUtil; import com.idormy.sms.forwarder.utils.TimeUtil; import com.idormy.sms.forwarder.view.StepBar; -import com.melnykov.fab.FloatingActionButton; import com.umeng.commonsdk.UMConfigure; import java.lang.reflect.Method; diff --git a/app/src/main/java/com/idormy/sms/forwarder/RuleActivity.java b/app/src/main/java/com/idormy/sms/forwarder/RuleActivity.java index 2eb09329..638d93bf 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/RuleActivity.java +++ b/app/src/main/java/com/idormy/sms/forwarder/RuleActivity.java @@ -26,6 +26,7 @@ import android.widget.TextView; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.hjq.toast.ToastUtils; import com.idormy.sms.forwarder.adapter.RuleAdapter; import com.idormy.sms.forwarder.model.RuleModel; @@ -38,7 +39,6 @@ import com.idormy.sms.forwarder.utils.LogUtil; import com.idormy.sms.forwarder.utils.RuleUtil; import com.idormy.sms.forwarder.utils.SettingUtil; import com.idormy.sms.forwarder.view.StepBar; -import com.melnykov.fab.FloatingActionButton; import java.lang.reflect.Method; import java.util.ArrayList; diff --git a/app/src/main/java/com/idormy/sms/forwarder/SenderActivity.java b/app/src/main/java/com/idormy/sms/forwarder/SenderActivity.java index 47a10f7d..85e54282 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/SenderActivity.java +++ b/app/src/main/java/com/idormy/sms/forwarder/SenderActivity.java @@ -41,6 +41,7 @@ import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import com.alibaba.fastjson.JSON; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.hjq.permissions.OnPermissionCallback; import com.hjq.permissions.Permission; import com.hjq.permissions.XXPermissions; @@ -78,7 +79,6 @@ import com.idormy.sms.forwarder.utils.LogUtil; import com.idormy.sms.forwarder.utils.RuleUtil; import com.idormy.sms.forwarder.view.ClearEditText; import com.idormy.sms.forwarder.view.StepBar; -import com.melnykov.fab.FloatingActionButton; import java.lang.reflect.Method; import java.net.Proxy; @@ -432,16 +432,16 @@ public class SenderActivity extends AppCompatActivity { Log.d(TAG, "onCheckedChanged:" + isChecked); }); - Button buttonDingdingOk = view1.findViewById(R.id.buttonDingdingOk); - Button buttonDingdingDel = view1.findViewById(R.id.buttonDingdingDel); - Button buttonDingdingTest = view1.findViewById(R.id.buttonDingdingTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setdingdingtitle) .setIcon(R.mipmap.dingding) .setView(view1) .create(); final AlertDialog show = alertDialog71.show(); - buttonDingdingOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextDingdingName.getText().toString().trim(); int senderStatus = switchDingdingEnable.isChecked() ? STATUS_ON : STATUS_OFF; String token = editTextDingdingToken.getText().trim(); @@ -480,7 +480,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonDingdingDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -489,7 +489,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonDingdingTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String token = editTextDingdingToken.getText().trim(); if (CommonUtil.checkUrl(token, true)) { ToastUtils.delayedShow(R.string.invalid_token, 3000); @@ -552,9 +552,9 @@ public class SenderActivity extends AppCompatActivity { editTextEmailTitle.setText(emailSettingVo.getTitle()); } - Button buttonEmailOk = view1.findViewById(R.id.buttonEmailOk); - Button buttonEmailDel = view1.findViewById(R.id.buttonEmailDel); - Button buttonEmailTest = view1.findViewById(R.id.buttonEmailTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setemailtitle) .setIcon(R.mipmap.email) @@ -562,7 +562,7 @@ public class SenderActivity extends AppCompatActivity { .create(); final AlertDialog show = alertDialog71.show(); - buttonEmailOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextEmailName.getText().toString().trim(); int senderStatus = switchEmailEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -610,7 +610,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonEmailDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -619,7 +619,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonEmailTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String protocol = radioGroupEmailProtocol.getCheckedRadioButtonId() == R.id.radioEmailProtocolSmtp ? "SMTP" : "IMAP"; String host = editTextEmailHost.getText().toString().trim(); String port = editTextEmailPort.getText().toString().trim(); @@ -717,9 +717,9 @@ public class SenderActivity extends AppCompatActivity { radioGroupBarkLevel.check(barkSettingVo.getLevelId()); } - Button buttonBarkOk = view1.findViewById(R.id.buttonBarkOk); - Button buttonBarkDel = view1.findViewById(R.id.buttonBarkDel); - Button buttonBarkTest = view1.findViewById(R.id.buttonBarkTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setbarktitle) .setIcon(R.mipmap.bark) @@ -727,7 +727,7 @@ public class SenderActivity extends AppCompatActivity { .create(); final AlertDialog show = alertDialog71.show(); - buttonBarkOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextBarkName.getText().toString().trim(); int senderStatus = switchBarkEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -770,7 +770,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonBarkDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -779,7 +779,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonBarkTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String barkServer = editTextBarkServer.getText().trim(); String icon = editTextBarkIcon.getText().toString().trim(); //消息图标 String title = editTextBarkTitle.getText().toString().trim(); //标题模板 @@ -865,9 +865,9 @@ public class SenderActivity extends AppCompatActivity { radioGroupWebNotifyMethod.check(webNotifySettingVo.getWebNotifyMethodCheckId()); } - Button buttonWebNotifyOk = view1.findViewById(R.id.buttonWebNotifyOk); - Button buttonWebNotifyDel = view1.findViewById(R.id.buttonWebNotifyDel); - Button buttonWebNotifyTest = view1.findViewById(R.id.buttonWebNotifyTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setwebnotifytitle) .setIcon(R.mipmap.webhook) @@ -875,7 +875,7 @@ public class SenderActivity extends AppCompatActivity { .create(); final AlertDialog show = alertDialog71.show(); - buttonWebNotifyOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextWebNotifyName.getText().toString().trim(); int senderStatus = switchWebNotifyEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -913,7 +913,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonWebNotifyDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -922,7 +922,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonWebNotifyTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String webServer = editTextWebNotifyWebServer.getText().toString().trim(); String secret = editTextWebNotifySecret.getText().trim(); String method = radioGroupWebNotifyMethod.getCheckedRadioButtonId() == R.id.radioWebNotifyMethodGet ? "GET" : "POST"; @@ -970,9 +970,9 @@ public class SenderActivity extends AppCompatActivity { editTextQYWXGroupRobotWebHook.setText(qywxGroupRobotSettingVo.getWebHook()); } - Button buttonQyWxGroupRobotOk = view1.findViewById(R.id.buttonQyWxGroupRobotOk); - Button buttonQyWxGroupRobotDel = view1.findViewById(R.id.buttonQyWxGroupRobotDel); - Button buttonQyWxGroupRobotTest = view1.findViewById(R.id.buttonQyWxGroupRobotTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setqywxgrouprobottitle) .setIcon(R.mipmap.qywx) @@ -980,7 +980,7 @@ public class SenderActivity extends AppCompatActivity { .create(); final AlertDialog show = alertDialog71.show(); - buttonQyWxGroupRobotOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextQYWXGroupRobotName.getText().toString().trim(); int senderStatus = switchQYWXGroupRobotEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -1016,7 +1016,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonQyWxGroupRobotDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -1025,7 +1025,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonQyWxGroupRobotTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String webHook = editTextQYWXGroupRobotWebHook.getText().trim(); if (!CommonUtil.checkUrl(webHook, false)) { ToastUtils.delayedShow(R.string.invalid_webhook, 3000); @@ -1088,16 +1088,16 @@ public class SenderActivity extends AppCompatActivity { Log.d(TAG, "onCheckedChanged:" + isChecked); }); - Button buttonQYWXAppOk = view1.findViewById(R.id.buttonQYWXAppOk); - Button buttonQYWXAppDel = view1.findViewById(R.id.buttonQYWXAppDel); - Button buttonQYWXAppTest = view1.findViewById(R.id.buttonQYWXAppTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setqywxapptitle) .setIcon(R.mipmap.qywxapp) .setView(view1) .create(); final AlertDialog show = alertDialog71.show(); - buttonQYWXAppOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextQYWXAppName.getText().toString().trim(); int senderStatus = switchQYWXAppEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -1145,7 +1145,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonQYWXAppDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -1154,7 +1154,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonQYWXAppTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { QYWXAppSettingVo QYWXAppSettingVoNew = new QYWXAppSettingVo( editTextQYWXAppCorpID.getText().toString().trim(), editTextQYWXAppAgentID.getText().toString().trim(), @@ -1205,9 +1205,9 @@ public class SenderActivity extends AppCompatActivity { if (serverchanSettingVo != null) editTextServerChanSendKey.setText(serverchanSettingVo.getSendKey()); - Button buttonServerChanOk = view1.findViewById(R.id.buttonServerChanOk); - Button buttonServerChanDel = view1.findViewById(R.id.buttonServerChanDel); - Button buttonServerChanTest = view1.findViewById(R.id.buttonServerChanTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setserverchantitle) .setIcon(R.mipmap.serverchan) @@ -1215,7 +1215,7 @@ public class SenderActivity extends AppCompatActivity { .create(); final AlertDialog show = alertDialog71.show(); - buttonServerChanOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextServerChanName.getText().toString().trim(); int senderStatus = switchServerChanEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -1251,7 +1251,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonServerChanDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -1260,7 +1260,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonServerChanTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String serverChanServer = editTextServerChanSendKey.getText().trim(); if (TextUtils.isEmpty(serverChanServer)) { ToastUtils.delayedShow(R.string.invalid_sendkey, 3000); @@ -1357,9 +1357,9 @@ public class SenderActivity extends AppCompatActivity { editTextProxyPassword.setText(telegramSettingVo.getProxyPassword()); } - Button buttonTelegramOk = view1.findViewById(R.id.buttonTelegramOk); - Button buttonTelegramDel = view1.findViewById(R.id.buttonTelegramDel); - Button buttonTelegramTest = view1.findViewById(R.id.buttonTelegramTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.settelegramtitle) .setIcon(R.mipmap.telegram) @@ -1367,7 +1367,7 @@ public class SenderActivity extends AppCompatActivity { .create(); final AlertDialog show = alertDialog71.show(); - buttonTelegramOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextTelegramName.getText().toString().trim(); int senderStatus = switchTelegramEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -1422,7 +1422,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonTelegramDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -1431,7 +1431,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonTelegramTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String apiToken = editTextTelegramApiToken.getText().trim(); String chatId = editTextTelegramChatId.getText().toString().trim(); if (apiToken.isEmpty() || chatId.isEmpty()) { @@ -1529,9 +1529,9 @@ public class SenderActivity extends AppCompatActivity { switchSmsOnlyNoNetwork.setChecked(smsSettingVo.getOnlyNoNetwork()); } - Button buttonSmsOk = view1.findViewById(R.id.buttonSmsOk); - Button buttonSmsDel = view1.findViewById(R.id.buttonSmsDel); - Button buttonSmsTest = view1.findViewById(R.id.buttonSmsTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setsmstitle) .setIcon(R.mipmap.sms) @@ -1539,7 +1539,7 @@ public class SenderActivity extends AppCompatActivity { .create(); final AlertDialog show = alertDialog71.show(); - buttonSmsOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextSmsName.getText().toString().trim(); int senderStatus = switchSmsEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -1585,7 +1585,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonSmsDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -1594,7 +1594,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonSmsTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { int simSlot = R.id.btnSmsSimSlot2 == radioGroupSmsSimSlot.getCheckedRadioButtonId() ? 1 : 0; Boolean onlyNoNetwork = switchSmsOnlyNoNetwork.isChecked(); String mobiles = editTextSmsMobiles.getText().toString().trim(); @@ -1641,16 +1641,16 @@ public class SenderActivity extends AppCompatActivity { editTextFeishuSecret.setText(feiShuSettingVo.getSecret()); } - Button buttonFeishuOk = view1.findViewById(R.id.buttonFeishuOk); - Button buttonFeishuDel = view1.findViewById(R.id.buttonFeishuDel); - Button buttonFeishuTest = view1.findViewById(R.id.buttonFeishuTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setfeishutitle) .setIcon(R.mipmap.feishu) .setView(view1) .create(); final AlertDialog show = alertDialog71.show(); - buttonFeishuOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextFeishuName.getText().toString().trim(); int senderStatus = switchFeishuEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -1687,7 +1687,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonFeishuDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -1696,7 +1696,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonFeishuTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String webHook = editTextFeishuWebhook.getText().toString().trim(); String secret = editTextFeishuSecret.getText().trim(); if (!CommonUtil.checkUrl(webHook, false)) { @@ -1755,16 +1755,16 @@ public class SenderActivity extends AppCompatActivity { editTextPushPlusTitle.setText(pushPlusSettingVo.getTitleTemplate()); } - Button buttonPushPlusOk = view1.findViewById(R.id.buttonPushPlusOk); - Button buttonPushPlusDel = view1.findViewById(R.id.buttonPushPlusDel); - Button buttonPushPlusTest = view1.findViewById(R.id.buttonPushPlusTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setpushplustitle) .setIcon(R.mipmap.pushplus) .setView(view1) .create(); final AlertDialog show = alertDialog71.show(); - buttonPushPlusOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextPushPlusName.getText().toString().trim(); int senderStatus = switchPushPlusEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -1809,7 +1809,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonPushPlusDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -1818,7 +1818,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonPushPlusTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String title = editTextPushPlusTitle.getText().toString().trim(); if (title.isEmpty()) title = "SmsForwarder Title"; @@ -1908,9 +1908,9 @@ public class SenderActivity extends AppCompatActivity { editTextGotifyPriority.setText(gotifySettingVo.getPriority()); } - Button buttonGotifyOk = view1.findViewById(R.id.buttonGotifyOk); - Button buttonGotifyDel = view1.findViewById(R.id.buttonGotifyDel); - Button buttonGotifyTest = view1.findViewById(R.id.buttonGotifyTest); + Button buttonOk = view1.findViewById(R.id.buttonOk); + Button buttonDel = view1.findViewById(R.id.buttonDel); + Button buttonTest = view1.findViewById(R.id.buttonTest); alertDialog71 .setTitle(R.string.setgotifytitle) .setIcon(R.mipmap.gotify) @@ -1918,7 +1918,7 @@ public class SenderActivity extends AppCompatActivity { .create(); final AlertDialog show = alertDialog71.show(); - buttonGotifyOk.setOnClickListener(view -> { + buttonOk.setOnClickListener(view -> { String senderName = editTextGotifyName.getText().toString().trim(); int senderStatus = switchGotifyEnable.isChecked() ? STATUS_ON : STATUS_OFF; if (TextUtils.isEmpty(senderName)) { @@ -1960,7 +1960,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonGotifyDel.setOnClickListener(view -> { + buttonDel.setOnClickListener(view -> { if (senderModel != null) { SenderUtil.delSender(senderModel.getId()); initSenders(); @@ -1969,7 +1969,7 @@ public class SenderActivity extends AppCompatActivity { show.dismiss(); }); - buttonGotifyTest.setOnClickListener(view -> { + buttonTest.setOnClickListener(view -> { String webServer = editTextGotifyWebServer.getText().trim(); if (!CommonUtil.checkUrl(webServer, false)) { ToastUtils.delayedShow(R.string.invalid_webserver, 3000); diff --git a/app/src/main/java/com/idormy/sms/forwarder/model/vo/ResVo.java b/app/src/main/java/com/idormy/sms/forwarder/model/vo/ResVo.java index ba939936..3c32bdf9 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/model/vo/ResVo.java +++ b/app/src/main/java/com/idormy/sms/forwarder/model/vo/ResVo.java @@ -2,6 +2,7 @@ package com.idormy.sms.forwarder.model.vo; import lombok.Data; +@SuppressWarnings("UnusedReturnValue") @Data public class ResVo { public static final int ERROR_CODE = 500; diff --git a/app/src/main/java/com/idormy/sms/forwarder/receiver/PhoneStateReceiver.java b/app/src/main/java/com/idormy/sms/forwarder/receiver/PhoneStateReceiver.java index e0728fc2..4dc4c668 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/receiver/PhoneStateReceiver.java +++ b/app/src/main/java/com/idormy/sms/forwarder/receiver/PhoneStateReceiver.java @@ -128,7 +128,7 @@ public class PhoneStateReceiver extends BroadcastReceiver { SettingUtil.setPrevNoticeHash(phoneNumber, currHash); SmsVo smsVo = new SmsVo(phoneNumber, getTypeText(context, type, name, viaNumber), new Date(), simInfo); - Log.d(TAG, "send_msg" + smsVo.toString()); + Log.d(TAG, "send_msg" + smsVo); SendUtil.send_msg(context, smsVo, simId, "call"); //SmsHubApi diff --git a/app/src/main/java/com/idormy/sms/forwarder/sender/SenderBarkMsg.java b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderBarkMsg.java index b8a4bcf4..ebb34ae9 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/sender/SenderBarkMsg.java +++ b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderBarkMsg.java @@ -72,7 +72,7 @@ public class SenderBarkMsg extends SenderBaseMsg { } RequestBody body = builder.build(); - Log.d(TAG, "method = POST, Body = " + body.toString()); + Log.d(TAG, "method = POST, Body = " + body); OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); //设置重试拦截器 diff --git a/app/src/main/java/com/idormy/sms/forwarder/sender/SmsHubApiTask.java b/app/src/main/java/com/idormy/sms/forwarder/sender/SmsHubApiTask.java index f7472dfa..568142bb 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/sender/SmsHubApiTask.java +++ b/app/src/main/java/com/idormy/sms/forwarder/sender/SmsHubApiTask.java @@ -6,17 +6,24 @@ import android.util.Log; import com.alibaba.fastjson.JSON; import com.idormy.sms.forwarder.model.vo.SmsHubVo; -import com.idormy.sms.forwarder.utils.*; +import com.idormy.sms.forwarder.utils.HttpUtil; +import com.idormy.sms.forwarder.utils.SettingUtil; +import com.idormy.sms.forwarder.utils.SmsHubActionHandler; -import java.util.*; +import java.util.List; +import java.util.Objects; +import java.util.Timer; +import java.util.TimerTask; import java.util.concurrent.atomic.AtomicBoolean; /** * 主动发送短信轮询任务 + * * @author xxc * 2022/1/10 9:53 */ +@SuppressWarnings("CodeBlock2Expr") public class SmsHubApiTask extends TimerTask { private static Boolean hasInit = false; public static final long DELAY_SECONDS = 30; diff --git a/app/src/main/java/com/idormy/sms/forwarder/service/BatteryService.java b/app/src/main/java/com/idormy/sms/forwarder/service/BatteryService.java index f0f48ab9..b2fead11 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/service/BatteryService.java +++ b/app/src/main/java/com/idormy/sms/forwarder/service/BatteryService.java @@ -201,7 +201,7 @@ public class BatteryService extends Service { Log.i(TAG, msg); try { SmsVo smsVo = new SmsVo("88888888", msg, new Date(), "电池状态监听"); - Log.d(TAG, "send_msg" + smsVo.toString()); + Log.d(TAG, "send_msg" + smsVo); SendUtil.send_msg(context, smsVo, 1, "app"); //SmsHubApi diff --git a/app/src/main/java/com/idormy/sms/forwarder/service/NotifyService.java b/app/src/main/java/com/idormy/sms/forwarder/service/NotifyService.java index 818b7607..caa6ae21 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/service/NotifyService.java +++ b/app/src/main/java/com/idormy/sms/forwarder/service/NotifyService.java @@ -89,7 +89,7 @@ public class NotifyService extends NotificationListenerService { SettingUtil.setPrevNoticeHash(packageName, currHash); SmsVo smsVo = new SmsVo(packageName, text, new Date(), title); - Log.d(TAG, "send_msg" + smsVo.toString()); + Log.d(TAG, "send_msg" + smsVo); SendUtil.send_msg(this, smsVo, 1, "app"); //SmsHubApi diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/CommonUtil.java b/app/src/main/java/com/idormy/sms/forwarder/utils/CommonUtil.java index 9a05b59d..104e8a61 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/utils/CommonUtil.java +++ b/app/src/main/java/com/idormy/sms/forwarder/utils/CommonUtil.java @@ -17,9 +17,9 @@ import android.widget.ScrollView; import androidx.core.app.ActivityCompat; import androidx.core.app.NotificationManagerCompat; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.idormy.sms.forwarder.MyApplication; import com.idormy.sms.forwarder.service.NotifyService; -import com.melnykov.fab.FloatingActionButton; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/RuleLine.java b/app/src/main/java/com/idormy/sms/forwarder/utils/RuleLine.java index 614f0572..501e8ee7 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/utils/RuleLine.java +++ b/app/src/main/java/com/idormy/sms/forwarder/utils/RuleLine.java @@ -156,14 +156,14 @@ class RuleLine { } else { //生成了一个中间体 middleList.add(buildMiddleWord.toString()); - logg("get Middle++:" + buildMiddleWord.toString()); + logg("get Middle++:" + buildMiddleWord); buildMiddleWord = new StringBuilder(); } } else { //把w拼接到中间体上 buildMiddleWord.append(w); - logg("buildMiddleWord length:" + buildMiddleWord.length() + "buildMiddleWord:" + buildMiddleWord.toString()); + logg("buildMiddleWord length:" + buildMiddleWord.length() + "buildMiddleWord:" + buildMiddleWord); } } @@ -174,7 +174,7 @@ class RuleLine { } } - logg("isDealValue done valueBuilder:" + valueBuilder.toString()); + logg("isDealValue done valueBuilder:" + valueBuilder); if (middleList.size() != 4) { diff --git a/app/src/main/res/drawable/ic_about.xml b/app/src/main/res/drawable/ic_about.xml new file mode 100644 index 00000000..53ae5eb0 --- /dev/null +++ b/app/src/main/res/drawable/ic_about.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_add.xml b/app/src/main/res/drawable/ic_add.xml index 70046c48..d9a4ad6a 100644 --- a/app/src/main/res/drawable/ic_add.xml +++ b/app/src/main/res/drawable/ic_add.xml @@ -1,5 +1,10 @@ - - + + diff --git a/app/src/main/res/drawable/ic_delete.xml b/app/src/main/res/drawable/ic_delete.xml index f54f7d4d..ce7932be 100644 --- a/app/src/main/res/drawable/ic_delete.xml +++ b/app/src/main/res/drawable/ic_delete.xml @@ -1,5 +1,10 @@ - - + + diff --git a/app/src/main/res/drawable/ic_help.xml b/app/src/main/res/drawable/ic_help.xml index 1f5cba54..04fdd051 100644 --- a/app/src/main/res/drawable/ic_help.xml +++ b/app/src/main/res/drawable/ic_help.xml @@ -1,10 +1,10 @@ - + android:viewportHeight="24"> + diff --git a/app/src/main/res/drawable/line_bg_white_only_bottom_d8.xml b/app/src/main/res/drawable/line_bg_white_only_bottom_d8.xml deleted file mode 100644 index 3c569302..00000000 --- a/app/src/main/res/drawable/line_bg_white_only_bottom_d8.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 7b7e8a6a..6bc15e0c 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -6,15 +6,16 @@ + android:orientation="vertical" + android:background="@color/setting_bg_color"> @@ -49,9 +53,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="2dp" - android:background="@android:color/white" android:gravity="center_vertical" android:orientation="horizontal" + android:background="@color/setting_bar_color" android:padding="15dp">