Subversion Repository Public Repository

Nextrek

Diff Revisions 748 vs 762 for /Android/SmartCharging/SmartCharging/app/src/main/java/it/fedeloper/smartcharging/Controller/MapActivity.java

Diff revisions: vs.
  @@ -135,6 +135,22 @@
135 135 public void onResume() {
136 136 super.onResume();
137 137 isInFront = true;
138 + runOnUiThread(new Runnable() {
139 + @Override
140 + public void run() {
141 +
142 +
143 + if(!mapCacheRecensioni.containsKey(idlocale) && mapCacheInfo.containsKey(idlocale))
144 + {
145 + getInfoById(idlocale);
146 + if (expanded) {
147 + closeFullInfo();
148 + }
149 + }
150 +
151 +
152 + }
153 + });
138 154 }
139 155
140 156 @Override
  @@ -149,6 +165,18 @@
149 165 setContentView(R.layout.activity_map);
150 166 initView();
151 167
168 + if (MyLocation.isGpsEnabled(this,false))
169 + {
170 + loadingAll.setVisibility(View.VISIBLE);
171 + noLocalMsg.setText(R.string.ricerca_gps);
172 + }
173 + else
174 + {
175 + loadingAll.setVisibility(View.GONE);
176 + noLocalMsg.setText(R.string.seleziona_locale);
177 + }
178 +
179 +
152 180
153 181
154 182 final EditText addressView = (EditText) findViewById(R.id.editText6);
  @@ -211,6 +239,8 @@
211 239 if(location==null)
212 240 return;
213 241
242 + loadingAll.setVisibility(View.VISIBLE);
243 + noLocalMsg.setText(R.string.ricerca_locali);
214 244 final LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
215 245
216 246 lat = location.getLatitude();
  @@ -284,6 +314,8 @@
284 314 animationRefer=findViewById(R.id.descrizione);
285 315 noLocalMsg =(TextView) findViewById(R.id.no_locali_message);
286 316
317 +
318 +
287 319 RelativeLayout mapContainer = (RelativeLayout) findViewById(R.id.map_container);
288 320 ViewGroup.LayoutParams mapLayoutParams = mapContainer.getLayoutParams();
289 321 mapLayoutParams.width = RelativeLayout.LayoutParams.MATCH_PARENT;
  @@ -539,355 +571,398 @@
