Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add civil, nautical and astronomical dawn/dusk times to auto-enable filter #280

Open
Totorrr opened this issue Dec 19, 2020 · 1 comment
Labels
enhancement good first issue These issues are relatively simple and self-contained.

Comments

@Totorrr
Copy link

Totorrr commented Dec 19, 2020

I would like to be able to use civil, nautical or astronomical dawn/dusk times, and not only sunrise/sunset times, to disable/enable the Red Moon filter.

Especially because the transition is not progressive at the moment, it would be particularly interesting to keep the screen unfiltered up to the nautical dusk ("sunset") time for example. Because natural light is usually still strong right after sunset. This is even more the case as your are close to a pole during your hemisphere's summer solstice.

Another option would be progressive transitioning, as described in #33. But it may be more complicated to implement. Sometimes, it is just more practical to make better rather than make best. :)

@smichel17 smichel17 added the good first issue These issues are relatively simple and self-contained. label May 23, 2021
@smichel17
Copy link
Member

I would implement this as an additional setting, "Sunset type" with options civil/nautical/astronomical — although maybe there are other words that a layperson is more likely to understand that could be used instead.

I would be inclined to remove this setting if a gradual transition (#33), but since this is indeed easier to implement, I would accept a PR adding it. Probably these are the only lines of kotlin you'd need to touch (plus the xml to add the setting, of course)

const val DEFAULT_SUNSET = "19:30"
val sunsetTime: String
get() {
val (latitude, longitude, time) = location
return if (time == null) {
DEFAULT_SUNSET
} else {
val sunLocation = com.luckycatlabs.sunrisesunset.dto.Location(latitude, longitude)
val calculator = SunriseSunsetCalculator(sunLocation, TimeZone.getDefault())
calculator.getOfficialSunsetForDate(Calendar.getInstance())
}
}
const val DEFAULT_SUNRISE = "06:30"
val sunriseTime: String
get() {
val (latitude, longitude, time) = location
return if (time == null) {
DEFAULT_SUNRISE
} else {
val sunLocation = com.luckycatlabs.sunrisesunset.dto.Location(latitude, longitude)
val calculator = SunriseSunsetCalculator(sunLocation, TimeZone.getDefault())
calculator.getOfficialSunriseForDate(Calendar.getInstance())
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue These issues are relatively simple and self-contained.
Development

No branches or pull requests

2 participants