Beispiel #1
0
    @Override
    public View getInfoWindow(Marker marker) {
      long task_id;
      try {
        task_id = Long.parseLong(marker.getTitle());
      } catch (Exception e) {
        task_id = -1;
      }
      if (task_id != -1) {
        LayoutInflater inflater =
            (LayoutInflater)
                getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View windowview = inflater.inflate(R.layout.task_window, null);

        Task task =
            TaskList.getInstance(getApplicationContext())
                .getTaskById(Long.parseLong(marker.getTitle()));

        ((TextView) windowview.findViewById(R.id.tvTitleWin)).setText(task.getTitle());
        ((TextView) windowview.findViewById(R.id.tvDescriptionWin)).setText(task.getDesc());
        ((TextView) windowview.findViewById(R.id.tvLocationWin)).setText(task.getLocation());
        ((TextView) windowview.findViewById(R.id.tvFromToWin)).setText(task.getFromTo());
        String status = (task.isChecked() == 1) ? "Done" : "Not Done";
        ((TextView) windowview.findViewById(R.id.tvStatusWin)).setText(status);
        return windowview;
      } else {
        return null;
      }
    }
Beispiel #2
0
    @Override
    public View getInfoWindow(Marker marker) {
      // Don't show an InfoWindow for proppellern.
      if (marker.getPosition().equals(PROPELLERN) && null == marker.getTitle()) {
        return null;
      }

      ImageView pic = (ImageView) mWindow.findViewById(R.id.badge);
      pic.setImageResource(R.drawable.nopo);

      String title = marker.getTitle();
      TextView titleUi = (TextView) mWindow.findViewById(R.id.title);
      titleUi.setText(title);
      titleUi.setTextColor(getResources().getColor(R.color.red));

      String snippet = marker.getSnippet();
      TextView snippetUi = (TextView) mWindow.findViewById(R.id.snippet);
      snippetUi.setText(snippet);

      TextView numBeers = (TextView) mWindow.findViewById(R.id.numBeers);
      String beerText = "";
      int beers = beerMap.get(marker);
      if (0 < beers) {
        beerText = beerMap.get(marker) + " " + (beers == 1 ? "beer" : "beers") + " reported.";
      }
      numBeers.setText(beerText);

      return mWindow;
    }
