2022-07-17 22:17:40 -04:00
|
|
|
package eu.kanade.presentation.components
|
|
|
|
|
2022-10-30 15:50:09 -04:00
|
|
|
import androidx.annotation.StringRes
|
2022-07-17 22:17:40 -04:00
|
|
|
import androidx.compose.foundation.background
|
2022-10-08 10:24:50 -04:00
|
|
|
import androidx.compose.foundation.layout.Column
|
2022-07-17 22:17:40 -04:00
|
|
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
import androidx.compose.material3.Text
|
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
|
import androidx.compose.ui.text.style.TextAlign
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
import eu.kanade.tachiyomi.R
|
|
|
|
|
2022-10-30 15:50:09 -04:00
|
|
|
@Composable
|
|
|
|
fun WarningBanner(
|
|
|
|
@StringRes textRes: Int,
|
|
|
|
modifier: Modifier = Modifier,
|
|
|
|
) {
|
|
|
|
Text(
|
|
|
|
text = stringResource(textRes),
|
|
|
|
modifier = modifier
|
|
|
|
.fillMaxWidth()
|
|
|
|
.background(MaterialTheme.colorScheme.error)
|
|
|
|
.padding(16.dp),
|
|
|
|
color = MaterialTheme.colorScheme.onError,
|
|
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
|
|
textAlign = TextAlign.Center,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-07-17 22:17:40 -04:00
|
|
|
@Composable
|
2022-10-08 10:24:50 -04:00
|
|
|
fun AppStateBanners(
|
2022-09-18 16:08:50 -04:00
|
|
|
downloadedOnlyMode: Boolean,
|
|
|
|
incognitoMode: Boolean,
|
2022-10-08 10:24:50 -04:00
|
|
|
modifier: Modifier = Modifier,
|
2022-09-18 16:08:50 -04:00
|
|
|
) {
|
2022-10-08 10:24:50 -04:00
|
|
|
Column(modifier = modifier) {
|
|
|
|
if (downloadedOnlyMode) {
|
|
|
|
DownloadedOnlyModeBanner()
|
|
|
|
}
|
|
|
|
if (incognitoMode) {
|
|
|
|
IncognitoModeBanner()
|
|
|
|
}
|
2022-09-18 16:08:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
private fun DownloadedOnlyModeBanner() {
|
2022-07-17 22:17:40 -04:00
|
|
|
Text(
|
|
|
|
text = stringResource(R.string.label_downloaded_only),
|
|
|
|
modifier = Modifier
|
|
|
|
.background(color = MaterialTheme.colorScheme.tertiary)
|
|
|
|
.fillMaxWidth()
|
|
|
|
.padding(4.dp),
|
|
|
|
color = MaterialTheme.colorScheme.onTertiary,
|
|
|
|
textAlign = TextAlign.Center,
|
|
|
|
style = MaterialTheme.typography.labelMedium,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Composable
|
2022-09-18 16:08:50 -04:00
|
|
|
private fun IncognitoModeBanner() {
|
2022-07-17 22:17:40 -04:00
|
|
|
Text(
|
|
|
|
text = stringResource(R.string.pref_incognito_mode),
|
|
|
|
modifier = Modifier
|
|
|
|
.background(color = MaterialTheme.colorScheme.primary)
|
|
|
|
.fillMaxWidth()
|
|
|
|
.padding(4.dp),
|
|
|
|
color = MaterialTheme.colorScheme.onPrimary,
|
|
|
|
textAlign = TextAlign.Center,
|
|
|
|
style = MaterialTheme.typography.labelMedium,
|
|
|
|
)
|
|
|
|
}
|