-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22c2dd7
commit c3e4352
Showing
10 changed files
with
203 additions
and
17 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...e/src/commonMain/kotlin/xyz/ksharma/krail/trip/planner/ui/state/settings/SettingsEvent.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,5 @@ | ||
package xyz.ksharma.krail.trip.planner.ui.state.settings | ||
|
||
sealed interface SettingsEvent { | ||
data object A : SettingsEvent | ||
} |
3 changes: 3 additions & 0 deletions
3
...e/src/commonMain/kotlin/xyz/ksharma/krail/trip/planner/ui/state/settings/SettingsState.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,3 @@ | ||
package xyz.ksharma.krail.trip.planner.ui.state.settings | ||
|
||
data class SettingsState(val x: Int = 0) |
24 changes: 24 additions & 0 deletions
24
feature/trip-planner/ui/src/commonMain/composeResources/drawable/ic_settings.xml
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,24 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="48dp" | ||
android:height="48dp" | ||
android:viewportWidth="48" | ||
android:viewportHeight="48"> | ||
<group> | ||
<clip-path | ||
android:pathData="M0,0h48v48h-48z"/> | ||
<path | ||
android:pathData="M24,30C27.314,30 30,27.314 30,24C30,20.686 27.314,18 24,18C20.686,18 18,20.686 18,24C18,27.314 20.686,30 24,30Z" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="4" | ||
android:fillColor="#00000000" | ||
android:strokeColor="#FFFFFF" | ||
android:strokeLineCap="round"/> | ||
<path | ||
android:pathData="M38.8,30C38.534,30.603 38.454,31.272 38.572,31.921C38.69,32.57 38.999,33.169 39.46,33.64L39.58,33.76C39.952,34.132 40.247,34.573 40.448,35.058C40.65,35.544 40.753,36.064 40.753,36.59C40.753,37.116 40.65,37.636 40.448,38.122C40.247,38.607 39.952,39.049 39.58,39.42C39.208,39.792 38.767,40.087 38.282,40.288C37.796,40.489 37.276,40.593 36.75,40.593C36.224,40.593 35.704,40.489 35.218,40.288C34.733,40.087 34.292,39.792 33.92,39.42L33.8,39.3C33.329,38.839 32.73,38.53 32.081,38.412C31.432,38.294 30.763,38.374 30.16,38.64C29.569,38.894 29.064,39.314 28.709,39.851C28.353,40.388 28.163,41.016 28.16,41.66V42C28.16,43.061 27.739,44.078 26.988,44.828C26.238,45.579 25.221,46 24.16,46C23.099,46 22.082,45.579 21.332,44.828C20.581,44.078 20.16,43.061 20.16,42V41.82C20.145,41.158 19.93,40.516 19.545,39.977C19.16,39.439 18.622,39.029 18,38.8C17.397,38.534 16.728,38.454 16.079,38.572C15.43,38.69 14.831,38.999 14.36,39.46L14.24,39.58C13.868,39.952 13.427,40.247 12.942,40.448C12.456,40.65 11.936,40.753 11.41,40.753C10.884,40.753 10.364,40.65 9.878,40.448C9.393,40.247 8.951,39.952 8.58,39.58C8.208,39.208 7.913,38.767 7.712,38.282C7.51,37.796 7.407,37.276 7.407,36.75C7.407,36.224 7.51,35.704 7.712,35.218C7.913,34.733 8.208,34.292 8.58,33.92L8.7,33.8C9.161,33.329 9.47,32.73 9.588,32.081C9.706,31.432 9.626,30.763 9.36,30.16C9.106,29.569 8.686,29.064 8.149,28.709C7.612,28.353 6.984,28.163 6.34,28.16H6C4.939,28.16 3.922,27.739 3.172,26.988C2.421,26.238 2,25.221 2,24.16C2,23.099 2.421,22.082 3.172,21.332C3.922,20.581 4.939,20.16 6,20.16H6.18C6.842,20.145 7.484,19.93 8.023,19.545C8.561,19.16 8.971,18.622 9.2,18C9.466,17.397 9.546,16.728 9.428,16.079C9.31,15.43 9.001,14.831 8.54,14.36L8.42,14.24C8.048,13.868 7.753,13.427 7.552,12.942C7.35,12.456 7.247,11.936 7.247,11.41C7.247,10.884 7.35,10.364 7.552,9.878C7.753,9.393 8.048,8.951 8.42,8.58C8.791,8.208 9.233,7.913 9.718,7.712C10.204,7.51 10.724,7.407 11.25,7.407C11.776,7.407 12.296,7.51 12.782,7.712C13.267,7.913 13.708,8.208 14.08,8.58L14.2,8.7C14.671,9.161 15.27,9.47 15.919,9.588C16.568,9.706 17.237,9.626 17.84,9.36H18C18.591,9.106 19.096,8.686 19.451,8.149C19.807,7.612 19.997,6.984 20,6.34V6C20,4.939 20.421,3.922 21.172,3.172C21.922,2.421 22.939,2 24,2C25.061,2 26.078,2.421 26.828,3.172C27.579,3.922 28,4.939 28,6V6.18C28.003,6.824 28.193,7.452 28.549,7.989C28.904,8.526 29.409,8.946 30,9.2C30.603,9.466 31.272,9.546 31.921,9.428C32.57,9.31 33.169,9.001 33.64,8.54L33.76,8.42C34.132,8.048 34.573,7.753 35.058,7.552C35.544,7.35 36.064,7.247 36.59,7.247C37.116,7.247 37.636,7.35 38.122,7.552C38.607,7.753 39.049,8.048 39.42,8.42C39.792,8.791 40.087,9.233 40.288,9.718C40.489,10.204 40.593,10.724 40.593,11.25C40.593,11.776 40.489,12.296 40.288,12.782C40.087,13.267 39.792,13.708 39.42,14.08L39.3,14.2C38.839,14.671 38.53,15.27 38.412,15.919C38.294,16.568 38.374,17.237 38.64,17.84V18C38.894,18.591 39.314,19.096 39.851,19.451C40.388,19.807 41.016,19.997 41.66,20H42C43.061,20 44.078,20.421 44.828,21.172C45.579,21.922 46,22.939 46,24C46,25.061 45.579,26.078 44.828,26.828C44.078,27.579 43.061,28 42,28H41.82C41.176,28.003 40.548,28.193 40.011,28.549C39.474,28.904 39.054,29.409 38.8,30Z" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="4" | ||
android:fillColor="#00000000" | ||
android:strokeColor="#FFFFFF" | ||
android:strokeLineCap="round"/> | ||
</group> | ||
</vector> |
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
26 changes: 26 additions & 0 deletions
26
...i/src/commonMain/kotlin/xyz/ksharma/krail/trip/planner/ui/settings/SettingsDestination.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,26 @@ | ||
package xyz.ksharma.krail.trip.planner.ui.settings | ||
|
||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.NavOptions | ||
import androidx.navigation.compose.composable | ||
import xyz.ksharma.krail.trip.planner.ui.navigation.SettingsRoute | ||
import xyz.ksharma.krail.trip.planner.ui.navigation.UsualRideRoute | ||
|
||
internal fun NavGraphBuilder.settingsDestination(navController: NavHostController) { | ||
composable<SettingsRoute> { | ||
// val viewModel: SettingsViewModel = koinViewModel<SettingsViewModel>() | ||
|
||
SettingsScreen( | ||
onChangeThemeClick = { | ||
navController.navigate( | ||
route = UsualRideRoute, | ||
navOptions = NavOptions.Builder().setLaunchSingleTop(true).build(), | ||
) | ||
}, | ||
onBackClick = { | ||
navController.popBackStack() | ||
}, | ||
) | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
...ner/ui/src/commonMain/kotlin/xyz/ksharma/krail/trip/planner/ui/settings/SettingsScreen.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,78 @@ | ||
package xyz.ksharma.krail.trip.planner.ui.settings | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.statusBarsPadding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.filled.ArrowBack | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.unit.dp | ||
import xyz.ksharma.krail.taj.components.Divider | ||
import xyz.ksharma.krail.taj.components.Text | ||
import xyz.ksharma.krail.taj.components.TitleBar | ||
import xyz.ksharma.krail.taj.theme.KrailTheme | ||
import xyz.ksharma.krail.trip.planner.ui.timetable.ActionButton | ||
|
||
@Composable | ||
fun SettingsScreen( | ||
modifier: Modifier = Modifier, | ||
onBackClick: () -> Unit = {}, | ||
onChangeThemeClick: () -> Unit = {}, | ||
) { | ||
Column( | ||
modifier = modifier | ||
.fillMaxSize() | ||
.background(color = KrailTheme.colors.surface) | ||
.statusBarsPadding(), | ||
) { | ||
Column(modifier = Modifier.fillMaxWidth()) { | ||
TitleBar( | ||
modifier = Modifier.fillMaxWidth(), | ||
navAction = { | ||
ActionButton( | ||
onClick = onBackClick, | ||
contentDescription = "Back", | ||
) { | ||
Image( | ||
imageVector = Icons.AutoMirrored.Filled.ArrowBack, | ||
contentDescription = null, | ||
colorFilter = ColorFilter.tint(KrailTheme.colors.onSurface), | ||
modifier = Modifier.size(24.dp), | ||
) | ||
} | ||
}, | ||
title = { Text(text = "Settings") }, | ||
) | ||
} | ||
|
||
LazyColumn( | ||
modifier = Modifier, | ||
contentPadding = PaddingValues(top = 20.dp, bottom = 104.dp), | ||
) { | ||
item { | ||
Text( | ||
text = "Change Theme", | ||
style = KrailTheme.typography.title, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 12.dp, horizontal = 16.dp) | ||
.clickable { | ||
onChangeThemeClick() | ||
} | ||
) | ||
Divider() | ||
} | ||
|
||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../ui/src/commonMain/kotlin/xyz/ksharma/krail/trip/planner/ui/settings/SettingsViewModel.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,18 @@ | ||
package xyz.ksharma.krail.trip.planner.ui.settings | ||
|
||
import androidx.lifecycle.ViewModel | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.StateFlow | ||
import xyz.ksharma.krail.trip.planner.ui.state.settings.SettingsEvent | ||
import xyz.ksharma.krail.trip.planner.ui.state.settings.SettingsState | ||
|
||
class SettingsViewModel() : ViewModel() { | ||
|
||
private val _uiState: MutableStateFlow<SettingsState> = MutableStateFlow(SettingsState()) | ||
val uiState: StateFlow<SettingsState> = _uiState | ||
|
||
/* fun onEvent(event: SettingsEvent) { | ||
when (event) { | ||
} | ||
}*/ | ||
} |
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