Skip to content

Commit

Permalink
Added initial list cell formatting. Basically functional.
Browse files Browse the repository at this point in the history
Missing: Time sorting, correct shapes for room names, correct room names (data issue), warning data (canceled events), Favorite is misaligned. Also: Overall top bar, title, etc is still missing.
  • Loading branch information
CHARLES BOND authored and CHARLES BOND committed Jun 25, 2024
1 parent 1f7231b commit 349a101
Showing 1 changed file with 46 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package io.github.droidkaigi.confsched.sessions.section

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Circle
Expand All @@ -26,13 +31,17 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment.Companion
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.seiko.imageloader.rememberImagePainter
import io.github.droidkaigi.confsched.model.Timetable
import io.github.droidkaigi.confsched.model.TimetableItem
import io.github.droidkaigi.confsched.model.TimetableRoom.Shapes.CIRCLE
Expand Down Expand Up @@ -62,6 +71,7 @@ fun TimetableList(
LazyColumn(
modifier = modifier.testTag(TimetableListTestTag),
state = scrollState,
verticalArrangement = Arrangement.spacedBy(10.dp),
contentPadding = contentPadding,
) {
items(uiState.timetable.timetableItems, key = { it.id.value }) { timetableItem ->
Expand All @@ -79,15 +89,17 @@ fun TimetableList(
val roomColor = timetableItem.room.getColor()

Column(
modifier = Modifier.border(border= BorderStroke(width=1.dp,color=Color.White))
.clip(RoundedCornerShape(5.dp))
.padding(15.dp)) {
modifier = Modifier
.border(border= BorderStroke(width=1.dp,color=Color.White), shape = RoundedCornerShape(5.dp))
.padding(15.dp)
) {
Row {
TagView(tagText=roomName, icon = roomIcon, tagColor=roomColor)
Spacer(modifier = Modifier.padding(3.dp))
TagView(tagText="JA", tagColor=Color.White)
Spacer(modifier = Modifier.padding(3.dp))
TagView(tagText="EN", tagColor=Color.White)
timetableItem.language.labels.forEach { label ->
TagView(tagText=label, tagColor=Color.White)
Spacer(modifier = Modifier.padding(3.dp))
}
Spacer(modifier = Modifier.weight(1f))
TextButton(
onClick = { onBookmarkClick(timetableItem, true) },
Expand All @@ -97,23 +109,49 @@ fun TimetableList(
Icon(
Icons.Filled.Favorite,
contentDescription = "Bookmarked",
tint = Color.Green
tint = Color.Green,
)
} else {
Icon(
Icons.Outlined.FavoriteBorder,
contentDescription = "Not Bookmarked",
tint = Color.White
tint = Color.White,
)
}
}
}
Text(
text = timetableItem.title.currentLangTitle,
fontSize = 24.sp,
modifier = Modifier
.testTag(TimetableListItemTestTag)
.padding(bottom=5.dp)
.clickable { onTimetableItemClick(timetableItem) },
)
timetableItem.speakers.forEach { speaker ->
Row {
//TODO: This style of image loading was included by default but it seems slow
val painter = rememberImagePainter(speaker.iconUrl)
Image(
painter = painter,
modifier = Modifier
.width(32.dp)
.height(32.dp)
.clip(CircleShape),
contentDescription = "image",
)
Text(
text = speaker.name,
fontSize = 24.sp,
modifier = Modifier
.testTag(TimetableListItemTestTag)
.padding(5.dp)
.align(Alignment.CenterVertically)
)
}
}
//TODO: There is no data for the warning string right now. (Should go here)

}
}
}
Expand Down

0 comments on commit 349a101

Please sign in to comment.