示例#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));
  }
示例#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)));
 }
示例#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());
  }
示例#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());
  }
示例#5
0
 private void updateFamilyStoryLines() {
   clearFamilyStoryLines();
   if (!Settings.isFamilyLinesEnabled()) return;
   recDrawFamilyStoryLines(MainModel.getEvent(selEventId), Settings.START_FAMILY_LINE_WIDTH);
 }