diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt index a7aba1aa6..a6df8ab6e 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt @@ -2,6 +2,7 @@ package eu.kanade.presentation.browse import androidx.annotation.StringRes import androidx.compose.animation.core.animateDpAsState +import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -31,6 +32,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp @@ -41,6 +43,7 @@ import eu.kanade.presentation.components.EmptyScreen import eu.kanade.presentation.components.FastScrollLazyColumn import eu.kanade.presentation.components.LoadingScreen import eu.kanade.presentation.components.PullRefresh +import eu.kanade.presentation.components.WarningBanner import eu.kanade.presentation.manga.components.DotSeparatorNoSpaceText import eu.kanade.presentation.theme.header import eu.kanade.presentation.util.padding @@ -52,6 +55,7 @@ import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.InstallStep import eu.kanade.tachiyomi.ui.browse.extension.ExtensionUiModel import eu.kanade.tachiyomi.ui.browse.extension.ExtensionsState +import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.LocaleHelper @Composable @@ -119,10 +123,29 @@ private fun ExtensionContent( onClickUpdateAll: () -> Unit, ) { var trustState by remember { mutableStateOf(null) } + val showMiuiWarning = DeviceUtil.isMiui && !DeviceUtil.isMiuiOptimizationDisabled() + val uriHandler = LocalUriHandler.current FastScrollLazyColumn( - contentPadding = contentPadding + topSmallPaddingValues, + contentPadding = if (showMiuiWarning) { + contentPadding + } else { + contentPadding + topSmallPaddingValues + }, ) { + if (showMiuiWarning) { + item { + WarningBanner( + textRes = R.string.ext_miui_warning, + modifier = Modifier + .padding(bottom = MaterialTheme.padding.small) + .clickable { + uriHandler.openUri("https://tachiyomi.org/extensions") + }, + ) + } + } + items( items = state.items, contentType = { diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index 94c10aa81..9fd40a7f7 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -306,6 +306,7 @@ Shizuku Shizuku is not running Install and start Shizuku to use Shizuku as extension installer. + Installing extensions may not work if MIUI Optimization is enabled. Try disabling it or installing from the website instead. Fullscreen