-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #541 from 5altNaCl/feature/525
Apply stamps initial screen
- Loading branch information
Showing
56 changed files
with
200 additions
and
17 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched2023/model/Stamp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.github.droidkaigi.confsched2023.model | ||
|
||
data class Stamp( | ||
val hasDrawableResId: Int, | ||
val notHasDrawableResId: Int, | ||
val hasStamp: Boolean = false, | ||
val contentDescription: String, | ||
) { | ||
fun getDrawableResId() = if (hasStamp) hasDrawableResId else notHasDrawableResId | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...re/stamps/src/main/java/io/github/droidkaigi/confsched2023/stamps/component/StampImage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.github.droidkaigi.confsched2023.stamps.component | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.unit.dp | ||
import io.github.droidkaigi.confsched2023.model.Stamp | ||
|
||
@Composable | ||
fun StampImage( | ||
stamp: Stamp, | ||
onStampClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
Image( | ||
painter = painterResource(id = stamp.getDrawableResId()), | ||
contentDescription = stamp.contentDescription, | ||
modifier = modifier | ||
.clickable { onStampClick() } | ||
.padding(horizontal = 21.dp), | ||
) | ||
} |
43 changes: 43 additions & 0 deletions
43
.../stamps/src/main/java/io/github/droidkaigi/confsched2023/stamps/component/StampsDetail.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.github.droidkaigi.confsched2023.stamps.component | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import io.github.droidkaigi.confsched2023.stamps.StampsStrings | ||
|
||
@Composable | ||
fun StampsDetail( | ||
modifier: Modifier = Modifier, | ||
) { | ||
Column(modifier = modifier) { | ||
Text( | ||
text = StampsStrings.Title.asString(), | ||
style = MaterialTheme.typography.headlineLarge, | ||
modifier = Modifier.fillMaxWidth(), | ||
) | ||
|
||
Spacer(modifier = Modifier.height(16.dp)) | ||
|
||
Text( | ||
text = StampsStrings.Description.asString(), | ||
style = MaterialTheme.typography.bodyLarge, | ||
modifier = Modifier.fillMaxWidth(), | ||
) | ||
|
||
Spacer(modifier = Modifier.height(12.dp)) | ||
|
||
Text( | ||
text = StampsStrings.DescriptionNotes.asString(), | ||
style = MaterialTheme.typography.bodySmall, | ||
modifier = Modifier.fillMaxWidth(), | ||
) | ||
|
||
Spacer(modifier = Modifier.height(24.dp)) | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
feature/stamps/src/main/java/io/github/droidkaigi/confsched2023/stamps/section/StampsList.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package io.github.droidkaigi.confsched2023.stamps.section | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.lazy.grid.GridCells.Fixed | ||
import androidx.compose.foundation.lazy.grid.GridItemSpan | ||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid | ||
import androidx.compose.foundation.lazy.grid.items | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import io.github.droidkaigi.confsched2023.model.Stamp | ||
import io.github.droidkaigi.confsched2023.stamps.component.StampImage | ||
import io.github.droidkaigi.confsched2023.stamps.component.StampsDetail | ||
import kotlinx.collections.immutable.ImmutableList | ||
|
||
private const val STAMP_LIST_COLUMNS = 2 | ||
private const val SINGLE_ITEM_SPAN_COUNT = 2 | ||
private const val DOUBLE_ITEM_SPAN_COUNT = 2 / 2 | ||
|
||
@Composable | ||
fun StampsList( | ||
stamps: ImmutableList<Stamp>, | ||
onStampsClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
LazyVerticalGrid( | ||
columns = Fixed(STAMP_LIST_COLUMNS), | ||
modifier = modifier, | ||
contentPadding = PaddingValues( | ||
horizontal = 16.dp, | ||
vertical = 20.dp, | ||
), | ||
horizontalArrangement = Arrangement.spacedBy(8.dp), | ||
verticalArrangement = Arrangement.spacedBy(16.dp), | ||
) { | ||
item( | ||
key = "stamps_header", | ||
span = { GridItemSpan(SINGLE_ITEM_SPAN_COUNT) }, | ||
) { | ||
StampsDetail() | ||
} | ||
items( | ||
items = stamps, | ||
key = { stamp -> stamp.hasDrawableResId }, | ||
span = { stamp -> | ||
GridItemSpan( | ||
if (stamp == stamps.last() && stamps.size % STAMP_LIST_COLUMNS != 0) { | ||
SINGLE_ITEM_SPAN_COUNT | ||
} else { | ||
DOUBLE_ITEM_SPAN_COUNT | ||
}, | ||
) | ||
}, | ||
) { stamp -> | ||
StampImage(stamp = stamp, onStampClick = onStampsClick) | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.