Beispiel #3
0
 // ---------------------------------------------------------------------------------------------
 // Method for updating the icons of the markers and plotting the new route. --------------------
 private void updateMarkersAndRoute(Marker marker) {
   Log.d("VetFirstActivity", ">> Marker clicked: " + marker.getTitle());
   vetMap.clear();
   int temp_i = 0;
   for (int i = 0; i < markerOptionsList.size(); i++) {
     if (marker.getTitle().equals(markerOptionsList.get(i).getTitle())) {
       temp_i = i;
       Log.d("VetFirstActivity", ">> Position in list:" + temp_i);
     }
   }
   for (int i = 0; i < markerOptionsList.size(); i++) {
     if ((i != nearestVetPosition) && (i != temp_i)) {
       vetMap.addMarker(markerOptionsList.get(i).icon(vetIcon).alpha(0.6f));
     } else if ((i != nearestVetPosition) && (i == temp_i)) {
       vetMap.addMarker(markerOptionsList.get(i).icon(vetIcon).alpha(1f));
     } else {
       vetMap.addMarker(markerOptionsList.get(i).icon(nearestVetIcon));
     }
   }
   vetMap.addMarker(
       new MarkerOptions()
           .position(currentLocationLatLng)
           .title("Βρίσκεστε εδώ")
           .icon(currentLocationIcon));
   GetRouteTask markerGetRouteTask = new GetRouteTask();
   markerGetRouteTask.execute(
       ConnectionManager.getDirectionsURL(currentLocationLatLng, vetLatLng));
   vetMap.animateCamera(CameraUpdateFactory.newLatLng(vetLatLng));
 }
  /*
   * Map methods
   */
  public static void staticOnMarkerClick(
      SherlockFragmentActivity mActivity,
      GoogleMap map,
      Marker marker,
      OnDetailsClick onDetailsClickImplementation) {
    String id = marker.getTitle();

    List<LocatedObject> list = MapManager.ClusteringHelper.getFromGridId(id);

    if (list == null || list.isEmpty()) {
      return;
    }

    if (list.size() > 1 && map.getCameraPosition().zoom == map.getMaxZoomLevel()) {
      AlertRoadsInfoDialog infoDialog = new AlertRoadsInfoDialog(onDetailsClickImplementation);
      Bundle args = new Bundle();
      args.putSerializable(AlertRoadsInfoDialog.ARG_ALERTSLIST, (ArrayList) list);
      infoDialog.setArguments(args);
      infoDialog.show(mActivity.getSupportFragmentManager(), "dialog");
    } else if (list.size() > 1) {
      map.animateCamera(
          CameraUpdateFactory.newLatLngZoom(
              marker.getPosition(), map.getCameraPosition().zoom + 1));
      MapManager.fitMapWithOverlays(list, map);
    } else {
      AlertRoadLoc alert = (AlertRoadLoc) list.get(0);
      AlertRoadsInfoDialog infoDialog = new AlertRoadsInfoDialog(onDetailsClickImplementation);
      Bundle args = new Bundle();
      args.putSerializable(AlertRoadsInfoDialog.ARG_ALERT, alert);
      infoDialog.setArguments(args);
      infoDialog.show(mActivity.getSupportFragmentManager(), "dialog");
    }
  }
 @Override
 public void onInfoWindowClick(Marker marker) {
   if (marker.getTitle().equals(getString(R.string.Marker_NotRegistered))) {
     // 未登録のマーカーであれば情報を追加する
     // 地点情報追加画面に遷移
     Intent intent = new Intent(this, AddPlaceActivity.class);
     intent.putExtra("latitude", marker.getPosition().latitude);
     intent.putExtra("longitude", marker.getPosition().longitude);
     startActivityForResult(intent, 123);
   }
   PlaceInfo pInfo = new PlaceInfo();
   pInfo.mMarker = marker;
   if (mPlaceInfoList.contains(pInfo)) {
     // マーカーの詳細情報画面を開く
     Intent intent = new Intent(this, DisplayDetailActivity.class);
     PlaceInfo pClone = mPlaceInfoList.get(mPlaceInfoList.indexOf(pInfo)).getSeralizable();
     intent.putExtra("placeInfo", pClone);
     try {
       startActivity(intent);
     } catch (RuntimeException e) {
       Toast t = Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG);
       t.show();
       e.getStackTrace();
     }
   }
 }
 @Override
 public void onInfoWindowClick(Marker marker) {
   switch (marker.getTitle()) {
     case "Indicative":
       {
         Intent indIntent = new Intent(Intent.ACTION_VIEW);
         indIntent.setData(Uri.parse(indURL));
         startActivity(indIntent);
       }
       break;
     case "Zirka":
       {
         Intent zirIntent = new Intent(Intent.ACTION_VIEW);
         zirIntent.setData(Uri.parse(zirURL));
         startActivity(zirIntent);
       }
       break;
     case "Hydrosila":
       {
         Intent hydIntent = new Intent(Intent.ACTION_VIEW);
         hydIntent.setData(Uri.parse(hydURL));
         startActivity(hydIntent);
       }
       break;
   }
 }
 @Override
 public View getInfoWindow(Marker marker) {
   view = custom.inflate(R.layout.custom_infowindow, null);
   info = (TextView) view.findViewById(R.id.infoWindowText);
   info.setText(marker.getTitle());
   if (isCustom) return view;
   else return null;
 }
    @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));
      }
    }
 @Override
 public void onInfoWindowClick(Marker marker) {
   String windowTitle = marker.getTitle();
   String windowSubtitle = marker.getSnippet();
   Intent openBuildingInfo = new Intent(MapHandler.this, InformationManager.class);
   Bundle windowInformation = new Bundle();
   windowInformation.putString("windowTitle", windowTitle);
   windowInformation.putString("windowSubtitle", windowSubtitle);
   openBuildingInfo.putExtras(windowInformation);
   startActivity(openBuildingInfo);
 }
 @Override
 public void onInfoWindowClick(Marker marker) {
   Intent intent = new Intent();
   Bundle bundle = new Bundle();
   int index = 0;
   if (marker.getTitle().equals("Swedish Physicians")) {
     index = 0;
   } else if (marker.getTitle().equals("Swedish Medical Center")) {
     index = 1;
   } else if (marker.getTitle().equals("University of Washington Medical Center")) {
     index = 2;
   } else if (marker.getTitle().equals("ZOOM Care Wallingford")) {
     index = 3;
   } else if (marker.getTitle().equals("Women's Health Care Center")) {
     index = 4;
   }
   bundle.putInt("ARRAY_INDEX", index);
   intent.putExtras(bundle);
   intent.setClass(getActivity(), HospitalDetailActivity.class);
   getActivity().startActivity(intent);
 }
  @Override
  public View getInfoContents(Marker marker) {
    View popup = inflater.inflate(R.layout.popup, null);

    TextView tv = (TextView) popup.findViewById(R.id.title);

    tv.setText(marker.getTitle());
    tv = (TextView) popup.findViewById(R.id.snippet);
    tv.setText(marker.getSnippet());

    return (popup);
  }
