Skip to content

Commit

Permalink
Update kotlin version and remove platform specific implementations, r…
Browse files Browse the repository at this point in the history
…emove unnecessary dependencies
  • Loading branch information
xavimolloy committed Oct 2, 2023
1 parent 2bc1de4 commit 8e14283
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 149 deletions.
2 changes: 1 addition & 1 deletion designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ kotlin {
dependencies {
api("androidx.activity:activity-compose:1.7.2")
api("androidx.appcompat:appcompat:1.6.1")
api("androidx.core:core-ktx:1.10.1")
api("androidx.core:core-ktx:1.12.0")
implementation("androidx.compose.material3:material3:1.2.0-alpha07")
implementation("com.google.zxing:core:3.5.2")
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
package org.hisp.dhis.mobile.ui.designsystem.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material3.Divider
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import kotlinx.coroutines.launch
import org.hisp.dhis.mobile.ui.designsystem.theme.InternalSizeValues
import org.hisp.dhis.mobile.ui.designsystem.theme.Shape
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor

@Composable
Expand Down Expand Up @@ -70,8 +90,9 @@ fun BottomSheetHeader(
* @param onDismiss: gives access to the onDismiss event
* @param modifier allows a modifier to be passed externally
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
expect fun BottomSheetShell(
fun BottomSheetShell(
title: String,
subtitle: String? = null,
description: String? = null,
Expand All @@ -81,4 +102,81 @@ expect fun BottomSheetShell(
content: @Composable (() -> Unit)? = null,
modifier: Modifier = Modifier,
onDismiss: () -> Unit,
)
) {
val sheetState = rememberModalBottomSheetState(true)
val scope = rememberCoroutineScope()

ModalBottomSheet(
modifier = modifier,
containerColor = Color.Transparent,
onDismissRequest = {
onDismiss()
},
sheetState = sheetState,
dragHandle = {
Box(
modifier = Modifier.background(Color.Transparent)
.padding(top = Spacing.Spacing72),
) {
BottomSheetIconButton(
icon = {
Icon(
imageVector = Icons.Outlined.Close,
contentDescription = "Button",
tint = SurfaceColor.SurfaceBright,
)
},
modifier = Modifier.padding(bottom = Spacing.Spacing4),
) {
scope.launch {
onDismiss()
}
}
}
},
) {
Column(
modifier = Modifier
.background(SurfaceColor.SurfaceBright, Shape.ExtraLargeTop)
.padding(Spacing.Spacing24)
.heightIn(Spacing.Spacing0, InternalSizeValues.Size800)
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
) {
BottomSheetHeader(
title,
subtitle,
description,
icon,
modifier = Modifier
.padding(horizontal = Spacing.Spacing24, vertical = Spacing.Spacing0),
)
searchBar?.invoke()
Divider(
modifier = Modifier.fillMaxWidth()
.padding(top = Spacing.Spacing24),
color = TextColor.OnDisabledSurface,
)
Box(
modifier = Modifier.align(Alignment.Start)
.heightIn(Spacing.Spacing0, InternalSizeValues.Size386)
.padding(bottom = Spacing.Spacing24),
) {
Column(
modifier = Modifier
.verticalScroll(rememberScrollState())
.fillMaxHeight(1f),
) {
content?.let {
it.invoke()
Divider(
modifier = Modifier.fillMaxWidth().padding(top = Spacing.Spacing8),
color = TextColor.OnDisabledSurface,
)
}
}
}
buttonBlock?.invoke()
}
}
}

This file was deleted.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ android.minSdk=21
#Versions
kotlin.version=1.9.10
agp.version=8.1.1
compose.version=1.5.1
compose.version=1.5.10-beta01

0 comments on commit 8e14283

Please sign in to comment.