Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Read and write data from/to Health Connect (#2)
* Read data * Write data to Health Connect
- Loading branch information
1 parent
b85b08f
commit 8e34516
Showing
8 changed files
with
155 additions
and
38 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
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/eevajonna/period/data/MenstruationPeriodRecord.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,11 @@ | ||
package com.eevajonna.period.data | ||
|
||
import androidx.health.connect.client.records.MenstruationPeriodRecord | ||
import com.eevajonna.period.ui.utils.TimeUtils | ||
import java.time.LocalDate | ||
|
||
fun MenstruationPeriodRecord.startDateToLocalDate(): LocalDate = TimeUtils.instantToLocalDate(this.startTime) | ||
|
||
fun MenstruationPeriodRecord.endDateToLocalDate(): LocalDate = TimeUtils.instantToLocalDate(this.endTime) | ||
|
||
fun MenstruationPeriodRecord.isCurrent(): Boolean = this.startDateToLocalDate().isEqual(this.endDateToLocalDate()) |
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/eevajonna/period/ui/PeriodViewModel.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
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