-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial design system, home screen UI propertype.
- Loading branch information
1 parent
7352541
commit cdfc1dd
Showing
40 changed files
with
1,426 additions
and
66 deletions.
There are no files selected for viewing
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
40 changes: 0 additions & 40 deletions
40
android/app/src/main/java/io/github/reactivecircus/kstreamlined/android/theme/Theme.kt
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
plugins { | ||
id("kstreamlined.android.library") | ||
id("kstreamlined.android.library.compose") | ||
} | ||
|
||
android { | ||
namespace = "io.github.reactivecircus.kstreamlined.android.common.ui.feed" | ||
buildFeatures { | ||
androidResources = true | ||
} | ||
} | ||
|
||
androidComponents { | ||
beforeVariants { | ||
@Suppress("UnstableApiUsage") | ||
it.androidTest.enable = false | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":designsystem")) | ||
implementation(project(":kmp:model")) | ||
|
||
// Compose | ||
implementation(libs.androidx.compose.foundation) | ||
implementation(libs.androidx.compose.ui.tooling) | ||
} |
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,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest /> |
114 changes: 114 additions & 0 deletions
114
...ain/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/KotlinWeeklyCard.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,114 @@ | ||
package io.github.reactivecircus.kstreamlined.android.common.ui.feed | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.unit.dp | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.ThemePreviews | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.component.IconButton | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.component.Surface | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.component.Text | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.foundation.KSTheme | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.foundation.icon.BookmarkAdd | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.foundation.icon.BookmarkFill | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.foundation.icon.KSIcons | ||
import io.github.reactivecircus.kstreamlined.kmp.model.feed.FeedItem | ||
|
||
@Composable | ||
public fun KotlinWeeklyCard( | ||
item: FeedItem.KotlinWeekly, | ||
onItemClick: (FeedItem.KotlinWeekly) -> Unit, | ||
onSaveButtonClick: (FeedItem.KotlinWeekly) -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
Surface( | ||
onClick = { onItemClick(item) }, | ||
modifier = modifier.fillMaxWidth(), | ||
shape = RoundedCornerShape(16.dp), | ||
color = KSTheme.colorScheme.primary, | ||
contentColor = KSTheme.colorScheme.onPrimary, | ||
elevation = 4.dp, | ||
) { | ||
Row( | ||
modifier = Modifier.padding(vertical = 24.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.weight(1f) | ||
.padding(start = 16.dp), | ||
verticalArrangement = Arrangement.spacedBy(8.dp), | ||
) { | ||
Text( | ||
text = item.title, | ||
style = KSTheme.typography.titleLarge, | ||
maxLines = 1, | ||
overflow = TextOverflow.Ellipsis, | ||
) | ||
Text( | ||
text = item.publishTime, | ||
style = KSTheme.typography.bodyMedium, | ||
) | ||
} | ||
IconButton( | ||
if (item.savedForLater) { | ||
KSIcons.BookmarkFill | ||
} else { | ||
KSIcons.BookmarkAdd | ||
}, | ||
contentDescription = null, | ||
onClick = { onSaveButtonClick(item) }, | ||
modifier = Modifier.padding(end = 8.dp), | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
@ThemePreviews | ||
private fun PreviewKotlinWeeklyCard_unsaved() { | ||
KSTheme { | ||
Surface { | ||
KotlinWeeklyCard( | ||
item = FeedItem.KotlinWeekly( | ||
id = "1", | ||
title = "Kotlin Weekly #381", | ||
publishTime = "Moments ago", | ||
contentUrl = "contentUrl", | ||
savedForLater = false, | ||
), | ||
onItemClick = {}, | ||
onSaveButtonClick = {}, | ||
modifier = Modifier.padding(24.dp), | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
@ThemePreviews | ||
private fun PreviewKotlinWeeklyCard_saved() { | ||
KSTheme { | ||
Surface { | ||
KotlinWeeklyCard( | ||
item = FeedItem.KotlinWeekly( | ||
id = "1", | ||
title = "Kotlin Weekly #381", | ||
publishTime = "3 hours ago", | ||
contentUrl = "contentUrl", | ||
savedForLater = true, | ||
), | ||
onItemClick = {}, | ||
onSaveButtonClick = {}, | ||
modifier = Modifier.padding(24.dp), | ||
) | ||
} | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
...src/main/java/io/github/reactivecircus/kstreamlined/android/designsystem/ThemePreviews.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,8 @@ | ||
package io.github.reactivecircus.kstreamlined.android.designsystem | ||
|
||
import android.content.res.Configuration | ||
import androidx.compose.ui.tooling.preview.Preview | ||
|
||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO, name = "Light") | ||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES, name = "Dark") | ||
public annotation class ThemePreviews |
39 changes: 39 additions & 0 deletions
39
...main/java/io/github/reactivecircus/kstreamlined/android/designsystem/component/Divider.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,39 @@ | ||
package io.github.reactivecircus.kstreamlined.android.designsystem.component | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.NonRestartableComposable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.foundation.KSTheme | ||
import androidx.compose.material3.HorizontalDivider as MaterialHorizontalDivider | ||
import androidx.compose.material3.VerticalDivider as MaterialVerticalDivider | ||
|
||
@Composable | ||
@NonRestartableComposable | ||
public fun HorizontalDivider( | ||
modifier: Modifier = Modifier, | ||
thickness: Dp = 1.dp, | ||
color: Color = KSTheme.colorScheme.outline, | ||
) { | ||
MaterialHorizontalDivider( | ||
modifier = modifier, | ||
thickness = thickness, | ||
color = color, | ||
) | ||
} | ||
|
||
@Composable | ||
@NonRestartableComposable | ||
public fun VerticalDivider( | ||
modifier: Modifier = Modifier, | ||
thickness: Dp = 1.dp, | ||
color: Color = KSTheme.colorScheme.outline, | ||
) { | ||
MaterialVerticalDivider( | ||
modifier = modifier, | ||
thickness = thickness, | ||
color = color, | ||
) | ||
} |
29 changes: 29 additions & 0 deletions
29
...rc/main/java/io/github/reactivecircus/kstreamlined/android/designsystem/component/Icon.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,29 @@ | ||
/* | ||
* Copyright (c) 2022 Woolworths. All rights reserved. | ||
*/ | ||
|
||
package io.github.reactivecircus.kstreamlined.android.designsystem.component | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.NonRestartableComposable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import io.github.reactivecircus.kstreamlined.android.designsystem.foundation.color.LocalContentColor | ||
import androidx.compose.material3.Icon as MaterialIcon | ||
|
||
@Composable | ||
@NonRestartableComposable | ||
public fun Icon( | ||
imageVector: ImageVector, | ||
contentDescription: String?, | ||
modifier: Modifier = Modifier, | ||
tint: Color = LocalContentColor.current, | ||
) { | ||
MaterialIcon( | ||
imageVector = imageVector, | ||
contentDescription = contentDescription, | ||
modifier = modifier, | ||
tint = tint, | ||
) | ||
} |
Oops, something went wrong.