Beispiel #12
0
 @SuppressLint("InflateParams")
 @Override
 public View getInfoContents(Marker marker) {
   if (mPopup == null) {
     mPopup = mInflater.inflate(R.layout.single_host_infowindow, null);
   }
   TextView titleView = (TextView) mPopup.findViewById(R.id.title);
   titleView.setText(marker.getTitle());
   TextView snippetView = (TextView) mPopup.findViewById(R.id.snippet);
   snippetView.setText(Html.fromHtml(marker.getSnippet()));
   return (mPopup);
 }
 public void removeMarker(Airplane airplane) {
   synchronized (markers) {
     for (Marker m : markers) {
       if (m.getTitle().equals(airplane.getHex())) {
         m.remove();
         markers.remove(m);
         airplanes.remove(airplane.getHex());
         break;
       }
     }
   }
 }
Beispiel #14
0
 @Override
 public void onInfoWindowClick(Marker marker) {
   MainActivity.marker = marker;
   Intent intent1 = new Intent(this, MarkerInfo.class);
   String markerSnippet = marker.getSnippet();
   // intent1.putExtras(marker);
   intent1.putExtra("id", markerID);
   intent1.putExtra("markername", marker.getTitle().toString());
   intent1.putExtra("MarkerGoogleID", marker.getId());
   intent1.putExtra(
       "snippet",
       markerSnippet); // тут буде стрінг, який містить джейсон дані з ключами дескріпшин
   startActivityForResult(intent1, 1);
 }
  @Override
  public boolean onMarkerClick(final Marker marker) {

    try {
      String s = marker.getTitle();
      URLConnection http = new URLConnection();
      ArrayList<Event> list = http.sendGetEvents();
      for (int j = 0; j < list.size(); j++) {}
      for (int i = 0; i < list.size(); i++) {

        if (list.get(i).getName() != null
            && marker.getTitle() != null
            && list.get(i).getName().equals(marker.getTitle())) {

          Bundle args = new Bundle();
          Fragment fragment = new ViewEventFragment();
          args.putString("EventID", list.get(i).getEventID());

          // args.putString("MapURL",map.toUrlValue());
          fragment.setArguments(args);
          FragmentManager frgManager = getFragmentManager();
          frgManager
              .beginTransaction()
              .replace(R.id.content_frame, fragment)
              .addToBackStack("Map")
              .commit();

          return true;
        }
      }
    } catch (IOException e) {
      Log.e(ETag, "Unable connect to server", e);
    } catch (Exception e) {
      Log.e(ETag, "Unable to connect to internet", e);
    }
    return true;
  }
  public void updateMarker(Airplane airplane) {
    for (Marker m : markers) {
      boolean infoShow = m.isInfoWindowShown();
      if (m.getTitle().equals(airplane.getHex())) {
        AirplanePosition position = airplane.getLastPosition();
        LatLng location = new LatLng(position.getLatitude(), position.getLongitude());
        float angle = (float) airplane.getHead() + map.getCameraPosition().bearing;
        m.setPosition(location);
        m.setIcon(BitmapDescriptorFactory.fromBitmap(getAirplaneIcon(angle)));

        if (infoShow) m.showInfoWindow();
        break;
      }
    }
  }
  @Override
  public void onClick(DialogInterface dialog, int which) {

    String[] title = marker.getTitle().split(" ");
    String nombre = title[0];

    String direccion =
        ObtenerDireccion(marker.getPosition().latitude, marker.getPosition().longitude);

    if (options[which] == "Elegir lugar") {
      onLugarSelected.onLugarSelected(
          marker.getPosition().latitude, marker.getPosition().longitude, direccion, nombre);

    } else if (options[which] == "Cancelar") {
      dialog.dismiss();
    }
  }
    @Override
    public View getInfoContents(Marker marker) {

      if (!aq.isExist() || cancelAsyncTasks || !isAdded()) {
        return null;
      }

      View myContentsView =
          getActivity().getLayoutInflater().inflate(R.layout.map_info_window, null);
      AQuery aq = new AQuery(myContentsView);

      String name = Utils.getNameFromEmail(context, marker.getTitle());
      aq.id(R.id.contact_name).text(name);
      aq.id(R.id.timestamp).text(Utils.timestampText(marker.getSnippet()));

      return myContentsView;
    }
