|
@@ -86,7 +86,7 @@ |
86 |
86 |
|
public Marker nearest = null; |
87 |
87 |
|
HashMap<Marker, JSONObject> ms = new HashMap<>(); |
88 |
88 |
|
HashMap<Integer, JSONObject> mapCacheInfo = new HashMap<Integer, JSONObject>(); |
89 |
|
- |
HashMap<Integer, JSONObject> mapCachelocals = new HashMap<Integer, JSONObject>(); |
|
89 |
+ |
|
90 |
90 |
|
public static HashMap<Integer, JSONObject> mapCacheRecensioni = new HashMap<Integer, JSONObject>(); |
91 |
91 |
|
Geocoder geoCoder; |
92 |
92 |
|
private GoogleMap map; |
|
@@ -508,7 +508,8 @@ |
508 |
508 |
|
}}); |
509 |
509 |
|
|
510 |
510 |
|
JSONObject jdata = arr.getJSONObject(i); |
511 |
|
- |
mapCachelocals.put(jdata.getInt("id"),jdata); |
|
511 |
+ |
|
|
512 |
+ |
mapCacheInfo.put(jdata.getInt("id"), jdata); |
512 |
513 |
|
LatLng latLng = new LatLng(jdata.getDouble("lat"), jdata.getDouble("lon")); |
513 |
514 |
|
|
514 |
515 |
|
String nome = ""; // jdata.getString("nomelocale"); Eliminato nome locale |
|
@@ -582,6 +583,8 @@ |
582 |
583 |
|
} |
583 |
584 |
|
|
584 |
585 |
|
if ( Utils.isNetworkConnected(c)) { |
|
586 |
+ |
// loadingAll.setVisibility(View.GONE); |
|
587 |
+ |
// noLocalMsg.setVisibility(View.GONE); |
585 |
588 |
|
new Thread(new Runnable() { |
586 |
589 |
|
public void run() { |
587 |
590 |
|
|
|
@@ -591,7 +594,7 @@ |
591 |
594 |
|
@Override |
592 |
595 |
|
public void run() { |
593 |
596 |
|
final JSONObject resp = mapCacheInfo.get(id); |
594 |
|
- |
final String[] tipi = getResources().getStringArray(R.array.type_array); |
|
597 |
+ |
|
595 |
598 |
|
runOnUiThread(new Runnable() { |
596 |
599 |
|
@Override |
597 |
600 |
|
public void run() { |
|
@@ -603,11 +606,13 @@ |
603 |
606 |
|
@Override |
604 |
607 |
|
public void onAnimationEnd(Animator animation) { |
605 |
608 |
|
super.onAnimationEnd(animation); |
|
609 |
+ |
loadingAll.setVisibility(View.GONE); |
|
610 |
+ |
noLocalMsg.setVisibility(View.GONE); |
606 |
611 |
|
localeContainer.setVisibility(View.VISIBLE); |
607 |
612 |
|
localeContainer.setAlpha(1.0f); |
608 |
613 |
|
try { |
609 |
614 |
|
((TextView) findViewById(R.id.nome_locale)).setText(resp.getString("nomelocale")); |
610 |
|
- |
((TextView) findViewById(R.id.tipologia)).setText(tipi[Integer.parseInt(resp.getString("tipologia"))]); |
|
615 |
+ |
((TextView) findViewById(R.id.tipologia)).setText(Utils.getTipologiaFromId(c,Integer.parseInt(resp.getString("tipologia")))); |
611 |
616 |
|
((TextView) findViewById(R.id.descrizione)).setText(resp.getString("descrizione")); |
612 |
617 |
|
((TextView) findViewById(R.id.via_locale)).setText(resp.getString("indirizzo")); |
613 |
618 |
|
((RatingBar) findViewById(R.id.ratingBar)).setRating(resp.getLong("stelle")); |
|
@@ -657,173 +662,9 @@ |
657 |
662 |
|
idlocale = id; |
658 |
663 |
|
} |
659 |
664 |
|
}); |
660 |
|
- |
}else |
661 |
|
- |
{ |
662 |
|
- |
if (firstLocal==false) |
663 |
|
- |
{ |
664 |
|
- |
runOnUiThread(new Runnable() { |
665 |
|
- |
@Override |
666 |
|
- |
public void run() { |
667 |
|
- |
animationOffEnded=false; |
668 |
|
- |
localeContainer.animate() |
669 |
|
- |
.translationY(0) |
670 |
|
- |
.alpha(0.0f) |
671 |
|
- |
.setListener(new AnimatorListenerAdapter() { |
672 |
|
- |
@Override |
673 |
|
- |
public void onAnimationEnd(Animator animation) { |
674 |
|
- |
super.onAnimationEnd(animation); |
675 |
|
- |
localeContainer.setVisibility(View.GONE); |
676 |
|
- |
loadingAll.setVisibility(View.VISIBLE); |
677 |
|
- |
noLocalMsg.setText(R.string.caricamento_info); |
678 |
|
- |
noLocalMsg.setVisibility(View.VISIBLE); |
679 |
|
- |
animationOffEnded=true; |
680 |
|
- |
} |
681 |
|
- |
}); |
682 |
|
- |
otherInfo.animate() |
683 |
|
- |
.translationY(0) |
684 |
|
- |
.alpha(0.0f) |
685 |
|
- |
.setListener(new AnimatorListenerAdapter() { |
686 |
|
- |
@Override |
687 |
|
- |
public void onAnimationEnd(Animator animation) { |
688 |
|
- |
super.onAnimationEnd(animation); |
689 |
|
- |
otherInfo.setVisibility(View.INVISIBLE); |
690 |
|
- |
} |
691 |
|
- |
}); |
692 |
|
- |
} |
693 |
|
- |
}); |
694 |
|
- |
}else |
695 |
|
- |
{ |
696 |
|
- |
|
697 |
|
- |
runOnUiThread(new Runnable() { |
698 |
|
- |
@Override |
699 |
|
- |
public void run() { |
700 |
|
- |
localeContainer.setVisibility(View.GONE); |
701 |
|
- |
otherInfo.setVisibility(View.INVISIBLE); |
702 |
|
- |
loadingAll.setVisibility(View.VISIBLE); |
703 |
|
- |
noLocalMsg.setText(R.string.caricamento_info); |
704 |
|
- |
noLocalMsg.setVisibility(View.VISIBLE); |
705 |
|
- |
} |
706 |
|
- |
}); |
707 |
|
- |
|
708 |
|
- |
} |
709 |
|
- |
|
710 |
|
- |
|
711 |
|
- |
JSONObject obj = new JSONObject(); |
712 |
|
- |
if (inLoading <= 0) { |
713 |
|
- |
inLoading = 0; |
714 |
|
- |
try { |
715 |
|
- |
inLoading++; |
716 |
|
- |
currentLoad = id; |
717 |
|
- |
obj.put("id", id); |
718 |
|
- |
final JSONObject resp = HttpClient.SendHttpPostAsync(EndPoint.MAIN_END_POINT + "/get_info_full_locale.php", obj); |
719 |
|
- |
|
720 |
|
- |
if (resp == null && isInFront) { |
721 |
|
- |
getInfoById(id); |
722 |
|
- |
} else { |
723 |
|
- |
|
724 |
|
- |
mapCacheInfo.put(id, resp); |
725 |
|
- |
if (firstLocal==false) |
726 |
|
- |
{ |
727 |
|
- |
while (animationOffEnded==false) |
728 |
|
- |
{ |
729 |
|
- |
try { |
730 |
|
- |
Thread.sleep(100); |
731 |
|
- |
} catch (InterruptedException e) { |
732 |
|
- |
e.printStackTrace(); |
733 |
|
- |
} |
734 |
|
- |
} |
735 |
|
- |
}else |
736 |
|
- |
{ |
737 |
|
- |
firstLocal=false; |
738 |
|
- |
} |
739 |
|
- |
|
740 |
|
- |
runOnUiThread(new Runnable() { |
741 |
|
- |
@Override |
742 |
|
- |
public void run() { |
743 |
|
- |
try { |
744 |
|
- |
|
745 |
|
- |
loadingAll.setVisibility(View.GONE); |
746 |
|
- |
noLocalMsg.setVisibility(View.GONE); |
747 |
|
- |
String[] tipi = getResources().getStringArray(R.array.type_array); |
748 |
|
- |
((TextView) findViewById(R.id.nome_locale)).setText(resp.getString("nomelocale")); |
749 |
|
- |
((TextView) findViewById(R.id.tipologia)).setText(tipi[Integer.parseInt(resp.getString("tipologia"))]); |
750 |
|
- |
((TextView) findViewById(R.id.descrizione)).setText(resp.getString("descrizione")); |
751 |
|
- |
((TextView) findViewById(R.id.via_locale)).setText(resp.getString("indirizzo")); |
752 |
|
- |
((RatingBar) findViewById(R.id.ratingBar)).setRating(resp.getLong("stelle")); |
753 |
|
- |
|
754 |
|
- |
String sito = resp.getString("sito"); |
755 |
|
- |
String em = resp.getString("email"); |
756 |
|
- |
|
757 |
|
- |
if (em.length()>0) |
758 |
|
- |
emailLocaleTextView.setVisibility(View.VISIBLE); |
759 |
|
- |
else |
760 |
|
- |
emailLocaleTextView.setVisibility(View.GONE); |
761 |
|
- |
|
762 |
|
- |
|
763 |
|
- |
if (sito.length()>0) |
764 |
|
- |
sitoLocaleTextView.setVisibility(View.VISIBLE); |
765 |
|
- |
else |
766 |
|
- |
sitoLocaleTextView.setVisibility(View.GONE); |
767 |
|
- |
|
768 |
|
- |
sitoLocaleTextView.setText(sito); |
769 |
|
- |
emailLocaleTextView.setText(em); |
770 |
|
- |
|
771 |
|
- |
|
772 |
|
- |
|
773 |
|
- |
numLocaleTextView.setText(resp.getString("telefono")); |
774 |
|
- |
cariLocaleTextView.setText(getString(R.string.punti_di_ricarica)+resp.getString("n_punti_ricarica")); |
775 |
|
- |
idlocale = id; |
776 |
|
- |
} catch (JSONException e) { |
777 |
|
- |
e.printStackTrace(); |
778 |
|
- |
} |
779 |
|
- |
} |
780 |
|
- |
}); |
781 |
|
- |
} |
782 |
|
- |
} catch (JSONException e) { |
783 |
|
- |
e.printStackTrace(); |
784 |
|
- |
} |
785 |
|
- |
catch (NullPointerException e) { |
786 |
|
- |
Utils.toast(c, R.string.internet_problem); |
787 |
|
- |
} |
788 |
|
- |
|
789 |
|
- |
|
790 |
|
- |
runOnUiThread(new Runnable() { |
791 |
|
- |
@Override |
792 |
|
- |
public void run() { |
793 |
|
- |
|
794 |
|
- |
localeContainer.animate() |
795 |
|
- |
.translationY(0) |
796 |
|
- |
.alpha(1.0f) |
797 |
|
- |
.setListener(new AnimatorListenerAdapter() { |
798 |
|
- |
@Override |
799 |
|
- |
public void onAnimationEnd(Animator animation) { |
800 |
|
- |
super.onAnimationEnd(animation); |
801 |
|
- |
localeContainer.setVisibility(View.VISIBLE); |
802 |
|
- |
} |
803 |
|
- |
}); |
804 |
|
- |
otherInfo.animate() |
805 |
|
- |
.translationY(0) |
806 |
|
- |
.alpha(1.0f) |
807 |
|
- |
.setListener(new AnimatorListenerAdapter() { |
808 |
|
- |
@Override |
809 |
|
- |
public void onAnimationEnd(Animator animation) { |
810 |
|
- |
super.onAnimationEnd(animation); |
811 |
|
- |
otherInfo.setVisibility(View.VISIBLE); |
812 |
|
- |
} |
813 |
|
- |
}); |
814 |
|
- |
} |
815 |
|
- |
}); |
816 |
|
- |
|
817 |
|
- |
inLoading--; |
818 |
|
- |
if (nextToLoad != -1) |
819 |
|
- |
getInfoById(nextToLoad); |
820 |
|
- |
nextToLoad = -1; |
821 |
|
- |
} else { |
822 |
|
- |
if (nextToLoad != currentLoad) |
823 |
|
- |
nextToLoad = id; |
824 |
|
- |
} |
825 |
665 |
|
} |
826 |
666 |
|
|
|
667 |
+ |
|
827 |
668 |
|
} |
828 |
669 |
|
}).start(); |
829 |
670 |
|
|
|
@@ -1000,6 +841,7 @@ |
1000 |
841 |
|
final JSONObject j = ms.get(arg0); |
1001 |
842 |
|
|
1002 |
843 |
|
try { |
|
844 |
+ |
|
1003 |
845 |
|
getInfoById(j.getInt("id")); |
1004 |
846 |
|
} catch (Exception e) { |
1005 |
847 |
|
e.printStackTrace(); |