Panagiotis Triantafyllou

map fixes fixes

...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2 2
3 ext { 3 ext {
4 PUBLISH_GROUP_ID = 'ly.warp' 4 PUBLISH_GROUP_ID = 'ly.warp'
5 - PUBLISH_VERSION = '4.5.4.6rc69' 5 + PUBLISH_VERSION = '4.5.4.6rc70'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -71,6 +71,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -71,6 +71,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
71 private MerchantList mMerchantList = new MerchantList(); 71 private MerchantList mMerchantList = new MerchantList();
72 private AlertDialog mAlertDialogNoShopsAvailable; 72 private AlertDialog mAlertDialogNoShopsAvailable;
73 private Merchant mMerchant, mMerchantParent; 73 private Merchant mMerchant, mMerchantParent;
74 + private ArrayList<Merchant> mMerchantParentList = new ArrayList<>();
74 75
75 // =========================================================== 76 // ===========================================================
76 // Methods for/from SuperClass/Interfaces 77 // Methods for/from SuperClass/Interfaces
...@@ -214,7 +215,14 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -214,7 +215,14 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
214 dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); 215 dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss());
215 216
216 TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title); 217 TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title);
217 - pinTitle.setText(mMerchantParent != null ? mMerchantParent.getAdminName() : merch.getAdminName()); 218 + if (mMerchantParentList != null && mMerchantParentList.size() > 0) {
219 + for (Merchant parentMerch : mMerchantParentList) {
220 + if (parentMerch.getUuid().equals(merch.getParent())) {
221 + pinTitle.setText(parentMerch.getAdminName());
222 + break;
223 + }
224 + }
225 + }
218 226
219 ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo); 227 ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo);
220 if (!TextUtils.isEmpty(merch.getImgPreview())) { 228 if (!TextUtils.isEmpty(merch.getImgPreview())) {
...@@ -319,7 +327,8 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -319,7 +327,8 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
319 if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) { 327 if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) {
320 nonNullCoords++; 328 nonNullCoords++;
321 } else { 329 } else {
322 - mMerchantParent = merchCoords; 330 +// mMerchantParent = merchCoords;
331 + mMerchantParentList.add(merchCoords);
323 } 332 }
324 } 333 }
325 334
...@@ -368,7 +377,8 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -368,7 +377,8 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
368 if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) { 377 if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) {
369 nonNullCoords++; 378 nonNullCoords++;
370 } else { 379 } else {
371 - mMerchantParent = merchCoords; 380 +// mMerchantParent = merchCoords;
381 + mMerchantParentList.add(merchCoords);
372 } 382 }
373 } 383 }
374 384
...@@ -377,15 +387,20 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -377,15 +387,20 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
377 return; 387 return;
378 } 388 }
379 389
380 - if (mMerchantParent != null) { 390 +// if (mMerchantParent != null) {
381 - for (Merchant merch : result) { 391 + if (mMerchantParentList != null && mMerchantParentList.size() > 0) {
382 - merch.setImg_preview(mMerchantParent.getImgPreview()); 392 + for (Merchant parentMerch : mMerchantParentList) {
383 - if (merch.getLatitude() != 0.0 && merch.getLongitude() != 0.0) { 393 + for (Merchant merch : result) {
384 - mMap.addMarker(new MarkerOptions() 394 + if (parentMerch.getUuid().equals(merch.getParent())) {
385 - .position(new LatLng(merch.getLatitude(), merch.getLongitude())) 395 + merch.setImg_preview(parentMerch.getImgPreview());
386 - .anchor(0.5f, 0.5f) 396 + if (merch.getLatitude() != 0.0 && merch.getLongitude() != 0.0) {
387 - .title(merch.getTitle()) 397 + mMap.addMarker(new MarkerOptions()
388 - .snippet(merch.getUuid())); 398 + .position(new LatLng(merch.getLatitude(), merch.getLongitude()))
399 + .anchor(0.5f, 0.5f)
400 + .title(merch.getTitle())
401 + .snippet(merch.getUuid()));
402 + }
403 + }
389 } 404 }
390 } 405 }
391 } else { 406 } else {
......
...@@ -69,6 +69,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic ...@@ -69,6 +69,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
69 private MerchantList mMerchantList = new MerchantList(); 69 private MerchantList mMerchantList = new MerchantList();
70 private AlertDialog mAlertDialogNoShopsAvailable; 70 private AlertDialog mAlertDialogNoShopsAvailable;
71 private Merchant mMerchant, mMerchantParent; 71 private Merchant mMerchant, mMerchantParent;
72 + private ArrayList<Merchant> mMerchantParentList = new ArrayList<>();
72 73
73 // =========================================================== 74 // ===========================================================
74 // Methods for/from SuperClass/Interfaces 75 // Methods for/from SuperClass/Interfaces
...@@ -215,7 +216,14 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic ...@@ -215,7 +216,14 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
215 dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); 216 dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss());
216 217
217 TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title); 218 TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title);
218 - pinTitle.setText(mMerchantParent != null ? mMerchantParent.getAdminName() : merch.getAdminName()); 219 + if (mMerchantParentList != null && mMerchantParentList.size() > 0) {
220 + for (Merchant parentMerch : mMerchantParentList) {
221 + if (parentMerch.getUuid().equals(merch.getParent())) {
222 + pinTitle.setText(parentMerch.getAdminName());
223 + break;
224 + }
225 + }
226 + }
219 227
220 ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo); 228 ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo);
221 if (!TextUtils.isEmpty(merch.getImgPreview())) { 229 if (!TextUtils.isEmpty(merch.getImgPreview())) {
...@@ -336,7 +344,8 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic ...@@ -336,7 +344,8 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
336 if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) { 344 if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) {
337 nonNullCoords++; 345 nonNullCoords++;
338 } else { 346 } else {
339 - mMerchantParent = merchCoords; 347 +// mMerchantParent = merchCoords;
348 + mMerchantParentList.add(merchCoords);
340 } 349 }
341 } 350 }
342 351
...@@ -386,7 +395,8 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic ...@@ -386,7 +395,8 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
386 if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) { 395 if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) {
387 nonNullCoords++; 396 nonNullCoords++;
388 } else { 397 } else {
389 - mMerchantParent = merchCoords; 398 +// mMerchantParent = merchCoords;
399 + mMerchantParentList.add(merchCoords);
390 } 400 }
391 } 401 }
392 402
...@@ -395,16 +405,21 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic ...@@ -395,16 +405,21 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
395 return; 405 return;
396 } 406 }
397 407
398 - if (mMerchantParent != null) { 408 +// if (mMerchantParent != null) {
399 - for (Merchant merch : result) { 409 + if (mMerchantParentList != null && mMerchantParentList.size() > 0) {
400 - merch.setImg_preview(mMerchantParent.getImgPreview()); 410 + for (Merchant parentMerch : mMerchantParentList) {
401 - if (merch.getLatitude() != 0.0 && merch.getLongitude() != 0.0) { 411 + for (Merchant merch : result) {
402 - mMap.addMarker(new MarkerOptions() 412 + if (parentMerch.getUuid().equals(merch.getParent())) {
403 - .position(new LatLng(merch.getLatitude(), merch.getLongitude())) 413 + merch.setImg_preview(parentMerch.getImgPreview());
404 - .anchor(0.5f, 0.5f) 414 + if (merch.getLatitude() != 0.0 && merch.getLongitude() != 0.0) {
405 - .title(merch.getTitle()) 415 + mMap.addMarker(new MarkerOptions()
406 - .snippet(merch.getUuid()) 416 + .position(new LatLng(merch.getLatitude(), merch.getLongitude()))
407 - .clusterable(true)); 417 + .anchor(0.5f, 0.5f)
418 + .title(merch.getTitle())
419 + .snippet(merch.getUuid())
420 + .clusterable(true));
421 + }
422 + }
408 } 423 }
409 } 424 }
410 } else { 425 } else {
......