Beispiel #19
0
  @Override
  public View getInfoContents(Marker marker) {
    View popup = inflater.inflate(R.layout.popup, null);

    TextView tv = (TextView) popup.findViewById(R.id.title);
    tv.setText(marker.getTitle());
    try {
      tv = (TextView) popup.findViewById(R.id.snippet);

      SpannableString content = new SpannableString(marker.getSnippet());
      content.setSpan(new UnderlineSpan(), 0, content.length(), 0);

      tv.setText(content);

      Linkify.addLinks(((TextView) popup.findViewById(R.id.snippet)), Linkify.ALL);
    } catch (Exception e) {

    }
    return (popup);
  }
  @Override
  public View getInfoContents(Marker marker) {
    View v = inflater.inflate(R.layout.bus_info_layout, null);

    String[] args = marker.getSnippet().split("\n");

    TextView title = (TextView) v.findViewById(R.id.title_bus);
    title.setText(marker.getTitle());

    TextView patternName = (TextView) v.findViewById(R.id.pattern_name);
    TextView lastStop = (TextView) v.findViewById(R.id.last_stop);
    TextView passengers = (TextView) v.findViewById(R.id.passengers);

    patternName.setText(args[0]);

    if (args.length >= 3) {
      lastStop.setText(args[1]);
      passengers.setText(args[2]);
    }

    return v;
  }
    protected void onPostExecute(ArrayList<JSONObject> responseJSON) {
      if (wantedService.equals("Add main markers")) {
        try {
          Log.i("responseJSON", responseJSON.toString());
          if (responseJSON.get(responseJSON.size() - 1).getInt("status") == SUCCESS) {
            ArrayList<String> markersTitles = new ArrayList<String>();
            ArrayList<String> markersSubtitles = new ArrayList<String>();
            ArrayList<String> markersCategories = new ArrayList<String>();
            for (int i = 0; i < responseJSON.size() - 1; i++) {
              double latitude = responseJSON.get(i).getDouble("latitude");
              double longitude = responseJSON.get(i).getDouble("longitude");
              String title = responseJSON.get(i).getString("title");
              String snippet = responseJSON.get(i).getString("subtitle"); // Este sería
              // el
              // subtítulo.
              Marker fixedMarker =
                  campusMap.addMarker(
                      new MarkerOptions()
                          .position(new LatLng(latitude, longitude))
                          .title(title)
                          .snippet(snippet)
                          .icon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker)));
              markersTitles.add(fixedMarker.getTitle());
              markersSubtitles.add(fixedMarker.getSnippet());
              markersCategories.add(responseJSON.get(i).getString("category"));
              fixedMarkersList.add(fixedMarker);
            }
            new MapData(markersTitles, markersSubtitles, markersCategories);
            // Se guardan los títulos,
            // subtítulos y categorías de los
            // markers en la clase MapData.
            progressDialog.dismiss();
            String username = "";
            if (UserData.getUsername() != null) {
              username = UserData.getUsername();
            }
            Toast.makeText(
                    getApplicationContext(),
                    getResources().getString(R.string.welcome_msg) + " " + username + "!",
                    Toast.LENGTH_LONG)
                .show();
          } else {
            /*
            Toast.makeText(getApplicationContext(), getResources()
            	       	   .getString(R.string.connection_error),Toast.LENGTH_SHORT)
            	       	   .show();
            */
            AlertDialog.Builder builder = new AlertDialog.Builder(MapHandler.this);
            builder.setTitle(getResources().getString(R.string.connection_error_title));
            builder.setMessage(getResources().getString(R.string.connection_error));

            builder.setPositiveButton(
                getResources().getString(R.string.retry),
                new OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    new POSTConnection().execute(POST_URL);
                  }
                });

            builder.setNegativeButton(
                getResources().getString(R.string.exit),
                new OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    Intent exitApp = new Intent(MapHandler.this, MainActivity.class);
                    Bundle userActionInfo = new Bundle();
                    userActionInfo.putBoolean("exit", true);
                    exitApp.putExtras(userActionInfo);
                    exitApp.setFlags(
                        Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    startActivity(exitApp);
                    finish();
                  }
                });

            AlertDialog connectionErrorDialog = builder.create();
            progressDialog.dismiss();
            connectionErrorDialog.show();
          }
        } catch (JSONException e) {
          progressDialog.dismiss();
          e.printStackTrace();
        }
      } else if (wantedService.equals("Add user marker")) {
        /*
        try{
        	Log.i("responseJSON", responseJSON.toString());
        	if(responseJSON.getString("username") != "null"){ //Se compara con el String
        	"null"
        													 //debido a que ya ha sido
        													 // convertido
        			 										//por el
        													//convertInputStreamToString().
        		returnToLoginView(null);  //No hay necesidad de enviar ningún parámetro
        								 //para que se ejecute la acción deseada.
        		Toast.makeText(getApplicationContext(),
        				       getResources().getString(R.string.register_success),
        				       Toast.LENGTH_LONG).show();
        	}else{
        		Toast.makeText(getApplicationContext(),
        			           getResources().getString(
        			           R.string.register_user_already_exists_failure),
        			           Toast.LENGTH_LONG).show();
        	}

        }catch(JSONException e) {
        	e.printStackTrace();
        }
        */
      }
      paramsForHttpPOST.clear();
    }
    private void render(Marker marker, View view) {
      //            int badge;
      //            if (marker.equals(SwedishPhysiciansMarker)) {
      //                badge = R.drawable.badge_qld;
      //            } else if (marker.equals(WomensHealthCareCenterMarker)) {
      //                badge = R.drawable.badge_sa;
      //            } else if (marker.equals(SwedishMedicalCenterMarker)) {
      //                badge = R.drawable.badge_nsw;
      //            } else if (marker.equals(UniversityOfWashingtonMedicalCenterMarker)) {
      //                badge = R.drawable.badge_victoria;
      //            } else if (marker.equals(ZOOMCareWallingfordMarker)) {
      //                badge = R.drawable.badge_wa;
      //            } else {
      //                // Passing 0 to setImageResource will clear the image view.
      //                badge = 0;
      //            }
      //            ((ImageView) view.findViewById(R.id.badge)).setImageResource(badge);

      String title = marker.getTitle();
      TextView titleUi = ((TextView) view.findViewById(R.id.title));
      if (title != null) {
        // Spannable string allows us to edit the formatting of the
        // text.
        SpannableString titleText = new SpannableString(title);
        titleText.setSpan(new ForegroundColorSpan(Color.RED), 0, titleText.length(), 0);
        titleUi.setText(titleText);
      } else {
        titleUi.setText("");
      }

      //            String snippet = marker.getSnippet();
      //            TextView snippetUi = ((TextView) view.findViewById(R.id.snippet));
      //            if (snippet != null && snippet.length() > 12) {
      //                SpannableString snippetText = new SpannableString(snippet);
      //                snippetText.setSpan(new ForegroundColorSpan(Color.MAGENTA), 0,
      //                        10, 0);
      //                snippetText.setSpan(new ForegroundColorSpan(Color.BLUE), 12,
      //                        snippet.length(), 0);
      //                snippetUi.setText(snippetText);
      //            } else {
      //                snippetUi.setText("");
      //            }
      //
      String distance;
      if (marker.equals(SwedishPhysiciansMarker)) {
        distance = "1.0";
      } else if (marker.equals(WomensHealthCareCenterMarker)) {
        distance = "2.0";
      } else if (marker.equals(SwedishMedicalCenterMarker)) {
        distance = "3.0";
      } else if (marker.equals(UniversityOfWashingtonMedicalCenterMarker)) {
        distance = "4.0";
      } else if (marker.equals(ZOOMCareWallingfordMarker)) {
        distance = "5.0";
      } else {
        distance = "";
      }
      ((TextView) view.findViewById(R.id.distance)).setText(distance);

      String isOpen;
      if (marker.equals(SwedishPhysiciansMarker)) {
        isOpen = "open";
      } else if (marker.equals(WomensHealthCareCenterMarker)) {
        isOpen = "closed";
      } else if (marker.equals(SwedishMedicalCenterMarker)) {
        isOpen = "open";
      } else if (marker.equals(UniversityOfWashingtonMedicalCenterMarker)) {
        isOpen = "open";
      } else if (marker.equals(ZOOMCareWallingfordMarker)) {
        isOpen = "closed";
      } else {
        isOpen = "";
      }
      ((TextView) view.findViewById(R.id.openText)).setText(isOpen);

      String stars;
      if (marker.equals(SwedishPhysiciansMarker)) {
        stars = "4.9";
      } else if (marker.equals(WomensHealthCareCenterMarker)) {
        stars = "9.6";
      } else if (marker.equals(SwedishMedicalCenterMarker)) {
        stars = "8.2";
      } else if (marker.equals(UniversityOfWashingtonMedicalCenterMarker)) {
        stars = "9.7";
      } else if (marker.equals(ZOOMCareWallingfordMarker)) {
        stars = "6.8";
      } else {
        stars = "";
      }
      ((TextView) view.findViewById(R.id.starText)).setText(stars);

      String cost;
      if (marker.equals(SwedishPhysiciansMarker)) {
        cost = "$300/hr";
      } else if (marker.equals(WomensHealthCareCenterMarker)) {
        cost = "$100/hr";
      } else if (marker.equals(SwedishMedicalCenterMarker)) {
        cost = "$200/hr";
      } else if (marker.equals(UniversityOfWashingtonMedicalCenterMarker)) {
        cost = "$10/hr";
      } else if (marker.equals(ZOOMCareWallingfordMarker)) {
        cost = "$150/hr";
      } else {
        cost = "";
      }
      ((TextView) view.findViewById(R.id.dollarsText)).setText(cost);

      int starBadge = R.drawable.popup_star;
      ((ImageView) view.findViewById(R.id.star)).setImageResource(starBadge);

      int dollarsBadge = R.drawable.popup_dollar;
      ((ImageView) view.findViewById(R.id.dollars)).setImageResource(dollarsBadge);

      int openBadge = R.drawable.popup_open;
      ((ImageView) view.findViewById(R.id.open)).setImageResource(openBadge);
    }
 private void markerClick(Marker marker) {
   TextView text = (TextView) findViewById(R.id.location_name);
   text.setText(marker.getTitle());
 }
 @Override
 public boolean onMarkerClick(Marker marker) {
   mTextViewScursal.setText(marker.getTitle());
   mOfficeSelected = Integer.parseInt(marker.getSnippet());
   return false;
 }
