Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed merge conflict

  • Loading branch information...
commit dc0bbefbdb4f5cba3bbd847f0cb2bcb01e0092de 2 parents 245e900 + 272f479
Sam Karp authored
View
4 Test/tests/gov/nasa/arc/geocam/talk/activity/test/GeoCamTalkMessageArrayAdapterTest.java
@@ -1,7 +1,7 @@
package gov.nasa.arc.geocam.talk.activity.test;
import gov.nasa.arc.geocam.talk.R;
-import gov.nasa.arc.geocam.talk.activity.GeoCamTalkMessageArrayAdapter;
+import gov.nasa.arc.geocam.talk.activity.GeoCamTalkMessageAdapter;
import gov.nasa.arc.geocam.talk.bean.GeoCamTalkMessage;
import gov.nasa.arc.geocam.talk.injected.FakeGeoCamTalkMessageFactory;
import gov.nasa.arc.geocam.talk.test.GeoCamTestCase;
@@ -28,7 +28,7 @@ public void shouldProperlyDisplayGeolocaionStatus() throws Exception {
msgs.add(FakeGeoCamTalkMessageFactory.getMessage("testing", "Patrick", true));
msgs.add(FakeGeoCamTalkMessageFactory.getMessage("testing2", "Not Patrick", false));
- GeoCamTalkMessageArrayAdapter adapter = new GeoCamTalkMessageArrayAdapter(
+ GeoCamTalkMessageAdapter adapter = new GeoCamTalkMessageAdapter(
Robolectric.application.getApplicationContext());
adapter.setTalkMessages(msgs);
View
17 Test/tests/gov/nasa/arc/geocam/talk/bean/test/GeoCamTalkMessageTest.java
@@ -48,24 +48,11 @@ public void testEqualsMethodFalse() throws Exception
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy hh:mm:ss");
GeoCamTalkMessage message1 = new GeoCamTalkMessage();
- 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/11 10:48:44"));
- message1.setLatitude(37.411629);
message1.setMessageId(15);
- message1.setAccuracy(60);
GeoCamTalkMessage message2 = new GeoCamTalkMessage();
- 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/11 10:48:44"));
- message2.setLatitude(37.411629);
- message2.setMessageId(15);
- message2.setAccuracy(60);
+ message2.setMessageId(12);
+
// assert
assertFalse(message1.equals(message2));
View
19 Test/tests/gov/nasa/arc/geocam/talk/injected/TestInjectedModule.java
@@ -1,6 +1,14 @@
package gov.nasa.arc.geocam.talk.injected;
+import com.google.inject.Scopes;
+
+import gov.nasa.arc.geocam.talk.service.AudioPlayer;
+import gov.nasa.arc.geocam.talk.service.AudioRecorder;
import gov.nasa.arc.geocam.talk.service.DatabaseHelper;
+import gov.nasa.arc.geocam.talk.service.IAudioPlayer;
+import gov.nasa.arc.geocam.talk.service.IAudioRecorder;
+import gov.nasa.arc.geocam.talk.service.ISiteAuth;
+import gov.nasa.arc.geocam.talk.service.SiteAuthCookie;
import gov.nasa.arc.geocam.talk.service.TalkJsonConverter;
import gov.nasa.arc.geocam.talk.service.GeoCamSynchronizationTimerTask;
import gov.nasa.arc.geocam.talk.service.IDatabaseHelper;
@@ -18,10 +26,13 @@
@Override
protected void configure() {
bind(ITalkServer.class).to(FakeTalkServer.class);
- bind(ITalkJsonConverter.class).to(TalkJsonConverter.class);
- bind(IMessageStore.class).to(MessageStore.class);
bind(IDatabaseHelper.class).to(DatabaseHelper.class);
+ bind(IMessageStore.class).to(MessageStore.class);
+ bind(IAudioRecorder.class).to(AudioRecorder.class);
+ bind(IAudioPlayer.class).to(AudioPlayer.class);
+ bind(ITalkJsonConverter.class).to(TalkJsonConverter.class);
+ bind(ISiteAuth.class).to(SiteAuthCookie.class).in(Scopes.SINGLETON);
bind(IIntentHelper.class).to(IntentHelper.class);
- bind(IGeoCamSynchronizationTimerTask.class).to(GeoCamSynchronizationTimerTask.class);
- }
+ bind(IGeoCamSynchronizationTimerTask.class).to(GeoCamSynchronizationTimerTask.class).in(
+ Scopes.SINGLETON); }
}
View
13 Test/tests/gov/nasa/arc/geocam/talk/service/test/TalkJsonConverterTest.java
@@ -20,7 +20,7 @@ public void ensureProperParsingOfMessageListFeed() throws Exception
{
// arrange
String jsonString =
- "{\"ts\": 1, \"ms\": [{\"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}]}";
+ "{\"ts\": 1, \"ms\": [{\"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\": 182376817,\"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\": 182376817, \"latitude\": 37.411629, \"messageId\": 15, \"accuracy\":60.0, \"hasGeolocation\":true}]}";
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
TalkJsonConverter converter =
new TalkJsonConverter();
@@ -30,7 +30,7 @@ public void ensureProperParsingOfMessageListFeed() throws Exception
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"));
+ message1.setContentTimestamp(new Date(182376817));
// don't set latitude
message1.setMessageId(19);
// don't set accuracy
@@ -39,7 +39,7 @@ public void ensureProperParsingOfMessageListFeed() throws Exception
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.setContentTimestamp(new Date(182376817));
message2.setLatitude(37.411629);
message2.setMessageId(15);
message2.setAccuracy(60);
@@ -62,13 +62,13 @@ public void ensureSingularDeserializationWorks() throws Exception {
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}";
+ "{\"authorUsername\": \"rhornsby\", \"longitude\": -122.057954, \"content\": \"Structural engineer not allowing access to building. Fire is too out of control. Fire squad alerted.\", \"contentTimestamp\": 182376817, \"latitude\": 37.411629, \"messageId\": 15, \"accuracy\":60.0}";
GeoCamTalkMessage message = new GeoCamTalkMessage();
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.setContentTimestamp(new Date(182376817));
message.setLatitude(37.411629);
message.setMessageId(15);
message.setAccuracy(60);
@@ -88,7 +88,7 @@ public void ensureSerializeReturnsProperString() throws Exception
GeoCamTalkMessage msg = new GeoCamTalkMessage();
msg.setContent("contentTest");
- msg.setContentTimestamp(new Date());
+ msg.setContentTimestamp(new Long(182376817));
msg.setAccuracy(10);
msg.setLatitude(11);
msg.setLongitude(20.5);
@@ -99,6 +99,7 @@ public void ensureSerializeReturnsProperString() throws Exception
assertTrue(jsonString.contains("content"));
assertTrue(jsonString.contains("contentTest"));
assertTrue(jsonString.contains("contentTimestamp"));
+ assertTrue(jsonString.contains("182376817"));
assertTrue(jsonString.contains("accuracy"));
assertTrue(jsonString.contains("10"));
assertTrue(jsonString.contains("latitude"));
View
8 Test/tests/gov/nasa/arc/geocam/talk/service/test/TalkServerTest.java
@@ -51,6 +51,8 @@ public void shouldEnsureGetTalkMessagesReturnsMessages() throws Exception {
IIntentHelper intentHelper = mock(IIntentHelper.class);
setHiddenField(talkImpl, "intentHelper", intentHelper);
+ setHiddenField(talkImpl, "urlMessageList", "test");
+
// act
talkImpl.getTalkMessages();
@@ -73,6 +75,12 @@ public void shouldEnsureCreateTalkMessagePostsTalkMessage() throws Exception
when(jsonConv.serialize((GeoCamTalkMessage)anyObject())).thenReturn("");
setHiddenField(talkImpl, "jsonConverter", jsonConv);
+ MessageStore ms = mock(MessageStore.class);
+ setHiddenField(talkImpl, "messageStore", ms);
+
+ IIntentHelper ih = mock(IIntentHelper.class);
+ setHiddenField(talkImpl, "intentHelper", ih);
+
// act
talkImpl.createTalkMessage(new GeoCamTalkMessage());
View
6 android/src/gov/nasa/arc/geocam/talk/GeoCamTalkModule.java
@@ -29,12 +29,12 @@ protected void configure() {
bind(IDatabaseHelper.class).to(DatabaseHelper.class);
bind(IMessageStore.class).to(MessageStore.class);
bind(IAudioRecorder.class).to(AudioRecorder.class);
- bind(IAudioPlayer.class).to(AudioPlayer.class);
+ bind(IAudioPlayer.class).to(AudioPlayer.class).in(Scopes.SINGLETON);
bind(ITalkJsonConverter.class).to(TalkJsonConverter.class);
bind(ISiteAuth.class).to(SiteAuthCookie.class).in(Scopes.SINGLETON);
bind(IIntentHelper.class).to(IntentHelper.class);
- bind(IGeoCamSynchronizationTimerTask.class).to(GeoCamSynchronizationTimerTask.class).in(
- Scopes.SINGLETON);
+ bind(IGeoCamSynchronizationTimerTask.class).to(
+ GeoCamSynchronizationTimerTask.class).in(Scopes.SINGLETON);
}
}
View
133 android/src/gov/nasa/arc/geocam/talk/activity/GeoCamTalkActivity.java
@@ -29,7 +29,6 @@
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ListView;
-import android.widget.Toast;
import com.google.inject.Inject;
@@ -37,43 +36,46 @@
@Inject
ITalkServer djangoTalk;
+
@InjectView(R.id.TalkListView)
ListView talkListView;
+
@InjectResource(R.string.url_server_root)
String serverRootUrl;
+
@Inject
- GeoCamTalkMessageArrayAdapter adapter;
+ GeoCamTalkMessageAdapter adapter;
+
@Inject
IMessageStore messageStore;
+
@Inject
ISiteAuth siteAuth;
+
@Inject
IAudioPlayer player;
@Inject
SharedPreferences prefs;
@Inject
IIntentHelper intentHelper;
-
+
List<GeoCamTalkMessage> talkMessages;
private EditText username;
private BroadcastReceiver receiver = new BroadcastReceiver() {
-
+
@Override
public void onReceive(Context context, Intent intent) {
- if(intent.getAction().contentEquals(TalkServerIntent.INTENT_NEW_MESSAGES.toString()))
- {
+ if (intent.getAction().contentEquals(TalkServerIntent.INTENT_NEW_MESSAGES.toString())) {
GeoCamTalkActivity.this.newMessages();
}
}
};
-
-
- /** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
setUsername();
}
@@ -85,7 +87,20 @@ private void setUsername()
username.setText(prefs.getString("webapp_username", null));
}
}
-
+
+ private void populateListView() {
+ try {
+ talkMessages = messageStore.getAllMessages();
+ } catch (Exception e) {
+ Log.i("Talk", "Error:" + e.getMessage());
+ }
+
+ if (talkMessages != null) {
+ adapter.setTalkMessages(talkMessages);
+ talkListView.setAdapter(adapter);
+ }
+ }
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
@@ -128,18 +143,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
public void onGoHomeClick(View v) {
- List<GeoCamTalkMessage> talkMessages = null;
-
- try {
- talkMessages = messageStore.getAllMessages();
- } catch (Exception e) {
- Log.i("Talk", "Error:" + e.getMessage());
- }
-
- if (talkMessages != null) {
- adapter.setTalkMessages(talkMessages);
- talkListView.setAdapter(adapter);
- }
+ populateListView();
}
public void onCreateTalkClick(View v) {
@@ -147,65 +151,40 @@ public void onCreateTalkClick(View v) {
}
public void newMessages() {
- try {
- talkMessages = messageStore.getAllMessages();
- } catch (Exception e) {
- Log.i("Talk", "Error:" + e.getMessage());
- }
-
- if (talkMessages != null) {
- adapter.setTalkMessages(talkMessages);
- talkListView.setAdapter(adapter);
- }
+ populateListView();
}
-
- @Override
- protected void onResume() {
- super.onResume();
- IntentFilter filter = new IntentFilter();
- filter.addAction(TalkServerIntent.INTENT_NEW_MESSAGES.toString());
- registerReceiver(receiver, filter);
+ @Override
+ protected void onResume() {
+ super.onResume();
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(TalkServerIntent.INTENT_NEW_MESSAGES.toString());
+ registerReceiver(receiver, filter);
- setContentView(R.layout.main);
+ populateListView();
setUsername();
- talkListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
- @Override
- public void onItemClick (AdapterView<?> parentView, View childView, int position, long id) {
- GeoCamTalkMessage msg = adapter.getTalkMessage(position);
- if(msg.hasAudio())
- {
- try
- {
- UIUtils.playAudio(getApplicationContext(), msg, player, siteAuth);
- } catch (Exception e)
- {
- UIUtils.displayException(getApplicationContext(), e, "Cannot retrieve audio");
- }
- }
- }
- });
-
-
- try {
- talkMessages = messageStore.getAllMessages();
- } catch (Exception e) {
- Log.i("Talk", "Error:" + e.getMessage());
- }
+ talkListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parentView, View childView,
+ int position, long id) {
+ GeoCamTalkMessage msg = adapter.getTalkMessage(position);
+ if (msg.hasAudio()) {
+ try {
+ UIUtils.playAudio(getApplicationContext(), msg, player,
+ siteAuth);
+ } catch (Exception e) {
+ UIUtils.displayException(getApplicationContext(), e,
+ "Cannot retrieve audio");
+ }
+ }
+ }
+ });
+ }
- if (talkMessages != null) {
- adapter.setTalkMessages(talkMessages);
- talkListView.setAdapter(adapter);
- } else {
- Toast.makeText(this.getApplicationContext(), "Communication Error with Server",
- Toast.LENGTH_SHORT).show();
- }
- }
-
- @Override
- protected void onPause() {
- unregisterReceiver(receiver);
- super.onPause();
- }
+ @Override
+ protected void onPause() {
+ unregisterReceiver(receiver);
+ super.onPause();
+ }
}
View
72 .../talk/activity/GeoCamTalkMessageArrayAdapter.java → ...eocam/talk/activity/GeoCamTalkMessageAdapter.java
@@ -7,36 +7,34 @@
import java.util.Date;
import java.util.List;
+import roboguice.adapter.IterableAdapter;
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 GeoCamTalkMessageArrayAdapter extends ArrayAdapter<GeoCamTalkMessage> {
-
- @Inject LayoutInflater mInflater;
-
+public class GeoCamTalkMessageAdapter extends IterableAdapter<GeoCamTalkMessage> {
+
+ @Inject
+ LayoutInflater mInflater;
+
@Inject
- public GeoCamTalkMessageArrayAdapter(Context context) {
+ public GeoCamTalkMessageAdapter(Context context) {
super(context, R.layout.list_item);
}
-
- public void setTalkMessages(List<GeoCamTalkMessage> talkMessages)
- {
+
+ public void setTalkMessages(List<GeoCamTalkMessage> talkMessages) {
this.clear();
- for(GeoCamTalkMessage m:talkMessages)
- {
+ for (GeoCamTalkMessage m : talkMessages) {
add(m);
}
}
-
- public GeoCamTalkMessage getTalkMessage(int position){
+
+ public GeoCamTalkMessage getTalkMessage(int position) {
GeoCamTalkMessage msg = getItem(position);
return msg;
}
@@ -44,50 +42,40 @@ public GeoCamTalkMessage getTalkMessage(int position){
@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);
- ImageView audioImageView =
- (ImageView) row.findViewById(R.id.hasAudio);
-
+
+ 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);
+ ImageView audioImageView = (ImageView) row.findViewById(R.id.hasAudio);
+
GeoCamTalkMessage msg = getItem(position);
-
+
contentTextView.setText(msg.getContent());
fullnameTextView.setText(msg.getAuthorFullname());
- Date contentTimestamp = msg.getContentTimestamp();
+ Date contentTimestamp = msg.getContentTimestampDate();
+
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
contentTimestampTextView.setText(sdf.format(contentTimestamp));
-
- if(msg.hasGeolocation())
- {
+
+ if (msg.hasGeolocation()) {
geolocationImageView.setVisibility(View.VISIBLE);
- }
- else
- {
+ } else {
geolocationImageView.setVisibility(View.INVISIBLE);
}
- if(msg.hasAudio())
- {
+ if (msg.hasAudio()) {
audioImageView.setVisibility(View.VISIBLE);
- }
- else
- {
+ } else {
audioImageView.setVisibility(View.INVISIBLE);
}
-
+
return row;
- }
+ }
}
View
18 android/src/gov/nasa/arc/geocam/talk/bean/GeoCamTalkMessage.java
@@ -1,5 +1,6 @@
package gov.nasa.arc.geocam.talk.bean;
+import java.sql.Timestamp;
import java.util.Date;
import android.location.Location;
@@ -38,7 +39,7 @@
private String content;
@DatabaseField(columnName = DATE_FIELD_NAME)
- private Date contentTimestamp;
+ private Long contentTimestamp;
@DatabaseField
private Double latitude;
@@ -90,12 +91,18 @@ public void setAuthorFullname(String authorFullname) {
public void setContent(String content) {
this.content = content;
}
- public Date getContentTimestamp() {
- return contentTimestamp;
+ public Long getContentTimestamp() {
+ return this.contentTimestamp;
}
- public void setContentTimestamp(Date contentTimestamp) {
+ public void setContentTimestamp(Long contentTimestamp) {
this.contentTimestamp = contentTimestamp;
}
+ public Date getContentTimestampDate() {
+ return new Date(this.contentTimestamp);
+ }
+ public void setContentTimestamp(Date contentTimestamp) {
+ this.contentTimestamp = contentTimestamp.getTime();
+ }
public Double getLatitude() {
return latitude;
}
@@ -200,12 +207,13 @@ public int compareTo(GeoCamTalkMessage another) {
return -1;
} else if(another.getContentTimestamp() == null) {
return 1;
- } else if(this.contentTimestamp.after(another.getContentTimestamp())) {
+ } else if(this.getContentTimestampDate().after(another.getContentTimestampDate())) {
return 1;
} else {
return -1;
}
}
+
public void setLocation(Location location) {
if (location != null) {
this.setLatitude(location.getLatitude());
View
1  android/src/gov/nasa/arc/geocam/talk/service/C2DMReciever.java
@@ -5,7 +5,6 @@
import android.content.Context;
import android.content.Intent;
import android.util.Log;
-import android.widget.Toast;
import com.google.inject.Inject;
View
2  android/src/gov/nasa/arc/geocam/talk/service/GeoCamSynchronizationTimerTask.java
@@ -8,7 +8,7 @@
private IIntentHelper intentHelper;
private Handler handler = new Handler();
- private long period = 60 * 10 * 1000; // 10 minutes TODO make shared preference
+ private long period = 10 * 1000; // 10 minutes TODO make shared preference
@Inject
public GeoCamSynchronizationTimerTask(IIntentHelper intentHelper) {
View
10 android/src/gov/nasa/arc/geocam/talk/service/TalkServer.java
@@ -1,6 +1,7 @@
package gov.nasa.arc.geocam.talk.service;
import gov.nasa.arc.geocam.talk.R;
+import gov.nasa.arc.geocam.talk.UIUtils;
import gov.nasa.arc.geocam.talk.bean.GeoCamTalkMessage;
import gov.nasa.arc.geocam.talk.bean.ServerResponse;
import gov.nasa.arc.geocam.talk.bean.TalkServerIntent;
@@ -14,6 +15,7 @@
import org.apache.http.client.ClientProtocolException;
+import roboguice.application.RoboApplication;
import roboguice.inject.InjectResource;
import roboguice.service.RoboIntentService;
import android.content.Intent;
@@ -49,6 +51,9 @@
IIntentHelper intentHelper;
@Inject
+ IAudioPlayer audioPlayer;
+
+ @Inject
IGeoCamSynchronizationTimerTask geoCamSynchronizationTimerTask;
public TalkServer() {
@@ -178,7 +183,12 @@ private void handlePushedMessageIntent(String messageId) { // assumed this is no
GeoCamTalkMessage pushedMessage =
jsonConverter.deserialize(jsonString);
// TODO: We're assuming all is well, may need to check for existing message id first
+
+ pushedMessage.setSynchronized(true);
messageStore.addMessage(pushedMessage); // TODO: go get audio if avaialable
+
+ UIUtils.playAudio(getApplicationContext(), pushedMessage, audioPlayer, siteAuth);
+
intentHelper.BroadcastNewMessages();
} catch (Exception e) {
Log.e("GeoCam Talk", "Error on single message get", e);
Please sign in to comment.
Something went wrong with that request. Please try again.