-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(settings): add settings menu and checkbox for autosave
relates to #35
- Loading branch information
Patrick Hoefer
committed
Jan 6, 2021
1 parent
c4dd2a5
commit da2f6c7
Showing
5 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
8 changes: 7 additions & 1 deletion
8
src/main/kotlin/com/github/xetra11/ck3workbench/app/SettingsHolder.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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
package com.github.xetra11.ck3workbench.app | ||
|
||
import androidx.compose.runtime.mutableStateListOf | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.snapshots.SnapshotStateList | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.setValue | ||
import com.github.xetra11.ck3workbench.module.character.CK3Character | ||
|
||
/** | ||
* Holds all the app wide settings state | ||
*/ | ||
object SettingsHolder { | ||
val characters: SnapshotStateList<CK3Character> = mutableStateListOf() | ||
var autosave by mutableStateOf(false) | ||
} |
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
33 changes: 32 additions & 1 deletion
33
src/main/kotlin/com/github/xetra11/ck3workbench/app/view/SettingsView.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 |
---|---|---|
@@ -1,4 +1,35 @@ | ||
package com.github.xetra11.ck3workbench.app.view | ||
|
||
class SettingsView { | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.Checkbox | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.github.xetra11.ck3workbench.app.SettingsHolder | ||
|
||
@Composable | ||
fun SettingsView() { | ||
Column( | ||
Modifier.fillMaxWidth(), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Spacer(Modifier.padding(top = 100.dp)) | ||
Row( | ||
Modifier.fillMaxWidth(), | ||
horizontalArrangement = Arrangement.SpaceEvenly | ||
) { | ||
Text("Activate Autosave") | ||
Checkbox( | ||
checked = SettingsHolder.autosave, | ||
onCheckedChange = { SettingsHolder.autosave = it } | ||
) | ||
} | ||
} | ||
} |
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