Example #1
0
  private void showObservationCallout(com.google.android.gms.maps.model.Marker marker) {
    final Marker item = mMarkersAdapter.getItem(marker);
    Bundle args = new Bundle();
    args.putString("uid", item.uid);
    getLoaderManager()
        .restartLoader(
            LOADER_OBSERVATION,
            args,
            new LoaderManager.LoaderCallbacks<Observation>() {

              @Override
              public Loader<Observation> onCreateLoader(int id, Bundle args) {
                return new ObservationLoader(getActivity(), args.getString("uid"));
              }

              @Override
              public void onLoadFinished(Loader<Observation> loader, Observation data) {
                if (data != null) {
                  com.google.android.gms.maps.model.Marker marker = mMarkersAdapter.getMarker(item);
                  if (marker != null) {
                    mMarkersAdapter.getItem(marker).observation = data;
                    if (marker.isInfoWindowShown()) marker.showInfoWindow();
                  }
                }
              }

              @Override
              public void onLoaderReset(Loader<Observation> loader) {}
            });
    marker.showInfoWindow();
    mInfoWindowMarker = marker;
    AnalyticsHelper.trackUiEvent("callout", null);
  }
Example #2
0
 @Override
 public void onInfoWindowClick(com.google.android.gms.maps.model.Marker marker) {
   Marker item = mMarkersAdapter.getItem(marker);
   if (item.observation != null) {
     // TODO
     if (!(item.observation instanceof WezzooObservation)) return;
     startActivity(ObservationActivity.newIntent(getActivity(), item.observation, false));
   }
 }