|
@@ -214,9 +214,7 @@ |
214 |
214 |
|
@Override |
215 |
215 |
|
public boolean onMarkerClick(Marker arg0) { |
216 |
216 |
|
markerClick(arg0); |
217 |
|
- |
localeContainer.setVisibility(View.VISIBLE); |
218 |
|
- |
noLocalMsg.setVisibility(View.GONE); |
219 |
|
- |
|
|
217 |
+ |
showLocaleContainer(); |
220 |
218 |
|
return true; |
221 |
219 |
|
} |
222 |
220 |
|
|
|
@@ -254,8 +252,8 @@ |
254 |
252 |
|
|
255 |
253 |
|
|
256 |
254 |
|
localeContainer = (LinearLayout) findViewById(R.id.locale_container); |
257 |
|
- |
localeContainer.setVisibility(View.GONE); |
258 |
|
- |
noLocalMsg.setVisibility(View.VISIBLE); |
|
255 |
+ |
|
|
256 |
+ |
hideLocaleContainer(); |
259 |
257 |
|
|
260 |
258 |
|
|
261 |
259 |
|
sitoLocaleTextView = (TextView) findViewById(R.id.sito_locale); |
|
@@ -300,8 +298,7 @@ |
300 |
298 |
|
try { |
301 |
299 |
|
runOnUiThread(new Runnable() { |
302 |
300 |
|
public void run() { |
303 |
|
- |
localeContainer.setVisibility(View.GONE); |
304 |
|
- |
noLocalMsg.setVisibility(View.VISIBLE); |
|
301 |
+ |
hideLocaleContainer(); |
305 |
302 |
|
} |
306 |
303 |
|
}); |
307 |
304 |
|
|
|
@@ -344,8 +341,7 @@ |
344 |
341 |
|
@Override |
345 |
342 |
|
public boolean onMarkerClick(Marker arg0) { |
346 |
343 |
|
markerClick(arg0); |
347 |
|
- |
localeContainer.setVisibility(View.VISIBLE); |
348 |
|
- |
noLocalMsg.setVisibility(View.GONE); |
|
344 |
+ |
showLocaleContainer(); |
349 |
345 |
|
return true; |
350 |
346 |
|
} |
351 |
347 |
|
|
|
@@ -372,6 +368,18 @@ |
372 |
368 |
|
}).start(); |
373 |
369 |
|
} |
374 |
370 |
|
|
|
371 |
+ |
private void showLocaleContainer() { |
|
372 |
+ |
otherInfo.setVisibility(View.VISIBLE); |
|
373 |
+ |
localeContainer.setVisibility(View.VISIBLE); |
|
374 |
+ |
noLocalMsg.setVisibility(View.GONE); |
|
375 |
+ |
} |
|
376 |
+ |
|
|
377 |
+ |
private void hideLocaleContainer() { |
|
378 |
+ |
otherInfo.setVisibility(View.GONE); |
|
379 |
+ |
localeContainer.setVisibility(View.GONE); |
|
380 |
+ |
noLocalMsg.setVisibility(View.VISIBLE); |
|
381 |
+ |
} |
|
382 |
+ |
|
375 |
383 |
|
private void backPress() { |
376 |
384 |
|
if (expanded) { |
377 |
385 |
|
closeFullInfo(); |
|
@@ -417,8 +425,7 @@ |
417 |
425 |
|
|
418 |
426 |
|
@Override |
419 |
427 |
|
public void run() { |
420 |
|
- |
localeContainer.setVisibility(View.VISIBLE); |
421 |
|
- |
noLocalMsg.setVisibility(View.GONE); |
|
428 |
+ |
showLocaleContainer(); |
422 |
429 |
|
}}); |
423 |
430 |
|
|
424 |
431 |
|
JSONObject jdata = arr.getJSONObject(i); |
|
@@ -492,92 +499,57 @@ |
492 |
499 |
|
if (full != null && id != idlocale) { |
493 |
500 |
|
backPress(); |
494 |
501 |
|
} |
495 |
|
- |
if (mapCacheInfo.containsKey(id)) { |
496 |
|
- |
runOnUiThread(new Runnable() { |
497 |
|
- |
@Override |
498 |
|
- |
public void run() { |
|
502 |
+ |
//getting info of local |
|
503 |
+ |
new Thread(new Runnable() { |
|
504 |
+ |
public void run() { |
|
505 |
+ |
JSONObject obj = new JSONObject(); |
|
506 |
+ |
if (inLoading <= 0) { |
|
507 |
+ |
inLoading = 0; |
499 |
508 |
|
try { |
500 |
|
- |
JSONObject resp = mapCacheInfo.get(id); |
501 |
|
- |
String[] tipi = getResources().getStringArray(R.array.type_array); |
502 |
|
- |
|
503 |
|
- |
((TextView) findViewById(R.id.nome_locale)).setText(resp.getString("nomelocale")); |
504 |
|
- |
((TextView) findViewById(R.id.tipologia)).setText(tipi[Integer.parseInt(resp.getString("tipologia"))]); |
505 |
|
- |
((TextView) findViewById(R.id.descrizione)).setText(resp.getString("descrizione")); |
506 |
|
- |
((TextView) findViewById(R.id.via_locale)).setText(resp.getString("indirizzo")); |
507 |
|
- |
((RatingBar) findViewById(R.id.ratingBar)).setRating(resp.getLong("stelle")); |
508 |
|
- |
sitoLocaleTextView.setText(resp.getString("sito")); |
509 |
|
- |
if(resp.getString("sito").equals("")) |
510 |
|
- |
sitoLocaleTextView.setVisibility(View.GONE); |
511 |
|
- |
emailLocaleTextView.setText(resp.getString("email")); |
512 |
|
- |
if(resp.getString("email").equals("")) |
513 |
|
- |
emailLocaleTextView.setVisibility(View.GONE); |
514 |
|
- |
numLocaleTextView.setText(resp.getString("telefono")); |
515 |
|
- |
|
516 |
|
- |
idlocale = id; |
517 |
|
- |
|
518 |
|
- |
} catch (JSONException e) { |
519 |
|
- |
e.printStackTrace(); |
520 |
|
- |
} |
521 |
|
- |
} |
522 |
|
- |
}); |
523 |
|
- |
} else { |
524 |
|
- |
//getting info of local |
525 |
|
- |
new Thread(new Runnable() { |
526 |
|
- |
public void run() { |
527 |
|
- |
JSONObject obj = new JSONObject(); |
528 |
|
- |
if (inLoading <= 0) { |
529 |
|
- |
inLoading = 0; |
530 |
|
- |
|
531 |
|
- |
try { |
532 |
|
- |
inLoading++; |
533 |
|
- |
currentLoad = id; |
534 |
|
- |
obj.put("id", id); |
535 |
|
- |
final JSONObject resp = HttpClient.SendHttpPostAsync(EndPoint.MAIN_END_POINT + "/get_info_full_locale.php", obj); |
536 |
|
- |
|
537 |
|
- |
if (resp == null && isInFront) { |
538 |
|
- |
getInfoById(id); |
539 |
|
- |
} else { |
540 |
|
- |
|
541 |
|
- |
mapCacheInfo.put(id, resp); |
542 |
|
- |
runOnUiThread(new Runnable() { |
543 |
|
- |
@Override |
544 |
|
- |
public void run() { |
545 |
|
- |
try { |
546 |
|
- |
|
547 |
|
- |
String[] tipi = getResources().getStringArray(R.array.type_array); |
548 |
|
- |
((TextView) findViewById(R.id.nome_locale)).setText(resp.getString("nomelocale")); |
549 |
|
- |
((TextView) findViewById(R.id.tipologia)).setText(tipi[Integer.parseInt(resp.getString("tipologia"))]); |
550 |
|
- |
((TextView) findViewById(R.id.descrizione)).setText(resp.getString("descrizione")); |
551 |
|
- |
((TextView) findViewById(R.id.via_locale)).setText(resp.getString("indirizzo")); |
552 |
|
- |
((RatingBar) findViewById(R.id.ratingBar)).setRating(resp.getLong("stelle")); |
553 |
|
- |
sitoLocaleTextView.setText(resp.getString("sito")); |
554 |
|
- |
emailLocaleTextView.setText(resp.getString("email")); |
555 |
|
- |
numLocaleTextView.setText(resp.getString("telefono")); |
556 |
|
- |
|
557 |
|
- |
idlocale = id; |
|
509 |
+ |
inLoading++; |
|
510 |
+ |
currentLoad = id; |
|
511 |
+ |
obj.put("id", id); |
|
512 |
+ |
final JSONObject resp = HttpClient.SendHttpPostAsync(EndPoint.MAIN_END_POINT + "/get_info_full_locale.php", obj); |
558 |
513 |
|
|
|
514 |
+ |
if (resp == null && isInFront) { |
|
515 |
+ |
getInfoById(id); |
|
516 |
+ |
} else { |
559 |
517 |
|
|
560 |
|
- |
} catch (JSONException e) { |
561 |
|
- |
e.printStackTrace(); |
562 |
|
- |
} |
|
518 |
+ |
mapCacheInfo.put(id, resp); |
|
519 |
+ |
runOnUiThread(new Runnable() { |
|
520 |
+ |
@Override |
|
521 |
+ |
public void run() { |
|
522 |
+ |
try { |
|
523 |
+ |
String[] tipi = getResources().getStringArray(R.array.type_array); |
|
524 |
+ |
((TextView) findViewById(R.id.nome_locale)).setText(resp.getString("nomelocale")); |
|
525 |
+ |
((TextView) findViewById(R.id.tipologia)).setText(tipi[Integer.parseInt(resp.getString("tipologia"))]); |
|
526 |
+ |
((TextView) findViewById(R.id.descrizione)).setText(resp.getString("descrizione")); |
|
527 |
+ |
((TextView) findViewById(R.id.via_locale)).setText(resp.getString("indirizzo")); |
|
528 |
+ |
((RatingBar) findViewById(R.id.ratingBar)).setRating(resp.getLong("stelle")); |
|
529 |
+ |
sitoLocaleTextView.setText(resp.getString("sito")); |
|
530 |
+ |
emailLocaleTextView.setText(resp.getString("email")); |
|
531 |
+ |
numLocaleTextView.setText(resp.getString("telefono")); |
|
532 |
+ |
|
|
533 |
+ |
idlocale = id; |
|
534 |
+ |
} catch (JSONException e) { |
|
535 |
+ |
e.printStackTrace(); |
563 |
536 |
|
} |
564 |
|
- |
}); |
565 |
|
- |
} |
566 |
|
- |
} catch (JSONException e) { |
567 |
|
- |
e.printStackTrace(); |
|
537 |
+ |
} |
|
538 |
+ |
}); |
568 |
539 |
|
} |
569 |
|
- |
inLoading--; |
570 |
|
- |
if (nextToLoad != -1) |
571 |
|
- |
getInfoById(nextToLoad); |
572 |
|
- |
nextToLoad = -1; |
573 |
|
- |
} else { |
574 |
|
- |
if (nextToLoad != currentLoad) |
575 |
|
- |
nextToLoad = id; |
|
540 |
+ |
} catch (JSONException e) { |
|
541 |
+ |
e.printStackTrace(); |
576 |
542 |
|
} |
|
543 |
+ |
inLoading--; |
|
544 |
+ |
if (nextToLoad != -1) |
|
545 |
+ |
getInfoById(nextToLoad); |
|
546 |
+ |
nextToLoad = -1; |
|
547 |
+ |
} else { |
|
548 |
+ |
if (nextToLoad != currentLoad) |
|
549 |
+ |
nextToLoad = id; |
577 |
550 |
|
} |
578 |
|
- |
}).start(); |
579 |
|
- |
|
580 |
|
- |
} |
|
551 |
+ |
} |
|
552 |
+ |
}).start(); |
581 |
553 |
|
|
582 |
554 |
|
//getting avatar image |
583 |
555 |
|
new Thread(new Runnable() { |
|
@@ -701,19 +673,19 @@ |
701 |
673 |
|
// full = mapCacheFragment.get(idlocale); |
702 |
674 |
|
// |
703 |
675 |
|
// } else { |
704 |
|
- |
if ( Utils.isNetworkConnected(c)) |
705 |
|
- |
{ |
706 |
|
- |
Bundle b = new Bundle(); |
707 |
|
- |
b.putInt("idlocale", idlocale); |
708 |
|
- |
FragmentManager fragmentManager = getFragmentManager(); |
709 |
|
- |
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); |
710 |
|
- |
FullInfoFragment hello = new FullInfoFragment(); |
711 |
|
- |
hello.setArguments(b); |
712 |
|
- |
fragmentTransaction.add(R.id.fullInfo, hello, "HELLO"); |
713 |
|
- |
fragmentTransaction.commit(); |
714 |
|
- |
full = hello; |
|
676 |
+ |
if ( Utils.isNetworkConnected(c)) |
|
677 |
+ |
{ |
|
678 |
+ |
Bundle b = new Bundle(); |
|
679 |
+ |
b.putInt("idlocale", idlocale); |
|
680 |
+ |
FragmentManager fragmentManager = getFragmentManager(); |
|
681 |
+ |
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); |
|
682 |
+ |
FullInfoFragment hello = new FullInfoFragment(); |
|
683 |
+ |
hello.setArguments(b); |
|
684 |
+ |
fragmentTransaction.add(R.id.fullInfo, hello, "HELLO"); |
|
685 |
+ |
fragmentTransaction.commit(); |
|
686 |
+ |
full = hello; |
715 |
687 |
|
// mapCacheFragment.put(idlocale, hello); |
716 |
|
- |
} |
|
688 |
+ |
} |
717 |
689 |
|
|
718 |
690 |
|
// } |
719 |
691 |
|
} |