This might work best between smaller images and bigger images

This commit is contained in:
Vitor Pamplona
2023-02-13 17:12:19 -05:00
parent 3f671350ce
commit 620bd4d5a8
@@ -5,8 +5,10 @@ import androidx.compose.foundation.border
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.* import androidx.compose.material.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
@@ -54,6 +56,8 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, account: Account
val focusRequester = remember { FocusRequester() } val focusRequester = remember { FocusRequester() }
val keyboardController = LocalSoftwareKeyboardController.current val keyboardController = LocalSoftwareKeyboardController.current
val scroolState = rememberScrollState()
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
delay(100) delay(100)
focusRequester.requestFocus() focusRequester.requestFocus()
@@ -72,7 +76,7 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, account: Account
) )
) { ) {
Surface(modifier = Modifier.fillMaxWidth().fillMaxHeight()) { Surface(modifier = Modifier.fillMaxWidth().fillMaxHeight()) {
Column(modifier = Modifier.padding(10.dp).imePadding()) { Column(modifier = Modifier.padding(10.dp).imePadding().verticalScroll(scroolState)) {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween, horizontalArrangement = Arrangement.SpaceBetween,
@@ -114,7 +118,7 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, account: Account
capitalization = KeyboardCapitalization.Sentences capitalization = KeyboardCapitalization.Sentences
), ),
modifier = Modifier modifier = Modifier
.fillMaxWidth().weight(1f) .fillMaxWidth().imePadding().heightIn(300.dp, 500.dp)
.border( .border(
width = 1.dp, width = 1.dp,
color = MaterialTheme.colors.surface, color = MaterialTheme.colors.surface,
@@ -147,7 +151,8 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, account: Account
contentPadding = PaddingValues( contentPadding = PaddingValues(
top = 10.dp, top = 10.dp,
bottom = 10.dp bottom = 10.dp
) ),
modifier = Modifier.heightIn(0.dp, 300.dp)
) { ) {
itemsIndexed(userSuggestions, key = { _, item -> item.pubkeyHex }) { index, item -> itemsIndexed(userSuggestions, key = { _, item -> item.pubkeyHex }) { index, item ->
UserLine(item, account) { UserLine(item, account) {
@@ -159,7 +164,7 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, account: Account
val myUrlPreview = postViewModel.urlPreview val myUrlPreview = postViewModel.urlPreview
if (myUrlPreview != null) { if (myUrlPreview != null) {
Row(modifier = Modifier.padding(top = 5.dp).heightIn(0.dp, 200.dp)) { Row(modifier = Modifier.padding(top = 5.dp)) {
if (isValidURL(myUrlPreview)) { if (isValidURL(myUrlPreview)) {
val removedParamsFromUrl = myUrlPreview.split("?")[0].toLowerCase() val removedParamsFromUrl = myUrlPreview.split("?")[0].toLowerCase()
if (imageExtension.matcher(removedParamsFromUrl).matches()) { if (imageExtension.matcher(removedParamsFromUrl).matches()) {