联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2020-09-20 10:14

159.336 Assignment 2

Due 18th September 2020

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 or RecyclerView 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.

If you use a target API of 29, you need to set requestLegacyExternalStorage to true in the manifest file to allow access to the

filesystem. If you use a target API of 30, use a content URI with the _ID column appended and BitmapFactory.decodeStream

with ContentResolver.openInputStream instead of decodeFile and the file path.

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


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp