diff --git a/app/src/main/java/com/smsreceive/app/ui/MainActivity.java b/app/src/main/java/com/smsreceive/app/ui/MainActivity.java index 12b5b9c..8d1f8e6 100644 --- a/app/src/main/java/com/smsreceive/app/ui/MainActivity.java +++ b/app/src/main/java/com/smsreceive/app/ui/MainActivity.java @@ -73,7 +73,6 @@ public final class MainActivity extends Activity { private EditText feishuSecretEdit; private EditText pollingIntervalEdit; private AlertDialog debugInfoDialog; - private View debugInfoView; private long lastInboxSmsId = -1L; private String googlePlayTextValue = ""; private String keepAliveTextValue = ""; @@ -189,7 +188,7 @@ public final class MainActivity extends Activity { private void showDebugInfoDialog() { if (debugInfoDialog == null) { - debugInfoView = LayoutInflater.from(this).inflate(R.layout.dialog_debug_info, null); + View debugInfoView = LayoutInflater.from(this).inflate(R.layout.dialog_debug_info, null); googlePlayText = debugInfoView.findViewById(R.id.google_play_text); keepAliveText = debugInfoView.findViewById(R.id.keep_alive_text); databaseHeartbeatText = debugInfoView.findViewById(R.id.database_heartbeat_text); @@ -503,13 +502,11 @@ public final class MainActivity extends Activity { } private String buildLatestSmsTestMarkdown(SmsInboxReader.InboxResult inboxResult) { - StringBuilder builder = new StringBuilder(); - builder.append("**SmsReceive 最近短信测试推送**").append('\n'); - builder.append("时间:").append(formatTime(inboxResult.dateMillis)).append('\n'); - builder.append("发送方:").append(maskSender(inboxResult.sender)).append('\n'); - builder.append("短信ID:").append(inboxResult.id).append('\n'); - builder.append("正文:").append(emptyAsDash(inboxResult.body)); - return builder.toString(); + return "**SmsReceive 最近短信测试推送**" + '\n' + + "时间:" + formatTime(inboxResult.dateMillis) + '\n' + + "发送方:" + maskSender(inboxResult.sender) + '\n' + + "短信ID:" + inboxResult.id + '\n' + + "正文:" + emptyAsDash(inboxResult.body); } private boolean hasReceiveSmsPermission() { @@ -693,9 +690,6 @@ public final class MainActivity extends Activity { } private boolean isIgnoringBatteryOptimizations() { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { - return true; - } PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); return powerManager != null && powerManager.isIgnoringBatteryOptimizations(getPackageName()); } diff --git a/build.gradle b/build.gradle index 8f07d52..56fe1bc 100644 --- a/build.gradle +++ b/build.gradle @@ -18,12 +18,12 @@ allprojects { } ext { - minSdkVersion = 21 + minSdkVersion = 23 compileSdkVersion = 30 targetSdkVersion = 30 buildToolsVersion = '30.0.3' } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir }