Пример #1
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);
  }
 public void setTitle(String title) {
   this.title = title;
   if (marker != null) {
     marker.setTitle(title);
   }
   update();
 }
Пример #3
0
  @Override
  public boolean onMarkerClick(Marker arg0) {
    String userId = UsersManager.getInstance().getUserIdForMarkerId(arg0.getId());
    if (userId != null) {
      String name = UsersManager.getInstance().getUserNameForMarkerId(arg0.getId());
      String title = name + " meet me:";
      arg0.setTitle(title);
      arg0.showInfoWindow();
    }

    return true;
  }
  /**
   * @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);
 }
Пример #6
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    marker.setTitle(getIntent().getStringExtra("MarkerTitle"));

    marker.showInfoWindow();
    // refresh markers here
    // result code == 1 means that returned from MarkersInfo activity, data hasn`t changed
    // result code == 2 means that returned from MarkersInfo, data has changed
    // result code == 3 means that returned from EditActivity, but info not changed
    // result code == 4 means that returned from EditActivity, and data has changed
    if (data == null) {
      return;
    }
    if (resultCode == 1) {
      String name = data.getStringExtra("message"); // not used yet
    }
  }
  private Marker setMarker(Marker marker, double lat, double lng, String title) {
    if (marker != null) {
      marker.setPosition(new LatLng(lat, lng));
      if (title != null) {
        marker.setTitle(title);
      }

      return marker;
      // marker.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));
    return mMap.addMarker(options);
  }
Пример #8
0
 @Override
 public void onMarkerDragEnd(Marker marker) {
   marker.hideInfoWindow();
   currentLatLng = marker.getPosition();
   localizacion = new Localizacion(MapsActivity.this, currentLatLng);
   information = Arrays.toString(localizacion.gps()).replaceAll("\\[|\\]", "");
   marker.setTitle(information);
   preferences =
       new Preferences(
           getApplicationContext(),
           "Latitude,Longitude, CountryCode,Country, State, City, Address",
           String.valueOf(currentLatLng.latitude)
               + ","
               + String.valueOf(currentLatLng.longitude)
               + ","
               + information,
           "Laundry");
   preferences.savePreferences();
 }
 private void setMakerTitle(Marker marker, String title) {
   if (marker != null) {
     marker.setTitle(title);
   }
 }
Пример #10
0
 public static void update(Marker marker, Gcp gcp) {
   marker.setPosition(gcp.coord);
   marker.setTitle(String.valueOf(0));
   marker.setIcon(getIcon(gcp));
 }
Пример #11
0
  @Override
  public void onLocationReceived(LatLng latlong) {
    if (googleMap == null) {
      return;
    }

    if (markerClient_d_location == null) {
      if (requestDetail.getClient_d_latitude() != null
          && requestDetail.getClient_d_longitude() != null) {
        markerClient_d_location =
            googleMap.addMarker(
                new MarkerOptions()
                    .position(
                        new LatLng(
                            Double.parseDouble(requestDetail.getClient_d_latitude()),
                            Double.parseDouble(requestDetail.getClient_d_longitude())))
                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.pin_client))
                    .title("Destination"));
      }
    }

    if (markerClientLocation == null) {
      markerClientLocation =
          googleMap.addMarker(
              new MarkerOptions()
                  .position(
                      new LatLng(
                          Double.parseDouble(requestDetail.getClientLatitude()),
                          Double.parseDouble(requestDetail.getClientLongitude())))
                  .icon(BitmapDescriptorFactory.fromResource(R.drawable.pin_client)));

      if (jobStatus == AndyConstants.IS_WALK_COMPLETED) {
        markerClientLocation.setTitle(
            mapActivity.getResources().getString(R.string.job_start_location));
      } else {
        markerClientLocation.setTitle(
            mapActivity.getResources().getString(R.string.client_location));
      }
    }

    if (latlong != null) {
      if (googleMap != null) {
        if (markerDriverLocation == null) {
          markerDriverLocation =
              googleMap.addMarker(
                  new MarkerOptions()
                      .position(new LatLng(latlong.latitude, latlong.longitude))
                      .icon(BitmapDescriptorFactory.fromResource(R.drawable.pin_driver))
                      .title(getResources().getString(R.string.my_location)));
          googleMap.animateCamera(
              CameraUpdateFactory.newLatLngZoom(
                  new LatLng(latlong.latitude, latlong.longitude), 16));
        } else {
          markerDriverLocation.setPosition(new LatLng(latlong.latitude, latlong.longitude));
          if (jobStatus == AndyConstants.IS_WALK_COMPLETED) {
            drawTrip(new LatLng(latlong.latitude, latlong.longitude));

            // distance = decimalFormat.format(distanceMeter / (1000
            // * 1.62));

            // tvJobDistance.setText(decimalFormat
            // .format(preferenceHelper.getDistance()
            // / (1000 * 1.62))
            // + " "
            // + mapActivity.getResources().getString(
            // R.string.text_miles));

            tvJobDistance.setText(
                decimalFormat.format(
                        preferenceHelper.getDistance()
                        // / (1000 * 1.62))
                        )
                    + " "
                    + preferenceHelper.getUnit());
          }
        }
        // getDistance();
      }
    }
  }
Пример #12
0
  @Override
  public void onTaskCompleted(String response, int serviceCode) {
    AndyUtils.removeCustomProgressDialog();
    switch (serviceCode) {
      case AndyConstants.ServiceCode.WALKER_STARTED:
        AppLog.Log(TAG, "walker started response " + response);
        if (parseContent.isSuccess(response)) {
          jobStatus = AndyConstants.IS_WALKER_ARRIVED;
          setjobStatus(jobStatus);
        }

        break;
      case AndyConstants.ServiceCode.WALKER_ARRIVED:
        AppLog.Log(TAG, "walker arrived response " + response);
        if (parseContent.isSuccess(response)) {
          jobStatus = AndyConstants.IS_WALK_STARTED;
          setjobStatus(jobStatus);
        }
        break;
      case AndyConstants.ServiceCode.WALK_STARTED:
        AppLog.Log(TAG, "walk started response " + response);
        Log.d("amal", response);
        if (parseContent.isSuccess(response)) {
          preferenceHelper.putIsTripStart(true);
          jobStatus = AndyConstants.IS_WALK_COMPLETED;
          setjobStatus(jobStatus);
          // getDistance();
          preferenceHelper.putRequestTime(Calendar.getInstance().getTimeInMillis());
          if (markerClientLocation != null) {
            markerClientLocation.setTitle(
                mapActivity.getResources().getString(R.string.job_start_location));
            markerClientLocation.remove();
          }
          startElapsedTimer();
        }

        break;
      case AndyConstants.ServiceCode.WALK_COMPLETED:
        AppLog.Log(TAG, "walk completed response" + response);
        Log.d("mahi", "response done" + response);
        if (parseContent.isSuccess(response)) {
          FeedbackFrament feedbackFrament = new FeedbackFrament();
          Bundle bundle = new Bundle();
          bundle.putSerializable(AndyConstants.REQUEST_DETAIL, requestDetail);
          Bill bill = parseContent.parsebillwhenwalkcomplete(response);
          bundle.putSerializable("bill", bill);
          // bundle.putString(
          // AndyConstants.Params.TIME,
          // time
          // + " "
          // + mapActivity.getResources().getString(
          // R.string.text_mins));
          // bundle.putString(
          // AndyConstants.Params.DISTANCE,
          // decimalFormat.format(preferenceHelper.getDistance())
          // // / (1000 * 1.62))
          // + " "
          // + mapActivity.getResources().getString(
          // R.string.text_miles));

          requestDetail.setTime(time);
          requestDetail.setDistance(" " + preferenceHelper.getDistance());
          requestDetail.setUnit(preferenceHelper.getUnit());
          feedbackFrament.setArguments(bundle);
          preferenceHelper.clearRequestData();
          mapActivity.addFragment(
              new ClientRequestFragment(), false, AndyConstants.CLIENT_REQUEST_TAG, true);

          // removing feedback
          // mapActivity.addFragment(feedbackFrament, false,
          //		AndyConstants.FEEDBACK_FRAGMENT_TAG, true);
        }
        break;

      case AndyConstants.ServiceCode.GET_ROUTE:
        // if (parseContent.isSuccess(response)) {
        // jobStatus = AndyConstants.;
        // setjobStatus(jobStatus);
        // }
      case AndyConstants.ServiceCode.PATH_REQUEST:
        AppLog.Log(TAG, "Path request :" + response);
        if (parseContent.isSuccess(response)) {
          parseContent.parsePathRequest(response, points);
          initPreviousDrawPath();
        }
        break;
      default:
        break;
    }
  }