Beispiel #25
0
 // needed for the marker clicks
 @Override
 public boolean onMarkerClick(final Marker marker) {
   double markerLat = marker.getPosition().latitude;
   double markerLng = marker.getPosition().longitude;
   double NOISE = 0.01;
   Location currentLocation = mLocationClient.getLastLocation();
   double latdiff = Math.abs(markerLat - currentLocation.getLatitude());
   double lngdiff = Math.abs(markerLng - currentLocation.getLongitude());
   // test.show(getFragmentManager(), null);
   if (latdiff < NOISE && lngdiff < NOISE) {
     CreatureGenerator gen =
         new CreatureGenerator(marker.getPosition().latitude, marker.getPosition().longitude);
     final Stats s = gen.stats;
     final Dialog dialog = new Dialog(this);
     dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
     dialog.setContentView(R.layout.dialog_layout);
     TextView tv = (TextView) dialog.findViewById(R.id.dialogText);
     tv.setText(
         "   "
             + marker.getTitle()
             + "\n"
             + "   health: "
             + s.health
             + "\n"
             + "   strength: "
             + s.strength
             + "\n"
             + "   armor: "
             + s.armor
             + "\n"
             + "   dexterity: "
             + s.dexterity);
     Button dialogButton = (Button) dialog.findViewById(R.id.ok);
     dialogButton.setBackgroundColor(Color.rgb(0, 0, 0));
     dialogButton.setTextColor(Color.WHITE);
     dialogButton.setOnClickListener(
         new OnClickListener() {
           @Override
           public void onClick(View v) {
             DBHandler db = new DBHandler(getApplicationContext());
             db.addCreature(
                 new Creature(
                     marker.getTitle(),
                     marker.getPosition(),
                     s.health,
                     s.strength,
                     s.armor,
                     s.dexterity,
                     1));
             marker.remove();
             dialog.dismiss();
           }
         });
     Button cancelButton = (Button) dialog.findViewById(R.id.cancel);
     cancelButton.setBackgroundColor(Color.rgb(0, 0, 0));
     cancelButton.setTextColor(Color.WHITE);
     cancelButton.setOnClickListener(
         new OnClickListener() {
           @Override
           public void onClick(View v) {
             dialog.dismiss();
           }
         });
     dialog.show();
   }
   // if button is clicked, close the custom dialog
   // if(latdiff < NOISE && lngdiff < NOISE){
   // DBHandler db = new DBHandler(this);
   // db.addCreature(new Creature(marker.getTitle(), marker.getPosition()));
   // marker.remove();
   // }
   return false;
 }