From 79f912b16fb326d1c47d2b95ab7da7d65ae40bf5 Mon Sep 17 00:00:00 2001 From: aj3423 Date: Thu, 10 Oct 2024 12:04:59 +0800 Subject: [PATCH] clear all unused imports --- README.md | 31 ++++++++--------- .../java/spam/blocker/service/RuleTest.kt | 12 +++---- .../java/spam/blocker/util/RecurringTest.kt | 2 +- app/src/main/java/spam/blocker/db/BotTable.kt | 3 -- .../main/java/spam/blocker/db/SpamTable.kt | 7 ---- .../main/java/spam/blocker/service/Checker.kt | 3 +- .../java/spam/blocker/service/bot/Action.kt | 1 - .../java/spam/blocker/service/bot/Actions.kt | 2 -- .../service/bot/BotSerializersModule.kt | 1 - .../java/spam/blocker/service/bot/Schedule.kt | 33 ++++++------------- .../blocker/ui/crash/CrashReportActivity.kt | 3 -- .../spam/blocker/ui/history/HistoryList.kt | 1 - .../blocker/ui/history/HistoryViewModel.kt | 1 - .../main/java/spam/blocker/ui/main/Debug.kt | 9 ----- .../java/spam/blocker/ui/main/MainActivity.kt | 9 +++-- .../blocker/ui/setting/GloballyEnabled.kt | 1 - .../spam/blocker/ui/setting/bot/ActionCard.kt | 25 -------------- .../blocker/ui/setting/bot/ActionHeader.kt | 1 - .../spam/blocker/ui/setting/bot/ActionList.kt | 4 --- .../spam/blocker/ui/setting/bot/BotCard.kt | 3 -- .../spam/blocker/ui/setting/bot/BotHeader.kt | 2 -- .../ui/setting/bot/BotImportExportDialog.kt | 2 -- .../spam/blocker/ui/setting/bot/BotList.kt | 2 -- .../spam/blocker/ui/setting/bot/BotPresets.kt | 4 +-- .../blocker/ui/setting/misc/BackupRestore.kt | 2 -- .../blocker/ui/setting/quick/BlockType.kt | 1 - .../spam/blocker/ui/setting/quick/Contacts.kt | 1 - .../spam/blocker/ui/setting/quick/Dialed.kt | 1 - .../spam/blocker/ui/setting/quick/OffTime.kt | 1 - .../blocker/ui/setting/quick/RecentApps.kt | 2 -- .../blocker/ui/setting/quick/RepeatedCall.kt | 1 - .../ui/setting/regex/EditRuleDialog.kt | 1 - .../blocker/ui/setting/regex/ImportRule.kt | 1 - .../spam/blocker/ui/setting/regex/RuleCard.kt | 5 --- .../blocker/ui/setting/regex/RuleHeader.kt | 6 ---- .../spam/blocker/ui/setting/regex/RuleList.kt | 1 - .../blocker/ui/setting/regex/RuleSearchBox.kt | 5 --- .../java/spam/blocker/ui/widgets/CheckBox.kt | 3 -- .../java/spam/blocker/ui/widgets/Dropdown.kt | 10 ------ .../spam/blocker/ui/widgets/FileChooser.kt | 1 - .../spam/blocker/ui/widgets/PopupDialog.kt | 2 -- .../java/spam/blocker/ui/widgets/Resource.kt | 5 --- .../java/spam/blocker/ui/widgets/Section.kt | 1 - .../java/spam/blocker/ui/widgets/Swipe.kt | 2 -- .../spam/blocker/ui/widgets/WeekdaysPicker.kt | 1 - .../main/java/spam/blocker/util/Contact.kt | 3 +- .../java/spam/blocker/util/Permissions.kt | 10 +++--- app/src/main/java/spam/blocker/util/Util.kt | 13 -------- app/src/main/java/spam/blocker/util/Xml.kt | 1 - 49 files changed, 48 insertions(+), 194 deletions(-) diff --git a/README.md b/README.md index 5ab4d79a..66751bd4 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Table of Contents # Target Audience - :white_check_mark: For people who are more inclined to reject unknown calls. - For those who need to answer unknown calls, for example, salesmen or lawyers, etc: - - :white_check_mark: If your carrier supports STIR/SHAKEN attestation, or there is any public spam database for your country. + - :white_check_mark: If your carrier supports STIR/SHAKEN attestation, or there is any public spam database available for your country. - :x: Otherwise, consider using a blocker that has its own proprietary spam database. # How it works @@ -56,21 +56,22 @@ It works without replacing your default Call/SMS app. # Permissions -| Permission (all optional) | Why | -|---------------------------|---------------------------------------------------------------------------------| -| INTERNET | For downloading spam numbers from public databases | -| ANSWER_PHONE_CALLS | Reject, Answer and Hang-up calls | -| POST_NOTIFICATIONS | Show notifications | -| READ_CONTACTS | For matching contacts | -| RECEIVE_SMS | For receiving new messages | -| READ_CALL_LOG
READ_SMS | For feature: Repeated Call/Dialed (check if it's repeated) | -| PACKAGE_USAGE_STATS | For feature: Recent Apps
For checking whether an app has been used recently | -| READ_PHONE_STATE | For block mode: Answer + Hang-up (monitor ringing state) | +| Permission (all optional) | Why | +|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------| +| INTERNET | For downloading spam numbers from public databases | +| MANAGE_EXTERNAL_STORAGE (Android 11+)
READ/WRITE_EXTERNAL_STORAGE (Android 10) | For file access from automated workflow | +| ANSWER_PHONE_CALLS | Reject, Answer and Hang-up calls | +| POST_NOTIFICATIONS | Show notifications | +| READ_CONTACTS | For matching contacts | +| RECEIVE_SMS | For receiving new messages | +| READ_CALL_LOG
READ_SMS | For checking if a call is repeated | +| PACKAGE_USAGE_STATS | For feature: Recent Apps
For checking whether an app has been used recently | +| READ_PHONE_STATE | For block mode: Answer + Hang-up (monitor ringing state) | # Privacy No data collection - - Internet access is only used for downloading spam numbers, if you don't use this feature, you can [disable the internet access](https://github.com/aj3423/SpamBlocker/issues/147). - - No external storage access, only accessible to scoped storage(the Downloads folder). + - Internet access: + - It's only used for downloading spam numbers, if you don't use this feature, you can [disable the internet access](https://github.com/aj3423/SpamBlocker/issues/147). - No communication with other app - [Reproducible](https://f-droid.org/docs/Reproducible_Builds/) apk @@ -80,8 +81,8 @@ It works without replacing your default Call/SMS app. # FAQ - [Google shows security warning when installing this app](https://github.com/aj3423/SpamBlocker/issues/108) - - [Any feature stops working after app is killed](https://github.com/aj3423/SpamBlocker/issues/100) - - [How to always block particular number regardless of how many times it repeats, or within OffTime, etc...](https://github.com/aj3423/SpamBlocker/issues/80#issuecomment-2176943329) + - [Any feature stops working after the app is killed](https://github.com/aj3423/SpamBlocker/issues/100) + - [How to always block a particular number regardless of how many times it repeats, or within OffTime, etc...](https://github.com/aj3423/SpamBlocker/issues/80#issuecomment-2176943329) - [Android 9- support](https://github.com/aj3423/SpamBlocker/issues/38) - [Dual SIM support](https://github.com/aj3423/SpamBlocker/issues/72#issuecomment-2158981192) diff --git a/app/src/androidTest/java/spam/blocker/service/RuleTest.kt b/app/src/androidTest/java/spam/blocker/service/RuleTest.kt index fc681c64..780caf54 100644 --- a/app/src/androidTest/java/spam/blocker/service/RuleTest.kt +++ b/app/src/androidTest/java/spam/blocker/service/RuleTest.kt @@ -1,8 +1,12 @@ package spam.blocker.service +//import androidx.test.core.app.ApplicationProvider +//import junit.framework.TestCase.assertEquals +//import org.junit.After +//import org.junit.Before +//import org.junit.Test import android.content.Context import androidx.test.core.app.ApplicationProvider -//import androidx.test.core.app.ApplicationProvider import io.mockk.clearAllMocks import io.mockk.every import io.mockk.mockkObject @@ -10,16 +14,13 @@ import junit.framework.TestCase.assertEquals import org.junit.After import org.junit.Before import org.junit.Test -//import junit.framework.TestCase.assertEquals -//import org.junit.After -//import org.junit.Before -//import org.junit.Test import spam.blocker.db.ContentRuleTable import spam.blocker.db.NumberRuleTable import spam.blocker.db.RegexRule import spam.blocker.def.Def import spam.blocker.util.ContactInfo import spam.blocker.util.Contacts +import spam.blocker.util.Now import spam.blocker.util.Permissions import spam.blocker.util.SharedPref.Contact import spam.blocker.util.SharedPref.Dialed @@ -28,7 +29,6 @@ import spam.blocker.util.SharedPref.RecentAppInfo import spam.blocker.util.SharedPref.RecentApps import spam.blocker.util.SharedPref.RepeatedCall import spam.blocker.util.SharedPref.SharedPref -import spam.blocker.util.Now import spam.blocker.util.Util import java.util.Calendar diff --git a/app/src/androidTest/java/spam/blocker/util/RecurringTest.kt b/app/src/androidTest/java/spam/blocker/util/RecurringTest.kt index 349fb159..97120ad2 100644 --- a/app/src/androidTest/java/spam/blocker/util/RecurringTest.kt +++ b/app/src/androidTest/java/spam/blocker/util/RecurringTest.kt @@ -7,9 +7,9 @@ import org.junit.Test import spam.blocker.service.bot.Daily import spam.blocker.service.bot.Time import spam.blocker.service.bot.Weekly +import java.time.DayOfWeek.THURSDAY import java.time.DayOfWeek.TUESDAY import java.time.DayOfWeek.WEDNESDAY -import java.time.DayOfWeek.THURSDAY import java.time.Duration import java.time.LocalDateTime diff --git a/app/src/main/java/spam/blocker/db/BotTable.kt b/app/src/main/java/spam/blocker/db/BotTable.kt index e457f2b8..7e89e5bc 100644 --- a/app/src/main/java/spam/blocker/db/BotTable.kt +++ b/app/src/main/java/spam/blocker/db/BotTable.kt @@ -6,15 +6,12 @@ import android.content.Context import androidx.core.database.getIntOrNull import androidx.core.database.getStringOrNull import kotlinx.serialization.Serializable -import spam.blocker.service.bot.CleanupSpamDB -import spam.blocker.service.bot.Daily import spam.blocker.service.bot.IAction import spam.blocker.service.bot.ISchedule import spam.blocker.service.bot.MyWorkManager import spam.blocker.service.bot.parseActions import spam.blocker.service.bot.parseSchedule import spam.blocker.service.bot.serialize -import spam.blocker.util.SharedPref.SpamDB import java.util.UUID @Serializable diff --git a/app/src/main/java/spam/blocker/db/SpamTable.kt b/app/src/main/java/spam/blocker/db/SpamTable.kt index 51a3efd0..797c573a 100644 --- a/app/src/main/java/spam/blocker/db/SpamTable.kt +++ b/app/src/main/java/spam/blocker/db/SpamTable.kt @@ -1,16 +1,9 @@ package spam.blocker.db import android.annotation.SuppressLint -import android.content.ContentValues import android.content.Context import android.database.Cursor -import androidx.core.database.getIntOrNull -import androidx.core.database.getStringOrNull import kotlinx.serialization.Serializable -import spam.blocker.def.Def -import spam.blocker.util.Util -import spam.blocker.util.hasFlag -import spam.blocker.util.loge @Serializable data class SpamNumber( diff --git a/app/src/main/java/spam/blocker/service/Checker.kt b/app/src/main/java/spam/blocker/service/Checker.kt index 973244b8..fc6cd0f0 100644 --- a/app/src/main/java/spam/blocker/service/Checker.kt +++ b/app/src/main/java/spam/blocker/service/Checker.kt @@ -14,16 +14,15 @@ import spam.blocker.db.RuleTable import spam.blocker.db.SmsTable import spam.blocker.db.SpamTable import spam.blocker.def.Def -import spam.blocker.ui.setting.quick.SpamDB import spam.blocker.util.Contacts import spam.blocker.util.Permissions -import spam.blocker.util.TimeSchedule import spam.blocker.util.SharedPref.Contact import spam.blocker.util.SharedPref.Dialed import spam.blocker.util.SharedPref.RecentApps import spam.blocker.util.SharedPref.RepeatedCall import spam.blocker.util.SharedPref.SpamDB import spam.blocker.util.SharedPref.Stir +import spam.blocker.util.TimeSchedule import spam.blocker.util.Util import spam.blocker.util.hasFlag diff --git a/app/src/main/java/spam/blocker/service/bot/Action.kt b/app/src/main/java/spam/blocker/service/bot/Action.kt index 4e25bace..3a14a958 100644 --- a/app/src/main/java/spam/blocker/service/bot/Action.kt +++ b/app/src/main/java/spam/blocker/service/bot/Action.kt @@ -20,7 +20,6 @@ import spam.blocker.util.IntentPermission import spam.blocker.util.Lambda1 import spam.blocker.util.NormalPermission import spam.blocker.util.Permissions -import java.lang.Exception // When adding a new IAction type, follow all the steps: // - add to `ActionType` diff --git a/app/src/main/java/spam/blocker/service/bot/Actions.kt b/app/src/main/java/spam/blocker/service/bot/Actions.kt index eff292ac..0a5c2305 100644 --- a/app/src/main/java/spam/blocker/service/bot/Actions.kt +++ b/app/src/main/java/spam/blocker/service/bot/Actions.kt @@ -4,7 +4,6 @@ import android.content.Context import androidx.compose.foundation.layout.Column import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.remember import kotlinx.coroutines.DelicateCoroutinesApi @@ -44,7 +43,6 @@ import spam.blocker.util.logi import spam.blocker.util.resolvePathTags import spam.blocker.util.resolveTimeTags import spam.blocker.util.toStringMap -import java.lang.Exception import java.net.HttpURLConnection import java.net.URL diff --git a/app/src/main/java/spam/blocker/service/bot/BotSerializersModule.kt b/app/src/main/java/spam/blocker/service/bot/BotSerializersModule.kt index 1867480c..2de6a4c7 100644 --- a/app/src/main/java/spam/blocker/service/bot/BotSerializersModule.kt +++ b/app/src/main/java/spam/blocker/service/bot/BotSerializersModule.kt @@ -1,7 +1,6 @@ package spam.blocker.service.bot import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonBuilder import kotlinx.serialization.modules.SerializersModule import kotlinx.serialization.modules.polymorphic import kotlinx.serialization.modules.subclass diff --git a/app/src/main/java/spam/blocker/service/bot/Schedule.kt b/app/src/main/java/spam/blocker/service/bot/Schedule.kt index 354f3197..ca73f4f6 100644 --- a/app/src/main/java/spam/blocker/service/bot/Schedule.kt +++ b/app/src/main/java/spam/blocker/service/bot/Schedule.kt @@ -5,45 +5,32 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.TimeInput -import androidx.compose.material3.rememberTimePickerState import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.Saver import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.snapshots.SnapshotStateList -import androidx.compose.runtime.toMutableStateList -import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import kotlinx.serialization.PolymorphicSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json -import java.time.DayOfWeek.MONDAY -import java.time.DayOfWeek.TUESDAY -import java.time.DayOfWeek.WEDNESDAY -import java.time.DayOfWeek.THURSDAY -import java.time.DayOfWeek.FRIDAY -import java.time.DayOfWeek.SATURDAY -import java.time.DayOfWeek.SUNDAY -import java.time.Duration -import java.time.LocalDateTime -import java.time.temporal.TemporalAdjusters -import kotlinx.serialization.modules.SerializersModule -import kotlinx.serialization.modules.polymorphic -import kotlinx.serialization.modules.subclass import spam.blocker.R import spam.blocker.ui.M -import spam.blocker.ui.rememberSaveableMutableStateListOf import spam.blocker.ui.widgets.HourMinInput import spam.blocker.ui.widgets.RowCenter import spam.blocker.ui.widgets.WeekdayPicker2 import spam.blocker.util.LocalDateTimeMockk -import java.lang.Exception import java.time.DayOfWeek +import java.time.DayOfWeek.FRIDAY +import java.time.DayOfWeek.MONDAY +import java.time.DayOfWeek.SATURDAY +import java.time.DayOfWeek.SUNDAY +import java.time.DayOfWeek.THURSDAY +import java.time.DayOfWeek.TUESDAY +import java.time.DayOfWeek.WEDNESDAY +import java.time.Duration +import java.time.LocalDateTime +import java.time.temporal.TemporalAdjusters // When adding a new ISchedule type, follow all the steps: // - add to `ScheduleType` diff --git a/app/src/main/java/spam/blocker/ui/crash/CrashReportActivity.kt b/app/src/main/java/spam/blocker/ui/crash/CrashReportActivity.kt index e85cc6b4..59b31b18 100644 --- a/app/src/main/java/spam/blocker/ui/crash/CrashReportActivity.kt +++ b/app/src/main/java/spam/blocker/ui/crash/CrashReportActivity.kt @@ -10,16 +10,13 @@ import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.material3.Scaffold -import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.remember -import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import spam.blocker.BuildConfig diff --git a/app/src/main/java/spam/blocker/ui/history/HistoryList.kt b/app/src/main/java/spam/blocker/ui/history/HistoryList.kt index 61ded59b..1a34b64c 100644 --- a/app/src/main/java/spam/blocker/ui/history/HistoryList.kt +++ b/app/src/main/java/spam/blocker/ui/history/HistoryList.kt @@ -25,7 +25,6 @@ import spam.blocker.db.historyTableForType import spam.blocker.def.Def import spam.blocker.ui.M import spam.blocker.ui.setting.regex.RuleEditDialog -import spam.blocker.ui.theme.LocalPalette import spam.blocker.ui.widgets.BgLaunchApp import spam.blocker.ui.widgets.DropdownWrapper import spam.blocker.ui.widgets.LabelItem diff --git a/app/src/main/java/spam/blocker/ui/history/HistoryViewModel.kt b/app/src/main/java/spam/blocker/ui/history/HistoryViewModel.kt index 7b0d0c3a..320efa7f 100644 --- a/app/src/main/java/spam/blocker/ui/history/HistoryViewModel.kt +++ b/app/src/main/java/spam/blocker/ui/history/HistoryViewModel.kt @@ -7,7 +7,6 @@ import spam.blocker.db.CallTable import spam.blocker.db.HistoryRecord import spam.blocker.db.HistoryTable import spam.blocker.db.SmsTable -import spam.blocker.util.SharedPref.Global import spam.blocker.util.SharedPref.HistoryOptions /* diff --git a/app/src/main/java/spam/blocker/ui/main/Debug.kt b/app/src/main/java/spam/blocker/ui/main/Debug.kt index 761f2aa8..5be511c1 100644 --- a/app/src/main/java/spam/blocker/ui/main/Debug.kt +++ b/app/src/main/java/spam/blocker/ui/main/Debug.kt @@ -1,15 +1,6 @@ package spam.blocker.ui.main import android.content.Context -import android.net.Uri -import android.os.Environment -import android.util.Log -import androidx.core.content.FileProvider.getUriForFile -import spam.blocker.util.TAG -import spam.blocker.util.Xml -import spam.blocker.util.loge -import java.io.File -import java.security.AccessController.getContext fun debug(ctx: Context) { diff --git a/app/src/main/java/spam/blocker/ui/main/MainActivity.kt b/app/src/main/java/spam/blocker/ui/main/MainActivity.kt index b0b1804d..3bad2b8c 100644 --- a/app/src/main/java/spam/blocker/ui/main/MainActivity.kt +++ b/app/src/main/java/spam/blocker/ui/main/MainActivity.kt @@ -27,7 +27,6 @@ import androidx.compose.ui.platform.LocalView import androidx.core.content.ContextCompat import androidx.core.view.WindowCompat import spam.blocker.BuildConfig -import spam.blocker.Events import spam.blocker.G import spam.blocker.R import spam.blocker.db.SmsTable @@ -63,9 +62,15 @@ class MainActivity : ComponentActivity() { super.onCreate(savedInstanceState) - if (BuildConfig.DEBUG) + if (BuildConfig.DEBUG) { debug(this) + // Detect resource leak + Class.forName("dalvik.system.CloseGuard") + .getMethod("setEnabled", Boolean::class.javaPrimitiveType) + .invoke(null, true) + } + val ctx = this val spf = Global(ctx) diff --git a/app/src/main/java/spam/blocker/ui/setting/GloballyEnabled.kt b/app/src/main/java/spam/blocker/ui/setting/GloballyEnabled.kt index b43fda25..6543b634 100644 --- a/app/src/main/java/spam/blocker/ui/setting/GloballyEnabled.kt +++ b/app/src/main/java/spam/blocker/ui/setting/GloballyEnabled.kt @@ -34,7 +34,6 @@ import spam.blocker.ui.widgets.Str import spam.blocker.ui.widgets.StrokeButton import spam.blocker.ui.widgets.SwitchBox import spam.blocker.util.NormalPermission -import spam.blocker.util.PermissionChain import spam.blocker.util.Permissions import spam.blocker.util.SharedPref.Global import spam.blocker.util.Util diff --git a/app/src/main/java/spam/blocker/ui/setting/bot/ActionCard.kt b/app/src/main/java/spam/blocker/ui/setting/bot/ActionCard.kt index a2e6ded1..a78ccff2 100644 --- a/app/src/main/java/spam/blocker/ui/setting/bot/ActionCard.kt +++ b/app/src/main/java/spam/blocker/ui/setting/bot/ActionCard.kt @@ -1,48 +1,23 @@ package spam.blocker.ui.setting.bot -import android.app.NotificationManager -import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.CardDefaults -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.OutlinedCard import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.setValue -import androidx.compose.runtime.snapshots.SnapshotStateList -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import spam.blocker.R -import spam.blocker.def.Def import spam.blocker.service.bot.IAction import spam.blocker.ui.M -import spam.blocker.ui.setting.regex.DisableNestedScrolling -import spam.blocker.ui.theme.LightMagenta import spam.blocker.ui.theme.LocalPalette import spam.blocker.ui.widgets.GreyIcon import spam.blocker.ui.widgets.OutlineCard -import spam.blocker.ui.widgets.ResIcon import spam.blocker.ui.widgets.RowVCenterSpaced -import spam.blocker.ui.widgets.Str -import spam.blocker.util.Lambda -import spam.blocker.util.hasFlag @Composable diff --git a/app/src/main/java/spam/blocker/ui/setting/bot/ActionHeader.kt b/app/src/main/java/spam/blocker/ui/setting/bot/ActionHeader.kt index cf70c95b..0dd9306c 100644 --- a/app/src/main/java/spam/blocker/ui/setting/bot/ActionHeader.kt +++ b/app/src/main/java/spam/blocker/ui/setting/bot/ActionHeader.kt @@ -25,7 +25,6 @@ import spam.blocker.ui.theme.LocalPalette import spam.blocker.ui.theme.SkyBlue import spam.blocker.ui.theme.Teal200 import spam.blocker.ui.widgets.BalloonQuestionMark -import spam.blocker.ui.widgets.GreyLabel import spam.blocker.ui.widgets.LabelItem import spam.blocker.ui.widgets.MenuButton import spam.blocker.ui.widgets.PopupDialog diff --git a/app/src/main/java/spam/blocker/ui/setting/bot/ActionList.kt b/app/src/main/java/spam/blocker/ui/setting/bot/ActionList.kt index dbe94be3..567f9bd4 100644 --- a/app/src/main/java/spam/blocker/ui/setting/bot/ActionList.kt +++ b/app/src/main/java/spam/blocker/ui/setting/bot/ActionList.kt @@ -17,19 +17,15 @@ import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.drawscope.DrawScope import androidx.compose.ui.input.nestedscroll.nestedScroll -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import sh.calvin.reorderable.ReorderableColumn import spam.blocker.service.bot.IAction -import spam.blocker.service.bot.allChainable import spam.blocker.service.bot.isNextChainable import spam.blocker.service.bot.isPreviousChainable import spam.blocker.ui.M import spam.blocker.ui.setting.regex.DisableNestedScrolling -import spam.blocker.ui.theme.Salmon import spam.blocker.ui.widgets.LeftDeleteSwipeWrapper import spam.blocker.ui.widgets.SwipeInfo -import spam.blocker.util.loge // Draw a green/red line above/below each action card, // indicating whether it's chainable to the previous/next action. diff --git a/app/src/main/java/spam/blocker/ui/setting/bot/BotCard.kt b/app/src/main/java/spam/blocker/ui/setting/bot/BotCard.kt index c215cca6..6fbdf060 100644 --- a/app/src/main/java/spam/blocker/ui/setting/bot/BotCard.kt +++ b/app/src/main/java/spam/blocker/ui/setting/bot/BotCard.kt @@ -1,10 +1,7 @@ package spam.blocker.ui.setting.bot import androidx.compose.foundation.Canvas -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size diff --git a/app/src/main/java/spam/blocker/ui/setting/bot/BotHeader.kt b/app/src/main/java/spam/blocker/ui/setting/bot/BotHeader.kt index 51a4eb84..31d12164 100644 --- a/app/src/main/java/spam/blocker/ui/setting/bot/BotHeader.kt +++ b/app/src/main/java/spam/blocker/ui/setting/bot/BotHeader.kt @@ -1,11 +1,9 @@ package spam.blocker.ui.setting.bot import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.setValue import androidx.compose.ui.platform.LocalContext import spam.blocker.G import spam.blocker.R diff --git a/app/src/main/java/spam/blocker/ui/setting/bot/BotImportExportDialog.kt b/app/src/main/java/spam/blocker/ui/setting/bot/BotImportExportDialog.kt index 8ad68eac..0e53e537 100644 --- a/app/src/main/java/spam/blocker/ui/setting/bot/BotImportExportDialog.kt +++ b/app/src/main/java/spam/blocker/ui/setting/bot/BotImportExportDialog.kt @@ -22,8 +22,6 @@ import spam.blocker.ui.widgets.Str import spam.blocker.ui.widgets.StrInputBox import spam.blocker.ui.widgets.StrokeButton import spam.blocker.util.Clipboard -import spam.blocker.util.Launcher -import java.lang.Exception @Composable fun BotImportExportDialog( diff --git a/app/src/main/java/spam/blocker/ui/setting/bot/BotList.kt b/app/src/main/java/spam/blocker/ui/setting/bot/BotList.kt index 535a664e..4df89ad2 100644 --- a/app/src/main/java/spam/blocker/ui/setting/bot/BotList.kt +++ b/app/src/main/java/spam/blocker/ui/setting/bot/BotList.kt @@ -20,7 +20,6 @@ import kotlinx.serialization.encodeToString import spam.blocker.G import spam.blocker.R import spam.blocker.db.BotTable -import spam.blocker.service.bot.botJson import spam.blocker.service.bot.botPrettyJson import spam.blocker.ui.M import spam.blocker.ui.setting.regex.DisableNestedScrolling @@ -30,7 +29,6 @@ import spam.blocker.ui.widgets.LabelItem import spam.blocker.ui.widgets.LeftDeleteSwipeWrapper import spam.blocker.ui.widgets.SnackBar import spam.blocker.ui.widgets.SwipeInfo -import spam.blocker.util.Clipboard @OptIn(ExperimentalFoundationApi::class) @Composable diff --git a/app/src/main/java/spam/blocker/ui/setting/bot/BotPresets.kt b/app/src/main/java/spam/blocker/ui/setting/bot/BotPresets.kt index 42a075e5..c8c0367c 100644 --- a/app/src/main/java/spam/blocker/ui/setting/bot/BotPresets.kt +++ b/app/src/main/java/spam/blocker/ui/setting/bot/BotPresets.kt @@ -14,10 +14,10 @@ import spam.blocker.service.bot.Weekly import spam.blocker.service.bot.WriteFile import java.time.DayOfWeek.FRIDAY import java.time.DayOfWeek.MONDAY -import java.time.DayOfWeek.THURSDAY -import java.time.DayOfWeek.TUESDAY import java.time.DayOfWeek.SATURDAY import java.time.DayOfWeek.SUNDAY +import java.time.DayOfWeek.THURSDAY +import java.time.DayOfWeek.TUESDAY import java.time.DayOfWeek.WEDNESDAY class BotPreset( diff --git a/app/src/main/java/spam/blocker/ui/setting/misc/BackupRestore.kt b/app/src/main/java/spam/blocker/ui/setting/misc/BackupRestore.kt index eacdc89d..37ea5b9c 100644 --- a/app/src/main/java/spam/blocker/ui/setting/misc/BackupRestore.kt +++ b/app/src/main/java/spam/blocker/ui/setting/misc/BackupRestore.kt @@ -14,7 +14,6 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import spam.blocker.Events -import spam.blocker.G import spam.blocker.R import spam.blocker.config.Configs import spam.blocker.ui.setting.LabeledRow @@ -27,7 +26,6 @@ import spam.blocker.ui.widgets.MenuButton import spam.blocker.ui.widgets.PopupDialog import spam.blocker.ui.widgets.ResIcon import spam.blocker.ui.widgets.Str -import spam.blocker.ui.widgets.StrokeButton import spam.blocker.ui.widgets.rememberFileReadChooser import spam.blocker.ui.widgets.rememberFileWriteChooser import spam.blocker.util.Algorithm.b64Decode diff --git a/app/src/main/java/spam/blocker/ui/setting/quick/BlockType.kt b/app/src/main/java/spam/blocker/ui/setting/quick/BlockType.kt index 2a3a6589..f91064fa 100644 --- a/app/src/main/java/spam/blocker/ui/setting/quick/BlockType.kt +++ b/app/src/main/java/spam/blocker/ui/setting/quick/BlockType.kt @@ -12,7 +12,6 @@ import spam.blocker.ui.widgets.GreyIcon16 import spam.blocker.ui.widgets.LabelItem import spam.blocker.ui.widgets.Spinner import spam.blocker.util.NormalPermission -import spam.blocker.util.PermissionChain import spam.blocker.util.SharedPref.BlockType @Composable diff --git a/app/src/main/java/spam/blocker/ui/setting/quick/Contacts.kt b/app/src/main/java/spam/blocker/ui/setting/quick/Contacts.kt index eded7af9..a7a89f9e 100644 --- a/app/src/main/java/spam/blocker/ui/setting/quick/Contacts.kt +++ b/app/src/main/java/spam/blocker/ui/setting/quick/Contacts.kt @@ -16,7 +16,6 @@ import spam.blocker.ui.widgets.Str import spam.blocker.ui.widgets.StrokeButton import spam.blocker.ui.widgets.SwitchBox import spam.blocker.util.NormalPermission -import spam.blocker.util.PermissionChain import spam.blocker.util.Permissions.isContactsPermissionGranted import spam.blocker.util.SharedPref.Contact diff --git a/app/src/main/java/spam/blocker/ui/setting/quick/Dialed.kt b/app/src/main/java/spam/blocker/ui/setting/quick/Dialed.kt index 54f0d1b2..8403f90e 100644 --- a/app/src/main/java/spam/blocker/ui/setting/quick/Dialed.kt +++ b/app/src/main/java/spam/blocker/ui/setting/quick/Dialed.kt @@ -19,7 +19,6 @@ import spam.blocker.ui.widgets.PopupDialog import spam.blocker.ui.widgets.Str import spam.blocker.ui.widgets.SwitchBox import spam.blocker.util.NormalPermission -import spam.blocker.util.PermissionChain import spam.blocker.util.Permissions.isCallLogPermissionGranted import spam.blocker.util.SharedPref.Dialed diff --git a/app/src/main/java/spam/blocker/ui/setting/quick/OffTime.kt b/app/src/main/java/spam/blocker/ui/setting/quick/OffTime.kt index a4721f36..fa69d42a 100644 --- a/app/src/main/java/spam/blocker/ui/setting/quick/OffTime.kt +++ b/app/src/main/java/spam/blocker/ui/setting/quick/OffTime.kt @@ -1,6 +1,5 @@ package spam.blocker.ui.setting.quick -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf diff --git a/app/src/main/java/spam/blocker/ui/setting/quick/RecentApps.kt b/app/src/main/java/spam/blocker/ui/setting/quick/RecentApps.kt index 79a09e80..0e36640b 100644 --- a/app/src/main/java/spam/blocker/ui/setting/quick/RecentApps.kt +++ b/app/src/main/java/spam/blocker/ui/setting/quick/RecentApps.kt @@ -53,9 +53,7 @@ import spam.blocker.ui.widgets.StrInputBox import spam.blocker.ui.widgets.SwitchBox import spam.blocker.util.AppInfo import spam.blocker.util.AppOpsPermission -import spam.blocker.util.PermissionChain import spam.blocker.util.Permissions -import spam.blocker.util.IntentPermission import spam.blocker.util.SharedPref.RecentAppInfo import spam.blocker.util.SharedPref.RecentApps import spam.blocker.util.Util diff --git a/app/src/main/java/spam/blocker/ui/setting/quick/RepeatedCall.kt b/app/src/main/java/spam/blocker/ui/setting/quick/RepeatedCall.kt index e21d3d34..530ec5a6 100644 --- a/app/src/main/java/spam/blocker/ui/setting/quick/RepeatedCall.kt +++ b/app/src/main/java/spam/blocker/ui/setting/quick/RepeatedCall.kt @@ -25,7 +25,6 @@ import spam.blocker.ui.widgets.Str import spam.blocker.ui.widgets.StrokeButton import spam.blocker.ui.widgets.SwitchBox import spam.blocker.util.NormalPermission -import spam.blocker.util.PermissionChain import spam.blocker.util.Permissions.isCallLogPermissionGranted import spam.blocker.util.SharedPref.RepeatedCall diff --git a/app/src/main/java/spam/blocker/ui/setting/regex/EditRuleDialog.kt b/app/src/main/java/spam/blocker/ui/setting/regex/EditRuleDialog.kt index 0d138bf1..04fa6e94 100644 --- a/app/src/main/java/spam/blocker/ui/setting/regex/EditRuleDialog.kt +++ b/app/src/main/java/spam/blocker/ui/setting/regex/EditRuleDialog.kt @@ -70,7 +70,6 @@ import spam.blocker.util.TimeSchedule import spam.blocker.util.Util import spam.blocker.util.addFlag import spam.blocker.util.hasFlag -import spam.blocker.util.loge import spam.blocker.util.removeFlag import spam.blocker.util.setFlag diff --git a/app/src/main/java/spam/blocker/ui/setting/regex/ImportRule.kt b/app/src/main/java/spam/blocker/ui/setting/regex/ImportRule.kt index d55972c4..a01839b3 100644 --- a/app/src/main/java/spam/blocker/ui/setting/regex/ImportRule.kt +++ b/app/src/main/java/spam/blocker/ui/setting/regex/ImportRule.kt @@ -4,7 +4,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.snapshots.SnapshotStateList import androidx.compose.ui.platform.LocalContext import spam.blocker.R import spam.blocker.db.NumberRuleTable diff --git a/app/src/main/java/spam/blocker/ui/setting/regex/RuleCard.kt b/app/src/main/java/spam/blocker/ui/setting/regex/RuleCard.kt index b65c0831..8ef80fc6 100644 --- a/app/src/main/java/spam/blocker/ui/setting/regex/RuleCard.kt +++ b/app/src/main/java/spam/blocker/ui/setting/regex/RuleCard.kt @@ -1,16 +1,11 @@ package spam.blocker.ui.setting.regex import android.app.NotificationManager -import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.CardDefaults -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.OutlinedCard import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment diff --git a/app/src/main/java/spam/blocker/ui/setting/regex/RuleHeader.kt b/app/src/main/java/spam/blocker/ui/setting/regex/RuleHeader.kt index 32eb95e4..4c6a1631 100644 --- a/app/src/main/java/spam/blocker/ui/setting/regex/RuleHeader.kt +++ b/app/src/main/java/spam/blocker/ui/setting/regex/RuleHeader.kt @@ -4,15 +4,9 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.snapshots.SnapshotStateList import androidx.compose.ui.platform.LocalContext import spam.blocker.R -import spam.blocker.db.ContentRuleTable -import spam.blocker.db.NumberRuleTable -import spam.blocker.db.QuickCopyRuleTable -import spam.blocker.db.RegexRule import spam.blocker.db.defaultRegexRuleByType -import spam.blocker.db.ruleTableForType import spam.blocker.def.Def import spam.blocker.ui.setting.LabeledRow import spam.blocker.ui.theme.SkyBlue diff --git a/app/src/main/java/spam/blocker/ui/setting/regex/RuleList.kt b/app/src/main/java/spam/blocker/ui/setting/regex/RuleList.kt index c2d22bb5..184b11aa 100644 --- a/app/src/main/java/spam/blocker/ui/setting/regex/RuleList.kt +++ b/app/src/main/java/spam/blocker/ui/setting/regex/RuleList.kt @@ -32,7 +32,6 @@ import kotlinx.coroutines.CoroutineScope import spam.blocker.Events import spam.blocker.R import spam.blocker.db.RegexRule -import spam.blocker.db.SpamTable import spam.blocker.db.ruleTableForType import spam.blocker.def.Def import spam.blocker.ui.M diff --git a/app/src/main/java/spam/blocker/ui/setting/regex/RuleSearchBox.kt b/app/src/main/java/spam/blocker/ui/setting/regex/RuleSearchBox.kt index 1efe3ba5..eece087a 100644 --- a/app/src/main/java/spam/blocker/ui/setting/regex/RuleSearchBox.kt +++ b/app/src/main/java/spam/blocker/ui/setting/regex/RuleSearchBox.kt @@ -3,12 +3,10 @@ package spam.blocker.ui.setting.regex import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.runtime.Composable -import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.onFocusEvent @@ -17,10 +15,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import spam.blocker.R import spam.blocker.ui.M -import spam.blocker.ui.widgets.LeftDeleteSwipeWrapper import spam.blocker.ui.widgets.StrInputBox -import spam.blocker.ui.widgets.SwipeInfo -import spam.blocker.util.loge @Composable fun RuleSearchBox( diff --git a/app/src/main/java/spam/blocker/ui/widgets/CheckBox.kt b/app/src/main/java/spam/blocker/ui/widgets/CheckBox.kt index a3e597da..9d805894 100644 --- a/app/src/main/java/spam/blocker/ui/widgets/CheckBox.kt +++ b/app/src/main/java/spam/blocker/ui/widgets/CheckBox.kt @@ -1,9 +1,7 @@ package spam.blocker.ui.widgets -import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.material.ripple.rememberRipple import androidx.compose.material3.Checkbox import androidx.compose.material3.CheckboxDefaults import androidx.compose.material3.MaterialTheme @@ -12,7 +10,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color import spam.blocker.ui.theme.LocalPalette import spam.blocker.util.Lambda1 diff --git a/app/src/main/java/spam/blocker/ui/widgets/Dropdown.kt b/app/src/main/java/spam/blocker/ui/widgets/Dropdown.kt index aa177b45..4c24c33e 100644 --- a/app/src/main/java/spam/blocker/ui/widgets/Dropdown.kt +++ b/app/src/main/java/spam/blocker/ui/widgets/Dropdown.kt @@ -5,30 +5,20 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width import androidx.compose.material3.DropdownMenu import androidx.compose.material3.HorizontalDivider import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable import androidx.compose.runtime.MutableState -import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.layout.onGloballyPositioned -import androidx.compose.ui.layout.positionOnScreen import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import spam.blocker.ui.M import spam.blocker.ui.theme.LocalPalette -import spam.blocker.util.Lambda import spam.blocker.util.Lambda1 // The built-in DropdownMenuItem is twice height as it should be. diff --git a/app/src/main/java/spam/blocker/ui/widgets/FileChooser.kt b/app/src/main/java/spam/blocker/ui/widgets/FileChooser.kt index 77d9fe55..a20ad71d 100644 --- a/app/src/main/java/spam/blocker/ui/widgets/FileChooser.kt +++ b/app/src/main/java/spam/blocker/ui/widgets/FileChooser.kt @@ -1,7 +1,6 @@ package spam.blocker.ui.widgets import android.app.Activity -import android.content.Context import android.content.Intent import androidx.activity.compose.ManagedActivityResultLauncher import androidx.activity.compose.rememberLauncherForActivityResult diff --git a/app/src/main/java/spam/blocker/ui/widgets/PopupDialog.kt b/app/src/main/java/spam/blocker/ui/widgets/PopupDialog.kt index 9c36bae3..6b685a6e 100644 --- a/app/src/main/java/spam/blocker/ui/widgets/PopupDialog.kt +++ b/app/src/main/java/spam/blocker/ui/widgets/PopupDialog.kt @@ -15,7 +15,6 @@ import androidx.compose.material3.CardDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.ui.Alignment -import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.Dp @@ -24,7 +23,6 @@ import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties import spam.blocker.ui.M import spam.blocker.ui.theme.LocalPalette -import spam.blocker.ui.theme.SkyBlue import spam.blocker.util.Lambda import kotlin.math.roundToInt diff --git a/app/src/main/java/spam/blocker/ui/widgets/Resource.kt b/app/src/main/java/spam/blocker/ui/widgets/Resource.kt index b40bfdc5..a424008c 100644 --- a/app/src/main/java/spam/blocker/ui/widgets/Resource.kt +++ b/app/src/main/java/spam/blocker/ui/widgets/Resource.kt @@ -2,14 +2,10 @@ package spam.blocker.ui.widgets import android.annotation.SuppressLint import androidx.compose.foundation.Image -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.material3.Icon import androidx.compose.material3.LocalContentColor import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter @@ -19,7 +15,6 @@ import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp -import spam.blocker.R import spam.blocker.ui.theme.LocalPalette @SuppressLint("ComposableNaming") @Composable diff --git a/app/src/main/java/spam/blocker/ui/widgets/Section.kt b/app/src/main/java/spam/blocker/ui/widgets/Section.kt index 391ec6b9..d515bb7f 100644 --- a/app/src/main/java/spam/blocker/ui/widgets/Section.kt +++ b/app/src/main/java/spam/blocker/ui/widgets/Section.kt @@ -13,7 +13,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp diff --git a/app/src/main/java/spam/blocker/ui/widgets/Swipe.kt b/app/src/main/java/spam/blocker/ui/widgets/Swipe.kt index ffd3d901..9637b7e4 100644 --- a/app/src/main/java/spam/blocker/ui/widgets/Swipe.kt +++ b/app/src/main/java/spam/blocker/ui/widgets/Swipe.kt @@ -38,8 +38,6 @@ import spam.blocker.R import spam.blocker.ui.theme.MayaBlue import spam.blocker.ui.theme.Salmon import spam.blocker.util.Lambda -import spam.blocker.util.loge -import kotlin.math.min private const val SwipeThresholdPercent = 0.35f diff --git a/app/src/main/java/spam/blocker/ui/widgets/WeekdaysPicker.kt b/app/src/main/java/spam/blocker/ui/widgets/WeekdaysPicker.kt index 4219a04a..c0e96b75 100644 --- a/app/src/main/java/spam/blocker/ui/widgets/WeekdaysPicker.kt +++ b/app/src/main/java/spam/blocker/ui/widgets/WeekdaysPicker.kt @@ -14,7 +14,6 @@ import spam.blocker.R import spam.blocker.ui.M import spam.blocker.ui.rememberSaveableMutableStateListOf import spam.blocker.ui.theme.LocalPalette -import spam.blocker.util.Lambda import spam.blocker.util.Lambda1 import java.time.DayOfWeek diff --git a/app/src/main/java/spam/blocker/util/Contact.kt b/app/src/main/java/spam/blocker/util/Contact.kt index f6c170c8..64869fe6 100644 --- a/app/src/main/java/spam/blocker/util/Contact.kt +++ b/app/src/main/java/spam/blocker/util/Contact.kt @@ -7,9 +7,8 @@ import android.graphics.Bitmap import android.graphics.ImageDecoder import android.net.Uri import android.provider.ContactsContract -import android.provider.ContactsContract.PhoneLookup -import android.provider.ContactsContract.CommonDataKinds.Phone import android.provider.ContactsContract.CommonDataKinds.GroupMembership +import android.provider.ContactsContract.PhoneLookup data class ContactInfo( val id: String, diff --git a/app/src/main/java/spam/blocker/util/Permissions.kt b/app/src/main/java/spam/blocker/util/Permissions.kt index 48ed8434..3b24de8e 100644 --- a/app/src/main/java/spam/blocker/util/Permissions.kt +++ b/app/src/main/java/spam/blocker/util/Permissions.kt @@ -1,6 +1,7 @@ package spam.blocker.util import android.Manifest +import android.annotation.SuppressLint import android.app.Activity import android.app.AppOpsManager import android.app.role.RoleManager @@ -14,6 +15,8 @@ import android.content.ServiceConnection import android.content.pm.PackageInfo import android.content.pm.PackageManager import android.content.pm.PackageManager.PERMISSION_GRANTED +import android.net.ConnectivityManager +import android.net.NetworkCapabilities import android.os.Build import android.os.Environment import android.os.IBinder @@ -80,15 +83,10 @@ object Permissions { fun isPermissionGranted(ctx: Context, permission: String): Boolean { val ret = ContextCompat.checkSelfPermission( ctx, permission - ) == PackageManager.PERMISSION_GRANTED + ) == PERMISSION_GRANTED return ret } -// fun isInternetPermissionGranted(ctx: Context) : Boolean { -// val pm = ctx.packageManager -// val result = pm.checkPermission(Manifest.permission.INTERNET, ctx.packageName) -// return result == PERMISSION_GRANTED -// } fun isFileReadPermissionGranted(ctx: Context): Boolean { return if(Build.VERSION.SDK_INT == Def.ANDROID_10) { isPermissionGranted(ctx, Manifest.permission.READ_EXTERNAL_STORAGE) diff --git a/app/src/main/java/spam/blocker/util/Util.kt b/app/src/main/java/spam/blocker/util/Util.kt index 5b0ec1aa..dadd09f9 100644 --- a/app/src/main/java/spam/blocker/util/Util.kt +++ b/app/src/main/java/spam/blocker/util/Util.kt @@ -2,7 +2,6 @@ package spam.blocker.util import android.Manifest import android.annotation.SuppressLint -import android.app.ActivityManager import android.content.Context import android.content.Intent import android.content.pm.ApplicationInfo @@ -10,32 +9,20 @@ import android.content.pm.PackageManager.PERMISSION_GRANTED import android.net.Uri import android.os.Build import android.os.Environment -import android.os.PowerManager import android.os.UserManager import android.provider.OpenableColumns import android.provider.Settings import android.provider.Telephony -import android.util.DisplayMetrics -import android.view.WindowManager import androidx.annotation.RequiresApi -import androidx.compose.runtime.MutableState import org.json.JSONArray import org.json.JSONObject import spam.blocker.R import spam.blocker.def.Def -import spam.blocker.util.SharedPref.Global import spam.blocker.util.SharedPref.SharedPref import java.io.File -import java.io.FileInputStream -import java.io.FileOutputStream import java.io.IOException import java.text.SimpleDateFormat -import java.time.DayOfWeek -import java.time.Duration import java.time.LocalDateTime -import java.time.LocalTime -import java.time.ZoneId -import java.time.temporal.TemporalAdjusters import java.util.Calendar import java.util.Date import java.util.Locale diff --git a/app/src/main/java/spam/blocker/util/Xml.kt b/app/src/main/java/spam/blocker/util/Xml.kt index a0356f7d..b85f35bc 100644 --- a/app/src/main/java/spam/blocker/util/Xml.kt +++ b/app/src/main/java/spam/blocker/util/Xml.kt @@ -2,7 +2,6 @@ package spam.blocker.util import org.w3c.dom.Document import org.w3c.dom.NodeList -import spam.blocker.db.RegexRule import java.io.ByteArrayInputStream import javax.xml.parsers.DocumentBuilderFactory import javax.xml.xpath.XPathConstants