-
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.
Merge pull request #75 from luongvo/release/0.4.0
Release 0.4.0
- Loading branch information
Showing
74 changed files
with
5,954 additions
and
160 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
9 changes: 9 additions & 0 deletions
9
android/src/main/java/vn/luongvo/kmm/survey/android/di/SurveyModule.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,9 @@ | ||
package vn.luongvo.kmm.survey.android.di | ||
|
||
import org.koin.androidx.viewmodel.dsl.viewModelOf | ||
import org.koin.dsl.module | ||
import vn.luongvo.kmm.survey.android.ui.screens.survey.SurveyViewModel | ||
|
||
val surveyModule = module { | ||
viewModelOf(::SurveyViewModel) | ||
} |
35 changes: 35 additions & 0 deletions
35
android/src/main/java/vn/luongvo/kmm/survey/android/ui/common/BackButton.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,35 @@ | ||
package vn.luongvo.kmm.survey.android.ui.common | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.wrapContentSize | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.rotate | ||
import androidx.compose.ui.graphics.Color.Companion.White | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.res.painterResource | ||
import vn.luongvo.kmm.survey.android.R | ||
import vn.luongvo.kmm.survey.android.ui.theme.AppTheme.dimensions | ||
|
||
private const val Rotate180 = 180f | ||
|
||
@Composable | ||
fun BackButton( | ||
onClick: () -> Unit, | ||
modifier: Modifier = Modifier | ||
) { | ||
Image( | ||
painter = painterResource(id = R.drawable.ic_arrow_right), | ||
contentDescription = null, | ||
colorFilter = ColorFilter.tint(White), | ||
contentScale = ContentScale.FillWidth, | ||
modifier = modifier | ||
.wrapContentSize() | ||
.rotate(Rotate180) // switch Right Arrow to Back button | ||
.clickable { onClick() } | ||
.padding(all = dimensions.paddingMedium) | ||
) | ||
} |
38 changes: 38 additions & 0 deletions
38
android/src/main/java/vn/luongvo/kmm/survey/android/ui/common/CloseButton.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,38 @@ | ||
package vn.luongvo.kmm.survey.android.ui.common | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import vn.luongvo.kmm.survey.android.R | ||
|
||
@Composable | ||
fun CloseButton( | ||
onClick: () -> Unit, | ||
modifier: Modifier = Modifier | ||
) { | ||
Image( | ||
painter = painterResource(id = R.drawable.ic_close), | ||
contentDescription = null, | ||
contentScale = ContentScale.FillWidth, | ||
modifier = modifier | ||
.size(28.dp) | ||
.clip(CircleShape) | ||
.clickable { onClick() } | ||
) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun CloseButtonPreview() { | ||
CloseButton( | ||
onClick = {} | ||
) | ||
} |
36 changes: 12 additions & 24 deletions
36
android/src/main/java/vn/luongvo/kmm/survey/android/ui/common/NextCircleButton.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
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
52 changes: 52 additions & 0 deletions
52
android/src/main/java/vn/luongvo/kmm/survey/android/ui/common/RtlModalDrawer.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,52 @@ | ||
package vn.luongvo.kmm.survey.android.ui.common | ||
|
||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.material.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.Shape | ||
import androidx.compose.ui.platform.LocalLayoutDirection | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.LayoutDirection | ||
|
||
/** | ||
* ModalDrawer from right/end side | ||
* https://issuetracker.google.com/issues/174514369#comment18 | ||
*/ | ||
@Composable | ||
fun RtlModalDrawer( | ||
drawerContent: @Composable ColumnScope.() -> Unit, | ||
modifier: Modifier = Modifier, | ||
drawerState: DrawerState = rememberDrawerState(DrawerValue.Closed), | ||
gesturesEnabled: Boolean = true, | ||
drawerShape: Shape = MaterialTheme.shapes.large, | ||
drawerElevation: Dp = DrawerDefaults.Elevation, | ||
drawerBackgroundColor: Color = MaterialTheme.colors.surface, | ||
drawerContentColor: Color = contentColorFor(drawerBackgroundColor), | ||
scrimColor: Color = DrawerDefaults.scrimColor, | ||
content: @Composable () -> Unit | ||
) { | ||
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) { | ||
ModalDrawer( | ||
modifier = modifier, | ||
drawerState = drawerState, | ||
gesturesEnabled = gesturesEnabled, | ||
drawerShape = drawerShape, | ||
drawerElevation = drawerElevation, | ||
drawerBackgroundColor = drawerBackgroundColor, | ||
drawerContentColor = drawerContentColor, | ||
scrimColor = scrimColor, | ||
drawerContent = { | ||
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) { | ||
drawerContent() | ||
} | ||
} | ||
) { | ||
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) { | ||
content() | ||
} | ||
} | ||
} | ||
} |
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
52 changes: 52 additions & 0 deletions
52
android/src/main/java/vn/luongvo/kmm/survey/android/ui/preview/HomeParameterProvider.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,52 @@ | ||
package vn.luongvo.kmm.survey.android.ui.preview | ||
|
||
import androidx.compose.material.DrawerValue | ||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider | ||
import vn.luongvo.kmm.survey.android.ui.screens.home.SurveyUiModel | ||
import vn.luongvo.kmm.survey.android.ui.screens.home.UserUiModel | ||
|
||
class HomeParameterProvider : PreviewParameterProvider<HomeParameterProvider.Params> { | ||
|
||
private val userUiModel = UserUiModel( | ||
email = "[email protected]", | ||
name = "Luong", | ||
avatarUrl = "https://secure.gravatar.com/avatar/8fae17b9d0c4cca18a9661bcdf650f23" | ||
) | ||
|
||
private val surveyUiModels = listOf( | ||
SurveyUiModel( | ||
id = "1", | ||
title = "Scarlett Bangkok", | ||
description = "We'd love to hear from you!", | ||
coverImageUrl = "https://dhdbhh0jsld0o.cloudfront.net/m/1ea51560991bcb7d00d0_" | ||
), | ||
SurveyUiModel( | ||
id = "2", | ||
title = "ibis Bangkok Riverside", | ||
description = "We'd love to hear from you!", | ||
coverImageUrl = "https://dhdbhh0jsld0o.cloudfront.net/m/287db81c5e4242412cc0_" | ||
) | ||
) | ||
|
||
override val values = sequenceOf( | ||
Params( | ||
isLoading = false, | ||
), | ||
Params( | ||
isLoading = true, | ||
), | ||
Params( | ||
isLoading = false, | ||
drawerState = DrawerValue.Open, | ||
) | ||
) | ||
|
||
inner class Params( | ||
val isLoading: Boolean, | ||
val drawerState: DrawerValue = DrawerValue.Closed, | ||
val appVersion: String = "v1.0.0", | ||
val currentDate: String = "Monday, JUNE 15", | ||
val user: UserUiModel = userUiModel, | ||
val surveys: List<SurveyUiModel> = surveyUiModels | ||
) | ||
} |
2 changes: 1 addition & 1 deletion
2
.../ui/providers/LoadingParameterProvider.kt → ...id/ui/preview/LoadingParameterProvider.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
Oops, something went wrong.