调整发送页面
This commit is contained in:
@@ -7,11 +7,13 @@ import androidx.activity.result.contract.ActivityResultContracts
|
|||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
@@ -28,6 +30,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
|||||||
import androidx.compose.foundation.text.BasicTextField
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
import androidx.compose.material.LinearProgressIndicator
|
import androidx.compose.material.LinearProgressIndicator
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.ModalBottomSheet
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -40,6 +43,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.draw.drawBehind
|
import androidx.compose.ui.draw.drawBehind
|
||||||
|
import androidx.compose.ui.geometry.CornerRadius
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.ColorFilter
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
import androidx.compose.ui.graphics.PathEffect
|
import androidx.compose.ui.graphics.PathEffect
|
||||||
@@ -142,7 +146,7 @@ fun NewPostTopBar(onSendClick: () -> Unit = {}) {
|
|||||||
modifier = Modifier.align(Alignment.CenterStart),
|
modifier = Modifier.align(Alignment.CenterStart),
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(id = R.drawable.rider_pro_close),
|
painter = painterResource(id = R.drawable.rider_pro_back_icon),
|
||||||
contentDescription = "Back",
|
contentDescription = "Back",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
@@ -151,11 +155,12 @@ fun NewPostTopBar(onSendClick: () -> Unit = {}) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
Image(
|
Icon(
|
||||||
painter = painterResource(id = R.drawable.rider_pro_send_post),
|
painter = painterResource(id = R.drawable.rider_pro_video_share),
|
||||||
|
tint = Color.Black,
|
||||||
contentDescription = "Send",
|
contentDescription = "Send",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(32.dp)
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
// 检查输入
|
// 检查输入
|
||||||
val errorMessage = model.validateMoment()
|
val errorMessage = model.validateMoment()
|
||||||
@@ -299,51 +304,41 @@ fun AddImageGrid() {
|
|||||||
}
|
}
|
||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
columns = GridCells.Fixed(3),
|
columns = GridCells.Fixed(3),
|
||||||
|
contentPadding = PaddingValues(16.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(18.dp),
|
.padding(18.dp),
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
// items(model.imageUriList.size) { index ->
|
|
||||||
// val uri = model.imageUriList[index]
|
|
||||||
// Box(
|
|
||||||
// modifier = Modifier
|
|
||||||
// .drawBehind {
|
|
||||||
// drawRoundRect(color = Color(0xFF999999), style = stroke)
|
|
||||||
// }
|
|
||||||
// ) {
|
|
||||||
// CustomAsyncImage(
|
|
||||||
// context,
|
|
||||||
// uri,
|
|
||||||
// contentDescription = "Image",
|
|
||||||
// modifier = Modifier
|
|
||||||
// .fillMaxWidth().aspectRatio(1f)
|
|
||||||
// .noRippleClickable {
|
|
||||||
// navController.navigate(NavigationRoute.NewPostImageGrid.route)
|
|
||||||
// },
|
|
||||||
// contentScale = ContentScale.Crop
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
item {
|
item {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.aspectRatio(1f)
|
.aspectRatio(1f)
|
||||||
.drawBehind {
|
.drawBehind {
|
||||||
drawRoundRect(color = Color(0xFF999999), style = stroke)
|
val strokeWidth = 1.dp.toPx()
|
||||||
|
val dashLength = 10f
|
||||||
|
val dashGap = 10f
|
||||||
|
val pathEffect = PathEffect.dashPathEffect(floatArrayOf(dashLength, dashGap))
|
||||||
|
drawRoundRect(
|
||||||
|
color = Color(0xFFD6D6D6),
|
||||||
|
style = Stroke(strokeWidth, pathEffect = pathEffect),
|
||||||
|
cornerRadius = CornerRadius(8.dp.toPx())
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
pickImagesLauncher.launch("image/*")
|
pickImagesLauncher.launch("image/*")
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Image(
|
Icon(
|
||||||
painter = painterResource(id = R.drawable.rider_pro_new_post_add_pic),
|
painter = painterResource(id = R.drawable.rider_pro_new_post_add_pic),
|
||||||
contentDescription = "Add Image",
|
contentDescription = "Add Image",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(48.dp)
|
.size(48.dp)
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center),
|
||||||
|
tint = Color(0xFFD6D6D6)
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,7 +348,15 @@ fun AddImageGrid() {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.aspectRatio(1f)
|
.aspectRatio(1f)
|
||||||
.drawBehind {
|
.drawBehind {
|
||||||
drawRoundRect(color = Color(0xFF999999), style = stroke)
|
val strokeWidth = 1.dp.toPx()
|
||||||
|
val dashLength = 10f
|
||||||
|
val dashGap = 10f
|
||||||
|
val pathEffect = PathEffect.dashPathEffect(floatArrayOf(dashLength, dashGap))
|
||||||
|
drawRoundRect(
|
||||||
|
color = Color(0xFFD6D6D6),
|
||||||
|
style = Stroke(strokeWidth, pathEffect = pathEffect),
|
||||||
|
cornerRadius = CornerRadius(8.dp.toPx())
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
val photoFile = File(context.cacheDir, "photo.jpg")
|
val photoFile = File(context.cacheDir, "photo.jpg")
|
||||||
@@ -366,13 +369,13 @@ fun AddImageGrid() {
|
|||||||
takePictureLauncher.launch(photoUri)
|
takePictureLauncher.launch(photoUri)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Image(
|
Icon(
|
||||||
painter = painterResource(id = R.drawable.rider_pro_camera),
|
painter = painterResource(id = R.drawable.rider_pro_camera),
|
||||||
contentDescription = "Take Photo",
|
contentDescription = "Take Photo",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(48.dp)
|
.size(48.dp)
|
||||||
.align(Alignment.Center),
|
.align(Alignment.Center),
|
||||||
colorFilter = ColorFilter.tint(Color.Gray)
|
tint = Color(0xFFD6D6D6)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
app/src/main/res/drawable/rider_pro_back_icon.xml
Normal file
14
app/src/main/res/drawable/rider_pro_back_icon.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M16,4l-8,8l8,8"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="1.77777778"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
Reference in New Issue
Block a user