public void onEventMainThread(Events.LocationMessageReceived e) { // Updates a contact or allocates a new one Contact c = App.getContacts().get(e.getTopic()); if (c == null) { Log.v(this.toString(), "Allocating new contact for " + e.getTopic()); c = new st.alr.mqttitude.model.Contact(e.getTopic()); updateContact(c); } c.setLocation(e.getGeocodableLocation()); App.getContacts().put(e.getTopic(), c); // if (e.getLocationMessage().hasTransition()) { // Notification noti = new Notification.InboxStyle( // new Notification.Builder(this.context) // .setContentTitle("title").setContentText("subject") // .setSmallIcon(R.drawable.ic_notification)).addLine( // "line1").build(); // // } // Fires a new event with the now updated or created contact to which // fragments can react EventBus.getDefault().post(new Events.ContactUpdated(c)); }
public void updateAllContacts() { Iterator<Entry<String, Contact>> it = App.getContacts().entrySet().iterator(); while (it.hasNext()) { Entry<String, Contact> item = it.next(); Contact c = item.getValue(); updateContact(c); EventBus.getDefault().post(new Events.ContactUpdated(c)); } }
public static HashMap<String, Contact> getContacts() { return App.getContacts(); }