You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Hannah, thanks so much for starting this project. I'm not a frequent programmer, so having this backbone in place for me to tweak for my needs has been greatly appreciated. I wanted to share some things that I've discovered in case you want to incorporate the changes. I'll only go over general concepts of my major changes, but I would be happy to share the actual code if you want details.
ForecastModule:
I wanted a little more out of the weather forecast, so I pulled in a few more items from the json and updated the layout:
currently.icon: A machine readable icon description used to show the associated Climacon. This required a new ImageView and corresponding switch statement to assign the right .png.
daily.data.get(0).temperatureMax: Today's max temperature.
daily.data.get(0).temperatureMin: Today's min temperature.
hourly.summary: Human readable description of today's weather.
NewsModule:
I wanted to see the top 5 headlines, so I just arrayified everything and added a for loop to populate it. I also added an icon to help the headlines stand out.
CalendarModule:
I've been fiddling with this the most because it's the feature that's most appealing to me. I use this for chores, reminders, meetings, and a countdown to fun things I have planned in the future. This is what I've changed and a couple of things for you to keep in mind if you're not already aware:
Potential "bugs:" You are using the Events table in the Calendar provider to search for upcoming events. This is fine and dandy, but it will not catch instances of recurring events. I banged my head on this one for a bit since I have several recurring chore-like events. I switched to using the following public method of the CalendarContract.Instances class when assigning the cursor:
public static final Cursor query (ContentResolver cr, String[] projection, long begin, long end)
This grabs all of the event instances since the instances table contains 1 instance for each single event and 1 instance each for every iteration of a recurring event.
Your where clause will also not catch events that last through to the following day(s). You might want it function that way, but you may consider changing the clause from: (dtstart > start) and (dtend < endofday)
to: (dtstart > start) and (dtstart < endofday)
My updates and how I use this module: I created a new shared calendar specifically for the device running the app and have it as the only visible one. I put chores and reminder type events as well as fun events ("countdown events") that I have coming up. There's nothing special about the chores/reminders, but the countdown events start with a # (more on that shortly). I query all event instances on the calendar for the next six months (hopefully this doesn't come back to bite me, but the Instances query doesn't let you specify a where clause, so I guess I'd have to do another query to optimize this).
The first chore/reminder event is shown only if there is one happening today. In the attached screenshot, the text on the bottom is an event reminding me to pick up anything from the floor so my Roomba "Rosie" doesn't get in trouble while I'm at work. The first upcoming countdown event in the next 180 days is always visible (default text if none), and I calculate the days until that event. I can distinguish those events from others due to the #, and then just take the .substring(1) of the title to get it to display properly.
layout-land:
I created a new resource folder called layout-land and copied the activity_mirror.xml into it. Android will automatically switch the layout based on screen orientation, so now I can choose which orientation to run the device.
Here's what the layout looks like for now (I am constantly tweaking the layout because I'm never satisfied with how it looks. arrrrgggggghhhh.)
Oh, I also changed the app icon to Minecraft's Magic Mirror item... sorry, I couldn't resist! 😛
The text was updated successfully, but these errors were encountered:
Hey Hannah, thanks so much for starting this project. I'm not a frequent programmer, so having this backbone in place for me to tweak for my needs has been greatly appreciated. I wanted to share some things that I've discovered in case you want to incorporate the changes. I'll only go over general concepts of my major changes, but I would be happy to share the actual code if you want details.
ForecastModule:
I wanted a little more out of the weather forecast, so I pulled in a few more items from the json and updated the layout:
NewsModule:
I wanted to see the top 5 headlines, so I just arrayified everything and added a
for
loop to populate it. I also added an icon to help the headlines stand out.CalendarModule:
I've been fiddling with this the most because it's the feature that's most appealing to me. I use this for chores, reminders, meetings, and a countdown to fun things I have planned in the future. This is what I've changed and a couple of things for you to keep in mind if you're not already aware:
Potential "bugs:" You are using the Events table in the Calendar provider to search for upcoming events. This is fine and dandy, but it will not catch instances of recurring events. I banged my head on this one for a bit since I have several recurring chore-like events. I switched to using the following public method of the
CalendarContract.Instances
class when assigning the cursor:public static final Cursor query (ContentResolver cr, String[] projection, long begin, long end)
This grabs all of the event instances since the instances table contains 1 instance for each single event and 1 instance each for every iteration of a recurring event.
Your
where
clause will also not catch events that last through to the following day(s). You might want it function that way, but you may consider changing the clause from:(dtstart > start) and (dtend < endofday)
to:
(dtstart > start) and (dtstart < endofday)
My updates and how I use this module: I created a new shared calendar specifically for the device running the app and have it as the only visible one. I put chores and reminder type events as well as fun events ("countdown events") that I have coming up. There's nothing special about the chores/reminders, but the countdown events start with a
#
(more on that shortly). I query all event instances on the calendar for the next six months (hopefully this doesn't come back to bite me, but the Instances query doesn't let you specify awhere
clause, so I guess I'd have to do another query to optimize this).The first chore/reminder event is shown only if there is one happening today. In the attached screenshot, the text on the bottom is an event reminding me to pick up anything from the floor so my Roomba "Rosie" doesn't get in trouble while I'm at work. The first upcoming countdown event in the next 180 days is always visible (default text if none), and I calculate the days until that event. I can distinguish those events from others due to the
#
, and then just take the.substring(1)
of the title to get it to display properly.layout-land:
I created a new resource folder called
layout-land
and copied theactivity_mirror.xml
into it. Android will automatically switch the layout based on screen orientation, so now I can choose which orientation to run the device.Here's what the layout looks like for now (I am constantly tweaking the layout because I'm never satisfied with how it looks. arrrrgggggghhhh.)
Oh, I also changed the app icon to Minecraft's Magic Mirror item... sorry, I couldn't resist! 😛
The text was updated successfully, but these errors were encountered: