Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Import to Talk repo from Memo

  • Loading branch information...
commit e3fee943a21375d9fd483cf3f6f0957d8fa366dd 1 parent 366455c
@patrickbaumann patrickbaumann authored
Showing with 1,006 additions and 24 deletions.
  1. +2 −0  .gitignore
  2. +8 −7 README.rst
  3. +15 −0 Test/.classpath
  4. +18 −0 Test/.project
  5. BIN  Test/lib/android.jar
  6. BIN  Test/lib/maps.jar
  7. BIN  Test/lib/mockito-core-1.8.5.jar
  8. BIN  Test/lib/robolectric-1.0-RC1-jar-with-dependencies.jar
  9. +44 −0 Test/tests/gov/nasa/arc/geocam/memo/activity/test/GeoCamMemoActivityTest.java
  10. +45 −0 Test/tests/gov/nasa/arc/geocam/memo/activity/test/GeoCamMemoMessageArrayAdapterTest.java
  11. +76 −0 Test/tests/gov/nasa/arc/geocam/memo/bean/test/GeoCamMemoMessageTest.java
  12. +49 −0 Test/tests/gov/nasa/arc/geocam/memo/injected/FakeDjangoMemoImplementation.java
  13. +37 −0 Test/tests/gov/nasa/arc/geocam/memo/injected/FakeGeoCamMemoMessageFactory.java
  14. +41 −0 Test/tests/gov/nasa/arc/geocam/memo/injected/InjectedTestRunner.java
  15. +22 −0 Test/tests/gov/nasa/arc/geocam/memo/injected/TestInjectedModule.java
  16. +80 −0 Test/tests/gov/nasa/arc/geocam/memo/service/test/DjangoGeoCamMemoJsonConverterImplementationTest.java
  17. +55 −0 Test/tests/gov/nasa/arc/geocam/memo/service/test/DjangoMemoImplementationTest.java
  18. +25 −0 Test/tests/gov/nasa/arc/geocam/memo/test/GeoCamTestCase.java
  19. +55 −0 Test/tests/gov/nasa/arc/geocam/memo/test/GeocamMemoModuleTest.java
  20. +3 −0  android/.classpath
  21. +1 −1  android/.project
  22. +6 −4 android/AndroidManifest.xml
  23. +1 −1  android/default.properties
  24. BIN  android/lib/gson-1.6-javadoc.jar
  25. BIN  android/lib/gson-1.6-sources.jar
  26. BIN  android/lib/gson-1.6.jar
  27. BIN  android/lib/guice-2.0-no_aop.jar
  28. BIN  android/lib/roboguice-1.1.1-javadoc.jar
  29. BIN  android/lib/roboguice-1.1.1.jar
  30. BIN  android/res/drawable/map.png
  31. +31 −0 android/res/layout/list_item.xml
  32. +5 −9 android/res/layout/main.xml
  33. +5 −0 android/res/values/server-strings.xml
  34. +2 −2 android/res/values/strings.xml
  35. +8 −0 android/res/values/styling.xml
  36. +26 −0 android/src/gov/nasa/arc/geocam/memo/GeoCamMemoModule.java
  37. +18 −0 android/src/gov/nasa/arc/geocam/memo/GeoCamMemoRoboApplication.java
  38. +33 −0 android/src/gov/nasa/arc/geocam/memo/activity/GeoCamMemoActivity.java
  39. +78 −0 android/src/gov/nasa/arc/geocam/memo/activity/GeoCamMemoMessageArrayAdapter.java
  40. +116 −0 android/src/gov/nasa/arc/geocam/memo/bean/GeoCamMemoMessage.java
  41. +48 −0 android/src/gov/nasa/arc/geocam/memo/service/DjangoMemoImplementation.java
  42. +9 −0 android/src/gov/nasa/arc/geocam/memo/service/DjangoMemoInterface.java
  43. +33 −0 android/src/gov/nasa/arc/geocam/memo/service/DjangoMemoJsonConverterImplementation.java
  44. +10 −0 android/src/gov/nasa/arc/geocam/memo/service/DjangoMemoJsonConverterInterface.java
  45. +1 −0  android/src/gov/nasa/arc/geocam/talk/GeoCamTalk.java
  46. BIN  tmp/cached-robolectric-classes.jar
