Exemplo n.º 1
0
  private void setUpMap() {
    mMap.setOnMarkerClickListener(
        new GoogleMap.OnMarkerClickListener() {
          @Override
          public boolean onMarkerClick(Marker marker) {
            //              Log.e(tag, "clicked on marker");
            String eventId = marker.getSnippet();
            setEvent(eventId);
            refreshIfNeeded();
            return false;
          }
        });

    mMap.setMapType(Settings.getMapType());

    computeMarkerColors();

    showEvents();

    selEventId = ((MapActivityInterface) getActivity()).getEventId();
    if (selEventId != null) {
      Log.e(tag, "Setting up initial event");
      setEvent(selEventId);
      Event e = MainModel.getEvent(selEventId);
      mMap.animateCamera(
          CameraUpdateFactory.newLatLngZoom(new LatLng(e.getLat(), e.getLng()), 12.0f));
    }
    //        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude,
    //              longitude), 12.0f));
  }
Exemplo n.º 2
0
 private void showEvent(String eventId) {
   Event e = MainModel.getEvent(eventId);
   LatLng pos =
       new LatLng(
           e.getLat() + Math.random() / MARKER_FUDGE_DENOM,
           e.getLng() + Math.random() / MARKER_FUDGE_DENOM);
   String description = e.getDescription();
   float event_color =
       (description_hues.containsKey(description))
           ? description_hues.get(description)
           : DEFAULT_MARKER_COLOR;
   mMap.addMarker(
       new MarkerOptions()
           .position(pos)
           .snippet(eventId)
           .icon(BitmapDescriptorFactory.defaultMarker(event_color)));
 }
Exemplo n.º 3
0
  private void setEvent(String eventId) {
    Event e = MainModel.getEvent(eventId);
    Person p = MainModel.getPerson(e.getPersonId());
    String eventText =
        p.getFirstName()
            + " "
            + p.getLastName()
            + System.getProperty("line.separator")
            + e.fullDescription();
    //        Log.e(tag, "setting event text to " + eventText);
    event_text.setText(eventText);
    selPersonId = e.getPersonId();
    selEventId = eventId;
    updateLines();

    showGenderImage(p.getGender());
  }
Exemplo n.º 4
0
  private void updateSpouseLines() {
    clearSpouseLine();

    if (!Settings.isSpouseLinesEnabled()) return;

    Event selEvent = MainModel.getEvent(selEventId);
    Person p = selEvent.getPerson();
    Person spouse = MainModel.getPerson(p.getSpouseId());

    if (spouse == null || selEvent == null) return;

    Event firstSpouseEvent = spouse.getEarliestEvent();

    if (firstSpouseEvent == null) return;

    if (!MainModel.isEventVisible(selEvent.getId())
        || !MainModel.isEventVisible(firstSpouseEvent.getId())) return;
    spouseLine =
        drawLine(selEvent, firstSpouseEvent, SPOUSE_LINE_WIDTH, Settings.getSpouseLineColor());
  }
Exemplo n.º 5
0
 private void updateFamilyStoryLines() {
   clearFamilyStoryLines();
   if (!Settings.isFamilyLinesEnabled()) return;
   recDrawFamilyStoryLines(MainModel.getEvent(selEventId), Settings.START_FAMILY_LINE_WIDTH);
 }