This file contains hidden or 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
| enum class Recurrence { | |
| Daily, | |
| Weekly, | |
| Monthly | |
| } | |
| fun getRecurrenceList(): List<Recurrence> { | |
| val recurrenceList = mutableListOf<Recurrence>() | |
| recurrenceList.add(Recurrence.Daily) | |
| recurrenceList.add(Recurrence.Weekly) |
This file contains hidden or 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
| @OptIn(ExperimentalMaterial3Api::class) | |
| @Composable | |
| fun AddMedicationScreen() { | |
| var medicationName by rememberSaveable { mutableStateOf("") } | |
| Column( | |
| modifier = Modifier | |
| .padding(16.dp, 16.dp) | |
| .verticalScroll(rememberScrollState()), | |
| verticalArrangement = Arrangement.spacedBy(8.dp) |
This file contains hidden or 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
| @Composable | |
| fun AddMedicationScreen() { | |
| Column( | |
| modifier = Modifier | |
| .padding(16.dp, 16.dp) | |
| .verticalScroll(rememberScrollState()), | |
| verticalArrangement = Arrangement.spacedBy(8.dp) | |
| ) { | |
| Text( |
This file contains hidden or 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
| @Composable | |
| fun MedicationApp() { | |
| MedicationAppTheme { | |
| Surface( | |
| modifier = Modifier.fillMaxSize(), | |
| color = MaterialTheme.colorScheme.background | |
| ) { | |
| AddMedicationScreen() | |
| } | |
| } |
This file contains hidden or 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
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContent { | |
| MedicationApp() | |
| } | |
| } |
This file contains hidden or 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
| plugins { | |
| id("com.android.application") version "8.2.0-beta01" apply false | |
| id("org.jetbrains.kotlin.android") version "1.8.10" apply false | |
| } |
This file contains hidden or 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
| plugins { | |
| id("com.android.application") | |
| id("org.jetbrains.kotlin.android") | |
| id("kotlin-kapt") | |
| id("kotlin-parcelize") | |
| } | |
| android { | |
| namespace = "com.example.medicationapp" | |
| compileSdk = 34 |
This file contains hidden or 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
| import org.gradle.kotlin.dsl.`kotlin-dsl` | |
| repositories { | |
| mavenCentral() | |
| } | |
| plugins { | |
| `kotlin-dsl` | |
| } |
This file contains hidden or 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
| @Composable | |
| fun ProfileProperty(label: String, value: String) { | |
| Column(modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp)) { | |
| Divider(modifier = Modifier.padding(bottom = 4.dp)) | |
| Text( | |
| text = label, | |
| modifier = Modifier.height(24.dp), | |
| style = MaterialTheme.typography.caption, | |
| ) | |
| Text( |
This file contains hidden or 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
| @Composable | |
| private fun ProfileContent(puppy: Puppy, containerHeight: Dp) { | |
| Column { | |
| Title(puppy) | |
| ProfileProperty(stringResource(R.string.sex), puppy.sex) | |
| ProfileProperty(stringResource(R.string.age), puppy.age.toString()) | |
| ProfileProperty(stringResource(R.string.personality), puppy.description) | |
| Spacer(Modifier.height((containerHeight - 320.dp).coerceAtLeast(0.dp))) | |
| } |