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

View File

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