-
Notifications
You must be signed in to change notification settings - Fork 13
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
676bbb5
commit 04a989d
Showing
28 changed files
with
248 additions
and
128 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
2 changes: 1 addition & 1 deletion
2
.../com/mensinator/app/CalculationsHelper.kt → ...inator/app/business/CalculationsHelper.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
2 changes: 1 addition & 1 deletion
2
.../java/com/mensinator/app/DatabaseUtils.kt → .../mensinator/app/business/DatabaseUtils.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,4 @@ | ||
package com.mensinator.app | ||
package com.mensinator.app.business | ||
|
||
import android.database.sqlite.SQLiteDatabase | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...n/java/com/mensinator/app/ExportImport.kt → ...m/mensinator/app/business/ExportImport.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
2 changes: 1 addition & 1 deletion
2
...com/mensinator/app/ICalculationsHelper.kt → ...nator/app/business/ICalculationsHelper.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,4 @@ | ||
package com.mensinator.app | ||
package com.mensinator.app.business | ||
|
||
import java.time.LocalDate | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
.../java/com/mensinator/app/IExportImport.kt → .../mensinator/app/business/IExportImport.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
2 changes: 1 addition & 1 deletion
2
.../mensinator/app/INotificationScheduler.kt → ...or/app/business/INotificationScheduler.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,4 @@ | ||
package com.mensinator.app | ||
package com.mensinator.app.business | ||
|
||
import java.time.LocalDate | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...om/mensinator/app/IOvulationPrediction.kt → ...ator/app/business/IOvulationPrediction.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,4 @@ | ||
package com.mensinator.app | ||
package com.mensinator.app.business | ||
|
||
import java.time.LocalDate | ||
|
||
|
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
2 changes: 1 addition & 1 deletion
2
...a/com/mensinator/app/IPeriodPrediction.kt → ...sinator/app/business/IPeriodPrediction.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,4 @@ | ||
package com.mensinator.app | ||
package com.mensinator.app.business | ||
|
||
import java.time.LocalDate | ||
|
||
|
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
2 changes: 1 addition & 1 deletion
2
...com/mensinator/app/OvulationPrediction.kt → ...nator/app/business/OvulationPrediction.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
2 changes: 1 addition & 1 deletion
2
...va/com/mensinator/app/PeriodPrediction.kt → ...nsinator/app/business/PeriodPrediction.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,4 @@ | ||
package com.mensinator.app | ||
package com.mensinator.app.business | ||
|
||
import java.time.LocalDate | ||
|
||
|
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
137 changes: 137 additions & 0 deletions
137
app/src/main/java/com/mensinator/app/calendar/SymptomDialogs.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,137 @@ | ||
package com.mensinator.app.calendar | ||
|
||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.* | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.mensinator.app.settings.ResourceMapper | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.mensinator.app.R | ||
import com.mensinator.app.data.Symptom | ||
import com.mensinator.app.ui.theme.MensinatorTheme | ||
import java.time.LocalDate | ||
|
||
@Composable | ||
fun EditSymptomsForDaysDialog( | ||
date: LocalDate, | ||
symptoms: List<Symptom>, | ||
currentlyActiveSymptomIds: Set<Int>, | ||
onSave: (List<Symptom>) -> Unit, | ||
onCancel: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
var selectedSymptoms by remember { | ||
mutableStateOf( | ||
symptoms.filter { it.id in currentlyActiveSymptomIds }.toSet() | ||
) | ||
} | ||
|
||
AlertDialog( | ||
onDismissRequest = { onCancel() }, | ||
confirmButton = { | ||
Button( | ||
onClick = { | ||
onSave(selectedSymptoms.toList()) | ||
}, | ||
modifier = Modifier.fillMaxWidth() | ||
) { | ||
Text(text = stringResource(id = R.string.save_symptoms_button)) | ||
} | ||
}, | ||
modifier = modifier, | ||
dismissButton = { | ||
Button( | ||
onClick = { | ||
onCancel() | ||
}, | ||
modifier = Modifier.fillMaxWidth() | ||
) { | ||
Text(text = stringResource(id = R.string.cancel_button)) | ||
} | ||
}, | ||
title = { | ||
Text(text = stringResource(id = R.string.symptoms_dialog_title, date)) | ||
}, | ||
text = { | ||
Column(modifier = Modifier.verticalScroll(rememberScrollState())) { | ||
symptoms.forEach { symptom -> | ||
val symptomKey = ResourceMapper.getStringResourceId(symptom.name) | ||
val symptomDisplayName = symptomKey?.let { stringResource(id = it) } ?: symptom.name | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(8.dp) | ||
.clickable { | ||
selectedSymptoms = if (selectedSymptoms.contains(symptom)) { | ||
selectedSymptoms - symptom | ||
} else { | ||
selectedSymptoms + symptom | ||
} | ||
}, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Checkbox( | ||
checked = selectedSymptoms.contains(symptom), | ||
onCheckedChange = null | ||
) | ||
Spacer(modifier = Modifier.width(8.dp)) | ||
Text(text = symptomDisplayName) | ||
} | ||
} | ||
// Spacer(modifier = Modifier.height(16.dp)) | ||
// Button( | ||
// onClick = { | ||
// onCreateNewSymptom() | ||
// }, | ||
// modifier = Modifier.fillMaxWidth() | ||
// ) { | ||
// Text(text = stringResource(id = R.string.create_new_symptom_button)) | ||
// } | ||
} | ||
}, | ||
) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun EditSymptomsForDaysDialog_OneDayPreview() { | ||
val symptoms = listOf( | ||
Symptom(1, "Light", 0, ""), | ||
Symptom(2, "Medium", 1, ""), | ||
) | ||
MensinatorTheme { | ||
EditSymptomsForDaysDialog( | ||
date = LocalDate.now(), | ||
symptoms = symptoms, | ||
currentlyActiveSymptomIds = setOf(2), | ||
onSave = {}, | ||
onCancel = { }, | ||
) | ||
} | ||
} | ||
|
||
// TODO: Fix within https://github.com/EmmaTellblom/Mensinator/issues/203 | ||
@Preview | ||
@Composable | ||
private fun EditSymptomsForDaysDialog_MultipleDaysPreview() { | ||
val symptoms = listOf( | ||
Symptom(1, "Light", 0, ""), | ||
Symptom(2, "Medium", 1, ""), | ||
) | ||
MensinatorTheme { | ||
EditSymptomsForDaysDialog( | ||
date = LocalDate.now(), | ||
symptoms = symptoms, | ||
currentlyActiveSymptomIds = setOf(2), | ||
onSave = {}, | ||
onCancel = { }, | ||
) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...c/main/java/com/mensinator/app/Setting.kt → ...n/java/com/mensinator/app/data/Setting.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,4 @@ | ||
package com.mensinator.app | ||
package com.mensinator.app.data | ||
|
||
data class Setting( | ||
val key: String, | ||
|
2 changes: 1 addition & 1 deletion
2
...c/main/java/com/mensinator/app/Symptom.kt → ...n/java/com/mensinator/app/data/Symptom.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,4 @@ | ||
package com.mensinator.app | ||
package com.mensinator.app.data | ||
|
||
data class Symptom( | ||
val id: Int, | ||
|
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
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
Oops, something went wrong.