add:comment list
This commit is contained in:
137
app/src/main/java/com/aiosman/riderpro/CommentsScreen.kt
Normal file
137
app/src/main/java/com/aiosman/riderpro/CommentsScreen.kt
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
package com.aiosman.riderpro
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun CommentsScreen() {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(color = Color(0xFFFFFFFF))
|
||||||
|
.padding(16.dp)
|
||||||
|
) {
|
||||||
|
LikesScreenHeader()
|
||||||
|
Spacer(modifier = Modifier.height(28.dp))
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
item {
|
||||||
|
repeat(20) {
|
||||||
|
CommentsItem()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun LikesScreenHeader() {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.rider_pro_nav_back),
|
||||||
|
contentDescription = "Likes",
|
||||||
|
modifier = Modifier.size(16.dp)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.size(12.dp))
|
||||||
|
Text("Comments", fontWeight = FontWeight.Bold, fontSize = 17.sp)
|
||||||
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.rider_pro_more_horizon),
|
||||||
|
contentDescription = "More",
|
||||||
|
modifier = Modifier.size(24.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun CommentsItem() {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.padding(horizontal = 24.dp, vertical = 16.dp)
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.default_avatar),
|
||||||
|
contentDescription = "Avatar",
|
||||||
|
modifier = Modifier
|
||||||
|
.size(40.dp)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.size(12.dp))
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
Text("Username", fontWeight = FontWeight.Bold, fontSize = 16.sp)
|
||||||
|
Spacer(modifier = Modifier.size(4.dp))
|
||||||
|
Text("Content", color = Color(0x99000000), fontSize = 12.sp)
|
||||||
|
Spacer(modifier = Modifier.size(4.dp))
|
||||||
|
Text("Date", color = Color(0x99000000), fontSize = 12.sp)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.rider_pro_like),
|
||||||
|
contentDescription = "Like",
|
||||||
|
modifier = Modifier.size(16.dp),
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
"270",
|
||||||
|
color = Color(0x99000000),
|
||||||
|
fontSize = 12.sp,
|
||||||
|
modifier = Modifier.padding(start = 4.dp)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.width(45.dp))
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.rider_pro_comments),
|
||||||
|
contentDescription = "Comments",
|
||||||
|
modifier = Modifier.size(16.dp)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
"270",
|
||||||
|
color = Color(0x99000000),
|
||||||
|
fontSize = 12.sp,
|
||||||
|
modifier = Modifier.padding(start = 4.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Box {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.default_moment_img),
|
||||||
|
contentDescription = "More",
|
||||||
|
modifier = Modifier.size(64.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -108,6 +108,9 @@ fun NavigationController(navController: NavHostController) {
|
|||||||
composable(route="MyMessage") {
|
composable(route="MyMessage") {
|
||||||
NotificationsScreen()
|
NotificationsScreen()
|
||||||
}
|
}
|
||||||
|
composable(route="Comments") {
|
||||||
|
CommentsScreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.aiosman.riderpro
|
|||||||
|
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
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
|
||||||
@@ -29,10 +30,10 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
@Preview(showBackground = true)
|
||||||
@Composable
|
@Composable
|
||||||
fun NotificationsScreen() {
|
fun NotificationsScreen() {
|
||||||
|
val navController = LocalNavController.current
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize()
|
modifier = Modifier.fillMaxSize()
|
||||||
) {
|
) {
|
||||||
@@ -53,9 +54,16 @@ fun NotificationsScreen() {
|
|||||||
.padding(horizontal = 16.dp),
|
.padding(horizontal = 16.dp),
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
) {
|
) {
|
||||||
NotificationIndicator(10, R.drawable.rider_pro_like, "LIKE")
|
NotificationIndicator(10, R.drawable.rider_pro_like, "LIKE") {
|
||||||
NotificationIndicator(10, R.drawable.rider_pro_followers, "FOLLOWERS")
|
|
||||||
NotificationIndicator(10, R.drawable.rider_pro_comments, "COMMENTS")
|
}
|
||||||
|
NotificationIndicator(10, R.drawable.rider_pro_followers, "FOLLOWERS"){
|
||||||
|
|
||||||
|
}
|
||||||
|
NotificationIndicator(10, R.drawable.rider_pro_comments, "COMMENTS"){
|
||||||
|
navController.navigate("Comments")
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
HorizontalDivider(color = Color(0xFFEbEbEb), modifier = Modifier.padding(16.dp))
|
HorizontalDivider(color = Color(0xFFEbEbEb), modifier = Modifier.padding(16.dp))
|
||||||
NotificationCounterItem(24)
|
NotificationCounterItem(24)
|
||||||
@@ -85,7 +93,12 @@ fun NotificationsScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun NotificationIndicator(notificationCount: Int, iconRes: Int, label: String) {
|
fun NotificationIndicator(
|
||||||
|
notificationCount: Int,
|
||||||
|
iconRes: Int,
|
||||||
|
label: String,
|
||||||
|
onClick: () -> Unit
|
||||||
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
) {
|
) {
|
||||||
@@ -93,6 +106,9 @@ fun NotificationIndicator(notificationCount: Int, iconRes: Int, label: String) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(16.dp)
|
.padding(16.dp)
|
||||||
.align(Alignment.TopCenter)
|
.align(Alignment.TopCenter)
|
||||||
|
.clickable {
|
||||||
|
onClick()
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
if (notificationCount > 0) {
|
if (notificationCount > 0) {
|
||||||
Box(
|
Box(
|
||||||
@@ -172,12 +188,14 @@ fun NotificationCounterItem(count: Int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class MessageItemData(
|
data class MessageItemData(
|
||||||
val userName: String,
|
val userName: String,
|
||||||
val message: String,
|
val message: String,
|
||||||
val timeAgo: String,
|
val timeAgo: String,
|
||||||
val profileImage: Int
|
val profileImage: Int
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MessageItem(messageItemData: MessageItemData) {
|
fun MessageItem(messageItemData: MessageItemData) {
|
||||||
Row(
|
Row(
|
||||||
|
|||||||
12
app/src/main/res/drawable/rider_pro_more_horizon.xml
Normal file
12
app/src/main/res/drawable/rider_pro_more_horizon.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<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="M4.5,11L6.5,11C6.776,11 7,11.224 7,11.5L7,13.5C7,13.776 6.776,14 6.5,14L4.5,14C4.224,14 4,13.776 4,13.5L4,11.5C4,11.224 4.224,11 4.5,11ZM11.5,11L13.5,11C13.776,11 14,11.224 14,11.5L14,13.5C14,13.776 13.776,14 13.5,14L11.5,14C11.224,14 11,13.776 11,13.5L11,11.5C11,11.224 11.224,11 11.5,11ZM18.5,11L20.5,11C20.776,11 21,11.224 21,11.5L21,13.5C21,13.776 20.776,14 20.5,14L18.5,14C18.224,14 18,13.776 18,13.5L18,11.5C18,11.224 18.224,11 18.5,11Z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
</vector>
|
||||||
Reference in New Issue
Block a user