diff --git a/README.md b/README.md index 5055042c3..cd66687cb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ | [![CI](https://github.com/tachiyomiorg/tachiyomi/actions/workflows/build_push.yml/badge.svg)](https://github.com/tachiyomiorg/tachiyomi/actions/workflows/build_push.yml) | [![stable release](https://img.shields.io/github/release/tachiyomiorg/tachiyomi.svg?maxAge=3600&label=download)](https://github.com/tachiyomiorg/tachiyomi/releases) | [![latest preview build](https://img.shields.io/github/v/release/tachiyomiorg/tachiyomi-preview.svg?maxAge=3600&label=download)](https://github.com/tachiyomiorg/tachiyomi-preview/releases) | [![Translation status](https://hosted.weblate.org/widgets/tachiyomi/-/svg-badge.svg)](https://hosted.weblate.org/engage/tachiyomi/?utm_source=widget) | [![Discord](https://img.shields.io/discord/1195734228319617024.svg?label=discord&labelColor=7289da&color=2c2f33&style=flat)](https://discord.gg/mihon) | # ![app icon](./.github/readme-images/app-icon.png)Mihon -Mihon is a free and open source manga reader for Android 6.0 and above. +Mihon is a free and open source manga reader for Android 8.0 and above. ## Features diff --git a/app/src/debug/res/mipmap-hdpi/ic_launcher.png b/app/src/debug/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 85b8efd98..000000000 Binary files a/app/src/debug/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 40dbb9c34..000000000 Binary files a/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-mdpi/ic_launcher.png b/app/src/debug/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index bbd7cb265..000000000 Binary files a/app/src/debug/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index ab81a8b5a..000000000 Binary files a/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-xhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index a17cf188d..000000000 Binary files a/app/src/debug/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index e4414a507..000000000 Binary files a/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 112552082..000000000 Binary files a/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index a14c8a3ae..000000000 Binary files a/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index c3c1617f4..000000000 Binary files a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 8c172e3c9..000000000 Binary files a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/debug/res/mipmap/ic_launcher.xml similarity index 100% rename from app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml rename to app/src/debug/res/mipmap/ic_launcher.xml diff --git a/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/debug/res/mipmap/ic_launcher_round.xml similarity index 100% rename from app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to app/src/debug/res/mipmap/ic_launcher_round.xml diff --git a/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt b/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt index 294812bdc..efb27fa02 100644 --- a/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt +++ b/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt @@ -1,6 +1,5 @@ package eu.kanade.domain.ui -import android.os.Build import eu.kanade.domain.ui.model.AppTheme import eu.kanade.domain.ui.model.TabletUiMode import eu.kanade.domain.ui.model.ThemeMode @@ -16,10 +15,7 @@ class UiPreferences( private val preferenceStore: PreferenceStore, ) { - fun themeMode() = preferenceStore.getEnum( - "pref_theme_mode_key", - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { ThemeMode.SYSTEM } else { ThemeMode.LIGHT }, - ) + fun themeMode() = preferenceStore.getEnum("pref_theme_mode_key", ThemeMode.SYSTEM) fun appTheme() = preferenceStore.getEnum( "pref_app_theme", diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt index b3c06a979..a71d08674 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt @@ -2,7 +2,6 @@ package eu.kanade.presentation.manga.components import android.graphics.Bitmap import android.graphics.drawable.BitmapDrawable -import android.os.Build import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row @@ -173,14 +172,9 @@ fun MangaCoverDialog( // Copy bitmap in case it came from memory cache // Because SSIV needs to thoroughly read the image val copy = (drawable as? BitmapDrawable)?.let { - val config = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - Bitmap.Config.HARDWARE - } else { - Bitmap.Config.ARGB_8888 - } BitmapDrawable( view.context.resources, - it.bitmap.copy(config, false), + it.bitmap.copy(Bitmap.Config.HARDWARE, false), ) } ?: drawable view.setImage(copy, ReaderPageImageView.Config(zoomDuration = 500)) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt index ee9fd485d..c86492287 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt @@ -3,7 +3,6 @@ package eu.kanade.presentation.more.settings.screen import android.annotation.SuppressLint import android.content.ActivityNotFoundException import android.content.Intent -import android.os.Build import android.provider.Settings import android.webkit.WebStorage import android.webkit.WebView @@ -84,60 +83,48 @@ object SettingsAdvancedScreen : SearchableSettings { val basePreferences = remember { Injekt.get() } val networkPreferences = remember { Injekt.get() } - return buildList { - addAll( - listOf( - Preference.PreferenceItem.TextPreference( - title = stringResource(MR.strings.pref_dump_crash_logs), - subtitle = stringResource(MR.strings.pref_dump_crash_logs_summary), - onClick = { - scope.launch { - CrashLogUtil(context).dumpLogs() - } - }, - ), - Preference.PreferenceItem.SwitchPreference( - pref = networkPreferences.verboseLogging(), - title = stringResource(MR.strings.pref_verbose_logging), - subtitle = stringResource(MR.strings.pref_verbose_logging_summary), - onValueChanged = { - context.toast(MR.strings.requires_app_restart) - true - }, - ), - Preference.PreferenceItem.TextPreference( - title = stringResource(MR.strings.pref_debug_info), - onClick = { navigator.push(DebugInfoScreen()) }, - ), - Preference.PreferenceItem.TextPreference( - title = stringResource(MR.strings.pref_onboarding_guide), - onClick = { navigator.push(OnboardingScreen()) }, - ), - ), - ) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - add( - Preference.PreferenceItem.TextPreference( - title = stringResource(MR.strings.pref_manage_notifications), - onClick = { - val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply { - putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName) - } - context.startActivity(intent) - }, - ), - ) - } - addAll( - listOf( - getBackgroundActivityGroup(), - getDataGroup(), - getNetworkGroup(networkPreferences = networkPreferences), - getLibraryGroup(), - getExtensionsGroup(basePreferences = basePreferences), - ), - ) - } + return listOf( + Preference.PreferenceItem.TextPreference( + title = stringResource(MR.strings.pref_dump_crash_logs), + subtitle = stringResource(MR.strings.pref_dump_crash_logs_summary), + onClick = { + scope.launch { + CrashLogUtil(context).dumpLogs() + } + }, + ), + Preference.PreferenceItem.SwitchPreference( + pref = networkPreferences.verboseLogging(), + title = stringResource(MR.strings.pref_verbose_logging), + subtitle = stringResource(MR.strings.pref_verbose_logging_summary), + onValueChanged = { + context.toast(MR.strings.requires_app_restart) + true + }, + ), + Preference.PreferenceItem.TextPreference( + title = stringResource(MR.strings.pref_debug_info), + onClick = { navigator.push(DebugInfoScreen()) }, + ), + Preference.PreferenceItem.TextPreference( + title = stringResource(MR.strings.pref_onboarding_guide), + onClick = { navigator.push(OnboardingScreen()) }, + ), + Preference.PreferenceItem.TextPreference( + title = stringResource(MR.strings.pref_manage_notifications), + onClick = { + val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply { + putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName) + } + context.startActivity(intent) + }, + ), + getBackgroundActivityGroup(), + getDataGroup(), + getNetworkGroup(networkPreferences = networkPreferences), + getLibraryGroup(), + getExtensionsGroup(basePreferences = basePreferences), + ) } @Composable diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt index c28b12d48..bc60037e9 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt @@ -60,7 +60,6 @@ object SettingsReaderScreen : SearchableSettings { pref = readerPref.trueColor(), title = stringResource(MR.strings.pref_true_color), subtitle = stringResource(MR.strings.pref_true_color_summary), - enabled = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O, ), Preference.PreferenceItem.SwitchPreference( pref = readerPref.pageTransitions(), diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemeModePreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemeModePreferenceWidget.kt index d1901745b..bd523c6de 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemeModePreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemeModePreferenceWidget.kt @@ -13,18 +13,11 @@ import eu.kanade.domain.ui.model.ThemeMode import tachiyomi.i18n.MR import tachiyomi.presentation.core.i18n.stringResource -private val options = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - mapOf( - ThemeMode.SYSTEM to MR.strings.theme_system, - ThemeMode.LIGHT to MR.strings.theme_light, - ThemeMode.DARK to MR.strings.theme_dark, - ) -} else { - mapOf( - ThemeMode.LIGHT to MR.strings.theme_light, - ThemeMode.DARK to MR.strings.theme_dark, - ) -} +private val options = mapOf( + ThemeMode.SYSTEM to MR.strings.theme_system, + ThemeMode.LIGHT to MR.strings.theme_light, + ThemeMode.DARK to MR.strings.theme_dark, +) @Composable internal fun AppThemeModePreferenceWidget( diff --git a/app/src/main/java/eu/kanade/presentation/util/Permissions.kt b/app/src/main/java/eu/kanade/presentation/util/Permissions.kt index b4f4f4bd3..d136fee7b 100644 --- a/app/src/main/java/eu/kanade/presentation/util/Permissions.kt +++ b/app/src/main/java/eu/kanade/presentation/util/Permissions.kt @@ -23,12 +23,7 @@ fun rememberRequestPackageInstallsPermissionState(initialValue: Boolean = false) DisposableEffect(lifecycleOwner.lifecycle) { val observer = object : DefaultLifecycleObserver { override fun onResume(owner: LifecycleOwner) { - installGranted = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context.packageManager.canRequestPackageInstalls() - } else { - @Suppress("DEPRECATION") - Settings.Secure.getInt(context.contentResolver, Settings.Secure.INSTALL_NON_MARKET_APPS) != 0 - } + installGranted = context.packageManager.canRequestPackageInstalls() } } lifecycleOwner.lifecycle.addObserver(observer) diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index a16be7e68..2b53cee0c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -169,22 +169,19 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory { } override fun getPackageName(): String { - // This causes freezes in Android 6/7 for some reason - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - try { - // Override the value passed as X-Requested-With in WebView requests - val stackTrace = Looper.getMainLooper().thread.stackTrace - val chromiumElement = stackTrace.find { - it.className.equals( - "org.chromium.base.BuildInfo", - ignoreCase = true, - ) - } - if (chromiumElement?.methodName.equals("getAll", ignoreCase = true)) { - return WebViewUtil.SPOOF_PACKAGE_NAME - } - } catch (_: Exception) { + try { + // Override the value passed as X-Requested-With in WebView requests + val stackTrace = Looper.getMainLooper().thread.stackTrace + val chromiumElement = stackTrace.find { + it.className.equals( + "org.chromium.base.BuildInfo", + ignoreCase = true, + ) } + if (chromiumElement?.methodName.equals("getAll", ignoreCase = true)) { + return WebViewUtil.SPOOF_PACKAGE_NAME + } + } catch (_: Exception) { } return super.getPackageName() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/coil/TachiyomiImageDecoder.kt b/app/src/main/java/eu/kanade/tachiyomi/data/coil/TachiyomiImageDecoder.kt index e0a5ffe8e..fb1278614 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/coil/TachiyomiImageDecoder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/coil/TachiyomiImageDecoder.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.data.coil -import android.os.Build import androidx.core.graphics.drawable.toDrawable import coil.ImageLoader import coil.decode.DecodeResult @@ -48,8 +47,7 @@ class TachiyomiImageDecoder(private val resources: ImageSource, private val opti ImageUtil.findImageType(it) } return when (type) { - ImageUtil.ImageType.AVIF, ImageUtil.ImageType.JXL -> true - ImageUtil.ImageType.HEIF -> Build.VERSION.SDK_INT < Build.VERSION_CODES.O + ImageUtil.ImageType.AVIF, ImageUtil.ImageType.JXL, ImageUtil.ImageType.HEIF -> true else -> false } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt index 9e5d60d7b..7d6e9099e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt @@ -5,7 +5,6 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.net.Uri -import android.os.Build import androidx.core.net.toUri import eu.kanade.tachiyomi.data.backup.restore.BackupRestoreJob import eu.kanade.tachiyomi.data.download.DownloadManager @@ -354,20 +353,18 @@ class NotificationReceiver : BroadcastReceiver() { When programmatically dismissing this notification, the group notification is not automatically dismissed. */ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - val groupKey = context.notificationManager.activeNotifications.find { - it.id == notificationId - }?.groupKey + val groupKey = context.notificationManager.activeNotifications.find { + it.id == notificationId + }?.groupKey - if (groupId != null && groupId != 0 && !groupKey.isNullOrEmpty()) { - val notifications = context.notificationManager.activeNotifications.filter { - it.groupKey == groupKey - } + if (groupId != null && groupId != 0 && !groupKey.isNullOrEmpty()) { + val notifications = context.notificationManager.activeNotifications.filter { + it.groupKey == groupKey + } - if (notifications.size == 2) { - context.cancelNotification(groupId) - return - } + if (notifications.size == 2) { + context.cancelNotification(groupId) + return } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/installer/ShizukuInstaller.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/installer/ShizukuInstaller.kt index 68eacd9d6..33ff287c7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/installer/ShizukuInstaller.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/installer/ShizukuInstaller.kt @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.extension.installer import android.app.Service import android.content.pm.PackageManager -import android.os.Build import eu.kanade.tachiyomi.extension.model.InstallStep import eu.kanade.tachiyomi.util.system.getUriSize import eu.kanade.tachiyomi.util.system.toast @@ -50,11 +49,7 @@ class ShizukuInstaller(private val service: Service) : Installer(service) { try { val size = service.getUriSize(entry.uri) ?: throw IllegalStateException() service.contentResolver.openInputStream(entry.uri)!!.use { - val createCommand = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - "pm install-create --user current -r -i ${service.packageName} -S $size" - } else { - "pm install-create -r -i ${service.packageName} -S $size" - } + val createCommand = "pm install-create --user current -r -i ${service.packageName} -S $size" val createResult = exec(createCommand) sessionId = SESSION_ID_REGEX.find(createResult.out)?.value ?: throw RuntimeException("Failed to create install session") diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt index e04fe78e6..55b6a7ac7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt @@ -14,11 +14,7 @@ import java.util.zip.ZipFile */ internal class ZipPageLoader(file: File) : PageLoader() { - private val zip = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - ZipFile(file, StandardCharsets.ISO_8859_1) - } else { - ZipFile(file) - } + private val zip = ZipFile(file, StandardCharsets.ISO_8859_1) override var isLocal: Boolean = true diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/storage/FileExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/storage/FileExtensions.kt index 3c0fab2ab..c0575c0d5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/storage/FileExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/storage/FileExtensions.kt @@ -2,9 +2,7 @@ package eu.kanade.tachiyomi.util.storage import android.content.Context import android.net.Uri -import android.os.Build import androidx.core.content.FileProvider -import androidx.core.net.toUri import eu.kanade.tachiyomi.BuildConfig import java.io.File @@ -17,11 +15,7 @@ val Context.cacheImageDir: File * @param context context of application */ fun File.getUriCompat(context: Context): Uri { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", this) - } else { - this.toUri() - } + return FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", this) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt index 96560e59a..92b5f3843 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt @@ -170,12 +170,8 @@ fun Context.isInstalledFromFDroid(): Boolean { } fun Context.launchRequestPackageInstallsPermission() { - val intent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).apply { - data = Uri.parse("package:$packageName") - } - } else { - Intent(Settings.ACTION_SECURITY_SETTINGS) + Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).apply { + data = Uri.parse("package:$packageName") + startActivity(this) } - startActivity(intent) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/NetworkExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/NetworkExtensions.kt index 8d72a9c86..18e16baac 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/NetworkExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/NetworkExtensions.kt @@ -18,8 +18,7 @@ fun Context.isOnline(): Boolean { val networkCapabilities = connectivityManager.getNetworkCapabilities(activeNetwork) ?: return false val maxTransport = when { Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 -> NetworkCapabilities.TRANSPORT_LOWPAN - Build.VERSION.SDK_INT >= Build.VERSION_CODES.O -> NetworkCapabilities.TRANSPORT_WIFI_AWARE - else -> NetworkCapabilities.TRANSPORT_VPN + else -> NetworkCapabilities.TRANSPORT_WIFI_AWARE } return (NetworkCapabilities.TRANSPORT_CELLULAR..maxTransport).any(networkCapabilities::hasTransport) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/NetworkStateTracker.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/NetworkStateTracker.kt index a4a686541..ac206262d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/NetworkStateTracker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/NetworkStateTracker.kt @@ -17,11 +17,7 @@ data class NetworkState( val isValidated: Boolean, val isWifi: Boolean, ) { - val isOnline = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - isConnected && isValidated - } else { - isConnected - } + val isOnline = isConnected && isValidated } @Suppress("DEPRECATION") @@ -34,34 +30,18 @@ fun Context.activeNetworkState(): NetworkState { ) } -@Suppress("DEPRECATION") fun Context.networkStateFlow() = callbackFlow { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - val networkCallback = object : NetworkCallback() { - override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities) { - trySend(activeNetworkState()) - } - override fun onLost(network: Network) { - trySend(activeNetworkState()) - } + val networkCallback = object : NetworkCallback() { + override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities) { + trySend(activeNetworkState()) } - - connectivityManager.registerDefaultNetworkCallback(networkCallback) - awaitClose { - connectivityManager.unregisterNetworkCallback(networkCallback) - } - } else { - val receiver = object : BroadcastReceiver() { - override fun onReceive(context: Context, intent: Intent) { - if (intent.action == ConnectivityManager.CONNECTIVITY_ACTION) { - trySend(activeNetworkState()) - } - } - } - - registerReceiver(receiver, IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)) - awaitClose { - unregisterReceiver(receiver) + override fun onLost(network: Network) { + trySend(activeNetworkState()) } } + + connectivityManager.registerDefaultNetworkCallback(networkCallback) + awaitClose { + connectivityManager.unregisterNetworkCallback(networkCallback) + } } diff --git a/app/src/main/res/drawable-v26/sc_collections_bookmark_48dp.xml b/app/src/main/res/drawable-v26/sc_collections_bookmark_48dp.xml deleted file mode 100644 index fd2784fbb..000000000 --- a/app/src/main/res/drawable-v26/sc_collections_bookmark_48dp.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - diff --git a/app/src/main/res/drawable-v26/sc_explore_48dp.xml b/app/src/main/res/drawable-v26/sc_explore_48dp.xml deleted file mode 100644 index 9737e6031..000000000 --- a/app/src/main/res/drawable-v26/sc_explore_48dp.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/drawable-v26/sc_history_48dp.xml b/app/src/main/res/drawable-v26/sc_history_48dp.xml deleted file mode 100644 index f8b0ff94a..000000000 --- a/app/src/main/res/drawable-v26/sc_history_48dp.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/drawable-v26/sc_new_releases_48dp.xml b/app/src/main/res/drawable-v26/sc_new_releases_48dp.xml deleted file mode 100644 index 256f5ff8f..000000000 --- a/app/src/main/res/drawable-v26/sc_new_releases_48dp.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/drawable/sc_collections_bookmark_48dp.xml b/app/src/main/res/drawable/sc_collections_bookmark_48dp.xml index d45e333f7..fd2784fbb 100644 --- a/app/src/main/res/drawable/sc_collections_bookmark_48dp.xml +++ b/app/src/main/res/drawable/sc_collections_bookmark_48dp.xml @@ -1,24 +1,24 @@ - - - - - - - - - + tools:keep="@drawable/sc_collections_bookmark_48dp"> + + + + + + + + + + diff --git a/app/src/main/res/drawable/sc_explore_48dp.xml b/app/src/main/res/drawable/sc_explore_48dp.xml index bc97eb259..9737e6031 100644 --- a/app/src/main/res/drawable/sc_explore_48dp.xml +++ b/app/src/main/res/drawable/sc_explore_48dp.xml @@ -1,21 +1,21 @@ - - - - - - - - + tools:keep="@drawable/sc_explore_48dp"> + + + + + + + + + diff --git a/app/src/main/res/drawable/sc_history_48dp.xml b/app/src/main/res/drawable/sc_history_48dp.xml index 3ee54e497..f8b0ff94a 100644 --- a/app/src/main/res/drawable/sc_history_48dp.xml +++ b/app/src/main/res/drawable/sc_history_48dp.xml @@ -1,21 +1,21 @@ - - - - - - - - + tools:keep="@drawable/sc_history_48dp"> + + + + + + + + + diff --git a/app/src/main/res/drawable/sc_new_releases_48dp.xml b/app/src/main/res/drawable/sc_new_releases_48dp.xml index 20d04862c..256f5ff8f 100644 --- a/app/src/main/res/drawable/sc_new_releases_48dp.xml +++ b/app/src/main/res/drawable/sc_new_releases_48dp.xml @@ -1,21 +1,21 @@ - - - - - - - - + tools:keep="@drawable/sc_new_releases_48dp"> + + + + + + + + + diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 8a33a1626..000000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index ec3538f9b..000000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index f84e248d0..000000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 35ee51185..000000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 959085a1d..000000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index e48e3f437..000000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index db5aeba41..000000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index d6f9884f6..000000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 89f53f50a..000000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index ead7c3241..000000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap/ic_launcher.xml similarity index 100% rename from app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to app/src/main/res/mipmap/ic_launcher.xml diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap/ic_launcher_round.xml similarity index 100% rename from app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to app/src/main/res/mipmap/ic_launcher_round.xml diff --git a/buildSrc/src/main/kotlin/AndroidConfig.kt b/buildSrc/src/main/kotlin/AndroidConfig.kt index 8a43b8c61..ba608c7e5 100644 --- a/buildSrc/src/main/kotlin/AndroidConfig.kt +++ b/buildSrc/src/main/kotlin/AndroidConfig.kt @@ -1,6 +1,6 @@ object AndroidConfig { const val compileSdk = 34 - const val minSdk = 23 + const val minSdk = 26 const val targetSdk = 34 const val ndk = "26.1.10909125" } diff --git a/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewClientCompat.kt b/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewClientCompat.kt index 93ce0337d..6547a46e0 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewClientCompat.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewClientCompat.kt @@ -1,7 +1,5 @@ package eu.kanade.tachiyomi.util.system -import android.annotation.TargetApi -import android.os.Build import android.webkit.WebResourceError import android.webkit.WebResourceRequest import android.webkit.WebResourceResponse @@ -28,7 +26,6 @@ abstract class WebViewClientCompat : WebViewClient() { ) { } - @TargetApi(Build.VERSION_CODES.N) final override fun shouldOverrideUrlLoading( view: WebView, request: WebResourceRequest, diff --git a/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt b/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt index 3769189b9..42b756f74 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.util.system import android.annotation.SuppressLint import android.content.Context import android.content.pm.PackageManager -import android.os.Build import android.webkit.CookieManager import android.webkit.WebSettings import android.webkit.WebView @@ -35,15 +34,11 @@ object WebViewUtil { } fun getVersion(context: Context): String { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - val webView = WebView.getCurrentWebViewPackage() ?: return "how did you get here?" - val pm = context.packageManager - val label = webView.applicationInfo.loadLabel(pm) - val version = webView.versionName - "$label $version" - } else { - "Unknown" - } + val webView = WebView.getCurrentWebViewPackage() ?: return "how did you get here?" + val pm = context.packageManager + val label = webView.applicationInfo.loadLabel(pm) + val version = webView.versionName + return "$label $version" } fun supportsWebView(context: Context): Boolean {