159.336 Assignment 2
Due 20th September 2019
For this assignment you need to write a simple gallery application for Android to view all the photos that are stored on the device.
The gallery must show a scrollable grid of all photos.
When you click on a photo it must open in a separate activity which shows only that photo.
Your app must use a GridView and an Adapter, the Adapter must load photos using a background thread.
Use the MediaStore content provider to get a Cursor for all photos ordered by date added with the most recent first. The file path for a photo is stored in the MediaStore.Images.Media.DATA column.
You can use BitmapFactory.decodeFile with inSampleSize Options to load a low resolution image and ThumbnailUtils.extractThumbnail to create a reasonable size thumbnail. You may need to rotate the thumbnail depending on the MediaStore.Images.Media.ORIENTATION.
To speed up loading you may want to use a cache of thumbnails. You are not allowed to use an image library such as Picasso or Glide but you can use a memory or disk cache as described here:
https://developer.android.com/topic/performance/graphics/cache-bitmap
The single photo activity view should have a higher resolution than the thumbnail. You can optionally add pinch to zoom to the photo viewer and gallery. Make sure your app behaves correctly when the device is rotated and when photos are added or deleted. Make sure your app works with large images, i.e. up to 12MP.
Submit your assignment on Stream. You must submit a zip file containing a clean source tree. To do this, use ¡°Build..Clean Project¡± in Android Studio and then create a zip file of the ¡°app¡± directory. You do not need to submit an apk. Do not use any libraries other than those included in the latest Android SDK. Marks will be deducted for zip files which do not build correctly.
This is an individual assignment, you can not work in groups. Marks will be awarded for well written programs. Use comments in your code to document it. Marks will be subtracted for plagiarism, late submission and bad documentation.
This assignment is worth 10% of the total marks for the course.
M Johnson 2019