Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ class GardenTrackerFragment : Fragment()
if (it.off.isEmpty()) return@let
val lightOnTime = LocalTime.parse(it.on, DateTimeFormatter.ofPattern("HH:mm"))
val lightOffTime = LocalTime.parse(it.off, DateTimeFormatter.ofPattern("HH:mm"))
var diff = (abs(Duration.between(lightOnTime, lightOffTime).toMinutes()) / 15.0)
var addHours = 0L;
if (lightOnTime > lightOffTime) {
addHours = 24L;
}
var diff = ((Duration.between(lightOnTime, lightOffTime).plusHours(addHours).toMinutes()) / 15.0)
if (diff == 0.0) diff = 96.0
binding.lightRatio.progress = diff.toInt()

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/me/anon/lib/manager/PlantManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class PlantManager private constructor()
public fun initialise(context: Context)
{
this.context = context.applicationContext
FILES_DIR = this.context.getExternalFilesDir(null)!!.absolutePath
val file = File("/storage/emulated/0/Android/data/me.anon.grow/files")
FILES_DIR = file.absolutePath
}

public fun indexOf(plant: Plant) = plants.indexOfFirst { it.id == plant.id }
Expand Down