Permalink
Browse files

Merge branch 'master' of https://github.com/bettsmatt/CowsEye

  • Loading branch information...
2 parents 72731a1 + d00a4a7 commit e969383251c8979bd617d8f3db4a659e56552c9f iplk committed Oct 11, 2012
Showing with 36 additions and 24 deletions.
  1. BIN Android River Watch Application/Application builds/RiverWatch_Android_V1.0.apk
  2. BIN Android River Watch Application/Application builds/River_Watch_Android.KeyStore
  3. BIN Android River Watch Application/Screenshots/Google Play/River Watch 1.png
  4. BIN Android River Watch Application/Screenshots/Google Play/River Watch 2.png
  5. BIN Android River Watch Application/Screenshots/Google Play/River Watch 3.png
  6. BIN Android River Watch Application/Screenshots/Google Play/River Watch 4.png
  7. BIN Android River Watch Application/Screenshots/Google Play/River Watch 5.png
  8. BIN Android River Watch Application/Screenshots/Google Play/River Watch 6.png
  9. BIN Android River Watch Application/Screenshots/Google Play/River Watch 7.png
  10. BIN Android River Watch Application/Screenshots/Google Play/logo_512x512.png
  11. BIN Android River Watch Application/Screenshots/River Watch 1.png
  12. BIN Android River Watch Application/Screenshots/River Watch 2a.png
  13. BIN Android River Watch Application/Screenshots/River Watch 2b.png
  14. BIN Android River Watch Application/Screenshots/River Watch 2c.png
  15. BIN Android River Watch Application/Screenshots/River Watch 2d.png
  16. BIN Android River Watch Application/Screenshots/River Watch 3a.png
  17. BIN Android River Watch Application/Screenshots/River Watch 3b.png
  18. BIN Android River Watch Application/Screenshots/River Watch 3c.png
  19. BIN Android River Watch Application/Screenshots/River Watch 4a.png
  20. BIN Android River Watch Application/Screenshots/River Watch 4b.png
  21. BIN Android River Watch Application/Screenshots/River Watch 4c.png
  22. BIN Android River Watch Application/Screenshots/River Watch 5.png
  23. BIN Android River Watch Application/Screenshots/River Watch 6.png
  24. BIN Android River Watch Application/Screenshots/River Watch 7a.png
  25. BIN Android River Watch Application/Screenshots/River Watch 7b.png
  26. +2 −2 CowsEyeAndroidApplication/AndroidManifest.xml
  27. +1 −1 CowsEyeAndroidApplication/res/layout/location_layout.xml
  28. +1 −1 CowsEyeAndroidApplication/src/nz/co/android/cowseye/RiverWatchApplication.java
  29. +2 −1 CowsEyeAndroidApplication/src/nz/co/android/cowseye/activity/MainScreenActivity.java
  30. +1 −1 CowsEyeAndroidApplication/src/nz/co/android/cowseye/activity/TakePictureActivity.java
  31. +3 −1 CowsEyeAndroidApplication/src/nz/co/android/cowseye/common/Constants.java
  32. +11 −6 CowsEyeAndroidApplication/src/nz/co/android/cowseye/event/GetImageEvent.java
  33. +3 −3 CowsEyeAndroidApplication/src/nz/co/android/cowseye/event/GetIncidentsEvent.java
  34. +3 −3 CowsEyeAndroidApplication/src/nz/co/android/cowseye/event/SubmissionEvent.java
  35. +5 −3 CowsEyeAndroidApplication/src/nz/co/android/cowseye/service/GetImageAsyncTask.java
  36. +4 −2 CowsEyeAndroidApplication/src/nz/co/android/cowseye/service/GetIncidentsAsyncTask.java
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="nz.co.android.cowseye"
- android:versionCode="1"
- android:versionName="1.0" >
+ android:versionCode="2"
+ android:versionName="1.01" >
<uses-sdk android:minSdkVersion="8" />
@@ -31,7 +31,7 @@
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:apiKey="0W_gYkxqIw4QuXYkhYV0aSvFaypmJ1V3lLo6xlQ"
+ android:apiKey="0W_gYkxqIw4RKZGVAyZ0oxubP2GQuPDF45IAM2w"
android:clickable="true" />
<LinearLayout style="@style/location_layout_style" >
@@ -31,7 +31,7 @@
public class RiverWatchApplication extends Application {
/* Service paths */
- public static String server_path = "http://barretts.ecs.vuw.ac.nz:4567/wainz";
+ public static String server_path = "http://api.riverwatch.co.nz:80/wainz";
public static String submission_path = server_path + "/submit";
public static String get_incidents_path = server_path + "/approved";
public static String get_incidents_path_start = "/start=";
@@ -124,7 +124,8 @@ public void endGetIncidentsServiceCall(boolean result){
Toast.makeText(this, getString(R.string.failure_load_images_msg), Toast.LENGTH_LONG).show();
}
else{
- haveBaseIncidents = true;
+ //REMOVED
+ haveBaseIncidents = false;
if(loadingGridView){
loadingGridView = false;
loadGridView();
@@ -151,7 +151,7 @@ private String saveBitmapToDisk(Bitmap rotatedBitmap) throws IOException {
String pathToDir = dir.getAbsolutePath();
final String pathName = pathToDir + File.separator+ ID;
FileOutputStream out = new FileOutputStream(pathName);
- rotatedBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
+ rotatedBitmap.compress(Bitmap.CompressFormat.JPEG, 85, out);
return pathName;
}
catch (FileNotFoundException e) {
@@ -4,6 +4,9 @@
public interface Constants {
+
+ public static final int CONNECTION_TIMEOUT_MS = 10000;
+ public static final int SOCKET_TIMEOUT_MS = 45000;
//Start Activity requestCode Constants
public static final String KEY_REQUEST_CODE = "KEY_REQUEST_CODE";
@@ -15,7 +18,6 @@
public static final int REQUEST_CODE_TAKE_PICTURE = 4;
public static final int REQUEST_CODE_GALLERY = 5;
-
/* Keys for information passed between activities or within for activity destroy on rotation */
public static final String IMAGE_URI_KEY = "image_uri_key";
@@ -1,9 +1,14 @@
package nz.co.android.cowseye.event;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.ProtocolException;
+import java.net.URL;
-import nz.co.android.cowseye.RiverWatchApplication;
-import nz.co.android.cowseye.utility.JSONHelper;
+import nz.co.android.cowseye.common.Constants;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
@@ -12,15 +17,13 @@
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpConnectionParams;
-import org.json.JSONObject;
import android.util.Log;
public class GetImageEvent{
- private static final int TIMEOUT_MS = 15000;
protected HttpGet httpGet;
protected HttpClient client;
@@ -36,13 +39,14 @@ public GetImageEvent(String url){
public HttpClient constructHttpClient(){
HttpClient client = new DefaultHttpClient();
//set timeout to 20 seconds
- HttpConnectionParams.setConnectionTimeout(client.getParams(), TIMEOUT_MS);
- HttpConnectionParams.setSoTimeout(client.getParams(), TIMEOUT_MS);
+ HttpConnectionParams.setConnectionTimeout(client.getParams(), Constants.CONNECTION_TIMEOUT_MS);
+ HttpConnectionParams.setSoTimeout(client.getParams(), Constants.SOCKET_TIMEOUT_MS);
return client;
}
/** Processes the event and returns the response of the event */
public HttpResponse processRaw() {
+
//add the created method body to the post request
HttpResponse response = null;
try {
@@ -55,6 +59,7 @@ public HttpResponse processRaw() {
} catch (IOException e) {
Log.e(toString(), "IOException : "+e);
}
+
if(response ==null)
Log.e(toString(), "response is null: ");
return response;
@@ -3,6 +3,7 @@
import java.io.IOException;
import nz.co.android.cowseye.RiverWatchApplication;
+import nz.co.android.cowseye.common.Constants;
import nz.co.android.cowseye.utility.JSONHelper;
import org.apache.http.HttpResponse;
@@ -20,7 +21,6 @@
public class GetIncidentsEvent{
- private static final int TIMEOUT_MS = 10000;
protected HttpGet httpGet;
protected HttpClient client;
@@ -40,8 +40,8 @@ public GetIncidentsEvent(RiverWatchApplication myApplication, int startOfInciden
public HttpClient constructHttpClient(){
HttpClient client = new DefaultHttpClient();
//set timeout to 20 seconds
- HttpConnectionParams.setConnectionTimeout(client.getParams(), TIMEOUT_MS);
- HttpConnectionParams.setSoTimeout(client.getParams(), TIMEOUT_MS);
+ HttpConnectionParams.setConnectionTimeout(client.getParams(), Constants.CONNECTION_TIMEOUT_MS);
+ HttpConnectionParams.setSoTimeout(client.getParams(), 25000);
return client;
}
@@ -73,8 +73,8 @@ public SubmissionEvent(RiverWatchApplication myApplication){
public HttpClient constructHttpClient(){
HttpClient client = new DefaultHttpClient();
//set timeout to 20 seconds
- HttpConnectionParams.setConnectionTimeout(client.getParams(), TIMEOUT_MS);
- HttpConnectionParams.setSoTimeout(client.getParams(), TIMEOUT_MS);
+ HttpConnectionParams.setConnectionTimeout(client.getParams(), Constants.CONNECTION_TIMEOUT_MS);
+ HttpConnectionParams.setSoTimeout(client.getParams(), Constants.SOCKET_TIMEOUT_MS);
return client;
}
@@ -178,7 +178,7 @@ public MultipartEntity makeEntity() {
try {
//convert data to JSON
jsonObject = makeJSONFromSubmissionData();
- Log.d(toString(), "json thaang : "+jsonObject.toString());
+ Log.i(toString(), "Incident as JSON: "+jsonObject.toString());
}
catch (JSONException e) {
Log.e(toString(), "JSONException: "+e);
@@ -1,5 +1,6 @@
package nz.co.android.cowseye.service;
+import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -73,10 +74,11 @@ private String saveImageFromInputStream(HttpResponse response) {
HttpEntity entity = response.getEntity();
if (entity != null) {
// A Simple JSON Response Read
- InputStream instream;
+// InputStream instream = new BufferedInputStream(in)
try {
- instream = entity.getContent();
- Bitmap bm = Utils.scaleBitmap(instream, 2);
+ InputStream instream = entity.getContent();
+ BufferedInputStream bInstream = new BufferedInputStream(instream);
+ Bitmap bm = Utils.scaleBitmap(bInstream, 2);
//save bitmap to filepath
if(bm!=null){
//save image
@@ -87,8 +87,10 @@ private Incident getIncidentFromJSONObject(JSONObject incident) throws JSONExcep
.setPhysicalLocation(incident.getString(Constants.JSON_INCIDENT_PHYSICAL_LOCATION_KEY));
if(incident.has(Constants.JSON_INCIDENT_GEOLOCATION_KEY)){
JSONObject geoJSON = incident.getJSONObject(Constants.JSON_INCIDENT_GEOLOCATION_KEY);
- builder.setLatitude(geoJSON.getInt(Constants.JSON_INCIDENT_LATITUDE_KEY))
- .setLongitude(geoJSON.getInt(Constants.JSON_INCIDENT_LONGITUDE_KEY));
+ if(!geoJSON.isNull(Constants.JSON_INCIDENT_LATITUDE_KEY))
+ builder.setLatitude(geoJSON.getInt(Constants.JSON_INCIDENT_LATITUDE_KEY));
+ if(!geoJSON.isNull(Constants.JSON_INCIDENT_LONGITUDE_KEY))
+ builder.setLongitude(geoJSON.getInt(Constants.JSON_INCIDENT_LONGITUDE_KEY));
}
return builder.build();
}

0 comments on commit e969383

Please sign in to comment.