Autoformat by ktLint

This commit is contained in:
Oleg Koretsky
2023-03-08 20:53:06 +02:00
parent f2b1fa9101
commit c6a991967c
2 changed files with 37 additions and 27 deletions

View File

@@ -36,12 +36,11 @@ import coil.compose.AsyncImage
import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.model.Account
import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.model.Note
import com.vitorpamplona.amethyst.service.model.TextNoteEvent
import com.vitorpamplona.amethyst.ui.components.* import com.vitorpamplona.amethyst.ui.components.*
import com.vitorpamplona.amethyst.ui.note.ReplyInformation import com.vitorpamplona.amethyst.ui.note.ReplyInformation
import com.vitorpamplona.amethyst.ui.screen.loggedIn.UserLine import com.vitorpamplona.amethyst.ui.screen.loggedIn.UserLine
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import com.vitorpamplona.amethyst.service.model.TextNoteEvent
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class)
@Composable @Composable
@@ -74,16 +73,22 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
decorFitsSystemWindows = false decorFitsSystemWindows = false
) )
) { ) {
Surface(modifier = Modifier Surface(
modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.fillMaxHeight()) { .fillMaxHeight()
Column(modifier = Modifier ) {
Column(
modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.fillMaxHeight()) { .fillMaxHeight()
Column(modifier = Modifier ) {
Column(
modifier = Modifier
.padding(start = 10.dp, end = 10.dp, top = 10.dp) .padding(start = 10.dp, end = 10.dp, top = 10.dp)
.imePadding() .imePadding()
.weight(1f)) { .weight(1f)
) {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween, horizontalArrangement = Arrangement.SpaceBetween,
@@ -99,8 +104,8 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
postViewModel.sendPost() postViewModel.sendPost()
onClose() onClose()
}, },
isActive = postViewModel.message.text.isNotBlank() isActive = postViewModel.message.text.isNotBlank() &&
&& !postViewModel.isUploadingImage !postViewModel.isUploadingImage
) )
} }
@@ -109,9 +114,11 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
.fillMaxWidth() .fillMaxWidth()
.weight(1f) .weight(1f)
) { ) {
Column(modifier = Modifier Column(
modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.verticalScroll(scroolState)) { .verticalScroll(scroolState)
) {
if (postViewModel.replyTos != null && baseReplyTo?.event is TextNoteEvent) { if (postViewModel.replyTos != null && baseReplyTo?.event is TextNoteEvent) {
ReplyInformation(postViewModel.replyTos, postViewModel.mentions, account, "") { ReplyInformation(postViewModel.replyTos, postViewModel.mentions, account, "") {
postViewModel.removeFromReplyList(it) postViewModel.removeFromReplyList(it)
@@ -188,7 +195,6 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
} }
} }
} }
} }
val userSuggestions = postViewModel.userSuggestions val userSuggestions = postViewModel.userSuggestions
@@ -201,7 +207,8 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
) { ) {
itemsIndexed( itemsIndexed(
userSuggestions, userSuggestions,
key = { _, item -> item.pubkeyHex }) { index, item -> key = { _, item -> item.pubkeyHex }
) { index, item ->
UserLine(item, account) { UserLine(item, account) {
postViewModel.autocompleteWithUser(item) postViewModel.autocompleteWithUser(item)
} }
@@ -211,7 +218,7 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
Row(modifier = Modifier.fillMaxWidth()) { Row(modifier = Modifier.fillMaxWidth()) {
UploadFromGallery( UploadFromGallery(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingImage
) { ) {
postViewModel.upload(it, context) postViewModel.upload(it, context)
} }

View File

@@ -63,9 +63,8 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
modifier = Modifier modifier = Modifier
.padding(20.dp) .padding(20.dp)
.fillMaxSize(), .fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally
) { ) {
Image( Image(
painterResource(id = R.drawable.amethyst), painterResource(id = R.drawable.amethyst),
contentDescription = stringResource(R.string.app_logo), contentDescription = stringResource(R.string.app_logo),
@@ -117,9 +116,13 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
IconButton(onClick = { showPassword = !showPassword }) { IconButton(onClick = { showPassword = !showPassword }) {
Icon( Icon(
imageVector = if (showPassword) Icons.Outlined.VisibilityOff else Icons.Outlined.Visibility, imageVector = if (showPassword) Icons.Outlined.VisibilityOff else Icons.Outlined.Visibility,
contentDescription = if (showPassword) stringResource(R.string.show_password) else stringResource( contentDescription = if (showPassword) {
stringResource(R.string.show_password)
} else {
stringResource(
R.string.hide_password R.string.hide_password
) )
}
) )
} }
}, },
@@ -163,7 +166,7 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
} }
ClickableText( ClickableText(
text = annotatedTermsString, text = annotatedTermsString
) { spanOffset -> ) { spanOffset ->
annotatedTermsString.getStringAnnotations(spanOffset, spanOffset) annotatedTermsString.getStringAnnotations(spanOffset, spanOffset)
.firstOrNull() .firstOrNull()