Skip to content

Commit 1b381c7

Browse files
committed
Apparently still didn't add the new Wall class on the last checkin. This should do it.
1 parent e992f68 commit 1b381c7

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package org.unallocatedspace.uasapp;
2+
3+
import java.net.MalformedURLException;
4+
import java.net.URI;
5+
6+
import android.app.Activity;
7+
import android.util.Log;
8+
9+
/**
10+
* The Wall object is used to retrieve the Wall image URI. The main work of
11+
* downloading the image and writing it to the file system is done by Info.java,
12+
* however, the wall specific information if handled by this class.
13+
*
14+
* @author Usako
15+
*/
16+
public class Wall {
17+
private static final String WALL_URL = "http://www.unallocatedspace.org/thewall/thewall.jpg";
18+
private static final String WALL_FILENAME = "thewall.jpg";
19+
private Info space;
20+
private URI wallImageURI;
21+
private static final String LOG_ID = "Wall";
22+
23+
/**
24+
* Creates member objects from the Info class and adds them to the array
25+
* members.
26+
*/
27+
Wall(Activity activity) {
28+
try {
29+
this.space = new Info(activity, WALL_URL);
30+
this.refresh();
31+
} catch (MalformedURLException e) {
32+
/*
33+
* We should catch this exception but I don't know where to log it
34+
* or how better to handle it. Will update this later.
35+
*/
36+
Log.e(LOG_ID, "Caught MalformedURLException: " + e.getMessage());
37+
}
38+
}
39+
40+
/**
41+
* Refreshes all member objects.
42+
*
43+
* Calls getMessage() methods of all other objects to keep them up to date.
44+
* Each time the activity page awakens, it will call this method to ensure
45+
* freshness.
46+
*/
47+
public void refresh() {
48+
this.wallImageURI = this.space.getImage(WALL_FILENAME);
49+
}
50+
51+
public URI getImgURI() {
52+
return this.wallImageURI;
53+
}
54+
}

0 commit comments

Comments
 (0)