public void setSnippet(String snippet) {
   this.snippet = snippet;
   if (marker != null) {
     marker.setSnippet(snippet);
   }
   update();
 }
Ejemplo n.º 2
0
  public void UpdateMarker() {
    marker.setTitle(
        (isInvoln() ? "Powered up " : "")
            + PlayerType.getTypeString(type)
            + " "
            + (local ? "You" : name));
    int drawableID = PlayerType.getDrawableID(type);

    Bitmap bmp = BitmapFactory.decodeResource(Game.getAppContext().getResources(), drawableID);

    if (bmp == null) {
      return;
    }

    double aspect = bmp.getWidth() / (double) bmp.getHeight();
    marker.setIcon(
        BitmapDescriptorFactory.fromBitmap(
            Bitmap.createScaledBitmap(bmp, (int) (100 * aspect), 100, false)));
    marker.setAlpha(isCooldown() ? 0.5f : 1f);
    marker.setVisible(true);
    marker.setPosition(new LatLng(latitude, longitude));
    marker.setSnippet("Score: " + score);
    accuracyCircle.setCenter(new LatLng(latitude, longitude));
    accuracyCircle.setRadius(accuracy);
  }
Ejemplo n.º 3
0
  public void updateFriendMarker(UserObject u) {
    if (!friend1.isVisible()) {
      friend1.setVisible(true);
    }
    friend1.setSnippet(u.getUsername());

    friend1.setPosition(new LatLng(u.getLast_lat_double(), u.getLast_long_double()));
    Log.i(
        TAG,
        " updating friend location..... " + u.getLast_lat_double() + " " + u.getLast_long_double());
  }
  /**
   * @param locality
   * @param lat
   * @param lng
   */
  private void addMarker(String locality, double lat, double lng) {
    if (marker != null) {
      marker.remove();
    }
    MarkerOptions options =
        new MarkerOptions().anchor(0.5f, 0.5f).position(new LatLng(lat, lng)).draggable(true);

    marker = mMap.addMarker(options);
    if (locality != null) {
      marker.setTitle(locality);
    }
    marker.setSnippet("Latitude: " + lat + "\n" + "Longitude: " + lng);
  }
 private void addMarker(String locality, double lat, double lng, int currentLocationFlag) {
   if (currentLocationMarker != null) {
     currentLocationMarker.remove();
   }
   MarkerOptions options =
       new MarkerOptions()
           .position(new LatLng(lat, lng))
           .anchor(0.5f, 0.5f)
           .draggable(true)
           .icon(BitmapDescriptorFactory.fromResource(R.drawable.current_location_blue));
   currentLocationMarker = mMap.addMarker(options);
   if (locality != null) {
     currentLocationMarker.setTitle(locality);
   }
   currentLocationMarker.setSnippet("Latitude: " + lat + "\n" + "Longitude: " + lng);
 }
Ejemplo n.º 6
0
    @Override
    protected void onPostExecute(Bitmap bitmapResult) {

      super.onPostExecute(bitmapResult);
      if (bitmapResult == null || cancelAsyncTasks || !isAdded() || map == null) {
        return;
      }
      Marker marker = markerMap.get(email);
      Boolean isNew = false;
      if (marker != null) {
        Log.d(TAG, "onPostExecute - updating marker: " + email);
        marker.setPosition(latLng);
        marker.setSnippet(time);
        marker.setIcon(BitmapDescriptorFactory.fromBitmap(bitmapResult));

      } else {
        Log.d(TAG, "onPostExecute - creating marker: " + email);
        marker =
            map.addMarker(
                new MarkerOptions()
                    .position(latLng)
                    .title(email)
                    .snippet(time)
                    .icon(BitmapDescriptorFactory.fromBitmap(bitmapResult)));
        Log.d(TAG, "onPostExecute - marker created");
        markerMap.put(email, marker);
        Log.d(TAG, "onPostExecute - marker in map stored. markerMap: " + markerMap.size());
        isNew = true;
      }

      if (marker.getTitle().equals(MainApplication.emailBeingTracked)) {
        marker.showInfoWindow();
        Log.d(TAG, "onPostExecute - showInfoWindow open");
        if (isNew) {
          map.moveCamera(CameraUpdateFactory.newLatLngZoom(marker.getPosition(), 16));
        } else {
          map.moveCamera(CameraUpdateFactory.newLatLng(marker.getPosition()));
        }
      } else if (firstTimeZoom
          && MainApplication.emailBeingTracked == null
          && MainApplication.userAccount != null
          && marker.getTitle().equals(MainApplication.userAccount)) {
        firstTimeZoom = false;
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(marker.getPosition(), 16));
      }
    }