Improves error zap message screens for Material3

This commit is contained in:
Vitor Pamplona
2023-09-30 11:37:23 -04:00
parent 52e1842174
commit 7387d9060f
2 changed files with 10 additions and 6 deletions
@@ -56,7 +56,7 @@ class LightningAddressResolver() {
} }
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
onError("Could not resolve $url. Check if the server is up and if the lightning address $lnaddress is correct") onError("Could not resolve $url. Check if you are connected, if the server is up and if the lightning address $lnaddress is correct")
} }
} }
@@ -5,6 +5,7 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Done import androidx.compose.material.icons.outlined.Done
import androidx.compose.material3.AlertDialog import androidx.compose.material3.AlertDialog
@@ -53,6 +54,7 @@ import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer
import com.vitorpamplona.amethyst.ui.theme.Size10dp import com.vitorpamplona.amethyst.ui.theme.Size10dp
import com.vitorpamplona.amethyst.ui.theme.Size16dp
import com.vitorpamplona.amethyst.ui.theme.Size55dp import com.vitorpamplona.amethyst.ui.theme.Size55dp
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.placeholderText
@@ -261,12 +263,14 @@ fun ErrorMessageDialog(
Text(title) Text(title)
}, },
text = { text = {
Text(textContent) SelectionContainer {
Text(textContent)
}
}, },
confirmButton = { confirmButton = {
Row( Row(
modifier = Modifier modifier = Modifier
.padding(all = 8.dp) .padding(vertical = 8.dp)
.fillMaxWidth(), .fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween horizontalArrangement = Arrangement.SpaceBetween
) { ) {
@@ -275,10 +279,10 @@ fun ErrorMessageDialog(
painter = painterResource(R.drawable.ic_dm), painter = painterResource(R.drawable.ic_dm),
contentDescription = null contentDescription = null
) )
Spacer(Modifier.width(8.dp)) Spacer(StdHorzSpacer)
Text(stringResource(R.string.error_dialog_talk_to_user)) Text(stringResource(R.string.error_dialog_talk_to_user))
} }
Button(onClick = onDismiss, colors = buttonColors) { Button(onClick = onDismiss, colors = buttonColors, contentPadding = PaddingValues(horizontal = Size16dp)) {
Row( Row(
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
@@ -286,7 +290,7 @@ fun ErrorMessageDialog(
imageVector = Icons.Outlined.Done, imageVector = Icons.Outlined.Done,
contentDescription = null contentDescription = null
) )
Spacer(Modifier.width(8.dp)) Spacer(StdHorzSpacer)
Text(stringResource(R.string.error_dialog_button_ok)) Text(stringResource(R.string.error_dialog_button_ok))
} }
} }