Skip to content

Commit

Permalink
Merge pull request #254 from Spendesk/release/1.12.0
Browse files Browse the repository at this point in the history
Release 1.12.0
  • Loading branch information
RomainGF committed Aug 21, 2023
2 parents 8dfb569 + 7a37413 commit 05372d8
Show file tree
Hide file tree
Showing 10 changed files with 347 additions and 39 deletions.
5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,32 @@
buildscript {

ext {
grapes_version = '1.11.3'
grapes_version = '1.12.0'

kotlin_version = '1.7.10'
kotlin_version = '1.8.20'
firebase_app_distribution_version = '2.1.2'
hilt_version = '2.44'
hilt_version = '2.47'
glide_version = '4.15.1'

compose_version = '1.2.1'
compose_kotlin_compiler = '1.3.1'
compose_bom_version = '2023.01.00'
compose_material_3_version = '1.1.0-beta01'
compose_kotlin_compiler = '1.4.6'
compose_bom_version = '2023.06.01'
compose_material_3_version = '1.1.1'

android_material_version = '1.4.0'
androidx_core_ktx_version = '1.9.0'
androidx_constraintlayout = '2.1.3'
android_material_version = '1.9.0'
androidx_core_ktx_version = '1.10.1'
androidx_constraintlayout = '2.1.4'
androidx_appcompat_version = '1.3.1'
androidx_lifecycle_version = '1.4.0'
}

repositories {
gradlePluginPortal()
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:8.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
classpath 'com.android.tools.build:gradle:8.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
classpath "com.google.firebase:firebase-appdistribution-gradle:$firebase_app_distribution_version"
}
Expand All @@ -37,7 +36,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Expand Down
19 changes: 8 additions & 11 deletions library-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_17.toString()
}

buildTypes {
Expand All @@ -48,8 +48,8 @@ android {

dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

// https://stackoverflow.com/a/75298544
constraints {
Expand All @@ -61,6 +61,8 @@ dependencies {
}
}

api("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")

// Compose
api platform("androidx.compose:compose-bom:$compose_bom_version")

Expand All @@ -72,14 +74,9 @@ dependencies {
api("androidx.compose.foundation:foundation")
// Material Design 2 & 3 while migration is pending.
api("androidx.compose.material:material")
api("androidx.compose.material3:material3:$compose_material_3_version") {
because("These subdependecies are using an unstable version of androidx.compose.material that introduce a breaking change and crash")
exclude group: 'androidx.compose.material', module: 'material-icons-core'
exclude group: 'androidx.compose.material', module: 'material-ripple'
}
api("androidx.compose.material3:material3:$compose_material_3_version")

// Material design icons
api("androidx.lifecycle:lifecycle-runtime-ktx:2.6.0")
api("androidx.compose.material:material-icons-core")
api("androidx.compose.material:material-icons-extended")
// Integration with observables
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
package com.spendesk.grapes.compose.card

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Card
import androidx.compose.material3.CardColors
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.dp
import com.spendesk.grapes.compose.listitem.GrapesDivider
import com.spendesk.grapes.compose.listitem.GrapesInlineInformationItem
import com.spendesk.grapes.compose.theme.GrapesTheme

/**
* @author RomainGF
* @since 17/08/2023
*/
@Composable
fun GrapesInformationCard(
title: String,
modifier: Modifier = Modifier,
colors: CardColors = GrapesInformationCardDefaults.colors,
border: BorderStroke = GrapesInformationCardDefaults.border,
contentVerticalArrangement: Arrangement.Vertical = GrapesInformationCardDefaults.contentVerticalArrangement,
content: @Composable ColumnScope.() -> Unit = {},
) {
Card(
modifier = modifier,
colors = colors,
border = border,
) {
Column(
verticalArrangement = Arrangement.spacedBy(GrapesTheme.dimensions.paddingLarge),
modifier = Modifier.padding(vertical = GrapesTheme.dimensions.paddingLarge),
) {
Text(
text = title,
style = GrapesTheme.typography.titleS,
modifier = Modifier.padding(horizontal = GrapesTheme.dimensions.paddingLarge),
)
GrapesDivider()
Column(
verticalArrangement = contentVerticalArrangement,
content = content,
modifier = Modifier.padding(horizontal = GrapesTheme.dimensions.paddingLarge),
)
}
}
}

object GrapesInformationCardDefaults {

private val borderThickness = 0.5.dp

val colors: CardColors @Composable get() = CardDefaults.elevatedCardColors(
containerColor = GrapesTheme.colors.mainWhite,
)

val border: BorderStroke @Composable get() = BorderStroke(
width = borderThickness,
color = GrapesTheme.colors.mainNeutralNormal,
)

val contentVerticalArrangement: Arrangement.HorizontalOrVertical
@Composable get() = Arrangement.spacedBy(GrapesTheme.dimensions.paddingLarge)
}

@Preview
@Composable
private fun PreviewDescription(
@PreviewParameter(DescriptionParameterProvider::class) texts: Pair<String, String>,
) {
GrapesTheme {
Surface(
color = GrapesTheme.colors.mainBackground,
) {
GrapesInformationCard(
title = texts.first,
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
) {
Text(texts.second)
}
}
}
}

private class DescriptionParameterProvider : PreviewParameterProvider<Pair<String, String>> {
override val values = sequenceOf(
"This is a simple example of a very very very long title" to "Lorem Ipsum is simply dummy text.",
"Short title" to "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.",
"This is a simple example of a very very very long title" to "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.",
)
}

@Preview
@Composable
private fun PreviewDescriptionItems() {
GrapesTheme {
Surface(
color = GrapesTheme.colors.mainBackground,
) {
GrapesInformationCard(
title = "Description",
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
) {
GrapesInlineInformationItem(
title = "Subscription owner",
value = "Ben Hintz",
)
GrapesInlineInformationItem(
title = "Subscription owner",
value = "Ben Hintz",
)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.spendesk.grapes.compose.listitem

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import com.spendesk.grapes.compose.theme.GrapesTheme

/**
* @author : RomainGF
* @since : 18/08/2023
**/
@Composable
fun GrapesInlineInformationItem(
title: String,
value: String,
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier,
horizontalArrangement = Arrangement.spacedBy(GrapesTheme.dimensions.paddingXSmall),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = title,
color = GrapesTheme.colors.mainNeutralDarker,
style = GrapesTheme.typography.bodyRegular,
modifier = Modifier.weight(1f),
)
Box(
modifier = Modifier.weight(1f),
contentAlignment = Alignment.CenterEnd,
) {
Text(
text = value,
style = GrapesTheme.typography.bodyRegular,
)
}
}
}

@Composable
@Preview(showBackground = true)
private fun Preview(
@PreviewParameter(ItemParameterProvider::class) item: Pair<String, String>,
) {
GrapesTheme {
GrapesInlineInformationItem(
title = item.first,
value = item.second,
)
}
}

private class ItemParameterProvider : PreviewParameterProvider<Pair<String, String>> {
override val values = sequenceOf(
"This is an example of a very long key" to "Short value",
"Short key" to "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.",
"This is an example of a very long key" to "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.",
)
}
Loading

0 comments on commit 05372d8

Please sign in to comment.