Comments (7)
Non-repeating alarms will be pretty easy. It just requires a bit of UI.
Repeating alarms are more challenging. It requires that Suntimes Alarms somehow know how to schedule these "roman hour events" (preferably without hardcoding that into the alarm clock itself).
I think I've found a pattern that can make this work.. Add-ons could provide their own custom events by implementing an interface (ContentProvider), and advertise that as part of their manifest. It should supply two methods; one that returns a list of event names, and another that returns the next timestamp for a given event. Suntimes Alarms would then scan for implementations when it starts and show any custom events in the alarm dialog. Internally it would continue to store the event name (no changes to the database), which could be extended to encode the ContentProvider uri. Later when a repeating alarm needs to be (re)scheduled and one of these uri's is encountered, the next timestamp could be queried - the scheduling is delegated to the addon (vs running an algorithm directly).
Something similar was done in the latest Suntimes Calendars implementation, where addons can now advertise a "calendar provider" in their manifest, which is then queried to create the list of available calendars. That allows the SolunarPeriods app to provide a "hunting and fishing" calendar.
Anyhow, thinking aloud.. This is probably some uninteresting detail, but it helps me to talk it through.
from naturalhour.
The alarms branch can now do this, when used with a version of Suntimes from the alarm-addon branch. Its necessary to rebuild both apps.
The plan is to release Suntimes v0.14.0
some time in January, and then Natural Hour v0.2.0
with the alarm feature after that.
from naturalhour.
These are 'moments', similar to minutes, except 40 to an "hour", with variable length. I think I remember reading this was a medieval thing. The hour is divided into quarters, and then each quarter divided into ten. It is basically just a fraction though (20/40 is half past), and I was considering simplifying it.
from naturalhour.
Nice and elegant way of integrating the event names and timestamps!
from naturalhour.
Thank you for this, setting and launching alarms on times related to roman hours is working. ππ½
Out of interest: Δ° have 39 subdivisions for every day-hours and night-hours even if they are not as long. How is the calculation done?
from naturalhour.
How is the calculation done?
In case you were actually asking about code.. The scheduling algorithm
basically reduces the moment to a float [0,1], then calls this function
which multiplies it by the length of the hour (day-hour vs night-hour), and adds to it. It basically boils down to..
Calendar calendar = Calendar.getInstance();
float hourLength = (hourNum >= 12) ? (naturalHours[13] - naturalHours[12]) : (naturalHours[1] - naturalHours[0]);
long momentMillis = (long)(hourLength * moments);
calendar.setTimeInMillis(naturalHours[hourNum] + momentMillis);
where naturalHours[]
contains timestamps (milliseconds) for each hour, previously assigned by
from naturalhour.
Thank you for these detailed answers! π
from naturalhour.
Related Issues (19)
- RFE: Day Hours begin HOT 5
- Documentation HOT 5
- Broken UI - Missing first hour - Watches HOT 3
- The widget does not update HOT 7
- DST Discussion - bug HOT 6
- false Apparent Solar Time timezone HOT 1
- Wear OS watch face HOT 1
- RFE: Start of Day options HOT 1
- unable to set alarm for all hours when using "sunset (24)"
- watch face show broken daylight HOT 3
- Solar midnight
- Feature request: Android screensaver support
- Wigdet hangs HOT 2
- Widget aspect HOT 1
- General thoughts on the clockface HOT 4
- Testing the .apk - unable to install HOT 4
- Feature: βhorizontalβ one-hour widget HOT 1
- Suggestion: colors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from naturalhour.