View
2  .gitignore
@@ -2,3 +2,5 @@
gen
bin
.DS_Store
+android/tmp
+Test/tmp
View
15 README.rst
@@ -1,5 +1,5 @@
=========================================
-GeoCam Talk for Android
+GeoCam Memo for Android
=========================================
.. sectnum::
@@ -13,12 +13,13 @@ The GeoCam Project helps people better understand and respond to disasters.
GeoCam consists of a GPS-enabled camera (or cell phone) and a web app for
sharing geotagged photos and other geospatial data.
-GeoCam Talk For Android is the android component of a communication application
-intended to aid in communication during a search mission. Members can send text
-and audio messages to any subset of their team members while on the field from
-their mobile devices. All messages are sent through a central server which
-catalogs them for later analysis. Just as in Memo, all messages are geotagged
-to provide instant awareness of team member location.
+GeoCam Memo For Android is the android component of a scribing and
+note-taking application intended for use by search team members as they
+canvas the scene of a disaster. Notes can be recorded using text or audio
+and various forms of attachments (including but not limited to images) can
+be attached for transmission to a central server. All messages can be
+geotagged and categorized before saving to provide proper context when
+analyzing them via a web interface at a later time.
News
~~~~
View
15 Test/.classpath
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="lib" path="lib/robolectric-1.0-RC1-jar-with-dependencies.jar"/>
+ <classpathentry kind="src" path="tests"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+ <classpathentry kind="lib" path="lib/android.jar"/>
+ <classpathentry kind="lib" path="lib/maps.jar"/>
+ <classpathentry kind="lib" path="lib/mockito-core-1.8.5.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/GeoCamTalkoForAndroid"/>
+ <classpathentry kind="lib" path="/GeoCamTalkoForAndroid/lib/gson-1.6.jar"/>
+ <classpathentry kind="lib" path="/GeoCamTalkoForAndroid/lib/guice-2.0-no_aop.jar"/>
+ <classpathentry kind="lib" path="/GeoCamTalkoForAndroid/lib/roboguice-1.1.1.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
18 Test/.project
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>GeocamTalkForAndroidTest</name>
+ <comment></comment>
+ <projects>
+ <project>GeoCamTalkForAndroid</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
BIN  Test/lib/android.jar
Binary file not shown
View
BIN  Test/lib/maps.jar
Binary file not shown
View
BIN  Test/lib/mockito-core-1.8.5.jar
Binary file not shown
View
BIN  Test/lib/robolectric-1.0-RC1-jar-with-dependencies.jar
Binary file not shown
View
44 Test/tests/gov/nasa/arc/geocam/memo/activity/test/GeoCamMemoActivityTest.java
@@ -0,0 +1,44 @@
+package gov.nasa.arc.geocam.memo.activity.test;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+import gov.nasa.arc.geocam.memo.R;
+import gov.nasa.arc.geocam.memo.activity.GeoCamMemoActivity;
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+import gov.nasa.arc.geocam.memo.injected.FakeDjangoMemoImplementation;
+import gov.nasa.arc.geocam.memo.test.GeoCamTestCase;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import android.widget.ListView;
+
+import com.google.inject.Inject;
+
+
+public class GeoCamMemoActivityTest extends GeoCamTestCase {
+ @Inject GeoCamMemoActivity activity;
+ @Inject FakeDjangoMemoImplementation fakeDjangoMemo;
+
+
+
+ @Test
+ public void shouldHaveHappySmiles() throws Exception {
+ String hello = new GeoCamMemoActivity().getResources().getString(R.string.hello);
+ assertThat(hello, equalTo("Hello World, GeoCamMemo!"));
+ }
+
+ @Test
+ public void shouldDisplayMemos() throws Exception {
+ //arrange
+ activity.onCreate(null);
+ List<GeoCamMemoMessage>fakeMemoList = fakeDjangoMemo.getMemos();
+
+ //act
+ ListView geoCamListView = (ListView)activity.findViewById(R.id.MemoListView);
+
+ //assert
+ assertThat(geoCamListView.getChildCount(), equalTo(fakeMemoList.size()));
+ }
+}
View
45 Test/tests/gov/nasa/arc/geocam/memo/activity/test/GeoCamMemoMessageArrayAdapterTest.java
@@ -0,0 +1,45 @@
+package gov.nasa.arc.geocam.memo.activity.test;
+
+import gov.nasa.arc.geocam.memo.R;
+import gov.nasa.arc.geocam.memo.activity.GeoCamMemoMessageArrayAdapter;
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+import gov.nasa.arc.geocam.memo.injected.FakeGeoCamMemoMessageFactory;
+import gov.nasa.arc.geocam.memo.test.GeoCamTestCase;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+
+import com.xtremelabs.robolectric.Robolectric;
+
+public class GeoCamMemoMessageArrayAdapterTest extends GeoCamTestCase{
+
+ @Test
+ public void shouldProperlyDisplayGeolocaionStatus() throws Exception {
+ //arrange
+ List<GeoCamMemoMessage> msgs = new ArrayList<GeoCamMemoMessage>();
+
+ msgs.add(FakeGeoCamMemoMessageFactory.getMessage("testing", "Patrick", true));
+ msgs.add(FakeGeoCamMemoMessageFactory.getMessage("testing2", "Not Patrick", false));
+
+ GeoCamMemoMessageArrayAdapter adapter = new GeoCamMemoMessageArrayAdapter();
+ adapter.setMemos(msgs);
+
+ View temp1 = View.inflate(Robolectric.application.getApplicationContext(), R.layout.list_item, null);
+ View temp2 = View.inflate(Robolectric.application.getApplicationContext(), R.layout.list_item, null);
+
+ //act
+ LinearLayout geoLocatedMsgView = (LinearLayout) adapter.getView(0, temp1, null);
+ LinearLayout nonGeoLocatedMsgView = (LinearLayout) adapter.getView(1, temp2, null);
+
+ //assert
+ assertTrue(((ImageView) geoLocatedMsgView.findViewById(R.id.hasGeoLocation)).getVisibility() == View.VISIBLE);
+ assertTrue(((ImageView) nonGeoLocatedMsgView.findViewById(R.id.hasGeoLocation)).getVisibility() == View.INVISIBLE);
+ }
+
+}
View
76 Test/tests/gov/nasa/arc/geocam/memo/bean/test/GeoCamMemoMessageTest.java
@@ -0,0 +1,76 @@
+package gov.nasa.arc.geocam.memo.bean.test;
+
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+
+import java.text.SimpleDateFormat;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+
+
+public class GeoCamMemoMessageTest extends TestCase {
+ @Test
+ public void testEqualsMethodTrue() throws Exception
+ {
+
+ // arrange
+ SimpleDateFormat sdf = new SimpleDateFormat("MM/dd hh:mm:ss");
+
+ GeoCamMemoMessage message1 = new GeoCamMemoMessage();
+ message1.setAuthorUsername("rhornsby");
+ message1.setAuthorFullname("Rufus Hornsby");
+ message1.setLongitude(-122.057954);
+ message1.setContent("Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted.");
+ message1.setContentTimestamp(sdf.parse("03/13 10:48:44"));
+ message1.setLatitude(37.411629);
+ message1.setMessageId(15);
+ message1.setAccuracy(60);
+ message1.setHasGeolocation(true);
+
+ GeoCamMemoMessage message2 = new GeoCamMemoMessage();
+ message2.setAuthorUsername("rhornsby");
+ message2.setAuthorFullname("Rufus Hornsby");
+ message2.setLongitude(-122.057954);
+ message2.setContent("Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted.");
+ message2.setContentTimestamp(sdf.parse("03/13 10:48:44"));
+ message2.setLatitude(37.411629);
+ message2.setMessageId(15);
+ message2.setAccuracy(60);
+ message2.setHasGeolocation(true);
+
+ // assert
+ assertTrue(message1.equals(message2));
+ }
+ @Test
+ public void testEqualsMethodFalse() throws Exception
+ {
+ // arrange
+ SimpleDateFormat sdf = new SimpleDateFormat("MM/dd hh:mm:ss");
+
+ GeoCamMemoMessage message1 = new GeoCamMemoMessage();
+ message1.setAuthorUsername("rhornsby");
+ message1.setAuthorFullname("Rufus Hornsby");
+ message1.setLongitude(-122.057954);
+ message1.setContent("Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted.");
+ message1.setContentTimestamp(sdf.parse("03/13 10:48:44"));
+ message1.setLatitude(37.411629);
+ message1.setMessageId(15);
+ message1.setAccuracy(60);
+ message1.setHasGeolocation(true);
+
+ GeoCamMemoMessage message2 = new GeoCamMemoMessage();
+ message2.setAuthorUsername("rhornsby");
+ message2.setAuthorFullname("Rufus Hornsby");
+ message2.setLongitude(-122.057954);
+ message2.setContent("Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted. Blah"); // changed here
+ message2.setContentTimestamp(sdf.parse("03/13 10:48:44"));
+ message2.setLatitude(37.411629);
+ message2.setMessageId(15);
+ message2.setAccuracy(60);
+ message2.setHasGeolocation(true);
+
+ // assert
+ assertFalse(message1.equals(message2));
+ }
+}
View
49 Test/tests/gov/nasa/arc/geocam/memo/injected/FakeDjangoMemoImplementation.java
@@ -0,0 +1,49 @@
+package gov.nasa.arc.geocam.memo.injected;
+
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterInterface;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoInterface;
+
+import java.util.ArrayList;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import com.google.inject.Inject;
+
+public class FakeDjangoMemoImplementation implements DjangoMemoInterface{
+
+ @Inject DjangoMemoJsonConverterInterface jsonConverter;
+
+ @Override
+ public List<GeoCamMemoMessage> getMemos() {
+ // TODO Auto-generated method stub
+ List<GeoCamMemoMessage>testList = new ArrayList<GeoCamMemoMessage>();
+
+ testList.add(
+ FakeGeoCamMemoMessageFactory.getMessage(
+ "Hey Guys, I'm the first message!",
+ "Ted Johnson",
+ true)
+ );
+ testList.add(
+ FakeGeoCamMemoMessageFactory.getMessage(
+ "I'm message #2",
+ "Ted Johnson",
+ false)
+ );
+ testList.add(
+ FakeGeoCamMemoMessageFactory.getMessage(
+ "And I'm 3rd in line!",
+ "Rufus Hornsby",
+ true)
+ );
+ testList.add(
+ FakeGeoCamMemoMessageFactory.getMessage(
+ "I should be at the top of the list",
+ "Ted Johnson",
+ true)
+ );
+
+ return testList;
+ }
+}
View
37 Test/tests/gov/nasa/arc/geocam/memo/injected/FakeGeoCamMemoMessageFactory.java
@@ -0,0 +1,37 @@
+package gov.nasa.arc.geocam.memo.injected;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+
+public class FakeGeoCamMemoMessageFactory {
+
+ public static int messageId = 0;
+ public static GregorianCalendar cal = new GregorianCalendar();
+
+ final static double CMUSVLAT = 37.41029;
+ final static double CMUSVLON = -122.05944;
+ final static double MAXDIST = 1;
+
+
+ public static GeoCamMemoMessage getMessage(String contents, String fullname, boolean hasGeolocation)
+ {
+ GeoCamMemoMessage msg = new GeoCamMemoMessage();
+ msg.setAuthorFullname(fullname);
+ msg.setAuthorUsername(fullname.replaceAll(" ", "").toLowerCase());
+ msg.setContent(contents);
+ msg.setMessageId(messageId++);
+ msg.setHasGeolocation(hasGeolocation);
+ if(hasGeolocation)
+ {
+ msg.setLatitude(Math.random()*MAXDIST + CMUSVLAT);
+ msg.setLongitude(Math.random()*MAXDIST + CMUSVLON);
+ msg.setAccuracy((int)(Math.random() * 600));
+ }
+ cal.add(Calendar.SECOND, (int)(Math.random() * 60));
+ msg.setContentTimestamp(cal.getTime());
+
+ return msg;
+ }
+}
View
41 Test/tests/gov/nasa/arc/geocam/memo/injected/InjectedTestRunner.java
@@ -0,0 +1,41 @@
+package gov.nasa.arc.geocam.memo.injected;
+
+import gov.nasa.arc.geocam.memo.GeoCamMemoRoboApplication;
+import gov.nasa.arc.geocam.memo.test.GeoCamTestCase;
+
+import org.junit.runners.model.InitializationError;
+
+import roboguice.inject.ContextScope;
+import android.app.Application;
+
+import com.google.inject.Injector;
+import com.xtremelabs.robolectric.Robolectric;
+import com.xtremelabs.robolectric.RobolectricTestRunner;
+
+public class InjectedTestRunner extends RobolectricTestRunner {
+ public InjectedTestRunner(Class<?> testClass) throws InitializationError {
+ super(testClass);
+ }
+
+ @Override
+ protected Application createApplication() {
+ GeoCamMemoRoboApplication application =
+ (GeoCamMemoRoboApplication)super.createApplication();
+
+ application.setModule(new TestInjectedModule());
+ return application;
+ }
+
+ @Override
+ public void prepareTest(Object test){
+ GeoCamMemoRoboApplication application =
+ (GeoCamMemoRoboApplication)Robolectric.application;
+
+ Injector injector = application.getInjector();
+ ContextScope scope = injector.getInstance(ContextScope.class);
+ scope.enter(application);
+
+ injector.injectMembers(test);
+ }
+
+}
View
22 Test/tests/gov/nasa/arc/geocam/memo/injected/TestInjectedModule.java
@@ -0,0 +1,22 @@
+package gov.nasa.arc.geocam.memo.injected;
+
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import gov.nasa.arc.geocam.memo.activity.GeoCamMemoMessageArrayAdapter;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterImplementation;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterInterface;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoInterface;
+import roboguice.config.AbstractAndroidModule;
+
+public class TestInjectedModule extends AbstractAndroidModule {
+
+ @Override
+ protected void configure() {
+ requestStaticInjection(GeoCamMemoMessageArrayAdapter.class);
+ //bind(GeoCamMemoMessageArrayAdapter.class).toInstance(new GeoCamMemoMessageArrayAdapter());
+ bind(DjangoMemoInterface.class).to(FakeDjangoMemoImplementation.class);
+ bind(DjangoMemoJsonConverterInterface.class)
+ .to(DjangoMemoJsonConverterImplementation.class);
+ }
+}
View
80 Test/tests/gov/nasa/arc/geocam/memo/service/test/DjangoGeoCamMemoJsonConverterImplementationTest.java
@@ -0,0 +1,80 @@
+package gov.nasa.arc.geocam.memo.service.test;
+
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterImplementation;
+import gov.nasa.arc.geocam.memo.test.GeoCamTestCase;
+
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+import org.junit.Test;
+
+
+public class DjangoGeoCamMemoJsonConverterImplementationTest extends GeoCamTestCase {
+
+ @Test
+ public void ensureProperParsingOfMessageListFeed() throws Exception
+ {
+ // arrange
+ String jsonString =
+ "[{\"authorUsername\": \"rhornsby\", \"authorFullname\":\"Rufus Hornsby\", \"longitude\": null, \"content\": \"Crap, my geolocation service crashed and I am not providing geoloc with this message. This message should be the latest to make sure we gracefully fall back to the next available geolocated message.\", \"contentTimestamp\": \"03/13/11 11:23:21\",\"latitude\": null, \"messageId\": 19, \"accuracy\": null}, {\"authorUsername\": \"rhornsby\", \"longitude\": -122.057954, \"content\": \"Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted.\", \"contentTimestamp\": \"03/13/11 10:48:44\", \"latitude\": 37.411629, \"messageId\": 15, \"accuracy\":60.0, \"hasGeolocation\":true}]";
+ SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
+ DjangoMemoJsonConverterImplementation converter =
+ new DjangoMemoJsonConverterImplementation();
+
+ GeoCamMemoMessage message1 = new GeoCamMemoMessage();
+ message1.setAuthorUsername("rhornsby");
+ message1.setAuthorFullname("Rufus Hornsby");
+ // don't set longitude
+ message1.setContent("Crap, my geolocation service crashed and I am not providing geoloc with this message. This message should be the latest to make sure we gracefully fall back to the next available geolocated message.");
+ message1.setContentTimestamp(sdf.parse("03/13/11 11:23:21"));
+ // don't set latitude
+ message1.setMessageId(19);
+ // don't set accuracy
+
+ GeoCamMemoMessage message2 = new GeoCamMemoMessage();
+ message2.setAuthorUsername("rhornsby");
+ message2.setLongitude(-122.057954);
+ message2.setContent("Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted.");
+ message2.setContentTimestamp(sdf.parse("03/13/11 10:48:44"));
+ message2.setLatitude(37.411629);
+ message2.setMessageId(15);
+ message2.setAccuracy(60);
+ message2.setHasGeolocation(true);
+
+ // act
+ List<GeoCamMemoMessage> resolvedList =
+ converter.deserializeList(jsonString);
+
+ // assert
+ assertTrue(resolvedList.contains(message1));
+ assertTrue(resolvedList.contains(message2));
+ }
+
+ @Test
+ public void ensureSingularDeserializationWorks() throws Exception {
+ // arrange
+ DjangoMemoJsonConverterImplementation converter =
+ new DjangoMemoJsonConverterImplementation();
+
+ SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
+
+ String jsonString =
+ "{\"authorUsername\": \"rhornsby\", \"longitude\": -122.057954, \"content\": \"Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted.\", \"contentTimestamp\": \"03/13/11 10:48:44\", \"latitude\": 37.411629, \"messageId\": 15, \"accuracy\":60.0}";
+
+ GeoCamMemoMessage message = new GeoCamMemoMessage();
+ message.setAuthorUsername("rhornsby");
+ message.setLongitude(-122.057954);
+ message.setContent("Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted.");
+ message.setContentTimestamp(sdf.parse("03/13/11 10:48:44"));
+ message.setLatitude(37.411629);
+ message.setMessageId(15);
+ message.setAccuracy(60);
+
+ // act
+ GeoCamMemoMessage convertedMessage = converter.deserialize(jsonString);
+
+ // arrange
+ assertEquals(message, convertedMessage);
+ }
+}
View
55 Test/tests/gov/nasa/arc/geocam/memo/service/test/DjangoMemoImplementationTest.java
@@ -0,0 +1,55 @@
+package gov.nasa.arc.geocam.memo.service.test;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoImplementation;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterInterface;
+import gov.nasa.arc.geocam.memo.test.GeoCamTestCase;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.junit.Test;
+
+import android.net.http.AndroidHttpClient;
+
+
+public class DjangoMemoImplementationTest extends GeoCamTestCase {
+
+ @Test
+ public void shouldEnsureGetMemosReturnsMemos() throws Exception {
+ DjangoMemoImplementation memoImpl = new DjangoMemoImplementation();
+
+ DjangoMemoJsonConverterInterface jsonConv =
+ mock(DjangoMemoJsonConverterInterface.class);
+
+ HttpClient httpClient = mock(AndroidHttpClient.class);
+ HttpResponse response = mock(HttpResponse.class);
+ HttpEntity entity = mock(HttpEntity.class);
+ when(response.getEntity()).thenReturn(entity);
+ when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response);
+ setHiddenField(memoImpl, "httpClient", httpClient);
+
+ List<GeoCamMemoMessage> expectedList = new ArrayList<GeoCamMemoMessage>();
+ when(jsonConv.deserializeList(anyString())).thenReturn(expectedList);
+ setHiddenField(memoImpl, "jsonConverter", jsonConv);
+
+ setHiddenField(memoImpl, "memoUrl", "http://xyz.com/");
+ setHiddenField(memoImpl, "memoMessagesJson", "dude.json");
+
+ // act
+ List<GeoCamMemoMessage> memos = memoImpl.getMemos();
+
+ // assert
+ assertEquals(expectedList, memos);
+ verify(jsonConv).deserializeList(anyString());
+ }
+}
View
25 Test/tests/gov/nasa/arc/geocam/memo/test/GeoCamTestCase.java
@@ -0,0 +1,25 @@
+package gov.nasa.arc.geocam.memo.test;
+
+import java.lang.reflect.Field;
+
+import gov.nasa.arc.geocam.memo.injected.InjectedTestRunner;
+import junit.framework.TestCase;
+
+import org.junit.runner.RunWith;
+
+import roboguice.config.AbstractAndroidModule;
+
+@RunWith(InjectedTestRunner.class)
+public abstract class GeoCamTestCase extends TestCase {
+ // containing class that forces use of injectedtestrunner
+ // may be able to create other commonalities between test cases
+
+ public static void setHiddenField(Object objectToSet, String fieldName, Object valueToSet) throws ClassNotFoundException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException
+ {
+ Class c = Class.forName(objectToSet.getClass().getName());
+ Field fieldToSet = c.getDeclaredField(fieldName);
+ fieldToSet.setAccessible(true);
+ fieldToSet.set(objectToSet, valueToSet);
+ }
+
+}
View
55 Test/tests/gov/nasa/arc/geocam/memo/test/GeocamMemoModuleTest.java
@@ -0,0 +1,55 @@
+package gov.nasa.arc.geocam.memo.test;
+
+public class GeocamMemoModuleTest{};
+
+/* TODO: Figure this out!
+
+package gov.nasa.arc.geocam.memo.test;
+
+import gov.nasa.arc.geocam.memo.GeoCamMemoModule;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoInterface;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterInterface;
+
+import org.junit.Test;
+
+import android.net.http.AndroidHttpClient;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+import roboguice.*;
+import roboguice.inject.InjectorProvider;
+
+public class GeocamMemoModuleTest extends GeoCamTestCase{
+ @Test
+ public void shouldBindDjangoMemoInterface() throws Exception
+ {
+ //arrange
+ GeoCamMemoModule module = new GeoCamMemoModule();
+
+ Injector injector = Guice.createInjector(new GeoCamMemoModule());
+
+ // act & assert (by non-exception)
+ injector.getProvider(DjangoMemoInterface.class);
+ }
+
+ @Test
+ public void shouldBindAwesomeJsonConverterInterface() throws Exception
+ {
+ //arrange
+ Injector injector = Guice.createInjector(new GeoCamMemoModule());
+
+ // act & assert (by non-exception)
+ injector.getProvider(DjangoMemoJsonConverterInterface.class);
+ }
+
+ @Test
+ public void shouldBindAndroidHttpClient() throws Exception
+ {
+ //arrange
+ Injector injector = Guice.createInjector(new GeoCamMemoModule());
+
+ // act & assert (by non-exception)
+ injector.getProvider(AndroidHttpClient.class);
+ }
+}*/
View
3  android/.classpath
@@ -3,5 +3,8 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="lib" path="lib/guice-2.0-no_aop.jar"/>
+ <classpathentry kind="lib" path="lib/roboguice-1.1.1.jar"/>
+ <classpathentry kind="lib" path="lib/gson-1.6.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
View
2  android/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>geocamTalkAndroid</name>
+ <name>GeoCamTalkoForAndroid</name>
<comment></comment>
<projects>
</projects>
View
10 android/AndroidManifest.xml
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="gov.nasa.arc.geocam.talk"
+ package="gov.nasa.arc.geocam.memo"
android:versionCode="1"
android:versionName="1.0">
- <application android:icon="@drawable/icon" android:label="@string/app_name">
- <activity android:name=".GeoCamTalk"
+ <application android:icon="@drawable/icon" android:label="@string/app_name"
+ android:name=".GeoCamMemoRoboApplication" android:debuggable="true"
+ android:theme="@style/default_style">
+ <activity android:name=".activity.GeoCamMemoActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -14,5 +16,5 @@
</application>
<uses-sdk android:minSdkVersion="8" />
-
+ <uses-permission android:name="android.permission.INTERNET" />
</manifest>
View
2  android/default.properties
@@ -8,4 +8,4 @@
# project structure.
# Project target.
-target=Google Inc.:Google APIs:9
+target=android-8
View
BIN  android/lib/gson-1.6-javadoc.jar
Binary file not shown
View
BIN  android/lib/gson-1.6-sources.jar
Binary file not shown
View
BIN  android/lib/gson-1.6.jar
Binary file not shown
View
BIN  android/lib/guice-2.0-no_aop.jar
Binary file not shown
View
BIN  android/lib/roboguice-1.1.1-javadoc.jar
Binary file not shown
View
BIN  android/lib/roboguice-1.1.1.jar
Binary file not shown
View
BIN  android/res/drawable/map.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
31 android/res/layout/list_item.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent" android:layout_height="fill_parent"
+ android:orientation="vertical" android:padding="2dip"
+ style="@style/default_style">
+
+ <TableLayout android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:id="@+id/headerTable"
+ android:stretchColumns="0,1">
+ <TableRow android:layout_width="fill_parent" android:id="@+id/headerRow"
+ android:layout_height="match_parent">
+ <TextView android:text="Fullname" android:id="@+id/fullname"
+ android:layout_height="wrap_content" android:layout_gravity="left"
+ android:layout_width="fill_parent" android:textStyle="bold"
+ style="@style/default_style"></TextView>
+ <TextView android:text="ContentTimestamp" android:id="@+id/content_timestamp"
+ android:layout_height="wrap_content" android:layout_gravity="right"
+ android:layout_width="fill_parent"
+ style="@style/default_style"></TextView>
+ <ImageView android:id="@+id/hasGeoLocation"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:src="@drawable/map" android:paddingLeft="2dip" android:visibility="visible"></ImageView>
+ </TableRow>
+ </TableLayout>
+ <TextView android:id="@+id/content"
+ android:text="Content blah blah blah blah blah blah blah blah blah"
+ android:layout_width="fill_parent" android:gravity="center_vertical"
+ android:textSize="16dip" android:layout_height="wrap_content"
+ android:paddingLeft="5dip"
+ style="@style/default_style"></TextView>
+</LinearLayout>
View
14 android/res/layout/main.xml
@@ -1,12 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
-<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/hello"
- />
+ android:orientation="vertical" android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <ListView android:id="@+id/MemoListView" android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
</LinearLayout>
View
5 android/res/values/server-strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="memo_url">http://10.0.2.2:8080/memo/</string>
+ <string name="memo_messages">messages.json</string>
+</resources>
View
4 android/res/values/strings.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="hello">Hello World, GeoCamTalk!</string>
- <string name="app_name">GeoCam Talk</string>
+ <string name="hello">Hello World, GeoCamMemo!</string>
+ <string name="app_name">GeoCam Memo</string>
</resources>
View
8 android/res/values/styling.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style
+ name="default_style">
+ <item name="android:textColor">#000000</item>
+ <item name="android:background">#FFFFFF</item>
+ </style>
+</resources>
View
26 android/src/gov/nasa/arc/geocam/memo/GeoCamMemoModule.java
@@ -0,0 +1,26 @@
+package gov.nasa.arc.geocam.memo;
+
+import gov.nasa.arc.geocam.memo.activity.GeoCamMemoMessageArrayAdapter;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoImplementation;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoInterface;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterImplementation;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterInterface;
+
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import roboguice.config.AbstractAndroidModule;
+
+public class GeoCamMemoModule extends AbstractAndroidModule{
+
+ @Override
+ protected void configure() {
+ requestStaticInjection(GeoCamMemoMessageArrayAdapter.class);
+ bind(DjangoMemoInterface.class).to(DjangoMemoImplementation.class);
+ bind(DjangoMemoJsonConverterInterface.class)
+ .to(DjangoMemoJsonConverterImplementation.class);
+ bind(HttpClient.class).toInstance(new DefaultHttpClient());
+ }
+
+
+}
View
18 android/src/gov/nasa/arc/geocam/memo/GeoCamMemoRoboApplication.java
@@ -0,0 +1,18 @@
+package gov.nasa.arc.geocam.memo;
+import roboguice.application.RoboApplication;
+import com.google.inject.Module;
+
+import java.util.List;
+
+public class GeoCamMemoRoboApplication extends RoboApplication{
+ private Module module = new GeoCamMemoModule();
+
+ protected void addApplicationModules(List<Module> modules) {
+ modules.add(this.module);
+ }
+
+ public void setModule(Module module) {
+ this.module = module;
+
+ }
+}
View
33 android/src/gov/nasa/arc/geocam/memo/activity/GeoCamMemoActivity.java
@@ -0,0 +1,33 @@
+package gov.nasa.arc.geocam.memo.activity;
+
+import gov.nasa.arc.geocam.memo.R;
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+import gov.nasa.arc.geocam.memo.service.DjangoMemoInterface;
+
+import java.util.List;
+
+import roboguice.activity.RoboActivity;
+import roboguice.inject.InjectView;
+import android.os.Bundle;
+import android.widget.ListView;
+
+import com.google.inject.Inject;
+
+public class GeoCamMemoActivity extends RoboActivity {
+
+ @Inject DjangoMemoInterface djangoMemo;
+ @InjectView(R.id.MemoListView) ListView memoListView;
+ @Inject GeoCamMemoMessageArrayAdapter adapter;
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ List<GeoCamMemoMessage> memos = djangoMemo.getMemos();
+ adapter.setMemos(memos);
+
+ memoListView.setAdapter(adapter);
+ }
+}
View
78 android/src/gov/nasa/arc/geocam/memo/activity/GeoCamMemoMessageArrayAdapter.java
@@ -0,0 +1,78 @@
+package gov.nasa.arc.geocam.memo.activity;
+
+import gov.nasa.arc.geocam.memo.R;
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class GeoCamMemoMessageArrayAdapter extends ArrayAdapter<GeoCamMemoMessage> {
+
+ @Inject protected static Provider<Context> contextProvider;
+ @Inject LayoutInflater mInflater;
+
+ public GeoCamMemoMessageArrayAdapter() {
+ super(contextProvider.get(), R.layout.list_item);
+ }
+
+ public void setMemos(List<GeoCamMemoMessage> memos)
+ {
+ this.clear();
+ for(GeoCamMemoMessage m:memos)
+ {
+ add(m);
+ }
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View row;
+
+ if (null == convertView) {
+ row = mInflater.inflate(R.layout.list_item, null);
+ } else {
+ row = convertView;
+ }
+
+ TextView contentTextView =
+ (TextView) row.findViewById(R.id.content);
+ TextView fullnameTextView =
+ (TextView) row.findViewById(R.id.fullname);
+ TextView contentTimestampTextView =
+ (TextView) row.findViewById(R.id.content_timestamp);
+ ImageView geolocationImageView =
+ (ImageView) row.findViewById(R.id.hasGeoLocation);
+
+ GeoCamMemoMessage msg = getItem(position);
+
+ contentTextView.setText(msg.getContent());
+ fullnameTextView.setText(msg.getAuthorFullname());
+
+ Date contentTimestamp = msg.getContentTimestamp();
+ SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
+ contentTimestampTextView.setText(sdf.format(contentTimestamp));
+
+ if(msg.hasGeolocation())
+ {
+ geolocationImageView.setVisibility(View.VISIBLE);
+ }
+ else
+ {
+ geolocationImageView.setVisibility(View.INVISIBLE);
+ }
+
+ return row;
+ }
+}
View
116 android/src/gov/nasa/arc/geocam/memo/bean/GeoCamMemoMessage.java
@@ -0,0 +1,116 @@
+package gov.nasa.arc.geocam.memo.bean;
+
+import java.util.Date;
+
+public class GeoCamMemoMessage {
+
+ private int messageId;
+ private Integer authorId;
+ private String authorUsername;
+ private String authorFullname;
+ private String content;
+ private Date contentTimestamp;
+ private Double latitude;
+ private Double longitude;
+ private Integer accuracy;
+ private boolean hasGeolocation;
+
+ public int getMessageId() {
+ return messageId;
+ }
+ public void setMessageId(int messageId) {
+ this.messageId = messageId;
+ }
+ public void setAuthorId(int authorId) {
+ this.authorId = authorId;
+ }
+ public Integer getAuthorId() {
+ return authorId;
+ }
+ public String getAuthorUsername() {
+ return authorUsername;
+ }
+ public void setAuthorUsername(String authorUsername) {
+ this.authorUsername = authorUsername;
+ }
+ public String getContent() {
+ return content;
+ }
+ public String getAuthorFullname() {
+ return authorFullname;
+ }
+ public void setAuthorFullname(String authorFullname) {
+ this.authorFullname = authorFullname;
+ }
+ public void setContent(String content) {
+ this.content = content;
+ }
+ public Date getContentTimestamp() {
+ return contentTimestamp;
+ }
+ public void setContentTimestamp(Date contentTimestamp) {
+ this.contentTimestamp = contentTimestamp;
+ }
+ public Double getLatitude() {
+ return latitude;
+ }
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+ public Double getLongitude() {
+ return longitude;
+ }
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+ public Integer getAccuracy() {
+ return accuracy;
+ }
+ public void setAccuracy(int accuracy) {
+ this.accuracy = accuracy;
+ }
+ public boolean hasGeolocation() {
+ return hasGeolocation;
+ }
+ public void setHasGeolocation(boolean hasGeolocation) {
+ this.hasGeolocation = hasGeolocation;
+ }
+
+
+
+ @Override
+ public boolean equals(Object o) {
+ GeoCamMemoMessage other = (GeoCamMemoMessage)o;
+
+ return
+ this.messageId == other.messageId &&
+ equalOrBothNull(authorId, other.authorId) &&
+ equalOrBothNull(authorUsername, other.authorUsername) &&
+ equalOrBothNull(authorFullname, other.authorFullname) &&
+ equalOrBothNull(content, other.content) &&
+ equalOrBothNull(contentTimestamp, other.contentTimestamp) &&
+ equalOrBothNull(latitude, other.latitude) &&
+ equalOrBothNull(longitude, other.longitude) &&
+ equalOrBothNull(accuracy, other.accuracy) &&
+ this.hasGeolocation == other.hasGeolocation;
+ }
+
+ // TODO: Revisit this if we need other helper methods. Maybe move to global helper function?
+ // Jakarta Commons library may provide some additional methods that would be useful
+ public static boolean equalOrBothNull(Object a, Object b)
+ {
+ if(a != null && b != null)
+ {
+ return a.equals(b);
+ }
+ else if(a == null && b == null)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+}
View
48 android/src/gov/nasa/arc/geocam/memo/service/DjangoMemoImplementation.java
@@ -0,0 +1,48 @@
+package gov.nasa.arc.geocam.memo.service;
+
+
+import gov.nasa.arc.geocam.memo.R;
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+
+import java.io.ByteArrayOutputStream;
+import java.util.List;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+
+import roboguice.inject.InjectResource;
+import android.content.Context;
+import android.widget.Toast;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class DjangoMemoImplementation implements DjangoMemoInterface{
+
+ @Inject DjangoMemoJsonConverterInterface jsonConverter;
+ @InjectResource(R.string.memo_url) String memoUrl;
+ @InjectResource(R.string.memo_messages) String memoMessagesJson;
+ @Inject protected static Provider<Context> contextProvider;
+ @Inject HttpClient httpClient;
+
+ @Override
+ public List<GeoCamMemoMessage> getMemos() {
+ //String jsonString =
+ // "[{\"authorUsername\": \"rhornsby\", \"longitude\": -122.057954, \"content\": \"Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted.\", \"contentTimestamp\": \"03/13/11 10:48:44\", \"latitude\": 37.411629, \"messageId\": 15, \"accuracy\":60.0}]";
+ String jsonString = null;
+
+ try {
+ HttpGet httpGet = new HttpGet(memoUrl + memoMessagesJson);
+ HttpResponse response = httpClient.execute(httpGet);
+
+ ByteArrayOutputStream ostream = new ByteArrayOutputStream();
+ response.getEntity().writeTo(ostream);
+ jsonString = ostream.toString();
+ } catch (Exception e) {
+ Toast.makeText(contextProvider.get(), "Cannot access Memo Web", Toast.LENGTH_SHORT).show();
+ }
+
+ return jsonConverter.deserializeList(jsonString);
+ }
+}
View
9 android/src/gov/nasa/arc/geocam/memo/service/DjangoMemoInterface.java
@@ -0,0 +1,9 @@
+package gov.nasa.arc.geocam.memo.service;
+
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+
+import java.util.List;
+
+public interface DjangoMemoInterface {
+ public List<GeoCamMemoMessage> getMemos();
+}
View
33 android/src/gov/nasa/arc/geocam/memo/service/DjangoMemoJsonConverterImplementation.java
@@ -0,0 +1,33 @@
+package gov.nasa.arc.geocam.memo.service;
+
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+
+import java.lang.reflect.Type;
+import java.util.List;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
+
+public class DjangoMemoJsonConverterImplementation
+ implements DjangoMemoJsonConverterInterface {
+
+ @Override
+ public List<GeoCamMemoMessage> deserializeList(String jsonString) {
+ GsonBuilder builder = new GsonBuilder();
+ builder.setDateFormat("MM/dd/yy HH:mm:ss");
+ Gson gson = builder.create();
+
+ Type listType = new TypeToken<List<GeoCamMemoMessage>>(){}.getType();
+
+ return gson.fromJson(jsonString, listType);
+ }
+
+ public GeoCamMemoMessage deserialize(String jsonString) {
+ GsonBuilder builder = new GsonBuilder();
+ builder.setDateFormat("MM/dd/yy HH:mm:ss");
+
+ Gson gson = builder.create();
+ return gson.fromJson(jsonString, GeoCamMemoMessage.class);
+ }
+}
View
10 android/src/gov/nasa/arc/geocam/memo/service/DjangoMemoJsonConverterInterface.java
@@ -0,0 +1,10 @@
+package gov.nasa.arc.geocam.memo.service;
+
+import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
+
+import java.util.List;
+
+public interface DjangoMemoJsonConverterInterface {
+ List<GeoCamMemoMessage> deserializeList(String jsonString);
+ GeoCamMemoMessage deserialize(String jsonString);
+}
View
1  android/src/gov/nasa/arc/geocam/talk/GeoCamTalk.java
@@ -1,5 +1,6 @@
package gov.nasa.arc.geocam.talk;
+import gov.nasa.arc.geocam.memo.R;
import android.app.Activity;
import android.os.Bundle;
View
BIN  tmp/cached-robolectric-classes.jar
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.