Comment on page
Lecture 5 & HW 5: Fragments, Navigation, and Networking
Complete Lecture Demo - 10/30/2023
in class code
Your task this week is to create a simple wallpaper app using
Fragmentsthat you can swipe through, a category of apps that sprung up in the heyday of user customization and have been popular ever since. The images in the application will be pulled from the internet using networking and the Pixabay open API. This homework, modeled roughly after them, will give you a rough idea of how the Gallery app functions on your phone. Once again, you'll have a lot of freedom over how this app looks and functions, given a few guidelines below.
We have provided you all with starter code that makes the networking call for you. We want you all to examine this code since networking can be confusing. This week we will give you the code to study and use, but next week you all will generate the code yourselves for the next homework assignment.
1. Your app should allow the user to choose from all 6 of the different wallpapers images from the networking call.
2. Your app should contain one activity that features multiple fragments; however, there need only be one
Fragmentclass used for displaying the available wallpapers. Each fragment should display only one image at a time and should include a way for the user to set the image as their phone's wallpaper.
3. The app should also include a second
Fragmentclass that acts as the home screen. This home screen is reachable from the wallpapers and vice versa. The app's homescreen could have a greeting message on it, be a display of all of the wallpapers in a gallery view or whatever you'd like!
- Take advantage of the Fragment newInstance method with how it takes in parameters and passes them in as arguments to the Fragment. When you create a new fragment there's template arguments but you can adjust them to your needs. Alternatively you can try adapting the Singleton pattern!
- You can use Glide, an image loading library, to populate your
ImageViewwith the image corresponding to the image URL you receive from the networking call. See the demo for an example of how to use Glide in conjunction with the networking helper code we give you.
- Setting the Wallpaper in Android requires the following NORMAL permission:
<uses-permission android:name="android.permission.SET_WALLPAPER" />
These are optional challenge problems, and completing each successfully will earn you 1 extra point per problem. If you do attempt a challenge problem, make sure to include a
README.txtthat states which problem(s) you've attempted!
- Modify the GET request to get spring inspired images.
- Imitate the Gallery app to it's fullest extent by reading images from folders in local storage (rather than the internal
drawablefolder or from networking calls)
- Design and implement a live wallpaper of any sort, from programmatic vector drawing to simple animation.
For this assignment, you may need to figure out a few things on your own. Some classes that may be helpful for this assignment include:
For basic functionality: