Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. ListViewPlaces.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  2. @Override
  3. public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) {
  4.  
  5. PlaceDetailsRequest placeDetails = new PlaceDetailsRequest(geoApiContext);
  6. placeDetails.placeId(places.get(i).getId());
  7. System.out.println(places.get(i).getId());
  8.  
  9. placeDetails.setCallback(new PendingResult.Callback<PlaceDetails>() {
  10. @Override
  11. public void onResult(PlaceDetails result) {
  12. places.get(i).setOpeningHours(result.openingHours);
  13. places.get(i).setLatlng(result.geometry.location);
  14.  
  15. startPlaceActivity.setOnClickListener(new View.OnClickListener() {
  16. @Override
  17. public void onClick(View view) {
  18. Bundle extras = new Bundle();
  19. extras.putDouble("lat", places.get(i).getLatlng().lat);
  20. extras.putDouble("lng", places.get(i).getLatlng().lng);
  21. extras.putString("placeName", places.get(i).getName());
  22.  
  23. Intent intent = new Intent(getApplicationContext(), MyMapsActivity.class);
  24. intent.putExtras(extras);
  25. startActivity(intent);
  26. }
  27. });
  28.  
  29.  
  30. places.get(i).setOpenHoursToday(result.openingHours.weekdayText[new LocalDate().getDayOfWeek()-1]);
  31.  
  32.  
  33.  
  34. refreshPopupLayout(i);
  35. refreshAlertLayout(places.get(i).getOpeningHours().openNow);
  36.  
  37.  
  38.  
  39. /*
  40.  
  41. PhotoRequest photoRequest = new PhotoRequest(geoApiContext);
  42.  
  43. System.out.println(places.get(i).getPhotoReference().toString());
  44.  
  45. photoRequest.photoReference(places.get(i).getPhotoReference().toString());
  46. photoRequest.maxHeight(400);
  47. photoRequest.maxWidth(400);
  48.  
  49.  
  50. photoRequest.setCallback(new PendingResult.Callback<ImageResult>() {
  51. @Override
  52. public void onResult(ImageResult result) {
  53. places.get(i).setPhotoData(result.imageData);
  54. placeIconView.setImageBitmap(places.get(i).getPhotoBitmap());
  55. refreshAlertLayout(places.get(i).getOpeningHours().openNow);
  56.  
  57.  
  58. }
  59.  
  60. @Override
  61. public void onFailure(Throwable e) {
  62. System.out.println("dupa");
  63. }
  64. }); */
  65. }
  66.  
  67. @Override
  68. public void onFailure(Throwable e) {
  69. System.out.println("onFailure_2");
  70. System.out.println(e.toString());
  71.  
  72. }
  73. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement