Lecture 3 & HW 3: Animations, Intents and Manifest
Last updated
Last updated
We’ll be creating a simple weather app this week. In this app, users can adjust the temperature and weather conditions, get the weather based on the user’s location (not the location’s actual weather!), and send the current weather information to someone as a text.
This is what the app should look like:
The background color and the icon should change according to the weather conditions, and the temperature should change with the slider. The “Get Location Weather” button should also change the icon and the background according to the fake weather value calculated by the user's location.
There must be a Text component that displays the temperature and a slider that changes the temperature.
There must be an Icon component that displays the icon based on the current weather.
There must be 4 or more buttons for each weather condition, and pressing this button should change the Icon and the background color according to the weather.
The icon and color changes should be smooth and done using Animations. You’re free to pick the icons and colors!
There should be a button to get the current location’s color. If location permissions are not granted, this button should say “Request permission” and clicking it would launch a permission request. If permissions are granted, it should say “Get Location Weather” and clicking it should change the icon and background color according to the location weather.
Find the remainder when the location’s latitude or longitude is divided by the number of weather conditions. Use this remainder to deduce the weather condition (remainder of 0-> Sunny, remainder of 1->Rain, etc)
It may be the case that your emulator will return a null location! The best way to test this feature is to use a physical device; however, if you don't have one, you can hardcode the latitude to test the feature and comment out this hardcoded value before you submit.
Use FusedLocationProviderClient to get the last known location. Make sure you add null checks as the returned location could be null!
Add a share button to share the current weather and temperature with other apps (through an ACTION_SEND intent). The text should say "It is currently <weather condition> with a temperature of <temperature> degrees"
You may need to add an app chooser to start the intent properly, as there may be many possible apps to use to send the text.
After completing the assignment, you will need to export your project as a zip file and upload it to CMS which you can see in the tutorial on this page: Importing, Exporting, & Submitting Your Project
If you have any trouble at all, do not hesitate to reach out to the course staff, we are all happy to help or just talk! Best of luck!