Skip to content

Commit

Permalink
Merge branch 'main' into renovate/org.openapi.generator-7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ashdavies authored Nov 19, 2024
2 parents 001120f + 68a3240 commit 6a27bf4
Show file tree
Hide file tree
Showing 10 changed files with 494 additions and 312 deletions.
2 changes: 2 additions & 0 deletions conferences-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ kotlin {
implementation(libs.androidx.paging.common)
implementation(libs.coil.compose)
implementation(libs.coil.network)
implementation(libs.compose.adaptive.layout)
implementation(libs.compose.adaptive.navigation)
implementation(libs.compose.window.size)
implementation(libs.kotlinx.collections.immutable)
implementation(libs.kotlinx.datetime)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.ashdavies.party.events

import androidx.compose.runtime.Composable
import io.ashdavies.party.tooling.MaterialPreviewTheme
import io.ashdavies.party.tooling.PreviewDayNight

@Composable
@PreviewDayNight
internal fun EventsDetailPreview() {
MaterialPreviewTheme {
EventsDetail(DroidconBerlin)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
import androidx.paging.PagingData
import io.ashdavies.paging.LazyPagingItems
import io.ashdavies.paging.collectAsLazyPagingItems
import io.ashdavies.party.tooling.MaterialPreviewTheme
import io.ashdavies.party.tooling.PreviewDayNight
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
Expand All @@ -12,8 +13,13 @@ private val DroidconEvents = listOf(AndroidMakers, DroidconBerlin, DroidconLondo

@Composable
@PreviewDayNight
internal fun EventsScreenPreview(data: List<Event> = DroidconEvents) {
EventsScreen(EventsScreen.State(lazyPagingItems(flowOf(PagingData.from(data)))))
internal fun EventsListPreview(data: List<Event> = DroidconEvents) {
MaterialPreviewTheme {
EventsList(
state = EventsScreen.State(lazyPagingItems(flowOf(PagingData.from(data)))),
onClick = { },
)
}
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,38 @@
package io.ashdavies.party.gallery

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import io.ashdavies.party.tooling.MaterialPreviewTheme
import io.ashdavies.party.tooling.PreviewDayNight
import kotlinx.collections.immutable.persistentListOf

@Composable
@PreviewDayNight
@OptIn(ExperimentalFoundationApi::class)
internal fun GalleryGridPreview() {
GalleryPreviewTheme {
Surface {
GalleryGrid(
itemList = persistentListOf(
galleryScreenStateItem(),
galleryScreenStateItem(isSelected = true),
galleryScreenStateItem(state = SyncState.SYNCING),
galleryScreenStateItem(state = SyncState.SYNCED),
),
onExpand = { },
onSelect = { },
isSelecting = true,
)
}
MaterialPreviewTheme {
GalleryGrid(
itemList = persistentListOf(
galleryScreenStateItem(),
galleryScreenStateItem(isSelected = true),
galleryScreenStateItem(state = SyncState.SYNCING),
galleryScreenStateItem(state = SyncState.SYNCED),
),
onExpand = { },
onSelect = { },
isSelecting = true,
)
}
}

@Composable
@PreviewDayNight
internal fun GalleryBottomSheetPreview() {
GalleryPreviewTheme {
MaterialPreviewTheme {
GallerySheetContent(eventSink = { })
}
}

@Composable
private fun GalleryPreviewTheme(content: @Composable () -> Unit) {
MaterialTheme(if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()) {
content()
}
}

private fun galleryScreenStateItem(
name: String = "Sample Image",
isSelected: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.ashdavies.party.tooling

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
import androidx.compose.material3.windowsizeclass.WindowSizeClass
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import io.ashdavies.party.material.LocalWindowSizeClass

@Composable
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
internal fun MaterialPreviewTheme(
size: DpSize = DpSize(1280.dp, 720.dp),
content: @Composable () -> Unit,
) {
MaterialTheme(if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()) {
CompositionLocalProvider(
value = LocalWindowSizeClass provides WindowSizeClass.calculateFromSize(size),
content = { Surface(content = content) },
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package io.ashdavies.party.events

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Event
import androidx.compose.material.icons.outlined.MyLocation
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import coil3.compose.AsyncImage

@Composable
internal fun EventsDetail(
event: Event,
modifier: Modifier = Modifier,
) {
Column(modifier) {
AsyncImage(
model = event.imageUrl,
contentDescription = null,
modifier = Modifier
.background(Color.DarkGray)
.fillMaxWidth()
.height(300.dp),
placeholder = null,
)

Row(
modifier = Modifier.padding(top = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = Icons.Outlined.Event,
contentDescription = null,
modifier = Modifier.padding(16.dp),
)

Column {
Text("${event.dateStart} - ${event.dateEnd}")
}
}

Row(
modifier = Modifier.padding(top = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = Icons.Outlined.MyLocation,
contentDescription = null,
modifier = Modifier.padding(16.dp),
)

Column {
Text(event.location)
}
}
}
}
Loading

0 comments on commit 6a27bf4

Please sign in to comment.