539 571 // }
540 572 // });
541 573 // }
542 - if (full != null && id != idlocale) {
574 + if (expanded && full != null && id != idlocale) {
543 575 backPress();
544 576 }
545 577
578 + if ( Utils.isNetworkConnected(c)) {
579 + new Thread(new Runnable() {
580 + public void run() {
581 +
582 + if (mapCacheInfo.containsKey(id)) {
583 + runOnUiThread(new Runnable() {
584 + @Override
585 + public void run() {
586 + final JSONObject resp = mapCacheInfo.get(id);
587 + final String[] tipi = getResources().getStringArray(R.array.type_array);
588 + runOnUiThread(new Runnable() {
589 + @Override
590 + public void run() {
591 +
592 + localeContainer.animate()
593 + .translationY(0)
594 + .alpha(0.0f)
595 + .setListener(new AnimatorListenerAdapter() {
596 + @Override
597 + public void onAnimationEnd(Animator animation) {
598 + super.onAnimationEnd(animation);
599 + localeContainer.setVisibility(View.VISIBLE);
600 + localeContainer.setAlpha(1.0f);
601 + try {
602 + ((TextView) findViewById(R.id.nome_locale)).setText(resp.getString("nomelocale"));
603 + ((TextView) findViewById(R.id.tipologia)).setText(tipi[Integer.parseInt(resp.getString("tipologia"))]);
604 + ((TextView) findViewById(R.id.descrizione)).setText(resp.getString("descrizione"));
605 + ((TextView) findViewById(R.id.via_locale)).setText(resp.getString("indirizzo"));
606 + ((RatingBar) findViewById(R.id.ratingBar)).setRating(resp.getLong("stelle"));
607 +
608 +
609 + String sito = resp.getString("sito");
610 + String em = resp.getString("email");
611 +
612 + if (em.length()>0)
613 + emailLocaleTextView.setVisibility(View.VISIBLE);
614 + else
615 + emailLocaleTextView.setVisibility(View.GONE);
616 +
617 +
618 + if (sito.length()>0)
619 + sitoLocaleTextView.setVisibility(View.VISIBLE);
620 + else
621 + sitoLocaleTextView.setVisibility(View.GONE);
622 +
623 + sitoLocaleTextView.setText(sito);
624 + emailLocaleTextView.setText(em);
625 + numLocaleTextView.setText(resp.getString("telefono"));
626 + cariLocaleTextView.setText(getString(R.string.punti_di_ricarica) + resp.getString("n_punti_ricarica"));
627 +
628 +
629 + } catch (JSONException e) {
630 + e.printStackTrace();
631 + }
632 +
633 +
634 + }
635 + });
636 + otherInfo.animate()
637 + .translationY(0)
638 + .alpha(0.0f)
639 + .setListener(new AnimatorListenerAdapter() {
640 + @Override
641 + public void onAnimationEnd(Animator animation) {
642 + super.onAnimationEnd(animation);
643 + otherInfo.setVisibility(View.VISIBLE);
644 + otherInfo.setAlpha(1.0f);
645 + }
646 + });
647 + }
648 + });
649 +
650 + idlocale = id;
651 + }
652 + });
653 + }else
654 + {
655 + if (firstLocal==false)
656 + {
657 + runOnUiThread(new Runnable() {
658 + @Override
659 + public void run() {
660 + animationOffEnded=false;
661 + localeContainer.animate()
662 + .translationY(0)
663 + .alpha(0.0f)
664 + .setListener(new AnimatorListenerAdapter() {
665 + @Override
666 + public void onAnimationEnd(Animator animation) {
667 + super.onAnimationEnd(animation);
668 + localeContainer.setVisibility(View.GONE);
669 + loadingAll.setVisibility(View.VISIBLE);
670 + noLocalMsg.setText(R.string.caricamento_info);
671 + noLocalMsg.setVisibility(View.VISIBLE);
672 + animationOffEnded=true;
673 + }
674 + });
675 + otherInfo.animate()
676 + .translationY(0)
677 + .alpha(0.0f)
678 + .setListener(new AnimatorListenerAdapter() {
679 + @Override
680 + public void onAnimationEnd(Animator animation) {
681 + super.onAnimationEnd(animation);
682 + otherInfo.setVisibility(View.INVISIBLE);
683 + }
684 + });
685 + }
686 + });
687 + }else
688 + {
689 + runOnUiThread(new Runnable() {
690 + @Override
691 + public void run() {
692 + loadingAll.setVisibility(View.VISIBLE);
693 + }
694 + });
695 +
696 + }
697 +
698 +
699 + JSONObject obj = new JSONObject();
700 + if (inLoading <= 0) {
701 + inLoading = 0;
702 + try {
703 + inLoading++;
704 + currentLoad = id;
705 + obj.put("id", id);
706 + final JSONObject resp = HttpClient.SendHttpPostAsync(EndPoint.MAIN_END_POINT + "/get_info_full_locale.php", obj);
707 +
708 + if (resp == null && isInFront) {
709 + getInfoById(id);
710 + } else {
711 +
712 + mapCacheInfo.put(id, resp);
713 + if (firstLocal==false)
714 + {
715 + while (animationOffEnded==false)
716 + {
717 + try {
718 + Thread.sleep(100);
719 + } catch (InterruptedException e) {
720 + e.printStackTrace();
721 + }
722 + }
723 + }else
724 + {
725 + firstLocal=false;
726 + }
727 +
728 + runOnUiThread(new Runnable() {
729 + @Override
730 + public void run() {
731 + try {
732 +
733 + loadingAll.setVisibility(View.GONE);
734 + noLocalMsg.setVisibility(View.GONE);
735 + String[] tipi = getResources().getStringArray(R.array.type_array);
736 + ((TextView) findViewById(R.id.nome_locale)).setText(resp.getString("nomelocale"));
737 + ((TextView) findViewById(R.id.tipologia)).setText(tipi[Integer.parseInt(resp.getString("tipologia"))]);
738 + ((TextView) findViewById(R.id.descrizione)).setText(resp.getString("descrizione"));
739 + ((TextView) findViewById(R.id.via_locale)).setText(resp.getString("indirizzo"));
740 + ((RatingBar) findViewById(R.id.ratingBar)).setRating(resp.getLong("stelle"));
741 +
742 + String sito = resp.getString("sito");
743 + String em = resp.getString("email");
744 +
745 + if (em.length()>0)
746 + emailLocaleTextView.setVisibility(View.VISIBLE);
747 + else
748 + emailLocaleTextView.setVisibility(View.GONE);
749 +
750 +
751 + if (sito.length()>0)
752 + sitoLocaleTextView.setVisibility(View.VISIBLE);
753 + else
754 + sitoLocaleTextView.setVisibility(View.GONE);
755 +
756 + sitoLocaleTextView.setText(sito);
757 + emailLocaleTextView.setText(em);
758 +
759 +
760 +
761 + numLocaleTextView.setText(resp.getString("telefono"));
762 + cariLocaleTextView.setText(getString(R.string.punti_di_ricarica)+resp.getString("n_punti_ricarica"));
763 + idlocale = id;
764 + } catch (JSONException e) {
765 + e.printStackTrace();
766 + }
767 + }
768 + });
769 + }
770 + } catch (JSONException e) {
771 + e.printStackTrace();
772 + }
773 + catch (NullPointerException e) {
774 + Utils.toast(c, R.string.internet_problem);
775 + }
776 +
777 +
778 + runOnUiThread(new Runnable() {
779 + @Override
780 + public void run() {
781 +
782 + localeContainer.animate()
783 + .translationY(0)
784 + .alpha(1.0f)
785 + .setListener(new AnimatorListenerAdapter() {
786 + @Override
787 + public void onAnimationEnd(Animator animation) {
788 + super.onAnimationEnd(animation);
789 + localeContainer.setVisibility(View.VISIBLE);
790 + }
791 + });
792 + otherInfo.animate()
793 + .translationY(0)
794 + .alpha(1.0f)
795 + .setListener(new AnimatorListenerAdapter() {
796 + @Override
797 + public void onAnimationEnd(Animator animation) {
798 + super.onAnimationEnd(animation);
799 + otherInfo.setVisibility(View.VISIBLE);
800 + }
801 + });
802 + }
803 + });
804 +
805 + inLoading--;
806 + if (nextToLoad != -1)
807 + getInfoById(nextToLoad);
808 + nextToLoad = -1;
809 + } else {
810 + if (nextToLoad != currentLoad)
811 + nextToLoad = id;
812 + }
813 + }
814 +
815 + }
816 + }).start();
817 +
818 +
819 +
820 + //getting recensione
821 +
822 + new Thread(new Runnable() {
823 + public void run() {
824 +
825 + if (mapCacheRecensioni.containsKey(id)) {
826 +
827 + runOnUiThread(new Runnable() {
828 + @Override
829 + public void run() {
830 +
831 + try {
832 + if( mapCacheRecensioni.get(id).getJSONObject("comment")!=null)
833 + reviewButton.setText(R.string.modifica_recensione);
834 + else
835 + reviewButton.setText(R.string.scrivirecensione_btn);
836 +
837 + } catch (JSONException e) {
838 + e.printStackTrace();
839 + reviewButton.setText(R.string.scrivirecensione_btn);
840 + }
841 + }
842 + });
843 + } else {
844 + try {
845 +
846 + JSONObject obj = new JSONObject();
847 + obj.put("id_local", id);
848 + obj.put("id_user", PrefsManager.getId(c));
849 +
850 +
851 + final JSONObject resp = HttpClient.SendHttpPostAsync(EndPoint.MAIN_END_POINT +"/get_commento.php", obj);
852 +
853 + if (resp.getInt("return") == 0) {
854 +
855 + mapCacheRecensioni.put(id, resp);
856 + if (currentLoad == id) {
857 + runOnUiThread(new Runnable() {
858 + @Override
859 + public void run() {
860 + try {
861 + if( mapCacheRecensioni.get(id).getJSONObject("comment")!=null)
862 + reviewButton.setText(R.string.modifica_recensione);
863 + else
864 + reviewButton.setText(R.string.scrivirecensione_btn);
865 + } catch (JSONException e) {
866 + e.printStackTrace();
867 + reviewButton.setText(R.string.scrivirecensione_btn);
868 + }
869 + }
870 + });
871 + }
872 + }
873 + } catch (JSONException e) {
874 + e.printStackTrace();
875 + }
876 + catch (NullPointerException e) {
877 + Utils.toast(c,R.string.internet_problem);
878 + }
879 + }
880 + }
881 + }).start();
882 +
883 +
884 +
885 +
886 + //getting avatar image
887 + new Thread(new Runnable() {
888 + public void run() {
889 +
890 + if (mapCacheImage.containsKey(id)) {
891 +
892 + runOnUiThread(new Runnable() {
893 + @Override
894 + public void run() {
895 +
896 + loadingImage.setVisibility(View.GONE);
897 + findViewById(R.id.profile_image).animate()
898 + .translationY(0)
899 + .alpha(0.0f)
900 + .setListener(new AnimatorListenerAdapter() {
901 + @Override
902 + public void onAnimationEnd(Animator animation) {
903 + super.onAnimationEnd(animation);
904 + findViewById(R.id.profile_image).setVisibility(View.VISIBLE);
905 + findViewById(R.id.profile_image).setAlpha(1.0f);
906 + ((ImageView) findViewById(R.id.profile_image)).setImageBitmap(mapCacheImage.get(id));
907 + }
908 + });
909 +
910 +
911 + }
912 + });
913 + } else {
914 +
915 + runOnUiThread(new Runnable() {
916 + @Override
917 + public void run() {
918 +
919 + findViewById(R.id.profile_image).setVisibility(View.INVISIBLE);
920 + loadingImage.setVisibility(View.VISIBLE);
921 + }
922 + });
923 +
924 + try {
925 +
926 + JSONObject obj = new JSONObject();
927 + obj.put("user_id", mapCachelocals.get(id).getInt("id_utente_owner"));
928 +
929 +
930 + final JSONObject resp = HttpClient.SendHttpPostAsync(EndPoint.MAIN_END_POINT +"/get_avatar.php", obj);
931 +
932 + if (resp.getInt("return") == 0) {
933 + String filename = resp.getString("avatar");
934 + final Bitmap bitm = Utils.getBitmapFromURL(filename);
935 + mapCacheImage.put(id, bitm);
936 + if (currentLoad == id) {
937 + runOnUiThread(new Runnable() {
938 + @Override
939 + public void run() {
940 + findViewById(R.id.profile_image).setVisibility(View.VISIBLE);
941 + loadingImage.setVisibility(View.GONE);
942 + ((ImageView) findViewById(R.id.profile_image)).setImageBitmap(bitm);
943 + }
944 + });
945 + }
946 + }
947 + } catch (JSONException e) {
948 + e.printStackTrace();
949 + }
950 + catch (NullPointerException e) {
951 + Utils.toast(c, R.string.internet_problem);
952 + }
953 + }
954 + }
955 + }).start();
546 956
957 + }
547 958 //getting info of local
548 - new Thread(new Runnable() {
549 - public void run() {
550 -
551 - if (mapCacheInfo.containsKey(id)) {
552 - runOnUiThread(new Runnable() {
553 - @Override
554 - public void run() {
555 - final JSONObject resp = mapCacheInfo.get(id);
556 - final String[] tipi = getResources().getStringArray(R.array.type_array);
557 - runOnUiThread(new Runnable() {
558 - @Override
559 - public void run() {
560 -
561 - localeContainer.animate()
562 - .translationY(0)
563 - .alpha(0.0f)
564 - .setListener(new AnimatorListenerAdapter() {
565 - @Override
566 - public void onAnimationEnd(Animator animation) {
567 - super.onAnimationEnd(animation);
568 - localeContainer.setVisibility(View.VISIBLE);
569 - localeContainer.setAlpha(1.0f);
570 - try {
571 - ((TextView) findViewById(R.id.nome_locale)).setText(resp.getString("nomelocale"));
572 - ((TextView) findViewById(R.id.tipologia)).setText(tipi[Integer.parseInt(resp.getString("tipologia"))]);
573 - ((TextView) findViewById(R.id.descrizione)).setText(resp.getString("descrizione"));
574 - ((TextView) findViewById(R.id.via_locale)).setText(resp.getString("indirizzo"));
575 - ((RatingBar) findViewById(R.id.ratingBar)).setRating(resp.getLong("stelle"));
576 - sitoLocaleTextView.setText(resp.getString("sito"));
577 - emailLocaleTextView.setText(resp.getString("email"));
578 - numLocaleTextView.setText(resp.getString("telefono"));
579 - cariLocaleTextView.setText(getString(R.string.punti_di_ricarica) + resp.getString("n_punti_ricarica"));
580 -
581 -
582 - } catch (JSONException e) {
583 - e.printStackTrace();
584 - }
585 -
586 -
587 - }
588 - });
589 - otherInfo.animate()
590 - .translationY(0)
591 - .alpha(0.0f)
592 - .setListener(new AnimatorListenerAdapter() {
593 - @Override
594 - public void onAnimationEnd(Animator animation) {
595 - super.onAnimationEnd(animation);
596 - otherInfo.setVisibility(View.VISIBLE);
597 - otherInfo.setAlpha(1.0f);
598 - }
599 - });
600 - }
601 - });
602 -
603 - idlocale = id;
604 - }
605 - });
606 - }else
607 - {
608 - if (firstLocal==false)
609 - {
610 - runOnUiThread(new Runnable() {
611 - @Override
612 - public void run() {
613 - animationOffEnded=false;
614 - localeContainer.animate()
615 - .translationY(0)
616 - .alpha(0.0f)
617 - .setListener(new AnimatorListenerAdapter() {
618 - @Override
619 - public void onAnimationEnd(Animator animation) {
620 - super.onAnimationEnd(animation);
621 - localeContainer.setVisibility(View.VISIBLE);
622 - animationOffEnded=true;
623 - }
624 - });
625 - otherInfo.animate()
626 - .translationY(0)
627 - .alpha(0.0f)
628 - .setListener(new AnimatorListenerAdapter() {
629 - @Override
630 - public void onAnimationEnd(Animator animation) {
631 - super.onAnimationEnd(animation);
632 - otherInfo.setVisibility(View.INVISIBLE);
633 - }
634 - });
635 - }
636 - });
637 - }else
638 - {
639 - runOnUiThread(new Runnable() {
640 - @Override
641 - public void run() {
642 - loadingAll.setVisibility(View.VISIBLE);
643 - }
644 - });
645 -
646 - }
647 -
648 -
649 - JSONObject obj = new JSONObject();
650 - if (inLoading <= 0) {
651 - inLoading = 0;
652 - try {
653 - inLoading++;
654 - currentLoad = id;
655 - obj.put("id", id);
656 - final JSONObject resp = HttpClient.SendHttpPostAsync(EndPoint.MAIN_END_POINT + "/get_info_full_locale.php", obj);
657 -
658 - if (resp == null && isInFront) {
659 - getInfoById(id);
660 - } else {
661 -
662 - mapCacheInfo.put(id, resp);
663 - if (firstLocal==false)
664 - {
665 - while (animationOffEnded==false)
666 - {
667 - try {
668 - Thread.sleep(100);
669 - } catch (InterruptedException e) {
670 - e.printStackTrace();
671 - }
672 - }
673 - }else
674 - {
675 - firstLocal=false;
676 - }
677 -
678 - runOnUiThread(new Runnable() {
679 - @Override
680 - public void run() {
681 - try {
682 -
683 - loadingAll.setVisibility(View.GONE);
684 -
685 - String[] tipi = getResources().getStringArray(R.array.type_array);
686 - ((TextView) findViewById(R.id.nome_locale)).setText(resp.getString("nomelocale"));
687 - ((TextView) findViewById(R.id.tipologia)).setText(tipi[Integer.parseInt(resp.getString("tipologia"))]);
688 - ((TextView) findViewById(R.id.descrizione)).setText(resp.getString("descrizione"));
689 - ((TextView) findViewById(R.id.via_locale)).setText(resp.getString("indirizzo"));
690 - ((RatingBar) findViewById(R.id.ratingBar)).setRating(resp.getLong("stelle"));
691 - sitoLocaleTextView.setText(resp.getString("sito"));
692 - emailLocaleTextView.setText(resp.getString("email"));
693 - numLocaleTextView.setText(resp.getString("telefono"));
694 - cariLocaleTextView.setText(getString(R.string.punti_di_ricarica)+resp.getString("n_punti_ricarica"));
695 - idlocale = id;
696 - } catch (JSONException e) {
697 - e.printStackTrace();
698 - }
699 - }
700 - });
701 - }
702 - } catch (JSONException e) {
703 - e.printStackTrace();
704 - }
705 959
706 -
707 - runOnUiThread(new Runnable() {
708 - @Override
709 - public void run() {
710 -
711 - localeContainer.animate()
712 - .translationY(0)
713 - .alpha(1.0f)
714 - .setListener(new AnimatorListenerAdapter() {
715 - @Override
716 - public void onAnimationEnd(Animator animation) {
717 - super.onAnimationEnd(animation);
718 - localeContainer.setVisibility(View.VISIBLE);
719 - }
720 - });
721 - otherInfo.animate()
722 - .translationY(0)
723 - .alpha(1.0f)
724 - .setListener(new AnimatorListenerAdapter() {
725 - @Override
726 - public void onAnimationEnd(Animator animation) {
727 - super.onAnimationEnd(animation);
728 - otherInfo.setVisibility(View.VISIBLE);
729 - }
730 - });
731 - }
732 - });
733 -
734 - inLoading--;
735 - if (nextToLoad != -1)
736 - getInfoById(nextToLoad);
737 - nextToLoad = -1;
738 - } else {
739 - if (nextToLoad != currentLoad)
740 - nextToLoad = id;
741 - }
742 - }
743 -
744 - }
745 - }).start();
746 -
747 -
748 -
749 - //getting recensione
750 -
751 - new Thread(new Runnable() {
752 - public void run() {
753 -
754 - if (mapCacheRecensioni.containsKey(id)) {
755 -
756 - runOnUiThread(new Runnable() {
757 - @Override
758 - public void run() {
759 -
760 - try {
761 - if( mapCacheRecensioni.get(id).getJSONObject("comment")!=null)
762 - reviewButton.setText(R.string.modifica_recensione);
763 - else
764 - reviewButton.setText(R.string.scrivirecensione_btn);
765 -
766 - } catch (JSONException e) {
767 - e.printStackTrace();
768 - reviewButton.setText(R.string.scrivirecensione_btn);
769 - }
770 - }
771 - });
772 - } else {
773 - try {
774 -
775 - JSONObject obj = new JSONObject();
776 - obj.put("id_local", id);
777 - obj.put("id_user", PrefsManager.getId(c));
778 -
779 -
780 - final JSONObject resp = HttpClient.SendHttpPostAsync(EndPoint.MAIN_END_POINT +"/get_commento.php", obj);
781 -
782 - if (resp.getInt("return") == 0) {
783 -
784 - mapCacheRecensioni.put(id, resp);
785 - if (currentLoad == id) {
786 - runOnUiThread(new Runnable() {
787 - @Override
788 - public void run() {
789 - try {
790 - if( mapCacheRecensioni.get(id).getJSONObject("comment")!=null)
791 - reviewButton.setText(R.string.modifica_recensione);
792 - else
793 - reviewButton.setText(R.string.scrivirecensione_btn);
794 - } catch (JSONException e) {
795 - e.printStackTrace();
796 - reviewButton.setText(R.string.scrivirecensione_btn);
797 - }
798 - }
799 - });
800 - }
801 - }
802 - } catch (JSONException e) {
803 - e.printStackTrace();
804 - }
805 - }
806 - }
807 - }).start();
808 -
809 -
810 -
811 -
812 - //getting avatar image
813 - new Thread(new Runnable() {
814 - public void run() {
815 -
816 - if (mapCacheImage.containsKey(id)) {
817 -
818 - runOnUiThread(new Runnable() {
819 - @Override
820 - public void run() {
821 -
822 - loadingImage.setVisibility(View.GONE);
823 - findViewById(R.id.profile_image).animate()
824 - .translationY(0)
825 - .alpha(0.0f)
826 - .setListener(new AnimatorListenerAdapter() {
827 - @Override
828 - public void onAnimationEnd(Animator animation) {
829 - super.onAnimationEnd(animation);
830 - findViewById(R.id.profile_image).setVisibility(View.VISIBLE);
831 - findViewById(R.id.profile_image).setAlpha(1.0f);
832 - ((ImageView) findViewById(R.id.profile_image)).setImageBitmap(mapCacheImage.get(id));
833 - }
834 - });
835 -
836 -
837 - }
838 - });
839 - } else {
840 -
841 - runOnUiThread(new Runnable() {
842 - @Override
843 - public void run() {
844 -
845 - findViewById(R.id.profile_image).setVisibility(View.INVISIBLE);
846 - loadingImage.setVisibility(View.VISIBLE);
847 - }
848 - });
849 -
850 - try {
851 -
852 - JSONObject obj = new JSONObject();
853 - obj.put("user_id", mapCachelocals.get(id).getInt("id_utente_owner"));
854 -
855 -
856 - final JSONObject resp = HttpClient.SendHttpPostAsync(EndPoint.MAIN_END_POINT +"/get_avatar.php", obj);
857 -
858 - if (resp.getInt("return") == 0) {
859 - String filename = resp.getString("avatar");
860 - final Bitmap bitm = Utils.getBitmapFromURL(filename);
861 - mapCacheImage.put(id, bitm);
862 - if (currentLoad == id) {
863 - runOnUiThread(new Runnable() {
864 - @Override
865 - public void run() {
866 - findViewById(R.id.profile_image).setVisibility(View.VISIBLE);
867 - loadingImage.setVisibility(View.GONE);
868 - ((ImageView) findViewById(R.id.profile_image)).setImageBitmap(bitm);
869 - }
870 - });
871 - }
872 - }
873 - } catch (JSONException e) {
874 - e.printStackTrace();
875 - }
876 - }
877 - }
878 - }).start();
879 960 }
880 961
881 962 public void markerClick(final Marker arg0) {
882 963
883 964 final JSONObject j = ms.get(arg0);
884 - runOnUiThread(new Runnable() {
885 - @Override
886 - public void run() {
887 - ((TextView) findViewById(R.id.nome_locale)).setText(arg0.getTitle());
888 - //TODO NULLPOINTER
889 - }
890 - });
965 +
891 966 try {
892 967 getInfoById(j.getInt("id"));
893 968 } catch (Exception e) {