mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
Minor fixes in UI of ErrorActivity.
* Fixed ktlint issue.
This commit is contained in:
parent
fb4dec2b51
commit
ea089e09f2
@ -13,6 +13,7 @@ ktlint_standard_blank-line-before-declaration = disabled
|
||||
ktlint_standard_string-template-indent = disabled
|
||||
ktlint_standard_multiline-expression-wrapping = disabled
|
||||
ktlint_standard_package-name = disabled
|
||||
ktlint_function_naming_ignore_when_annotated_with = Composable
|
||||
|
||||
[{*.sht,*.html,*.shtm,*.shtml,*.htm}]
|
||||
indent_style=space
|
||||
|
@ -20,17 +20,14 @@ package org.kiwix.kiwixmobile.core.error
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.content.pm.ResolveInfo
|
||||
import android.content.res.Configuration
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Process
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import kotlinx.coroutines.launch
|
||||
@ -92,31 +89,18 @@ open class ErrorActivity : BaseActivity() {
|
||||
null
|
||||
}
|
||||
setContent {
|
||||
PreviewScreen()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(
|
||||
uiMode = Configuration.UI_MODE_NIGHT_YES,
|
||||
name = "DefaultPreviewDark"
|
||||
)
|
||||
@Preview(
|
||||
uiMode = Configuration.UI_MODE_NIGHT_NO,
|
||||
name = "DefaultPreviewLight"
|
||||
)
|
||||
@Composable
|
||||
fun PreviewScreen() {
|
||||
checkBoxItems = remember {
|
||||
getCrashCheckBoxItems().map { it.first to mutableStateOf(it.second) }
|
||||
}
|
||||
KiwixTheme {
|
||||
ErrorActivityScreen(
|
||||
crashTitle,
|
||||
crashDescription,
|
||||
checkBoxItems,
|
||||
{ restartApp() },
|
||||
{ sendDetailsOnMail() }
|
||||
)
|
||||
checkBoxItems = remember {
|
||||
getCrashCheckBoxItems().map { it.first to mutableStateOf(it.second) }
|
||||
}
|
||||
KiwixTheme {
|
||||
ErrorActivityScreen(
|
||||
crashTitle,
|
||||
crashDescription,
|
||||
checkBoxItems,
|
||||
{ restartApp() },
|
||||
{ sendDetailsOnMail() }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
@ -46,9 +47,8 @@ import org.kiwix.kiwixmobile.core.composeviews.ComposeButton
|
||||
import org.kiwix.kiwixmobile.core.composeviews.CrashCheckBox
|
||||
import org.kiwix.kiwixmobile.core.extensions.loadBitmapFromMipmap
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.CRASH_IMAGE_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.CRASH_MESSAGE_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.CRASH_TITLE_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.EIGHT_DP
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.SEVENTEEN_DP
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.SIXTEEN_DP
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.SIXTY_DP
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.THIRTY_TWO_DP
|
||||
@ -71,7 +71,7 @@ fun ErrorActivityScreen(
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(crashTitleStringId),
|
||||
fontSize = CRASH_TITLE_TEXT_SIZE,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
color = colorResource(id = R.color.alabaster_white),
|
||||
modifier = Modifier.padding(top = SIXTY_DP, start = EIGHT_DP, end = EIGHT_DP)
|
||||
)
|
||||
@ -86,13 +86,13 @@ fun ErrorActivityScreen(
|
||||
|
||||
Text(
|
||||
text = stringResource(messageStringId),
|
||||
fontSize = CRASH_MESSAGE_TEXT_SIZE,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
textAlign = TextAlign.Center,
|
||||
color = colorResource(id = R.color.white),
|
||||
modifier = Modifier.padding(start = EIGHT_DP, top = EIGHT_DP, end = EIGHT_DP)
|
||||
)
|
||||
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Column(modifier = Modifier.weight(1f).padding(top = SEVENTEEN_DP, bottom = EIGHT_DP)) {
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
|
@ -20,7 +20,6 @@ package org.kiwix.kiwixmobile.core.ui.theme
|
||||
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Shapes
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.EXTRA_LARGE_ROUND_SHAPE_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.EXTRA_SMALL_ROUND_SHAPE_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.LARGE_ROUND_SHAPE_SIZE
|
||||
|
@ -20,6 +20,7 @@ package org.kiwix.kiwixmobile.core.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.LARGE_BODY_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.LARGE_HEADLINE_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.LARGE_LABEL_TEXT_SIZE
|
||||
@ -49,7 +50,10 @@ val KiwixTypography = Typography(
|
||||
bodyLarge = TextStyle(fontSize = LARGE_BODY_TEXT_SIZE),
|
||||
bodyMedium = TextStyle(fontSize = MEDIUM_BODY_TEXT_SIZE),
|
||||
bodySmall = TextStyle(fontSize = SMALL_BODY_TEXT_SIZE),
|
||||
labelLarge = TextStyle(fontSize = LARGE_LABEL_TEXT_SIZE),
|
||||
labelLarge = TextStyle(
|
||||
fontSize = LARGE_LABEL_TEXT_SIZE,
|
||||
fontWeight = FontWeight.Bold,
|
||||
),
|
||||
labelMedium = TextStyle(fontSize = MEDIUM_LABEL_TEXT_SIZE),
|
||||
labelSmall = TextStyle(fontSize = SMALL_LABEL_TEXT_SIZE),
|
||||
)
|
||||
|
@ -24,7 +24,7 @@ import androidx.compose.ui.unit.sp
|
||||
|
||||
object ComposeDimens {
|
||||
// Crash checkbox dimens
|
||||
val CRASH_CHECKBOX_START_PADDING = 100.dp
|
||||
val CRASH_CHECKBOX_START_PADDING = 80.dp
|
||||
val CRASH_CHECKBOX_TOP_PADDING = 8.dp
|
||||
|
||||
// Our default Button dimens
|
||||
@ -40,6 +40,7 @@ object ComposeDimens {
|
||||
// Padding & Margins
|
||||
val SIXTY_DP = 60.dp
|
||||
val THIRTY_TWO_DP = 30.dp
|
||||
val SEVENTEEN_DP = 17.dp
|
||||
val SIXTEEN_DP = 16.dp
|
||||
val TWELVE_DP = 12.dp
|
||||
val EIGHT_DP = 8.dp
|
||||
|
Loading…
x
Reference in New Issue
Block a user