Anda di halaman 1dari 23

Case Study: ImageDownloader App

(Part 1)
Douglas C. Schmidt
d.schmidt@vanderbilt.edu
www.dre.vanderbilt.edu/~schmidt

Institute for Software


Integrated Systems
Vanderbilt University
Nashville, Tennessee, USA
Learning Objectives in this Part of the Lesson
1. Recognize key elements in
the ImageDownloader app’s
design

2
Learning Objectives in this Part of the Lesson
1. Recognize key elements in
the ImageDownloader app’s
design
2. Know how to run the app
& interpret its UI & output

Activity
1

Activity
2

Activity
3

3
Learning Objectives in this Part of the Lesson
1. Recognize key elements in
the ImageDownloader app’s
design
2. Know how to run the app
& interpret its UI & output

The goal is to make it easier to understand


4 the detailed source code walkthrough
Key Design Elements in the
ImageDownloader App

5
Key Design Elements in the ImageDownloader App
• The ImageDownloader app
uses three activities

Activity
1

Activity
2

Activity
3

See gitlab.com/vandy-aad-2/ImageDownloader
6
Key Design Elements in the ImageDownloader App
• The ImageDownloader app
uses three activities
1. Prompts user for a URL

Activity
1

Activity
2

Activity
3

7
Key Design Elements in the ImageDownloader App
• The ImageDownloader app
uses three activities
1. Prompts user for a URL
2. Downloads & stores
the image

Activity
1

Activity
2

Activity
3

8
Key Design Elements in the ImageDownloader App
• The ImageDownloader app
uses three activities
1. Prompts user for a URL
2. Downloads & stores
the image
3. Displays the image
Activity
1

Activity
2

Activity
3

9
Key Design Elements in the ImageDownloader App
• The ImageDownloader app
uses three activities
1. Prompts user for a URL
2. Downloads & stores
the image
3. Displays the image
Activity
1
App
Activity A
2
These activities are
both defined in the Activity App
ImageDownloader app 3 B

10
Key Design Elements in the ImageDownloader App
• The ImageDownloader app
uses three activities
1. Prompts user for a URL
2. Downloads & stores
the image
3. Displays the image
Activity
1
App
Activity A
2

Activity App
3 B
This activity is defined in the Gallery app

See packages/apps/Gallery2/src/com/android/gallery3d/app/Gallery.java
11
Key Design Elements in the ImageDownloader App
• The AndroidManifest.xml file declares two activities

12
Key Design Elements in the ImageDownloader App
• The AndroidManifest.xml file declares two activities

13
Key Design Elements in the ImageDownloader App
• The AndroidManifest.xml file declares two activities
• DownloadImageActivity handles implicit DOWNLOAD_IMAGE intents

14
Key Design Elements in the ImageDownloader App
• The AndroidManifest.xml file declares two activities
• DownloadImageActivity handles implicit DOWNLOAD_IMAGE intents
• A FileProvider is used to ensure the downloaded image can be stored
securely in external device storage

See developer.android.com/reference/android/support/v4/content/FileProvider.html
15
Key Design Elements in the ImageDownloader App
• There are four classes related to
activities in ImageDownloader

We’ll examine the source code for


16 most of these activities in detail
Key Design Elements in the ImageDownloader App
• There are four classes related to
activities in ImageDownloader

Defines a common super class17for logging lifecycle operations


Key Design Elements in the ImageDownloader App
• There are four classes related to
activities in ImageDownloader

Defines a common super class that 18


handles dynamic Android permissions
Key Design Elements in the ImageDownloader App
• There are four classes related to
activities in ImageDownloader

Prompts user for image URL & uses intents


19 & activities to download & view image
Key Design Elements in the ImageDownloader App
• There are four classes related to
activities in ImageDownloader

Downloads image, stores it in local20


file, & returns a Uri to this image file
Key Design Elements in the ImageDownloader App
• There are four other classes that
provide various utility methods

We will examine these utility classes


21 briefly since we focus on activities
Running the App
ImageDownloader

22
End of Case Study of the
ImageDownloader App
(Part 1)
23

Anda mungkin juga menyukai