MultiImagePicker Library for Multiple Image Selection

App developmentcan be done in more than a handful of ways. You can write every single … more

Shoot Troubles, Not Users w/ Alex Boag-Munroe – XDA:DevCon 2014

In presenting the various sessions from XDA:DevCon 2014, weve mainly … more

Oppo Releases ColorOS for the Find 5… Poorly

Almost every OEM has taken the liberty of creating its own incarnation of the Android OS. … more

XDA LG Development Challenge Winners

Almost 3months ago, we set out with LGto findtwo amazing apps that developers could put together … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Zooper Clock with Time-Accurate Sun/Moon-rise/set

OP lydonw

30th June 2014, 07:38 PM   |  #1  
OP Junior Member
Thanks Meter: 2
 
8 posts
Join Date:Joined: May 2012
This is a project I have been working on for the last couple weeks.

Premise: I wanted to display the current weather conditions and moon phase as an icon, while also putting their position on an arc that represents their position between when they rise and set. I was also not satisfied with existing solutions which used a half circle, as I found the height of the 180 degree arc unpleasant, and wanted something a bit shallower.

Result: This widget displays the time, date, sunrise/set time, current temp, the day's high/low, with current wind speed and direction. These are in a static position. The current moon phase and weather conditions each move along a 120 degree arc, and are shown for the periods at which they are visible. At night a field of stars is displayed with astrological constellations highlighted, roughly accurate to the day of the year (not pictured).

Extension: Using popup widget 2, clicking on the current conditions or current moon phase icon pops up another widget, which displays the weather/moon forecast.

Time & Weather Zooper widget: attached
Weather Popup widet: attached
Moon Phrase popup widget: attached
Popup widget 2: Available on play store (I can't post links yet)
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2014-06-23-12-48-40.jpg
Views:	370
Size:	203.1 KB
ID:	2825807   Click image for larger version

Name:	Screenshot_2014-06-23-12-48-44.jpg
Views:	294
Size:	209.3 KB
ID:	2825808   Click image for larger version

Name:	Screenshot_2014-06-23-12-48-57.jpg
Views:	291
Size:	208.4 KB
ID:	2825809  
Attached Files
File Type: zip Time and Weather.zwapk.zip - [Click for QR Code] (1,018.4 KB, 50 views)
File Type: zip Weather Pop-up.zwapk.zip - [Click for QR Code] (50.3 KB, 19 views)
File Type: zip Moon Phase Pop Up.zwapk.zip - [Click for QR Code] (215.4 KB, 41 views)
The Following User Says Thank You to lydonw For This Useful Post: [ View ]
30th June 2014, 08:02 PM   |  #2  
OP Junior Member
Thanks Meter: 2
 
8 posts
Join Date:Joined: May 2012
Wanted to provide a few more details.

The advanced parameters for the current weather conditions are as follows:
[ar]160[/ar]
[as]$-60+((120/((#ASH#+(#ASmm#/60))-(#ARH#+(#ARmm#/60))))*(#DH#-#ARH#)))$[/as]

This essentially determines how many hours (in decimals) there will be in the day, which is used to determine how many steps will be necessary to show the sun's arc over 120 degrees. This is then multiplied by the number of hours that have past since sunrise, and sets sunrise at -60 degrees (or the left horizon).


The truly troubling one was setting the Moon's arc, specifically because it is more complicated. This is because the moon can rise and set at vastly different times, the most problematic being when the moon rises before midnight and sets after; this breaks the math I used for the sun, as sunset hour ends up being less than sunrise hour at these times.

The advanced parameters I used for the moon are as follows:
[ar]160[/ar]
[as]$#AMSH#<#AMRH#&&#DH#>#AMRH#?(-60+((120/((24+#AMSH#+(#AMSmm#/60))-(#AMRH#+(#AMRmm#/60))))*(#DH#-#AMRH#)))$
$#AMSH#<#AMRH#&&#DH#<#AMRH#?((120/((24+#AMSH#+(#AMSmm#/60))-(#AMRH#+(#AMRmm#/60))))*(#DH#))$
$#AMSH#>#AMRH#?(-60+((120/((#AMSH#+(#AMSmm#/60))-(#AMRH#+(#AMRmm#/60))))*(#DH#-#AMRH#)))$[/as]

This one is much more complicated, but essentially considers three conditions -

1) Will the sunset be earlier than the sunrise, and is the current time greater than sunrise? If these are true, this tells me that the moon will cross the midnight threshold, but has not yet done so. What follows is a formula similar to the current conditions arc, but adds 24 to #AMSH# to accurately determine how many hours the moon will be in the sky.
2) Will the sunset be earlier than the sunrise, and is the current time less than sunrise? If these are true, this tells me the moon has already crossed the midnight threshold. The previous formula is used, although arc origin is not moved -60 degrees, and the current hour is used to determine location on the arc (#AMRH# is not subtracted from it).
3) Will sunset be later than sunrise? If true, the moon will not cross the midnight threshold and my formula is largely unchanged from that which governs the current weather condition arc.


(hopefully someone finds all of this useful. If there is anything incorrect about this, please let me know)
The Following User Says Thank You to lydonw For This Useful Post: [ View ]
13th August 2014, 01:59 PM   |  #3  
Junior Member
Thanks Meter: 0
 
9 posts
Join Date:Joined: Aug 2014
More
Quote:
Originally Posted by lydonw

Wanted to provide a few more details.

The advanced parameters for the current weather conditions are as follows:
[ar]160[/ar]
[as]$-60+((120/((#ASH#+(#ASmm#/60))-(#ARH#+(#ARmm#/60))))*(#DH#-#ARH#)))$[/as]

This essentially determines how many hours (in decimals) there will be in the day, which is used to determine how many steps will be necessary to show the sun's arc over 120 degrees. This is then multiplied by the number of hours that have past since sunrise, and sets sunrise at -60 degrees (or the left horizon).


The truly troubling one was setting the Moon's arc, specifically because it is more complicated. This is because the moon can rise and set at vastly different times, the most problematic being when the moon rises before midnight and sets after; this breaks the math I used for the sun, as sunset hour ends up being less than sunrise hour at these times.

The advanced parameters I used for the moon are as follows:
[ar]160[/ar]
[as]$#AMSH#<#AMRH#&&#DH#>#AMRH#?(-60+((120/((24+#AMSH#+(#AMSmm#/60))-(#AMRH#+(#AMRmm#/60))))*(#DH#-#AMRH#)))$
$#AMSH#<#AMRH#&&#DH#<#AMRH#?((120/((24+#AMSH#+(#AMSmm#/60))-(#AMRH#+(#AMRmm#/60))))*(#DH#))$
$#AMSH#>#AMRH#?(-60+((120/((#AMSH#+(#AMSmm#/60))-(#AMRH#+(#AMRmm#/60))))*(#DH#-#AMRH#)))$[/as]

This one is much more complicated, but essentially considers three conditions -

1) Will the sunset be earlier than the sunrise, and is the current time greater than sunrise? If these are true, this tells me that the moon will cross the midnight threshold, but has not yet done so. What follows is a formula similar to the current conditions arc, but adds 24 to #AMSH# to accurately determine how many hours the moon will be in the sky.
2) Will the sunset be earlier than the sunrise, and is the current time less than sunrise? If these are true, this tells me the moon has already crossed the midnight threshold. The previous formula is used, although arc origin is not moved -60 degrees, and the current hour is used to determine location on the arc (#AMRH# is not subtracted from it).
3) Will sunset be later than sunrise? If true, the moon will not cross the midnight threshold and my formula is largely unchanged from that which governs the current weather condition arc.


(hopefully someone finds all of this useful. If there is anything incorrect about this, please let me know)


I just wanted to say that this is really awesome. I just got into Zooper last week, and one of the first things I did was to try to create a moon phase widget. I was able to come up with something that works "ok", but it's ugly as sin and could definitely use a lot of improvement. If I have some time, I'm going to try yours out. Also, the explanation on the math and advanced parameters is helpful as I was disappointed that Zooper didn't handle the time math in the way I expected.

Thanks,
Jeremy
7th September 2014, 05:32 PM   |  #4  
Junior Member
Thanks Meter: 0
 
5 posts
Join Date:Joined: Jul 2008
I find very interesting your work: it was long expected that a solution like the one you proposed. Thank you. I'm trying to apply your directions, but I trust in your work complete.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes