Panagiotis Triantafyllou

new keys

...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { ...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
36 public void onWarplyReady() { 36 public void onWarplyReady() {
37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { 37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() 38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
39 - .setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons 39 + .setGuid("7000001315"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
40 mLoginReceiver); 40 mLoginReceiver);
41 } else { 41 } else {
42 startNextActivity(); 42 startNextActivity();
......
...@@ -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-cosbeta80' 5 + PUBLISH_VERSION = '4.5.4-cosbeta81'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentActivity; ...@@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentActivity;
15 import com.google.android.material.bottomnavigation.BottomNavigationView; 15 import com.google.android.material.bottomnavigation.BottomNavigationView;
16 import com.google.android.material.navigation.NavigationBarView; 16 import com.google.android.material.navigation.NavigationBarView;
17 17
18 +import java.util.ArrayList;
18 import java.util.HashMap; 19 import java.util.HashMap;
19 20
20 import ly.warp.sdk.R; 21 import ly.warp.sdk.R;
...@@ -183,9 +184,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -183,9 +184,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
183 } 184 }
184 }; 185 };
185 186
186 - private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() { 187 + private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
187 @Override 188 @Override
188 - public void onSuccess(CampaignList result) { 189 + public void onSuccess(ArrayList<Campaign> result) {
189 WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); 190 WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
190 } 191 }
191 192
......
...@@ -21,6 +21,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; ...@@ -21,6 +21,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
21 import org.greenrobot.eventbus.EventBus; 21 import org.greenrobot.eventbus.EventBus;
22 import org.json.JSONObject; 22 import org.json.JSONObject;
23 23
24 +import java.util.ArrayList;
25 +
24 import io.github.inflationx.viewpump.ViewPumpContextWrapper; 26 import io.github.inflationx.viewpump.ViewPumpContextWrapper;
25 import ly.warp.sdk.R; 27 import ly.warp.sdk.R;
26 import ly.warp.sdk.io.callbacks.CallbackReceiver; 28 import ly.warp.sdk.io.callbacks.CallbackReceiver;
...@@ -290,9 +292,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -290,9 +292,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
290 } 292 }
291 }; 293 };
292 294
293 - private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() { 295 + private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
294 @Override 296 @Override
295 - public void onSuccess(CampaignList result) { 297 + public void onSuccess(ArrayList<Campaign> result) {
296 OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); 298 OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
297 WorkManager.getInstance(CouponsetInfoActivity.this).enqueue(mywork); 299 WorkManager.getInstance(CouponsetInfoActivity.this).enqueue(mywork);
298 // Thread.currentThread().interrupt(); 300 // Thread.currentThread().interrupt();
......
...@@ -25,9 +25,7 @@ import java.util.ArrayList; ...@@ -25,9 +25,7 @@ import java.util.ArrayList;
25 import java.util.HashMap; 25 import java.util.HashMap;
26 import java.util.HashSet; 26 import java.util.HashSet;
27 import java.util.LinkedHashSet; 27 import java.util.LinkedHashSet;
28 -import java.util.Map;
29 import java.util.Set; 28 import java.util.Set;
30 -import java.util.TreeMap;
31 29
32 import io.github.inflationx.viewpump.ViewPumpContextWrapper; 30 import io.github.inflationx.viewpump.ViewPumpContextWrapper;
33 import ly.warp.sdk.R; 31 import ly.warp.sdk.R;
...@@ -160,34 +158,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -160,34 +158,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
160 @Override 158 @Override
161 protected void onActivityResult(int requestCode, int resultCode, Intent data) { 159 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
162 if (requestCode == 1004) { 160 if (requestCode == 1004) {
163 -// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); 161 + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
164 -// WorkManager.getInstance(GiftsForYouActivity.this).enqueue(mywork); 162 + WorkManager.getInstance(GiftsForYouActivity.this).enqueue(mywork);
165 -
166 - filterItems();
167 -
168 - if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) {
169 - mHashSetSeasonalList.clear();
170 - mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList());
171 - mSeasonalList.clear();
172 - mSeasonalList.addAll(mHashSetSeasonalList);
173 - }
174 -
175 - if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
176 - mContextualList.clear();
177 - for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
178 - if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA"))
179 - && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U"))
180 - mContextualList.add(ccmsItem);
181 - }
182 - }
183 -
184 - mergeDatasets(
185 - mSeasonalList,
186 - mContextualList,
187 - mValuesList
188 - );
189 -
190 - initViews2();
191 } 163 }
192 } 164 }
193 165
...@@ -236,6 +208,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -236,6 +208,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
236 if (mData != null && mData.size() > 0) { 208 if (mData != null && mData.size() > 0) {
237 mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 209 mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
238 mAdapterMergedGifts = new MergedGiftsAdapter(this, mData); 210 mAdapterMergedGifts = new MergedGiftsAdapter(this, mData);
211 + mAdapterMergedGifts.setHasStableIds(true);
212 + mRecyclerMergedGifts.setItemAnimator(null);
239 mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); 213 mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts);
240 mAdapterMergedGifts.getPositionClicks() 214 mAdapterMergedGifts.getPositionClicks()
241 .doOnNext(dataItem -> { 215 .doOnNext(dataItem -> {
...@@ -354,7 +328,6 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -354,7 +328,6 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
354 .doOnError(error -> { 328 .doOnError(error -> {
355 }) 329 })
356 .subscribe(); 330 .subscribe();
357 - mAdapterMergedGifts.notifyDataSetChanged();
358 } 331 }
359 } 332 }
360 333
...@@ -363,127 +336,131 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -363,127 +336,131 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
363 mIvPopupClose.setOnClickListener(this); 336 mIvPopupClose.setOnClickListener(this);
364 337
365 if (mData != null && mData.size() > 0) { 338 if (mData != null && mData.size() > 0) {
366 - mAdapterMergedGifts = new MergedGiftsAdapter(GiftsForYouActivity.this, mData); 339 +// mAdapterMergedGifts = new MergedGiftsAdapter(this, mData);
367 - mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); 340 +// mAdapterMergedGifts.setHasStableIds(true);
368 - mAdapterMergedGifts.getPositionClicks() 341 +// mRecyclerMergedGifts.setItemAnimator(null);
369 - .doOnNext(dataItem -> { 342 +// mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts);
370 - if (dataItem.getDataType() == 1) { 343 +// mAdapterMergedGifts.getPositionClicks()
371 - WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString()); 344 +// .doOnNext(dataItem -> {
372 - EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); 345 +// if (dataItem.getDataType() == 1) {
373 - 346 +// WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
374 - if (dataItem.getCampaign().getType().equals("coupon")) { 347 +// EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
375 - if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { 348 +//
376 - LoyaltyContextualOfferModel ccmsItem = null; 349 +// if (dataItem.getCampaign().getType().equals("coupon")) {
377 - for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { 350 +// if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
378 - if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { 351 +// LoyaltyContextualOfferModel ccmsItem = null;
379 - ccmsItem = ccms; 352 +// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
380 - break; 353 +// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
381 - } 354 +// ccmsItem = ccms;
382 - } 355 +// break;
383 - 356 +// }
384 - if (ccmsItem != null) { 357 +// }
385 - try { 358 +//
386 - JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); 359 +// if (ccmsItem != null) {
387 - if (campaignSettings != null) { 360 +// try {
388 - if (campaignSettings.has("couponset")) { 361 +// JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
389 - String cpnUuid = campaignSettings.optString("couponset"); 362 +// if (campaignSettings != null) {
390 - for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { 363 +// if (campaignSettings.has("couponset")) {
391 - if (cpns.getUuid().equals(cpnUuid)) { 364 +// String cpnUuid = campaignSettings.optString("couponset");
392 - WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); 365 +// for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
393 - Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); 366 +// if (cpns.getUuid().equals(cpnUuid)) {
394 - intent.putExtra("couponset", (Serializable) cpns); 367 +// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
395 - intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); 368 +// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
396 - intent.putExtra("ccms", ccmsItem); 369 +// intent.putExtra("couponset", (Serializable) cpns);
397 - startActivityForResult(intent, 1004); 370 +// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
398 - break; 371 +// intent.putExtra("ccms", ccmsItem);
399 - } 372 +// startActivityForResult(intent, 1004);
400 - } 373 +// break;
401 - } else { 374 +// }
402 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); 375 +// }
403 - } 376 +// } else {
404 - } 377 +// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
405 - } catch (Exception exception) { 378 +// }
406 - exception.printStackTrace(); 379 +// }
407 - } 380 +// } catch (Exception exception) {
408 - 381 +// exception.printStackTrace();
409 - return; 382 +// }
410 - } 383 +//
411 - } 384 +// return;
412 - 385 +// }
413 - try { 386 +// }
414 - JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); 387 +//
415 - if (campaignSettings != null) { 388 +// try {
416 - if (campaignSettings.has("couponset")) { 389 +// JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
417 - String cpnUuid = campaignSettings.optString("couponset"); 390 +// if (campaignSettings != null) {
418 - for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { 391 +// if (campaignSettings.has("couponset")) {
419 - if (cpns.getUuid().equals(cpnUuid)) { 392 +// String cpnUuid = campaignSettings.optString("couponset");
420 - WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); 393 +// for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
421 - Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); 394 +// if (cpns.getUuid().equals(cpnUuid)) {
422 - intent.putExtra("couponset", (Serializable) cpns); 395 +// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
423 - intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); 396 +// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
424 - startActivityForResult(intent, 1004); 397 +// intent.putExtra("couponset", (Serializable) cpns);
425 - break; 398 +// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
426 - } 399 +// startActivityForResult(intent, 1004);
427 - } 400 +// break;
428 - } else { 401 +// }
429 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); 402 +// }
430 - } 403 +// } else {
431 - } 404 +// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
432 - } catch (Exception exception) { 405 +// }
433 - exception.printStackTrace(); 406 +// }
434 - } 407 +// } catch (Exception exception) {
435 - 408 +// exception.printStackTrace();
436 - return; 409 +// }
437 - } 410 +//
438 - 411 +// return;
439 - try { 412 +// }
440 - JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); 413 +//
441 - if (extraFields != null) { 414 +// try {
442 - if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { 415 +// JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields());
443 - for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { 416 +// if (extraFields != null) {
444 - if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { 417 +// if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
445 - WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); 418 +// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
446 - Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); 419 +// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
447 - intent.putExtra("ccms", ccms); 420 +// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
448 - intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); 421 +// Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
449 - startActivityForResult(intent, 1004); 422 +// intent.putExtra("ccms", ccms);
450 - break; 423 +// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
451 - } 424 +// startActivityForResult(intent, 1004);
452 - } 425 +// break;
453 - return; 426 +// }
454 - } 427 +// }
455 - if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { 428 +// return;
456 - for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { 429 +// }
457 - if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { 430 +// if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
458 - WarpUtils.log("CCMS_CLICK " + ccms.toString()); 431 +// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
459 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004); 432 +// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
460 - break; 433 +// WarpUtils.log("CCMS_CLICK " + ccms.toString());
461 - } 434 +// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004);
462 - } 435 +// break;
463 - } else { 436 +// }
464 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); 437 +// }
465 - } 438 +// } else {
466 - } 439 +// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
467 - } catch (Exception exception) { 440 +// }
468 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); 441 +// }
469 - } 442 +// } catch (Exception exception) {
470 - } else if (dataItem.getDataType() == 2) { 443 +// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
471 - LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent(); 444 +// }
472 - seasonalCLick.setTitle(dataItem.getSeasonalList().getTitle()); 445 +// } else if (dataItem.getDataType() == 2) {
473 - seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId()); 446 +// LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent();
474 - seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl()); 447 +// seasonalCLick.setTitle(dataItem.getSeasonalList().getTitle());
475 - seasonalCLick.setContext(GiftsForYouActivity.this); 448 +// seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId());
476 - EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick)); 449 +// seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl());
477 - } else if (dataItem.getDataType() == 3) { 450 +// seasonalCLick.setContext(GiftsForYouActivity.this);
478 - Intent intent = new Intent(GiftsForYouActivity.this, ContextualActivity.class); 451 +// EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick));
479 - intent.putExtra("ccms", dataItem.getCCMS()); 452 +// } else if (dataItem.getDataType() == 3) {
480 - startActivity(intent); 453 +// Intent intent = new Intent(GiftsForYouActivity.this, ContextualActivity.class);
481 - } 454 +// intent.putExtra("ccms", dataItem.getCCMS());
482 - }) 455 +// startActivity(intent);
483 - .doOnError(error -> { 456 +// }
484 - }) 457 +// })
485 - .subscribe(); 458 +// .doOnError(error -> {
486 - mAdapterMergedGifts.notifyDataSetChanged(); 459 +// })
460 +// .subscribe();
461 +// mAdapterMergedGifts.notifyDataSetChanged();
462 +
463 + mAdapterMergedGifts.updateData(mData);
487 } 464 }
488 } 465 }
489 466
...@@ -497,6 +474,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -497,6 +474,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
497 MergedGifts data = new MergedGifts(); 474 MergedGifts data = new MergedGifts();
498 data.setCampaign(null); 475 data.setCampaign(null);
499 data.setSeasonalList(seasonal); 476 data.setSeasonalList(seasonal);
477 + data.setCCMS(null);
500 data.setDataType(2); 478 data.setDataType(2);
501 mData.add(data); 479 mData.add(data);
502 } 480 }
...@@ -515,11 +493,19 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -515,11 +493,19 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
515 } 493 }
516 494
517 if (campaignList != null && campaignList.size() > 0) { 495 if (campaignList != null && campaignList.size() > 0) {
496 + final ArrayList<Campaign> customs3 = new ArrayList<Campaign>();
497 + for (Campaign campaignItem : campaignList) {
498 + if (!customs3.contains(campaignItem)) {
499 + customs3.add(campaignItem);
500 + }
501 + }
502 +
518 Log.v("GIFTS_FOR_YOU", String.valueOf(campaignList.size())); 503 Log.v("GIFTS_FOR_YOU", String.valueOf(campaignList.size()));
519 - for (Campaign campaign : campaignList) { 504 + for (Campaign campaign : customs3) {
520 MergedGifts data = new MergedGifts(); 505 MergedGifts data = new MergedGifts();
521 data.setCampaign(campaign); 506 data.setCampaign(campaign);
522 data.setSeasonalList(null); 507 data.setSeasonalList(null);
508 + data.setCCMS(null);
523 data.setDataType(1); 509 data.setDataType(1);
524 mData.add(data); 510 mData.add(data);
525 } 511 }
...@@ -576,6 +562,14 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -576,6 +562,14 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
576 WarpUtils.log("GFY_FILTER_LIST_COUNT: " + String.valueOf(gfyList.size())); 562 WarpUtils.log("GFY_FILTER_LIST_COUNT: " + String.valueOf(gfyList.size()));
577 WarpUtils.log("GFY_FILTER_LIST_JSON: " + String.valueOf(gfyList.toString())); 563 WarpUtils.log("GFY_FILTER_LIST_JSON: " + String.valueOf(gfyList.toString()));
578 mValuesList.addAll(gfyList); 564 mValuesList.addAll(gfyList);
565 + final ArrayList<Campaign> customs = new ArrayList<Campaign>();
566 + for (Campaign campaignItem : mValuesList) {
567 + if (!customs.contains(campaignItem)) {
568 + customs.add(campaignItem);
569 + }
570 + }
571 + mValuesList.clear();
572 + mValuesList.addAll(customs);
579 WarpUtils.log("GFY_VAR_LIST_COUNT: " + String.valueOf(mValuesList.size())); 573 WarpUtils.log("GFY_VAR_LIST_COUNT: " + String.valueOf(mValuesList.size()));
580 WarpUtils.log("GFY_VAR_LIST_JSON: " + String.valueOf(mValuesList.toString())); 574 WarpUtils.log("GFY_VAR_LIST_JSON: " + String.valueOf(mValuesList.toString()));
581 } 575 }
......
...@@ -181,34 +181,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -181,34 +181,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
181 @Override 181 @Override
182 protected void onActivityResult(int requestCode, int resultCode, Intent data) { 182 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
183 if (requestCode == 1003) { 183 if (requestCode == 1003) {
184 -// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); 184 + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
185 -// WorkManager.getInstance(MoreForYouActivity.this).enqueue(mywork); 185 + WorkManager.getInstance(MoreForYouActivity.this).enqueue(mywork);
186 -
187 - // filterItems();
188 -
189 - /** New Implementation */
190 - filterItemsNew();
191 - /** New Implementation */
192 -
193 - if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
194 - mContextualList.clear();
195 - for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
196 - if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA"))
197 - && ccmsItem.getZone().equals("COSMOTE_APP_MORE4U"))
198 - mContextualList.add(ccmsItem);
199 - }
200 - }
201 -
202 -// mergeDatasets(
203 -// mValuesList,
204 -// mContextualList
205 -// );
206 -
207 -// initViews2();
208 -
209 - /** New Implementation */
210 - initViewsNew2();
211 - /** New Implementation */
212 } 186 }
213 } 187 }
214 188
...@@ -384,6 +358,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -384,6 +358,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
384 mResearchItems.setNestedScrollingEnabled(false); 358 mResearchItems.setNestedScrollingEnabled(false);
385 mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 359 mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
386 mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey)); 360 mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
361 + mResearchItems.setItemAnimator(null);
362 + mAdapterResearch.setHasStableIds(true);
387 mResearchItems.setAdapter(mAdapterResearch); 363 mResearchItems.setAdapter(mAdapterResearch);
388 mAdapterResearch.getPositionClicks() 364 mAdapterResearch.getPositionClicks()
389 .doOnNext(this::handleMoreItemClick) 365 .doOnNext(this::handleMoreItemClick)
...@@ -404,6 +380,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -404,6 +380,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
404 mExclusiveItems.setNestedScrollingEnabled(false); 380 mExclusiveItems.setNestedScrollingEnabled(false);
405 mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 381 mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
406 mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey)); 382 mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
383 + mExclusiveItems.setItemAnimator(null);
384 + mAdapterExclusive.setHasStableIds(true);
407 mExclusiveItems.setAdapter(mAdapterExclusive); 385 mExclusiveItems.setAdapter(mAdapterExclusive);
408 mAdapterExclusive.getPositionClicks() 386 mAdapterExclusive.getPositionClicks()
409 .doOnNext(this::handleMoreItemClick) 387 .doOnNext(this::handleMoreItemClick)
...@@ -424,6 +402,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -424,6 +402,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
424 mContestItems.setNestedScrollingEnabled(false); 402 mContestItems.setNestedScrollingEnabled(false);
425 mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 403 mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
426 mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey)); 404 mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
405 + mContestItems.setItemAnimator(null);
406 + mAdapterContest.setHasStableIds(true);
427 mContestItems.setAdapter(mAdapterContest); 407 mContestItems.setAdapter(mAdapterContest);
428 mAdapterContest.getPositionClicks() 408 mAdapterContest.getPositionClicks()
429 .doOnNext(this::handleMoreItemClick) 409 .doOnNext(this::handleMoreItemClick)
...@@ -442,6 +422,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -442,6 +422,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
442 mContextualItems.setNestedScrollingEnabled(false); 422 mContextualItems.setNestedScrollingEnabled(false);
443 mContextualItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 423 mContextualItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
444 mAdapterContextual = new MoreContextualAdapter(this, mContextualList); 424 mAdapterContextual = new MoreContextualAdapter(this, mContextualList);
425 + mContextualItems.setItemAnimator(null);
426 + mAdapterContextual.setHasStableIds(true);
445 mContextualItems.setAdapter(mAdapterContextual); 427 mContextualItems.setAdapter(mAdapterContextual);
446 mAdapterContextual.getPositionClicks() 428 mAdapterContextual.getPositionClicks()
447 .doOnNext(this::handleMoreContextualItemClick) 429 .doOnNext(this::handleMoreContextualItemClick)
...@@ -463,15 +445,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -463,15 +445,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
463 String firstKey = (String) mUniqueSectionList.keySet().toArray()[0]; 445 String firstKey = (String) mUniqueSectionList.keySet().toArray()[0];
464 if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) { 446 if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) {
465 mTvResearchSection.setText(firstKey.substring(1)); 447 mTvResearchSection.setText(firstKey.substring(1));
466 - mResearchItems.setNestedScrollingEnabled(false); 448 +// mResearchItems.setNestedScrollingEnabled(false);
467 - mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey)); 449 +// mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
468 - mResearchItems.setAdapter(mAdapterResearch); 450 +// mResearchItems.setItemAnimator(null);
469 - mAdapterResearch.getPositionClicks() 451 +// mAdapterResearch.setHasStableIds(true);
470 - .doOnNext(this::handleMoreItemClick) 452 +// mResearchItems.setAdapter(mAdapterResearch);
471 - .doOnError(error -> { 453 +// mAdapterResearch.getPositionClicks()
472 - }) 454 +// .doOnNext(this::handleMoreItemClick)
473 - .subscribe(); 455 +// .doOnError(error -> {
474 - mAdapterResearch.notifyDataSetChanged(); 456 +// })
457 +// .subscribe();
458 +// mAdapterResearch.notifyDataSetChanged();
459 +
460 + mAdapterResearch.updateData(mUniqueSectionList.get(firstKey));
475 461
476 mLlResearchItems.setVisibility(View.VISIBLE); 462 mLlResearchItems.setVisibility(View.VISIBLE);
477 } 463 }
...@@ -483,15 +469,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -483,15 +469,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
483 String secondKey = (String) mUniqueSectionList.keySet().toArray()[1]; 469 String secondKey = (String) mUniqueSectionList.keySet().toArray()[1];
484 if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) { 470 if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) {
485 mTvExclusiveSection.setText(secondKey.substring(1)); 471 mTvExclusiveSection.setText(secondKey.substring(1));
486 - mExclusiveItems.setNestedScrollingEnabled(false); 472 +// mExclusiveItems.setNestedScrollingEnabled(false);
487 - mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey)); 473 +// mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
488 - mExclusiveItems.setAdapter(mAdapterExclusive); 474 +// mExclusiveItems.setItemAnimator(null);
489 - mAdapterExclusive.getPositionClicks() 475 +// mAdapterExclusive.setHasStableIds(true);
490 - .doOnNext(this::handleMoreItemClick) 476 +// mExclusiveItems.setAdapter(mAdapterExclusive);
491 - .doOnError(error -> { 477 +// mAdapterExclusive.getPositionClicks()
492 - }) 478 +// .doOnNext(this::handleMoreItemClick)
493 - .subscribe(); 479 +// .doOnError(error -> {
494 - mAdapterExclusive.notifyDataSetChanged(); 480 +// })
481 +// .subscribe();
482 +// mAdapterExclusive.notifyDataSetChanged();
483 +
484 + mAdapterExclusive.updateData(mUniqueSectionList.get(secondKey));
495 485
496 mLlExclusiveItems.setVisibility(View.VISIBLE); 486 mLlExclusiveItems.setVisibility(View.VISIBLE);
497 } 487 }
...@@ -503,15 +493,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -503,15 +493,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
503 String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2]; 493 String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2];
504 if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) { 494 if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) {
505 mTvContestSection.setText(thirdKey.substring(1)); 495 mTvContestSection.setText(thirdKey.substring(1));
506 - mContestItems.setNestedScrollingEnabled(false); 496 +// mContestItems.setNestedScrollingEnabled(false);
507 - mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey)); 497 +// mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
508 - mContestItems.setAdapter(mAdapterContest); 498 +// mContestItems.setItemAnimator(null);
509 - mAdapterContest.getPositionClicks() 499 +// mAdapterContest.setHasStableIds(true);
510 - .doOnNext(this::handleMoreItemClick) 500 +// mContestItems.setAdapter(mAdapterContest);
511 - .doOnError(error -> { 501 +// mAdapterContest.getPositionClicks()
512 - }) 502 +// .doOnNext(this::handleMoreItemClick)
513 - .subscribe(); 503 +// .doOnError(error -> {
514 - mAdapterContest.notifyDataSetChanged(); 504 +// })
505 +// .subscribe();
506 +// mAdapterContest.notifyDataSetChanged();
507 +
508 + mAdapterContest.updateData(mUniqueSectionList.get(thirdKey));
515 509
516 mLlContestItems.setVisibility(View.VISIBLE); 510 mLlContestItems.setVisibility(View.VISIBLE);
517 } 511 }
...@@ -521,15 +515,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -521,15 +515,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
521 515
522 if (mContextualList != null && mContextualList.size() > 0) { 516 if (mContextualList != null && mContextualList.size() > 0) {
523 mTvContextualSection.setText(getString(R.string.cos_mfy_other)); 517 mTvContextualSection.setText(getString(R.string.cos_mfy_other));
524 - mContextualItems.setNestedScrollingEnabled(false); 518 +// mContextualItems.setNestedScrollingEnabled(false);
525 - mAdapterContextual = new MoreContextualAdapter(this, mContextualList); 519 +// mAdapterContextual = new MoreContextualAdapter(this, mContextualList);
526 - mContextualItems.setAdapter(mAdapterContextual); 520 +// mContextualItems.setItemAnimator(null);
527 - mAdapterContextual.getPositionClicks() 521 +// mAdapterContextual.setHasStableIds(true);
528 - .doOnNext(this::handleMoreContextualItemClick) 522 +// mContextualItems.setAdapter(mAdapterContextual);
529 - .doOnError(error -> { 523 +// mAdapterContextual.getPositionClicks()
530 - }) 524 +// .doOnNext(this::handleMoreContextualItemClick)
531 - .subscribe(); 525 +// .doOnError(error -> {
532 - mAdapterContextual.notifyDataSetChanged(); 526 +// })
527 +// .subscribe();
528 +// mAdapterContextual.notifyDataSetChanged();
529 +
530 + mAdapterContextual.updateData(mContextualList);
533 531
534 mLlContextualItems.setVisibility(View.VISIBLE); 532 mLlContextualItems.setVisibility(View.VISIBLE);
535 } 533 }
...@@ -663,8 +661,15 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -663,8 +661,15 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
663 mUniqueSectionList.clear(); 661 mUniqueSectionList.clear();
664 ArrayList<Campaign> mfyList = new ArrayList<>(); 662 ArrayList<Campaign> mfyList = new ArrayList<>();
665 if (WarplyManagerHelper.getCampaignListAll() != null && WarplyManagerHelper.getCampaignListAll().size() > 0) { 663 if (WarplyManagerHelper.getCampaignListAll() != null && WarplyManagerHelper.getCampaignListAll().size() > 0) {
664 + final ArrayList<Campaign> customs = new ArrayList<Campaign>();
665 + for(Campaign campaignItem: WarplyManagerHelper.getCampaignListAll()) {
666 + if (!customs.contains(campaignItem)) {
667 + customs.add(campaignItem);
668 + }
669 + }
670 +
666 if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() == null || WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() == 0) { 671 if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() == null || WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() == 0) {
667 - for (Campaign camp : WarplyManagerHelper.getCampaignListAll()) { 672 + for (Campaign camp : customs) {
668 if (camp.getOfferCategory().equals("more_for_you")) { 673 if (camp.getOfferCategory().equals("more_for_you")) {
669 try { 674 try {
670 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 675 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
...@@ -679,7 +684,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -679,7 +684,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
679 } 684 }
680 } 685 }
681 } else { 686 } else {
682 - for (Campaign camp : WarplyManagerHelper.getCampaignListAll()) { 687 + for (Campaign camp : customs) {
683 if (camp.getOfferCategory().equals("more_for_you")) { 688 if (camp.getOfferCategory().equals("more_for_you")) {
684 try { 689 try {
685 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 690 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
......
...@@ -27,6 +27,8 @@ package ly.warp.sdk.io.callbacks; ...@@ -27,6 +27,8 @@ package ly.warp.sdk.io.callbacks;
27 27
28 import org.json.JSONObject; 28 import org.json.JSONObject;
29 29
30 +import java.util.ArrayList;
31 +
30 import ly.warp.sdk.io.models.Campaign; 32 import ly.warp.sdk.io.models.Campaign;
31 import ly.warp.sdk.io.models.CampaignList; 33 import ly.warp.sdk.io.models.CampaignList;
32 import ly.warp.sdk.io.models.NewCampaign; 34 import ly.warp.sdk.io.models.NewCampaign;
...@@ -38,10 +40,10 @@ import ly.warp.sdk.io.models.NewCampaignList; ...@@ -38,10 +40,10 @@ import ly.warp.sdk.io.models.NewCampaignList;
38 40
39 public class NewCampaignsHook implements CallbackReceiver<JSONObject> { 41 public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
40 42
41 - private final CallbackReceiver<CampaignList> mListener; 43 + private final CallbackReceiver<ArrayList<Campaign>> mListener;
42 private final String mRequestSignature; 44 private final String mRequestSignature;
43 45
44 - public NewCampaignsHook(CallbackReceiver<CampaignList> listener, String requestSignature) { 46 + public NewCampaignsHook(CallbackReceiver<ArrayList<Campaign>> listener, String requestSignature) {
45 this.mListener = listener; 47 this.mListener = listener;
46 this.mRequestSignature = requestSignature; 48 this.mRequestSignature = requestSignature;
47 } 49 }
...@@ -52,7 +54,7 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> { ...@@ -52,7 +54,7 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
52 int status = result.optInt("status", 2); 54 int status = result.optInt("status", 2);
53 if (status == 1) { 55 if (status == 1) {
54 NewCampaignList cmpList = new NewCampaignList(result, mRequestSignature); 56 NewCampaignList cmpList = new NewCampaignList(result, mRequestSignature);
55 - CampaignList tempCampaigns = new CampaignList(); 57 + ArrayList<Campaign> tempCampaigns = new ArrayList<>();
56 for (NewCampaign newCamp : cmpList) { 58 for (NewCampaign newCamp : cmpList) {
57 Campaign camp = new Campaign(); 59 Campaign camp = new Campaign();
58 camp.setIndexUrl(newCamp.getIndexUrl()); 60 camp.setIndexUrl(newCamp.getIndexUrl());
......
...@@ -10,9 +10,12 @@ import androidx.work.WorkerParameters; ...@@ -10,9 +10,12 @@ import androidx.work.WorkerParameters;
10 10
11 import org.greenrobot.eventbus.EventBus; 11 import org.greenrobot.eventbus.EventBus;
12 12
13 +import java.util.ArrayList;
14 +
13 import ly.warp.sdk.Warply; 15 import ly.warp.sdk.Warply;
14 import ly.warp.sdk.activities.CouponsetInfoActivity; 16 import ly.warp.sdk.activities.CouponsetInfoActivity;
15 import ly.warp.sdk.io.callbacks.CallbackReceiver; 17 import ly.warp.sdk.io.callbacks.CallbackReceiver;
18 +import ly.warp.sdk.io.models.Campaign;
16 import ly.warp.sdk.io.models.CampaignList; 19 import ly.warp.sdk.io.models.CampaignList;
17 import ly.warp.sdk.io.models.CouponList; 20 import ly.warp.sdk.io.models.CouponList;
18 import ly.warp.sdk.io.models.CouponsEventModel; 21 import ly.warp.sdk.io.models.CouponsEventModel;
...@@ -55,9 +58,9 @@ public class EventCampaignCouponService extends Worker { ...@@ -55,9 +58,9 @@ public class EventCampaignCouponService extends Worker {
55 } 58 }
56 }; 59 };
57 60
58 - private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() { 61 + private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
59 @Override 62 @Override
60 - public void onSuccess(CampaignList result) { 63 + public void onSuccess(ArrayList<Campaign> result) {
61 LoyaltyEventModel campaignsAdded = new LoyaltyEventModel(); 64 LoyaltyEventModel campaignsAdded = new LoyaltyEventModel();
62 EventBus.getDefault().post(new WarplyEventBusManager(campaignsAdded)); 65 EventBus.getDefault().post(new WarplyEventBusManager(campaignsAdded));
63 } 66 }
......
...@@ -8,8 +8,11 @@ import androidx.work.WorkerParameters; ...@@ -8,8 +8,11 @@ import androidx.work.WorkerParameters;
8 8
9 import org.json.JSONObject; 9 import org.json.JSONObject;
10 10
11 +import java.util.ArrayList;
12 +
11 import ly.warp.sdk.Warply; 13 import ly.warp.sdk.Warply;
12 import ly.warp.sdk.io.callbacks.CallbackReceiver; 14 import ly.warp.sdk.io.callbacks.CallbackReceiver;
15 +import ly.warp.sdk.io.models.Campaign;
13 import ly.warp.sdk.io.models.CampaignList; 16 import ly.warp.sdk.io.models.CampaignList;
14 import ly.warp.sdk.io.models.Consumer; 17 import ly.warp.sdk.io.models.Consumer;
15 import ly.warp.sdk.io.request.WarplyConsumerRequest; 18 import ly.warp.sdk.io.request.WarplyConsumerRequest;
...@@ -45,9 +48,9 @@ public class EventQuestionnaireService extends Worker { ...@@ -45,9 +48,9 @@ public class EventQuestionnaireService extends Worker {
45 } 48 }
46 } 49 }
47 50
48 - WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() { 51 + WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<ArrayList<Campaign>>() {
49 @Override 52 @Override
50 - public void onSuccess(CampaignList result) { 53 + public void onSuccess(ArrayList<Campaign> result) {
51 WarpUtils.log("SUCCESS_QUESTIONNAIRE_EVENT"); 54 WarpUtils.log("SUCCESS_QUESTIONNAIRE_EVENT");
52 } 55 }
53 56
......
...@@ -67,7 +67,7 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -67,7 +67,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
67 private float[] velRing = new float[VEL_RING_SIZE]; 67 private float[] velRing = new float[VEL_RING_SIZE];
68 private long lastStepTimeNs = 0; 68 private long lastStepTimeNs = 0;
69 private float oldVelocityEstimate = 0; 69 private float oldVelocityEstimate = 0;
70 - private double eventMeters = 0.0d; 70 + private double eventMeters = 0.0d, pacingMeters = 0.0d;
71 private int sumSteps = 0; 71 private int sumSteps = 0;
72 72
73 // =========================================================== 73 // ===========================================================
...@@ -85,10 +85,11 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -85,10 +85,11 @@ public class WarplyHealthService extends Service implements SensorEventListener
85 85
86 mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); 86 mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
87 mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); 87 mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
88 - registerStepSensor(); 88 +// registerStepSensor();
89 + WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback);
89 } 90 }
90 91
91 - @RequiresApi(api = Build.VERSION_CODES.O) 92 + // @RequiresApi(api = Build.VERSION_CODES.O)
92 @Override 93 @Override
93 public int onStartCommand(Intent intent, int flags, int startId) { 94 public int onStartCommand(Intent intent, int flags, int startId) {
94 NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); 95 NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
...@@ -141,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -141,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
141 WarplyManagerHelper.mStepsWebview = 0; 142 WarplyManagerHelper.mStepsWebview = 0;
142 WarplyManagerHelper.mMetersWebview = 0.0d; 143 WarplyManagerHelper.mMetersWebview = 0.0d;
143 eventMeters = 0.0d; 144 eventMeters = 0.0d;
145 + pacingMeters = 0.0d;
144 sumSteps = 0; 146 sumSteps = 0;
145 sendSteps(); 147 sendSteps();
146 } 148 }
...@@ -222,8 +224,8 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -222,8 +224,8 @@ public class WarplyHealthService extends Service implements SensorEventListener
222 // healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022 224 // healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022
223 // healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022 225 // healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022
224 eventMeters = (sumSteps * 0.762); 226 eventMeters = (sumSteps * 0.762);
225 - WarpUtils.log("WIDGET_METERS: " + String.valueOf(eventMeters)); 227 + WarpUtils.log("WIDGET_METERS: " + String.valueOf(pacingMeters + eventMeters));
226 - healthSteps.setMeters(eventMeters); 228 + healthSteps.setMeters(pacingMeters + eventMeters);
227 EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); 229 EventBus.getDefault().post(new WarplyEventBusManager(healthSteps));
228 230
229 lastStepTimeNs = timeNs; 231 lastStepTimeNs = timeNs;
...@@ -292,4 +294,17 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -292,4 +294,17 @@ public class WarplyHealthService extends Service implements SensorEventListener
292 }); 294 });
293 } 295 }
294 } 296 }
297 +
298 + private CallbackReceiver<PacingDetails> mPacingCallback = new CallbackReceiver<PacingDetails>() {
299 + @Override
300 + public void onSuccess(PacingDetails result) {
301 + pacingMeters = result.getMeters().getDay().getValue();
302 + registerStepSensor();
303 + }
304 +
305 + @Override
306 + public void onFailure(int errorCode) {
307 +
308 + }
309 + };
295 } 310 }
......
...@@ -36,12 +36,13 @@ import ly.warp.sdk.utils.WarplyManagerHelper; ...@@ -36,12 +36,13 @@ import ly.warp.sdk.utils.WarplyManagerHelper;
36 public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.MergedGiftsViewHolder> { 36 public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.MergedGiftsViewHolder> {
37 37
38 private Context mContext; 38 private Context mContext;
39 - private ArrayList<MergedGifts> mMergedGifts; 39 + private ArrayList<MergedGifts> mMergedGifts = new ArrayList<>();
40 private final PublishSubject<MergedGifts> onClickSubject = PublishSubject.create(); 40 private final PublishSubject<MergedGifts> onClickSubject = PublishSubject.create();
41 41
42 public MergedGiftsAdapter(Context mContext, ArrayList<MergedGifts> mergedgifts) { 42 public MergedGiftsAdapter(Context mContext, ArrayList<MergedGifts> mergedgifts) {
43 this.mContext = mContext; 43 this.mContext = mContext;
44 - this.mMergedGifts = mergedgifts; 44 + this.mMergedGifts.clear();
45 + this.mMergedGifts.addAll(mergedgifts);
45 } 46 }
46 47
47 public class MergedGiftsViewHolder extends RecyclerView.ViewHolder { 48 public class MergedGiftsViewHolder extends RecyclerView.ViewHolder {
...@@ -64,6 +65,11 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. ...@@ -64,6 +65,11 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.
64 return mMergedGifts.size(); 65 return mMergedGifts.size();
65 } 66 }
66 67
68 + @Override
69 + public long getItemId(int position) {
70 +// return super.getItemId(position);
71 + return Double.valueOf(Math.random()).longValue();
72 + }
67 73
68 public MergedGifts getItem(int id) { 74 public MergedGifts getItem(int id) {
69 return mMergedGifts.get(id); 75 return mMergedGifts.get(id);
......
...@@ -25,12 +25,13 @@ import ly.warp.sdk.io.models.Campaign; ...@@ -25,12 +25,13 @@ import ly.warp.sdk.io.models.Campaign;
25 public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapter.MoreCampaignViewHolder> { 25 public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapter.MoreCampaignViewHolder> {
26 26
27 private Context mContext; 27 private Context mContext;
28 - private ArrayList<Campaign> mCampaigns; 28 + private ArrayList<Campaign> mCampaigns = new ArrayList<>();
29 private final PublishSubject<Campaign> onClickSubject = PublishSubject.create(); 29 private final PublishSubject<Campaign> onClickSubject = PublishSubject.create();
30 30
31 public MoreCampaignAdapter(Context mContext, ArrayList<Campaign> campaignList) { 31 public MoreCampaignAdapter(Context mContext, ArrayList<Campaign> campaignList) {
32 this.mContext = mContext; 32 this.mContext = mContext;
33 - this.mCampaigns = campaignList; 33 + this.mCampaigns.clear();
34 + this.mCampaigns.addAll(campaignList);
34 } 35 }
35 36
36 public class MoreCampaignViewHolder extends RecyclerView.ViewHolder { 37 public class MoreCampaignViewHolder extends RecyclerView.ViewHolder {
...@@ -67,6 +68,12 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte ...@@ -67,6 +68,12 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte
67 } 68 }
68 69
69 @Override 70 @Override
71 + public long getItemId(int position) {
72 +// return super.getItemId(position);
73 + return Double.valueOf(Math.random()).longValue();
74 + }
75 +
76 + @Override
70 public MoreCampaignViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 77 public MoreCampaignViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
71 View itemView; 78 View itemView;
72 79
......
...@@ -26,12 +26,13 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; ...@@ -26,12 +26,13 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
26 public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAdapter.MoreContextualViewHolder> { 26 public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAdapter.MoreContextualViewHolder> {
27 27
28 private Context mContext; 28 private Context mContext;
29 - private ArrayList<LoyaltyContextualOfferModel> mCampaigns; 29 + private ArrayList<LoyaltyContextualOfferModel> mCampaigns = new ArrayList<>();
30 private final PublishSubject<LoyaltyContextualOfferModel> onClickSubject = PublishSubject.create(); 30 private final PublishSubject<LoyaltyContextualOfferModel> onClickSubject = PublishSubject.create();
31 31
32 public MoreContextualAdapter(Context mContext, ArrayList<LoyaltyContextualOfferModel> campaignList) { 32 public MoreContextualAdapter(Context mContext, ArrayList<LoyaltyContextualOfferModel> campaignList) {
33 this.mContext = mContext; 33 this.mContext = mContext;
34 - this.mCampaigns = campaignList; 34 + this.mCampaigns.clear();
35 + this.mCampaigns.addAll(campaignList);
35 } 36 }
36 37
37 public class MoreContextualViewHolder extends RecyclerView.ViewHolder { 38 public class MoreContextualViewHolder extends RecyclerView.ViewHolder {
...@@ -56,6 +57,11 @@ public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAd ...@@ -56,6 +57,11 @@ public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAd
56 return mCampaigns.size(); 57 return mCampaigns.size();
57 } 58 }
58 59
60 + @Override
61 + public long getItemId(int position) {
62 +// return super.getItemId(position);
63 + return Double.valueOf(Math.random()).longValue();
64 + }
59 65
60 public LoyaltyContextualOfferModel getItem(int id) { 66 public LoyaltyContextualOfferModel getItem(int id) {
61 return mCampaigns.get(id); 67 return mCampaigns.get(id);
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
40 app:layout_constraintTop_toTopOf="parent" /> 40 app:layout_constraintTop_toTopOf="parent" />
41 </androidx.constraintlayout.widget.ConstraintLayout> 41 </androidx.constraintlayout.widget.ConstraintLayout>
42 42
43 - <RelativeLayout 43 + <LinearLayout
44 android:layout_width="match_parent" 44 android:layout_width="match_parent"
45 android:layout_height="match_parent" 45 android:layout_height="match_parent"
46 android:background="@drawable/shape_cos_loyalty_no_border" 46 android:background="@drawable/shape_cos_loyalty_no_border"
...@@ -97,7 +97,6 @@ ...@@ -97,7 +97,6 @@
97 android:id="@+id/rv_merged_gifts" 97 android:id="@+id/rv_merged_gifts"
98 android:layout_width="match_parent" 98 android:layout_width="match_parent"
99 android:layout_height="wrap_content" 99 android:layout_height="wrap_content"
100 - android:layout_below="@+id/ll_gifts_popup"
101 android:layout_marginTop="4dp" 100 android:layout_marginTop="4dp"
102 android:clipToPadding="false" 101 android:clipToPadding="false"
103 android:orientation="vertical" 102 android:orientation="vertical"
...@@ -213,5 +212,5 @@ ...@@ -213,5 +212,5 @@
213 <!-- app:layout_constraintRight_toRightOf="parent"--> 212 <!-- app:layout_constraintRight_toRightOf="parent"-->
214 <!-- app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />--> 213 <!-- app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />-->
215 <!-- </androidx.constraintlayout.widget.ConstraintLayout>--> 214 <!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
216 - </RelativeLayout> 215 + </LinearLayout>
217 </LinearLayout> 216 </LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
......
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools" 4 xmlns:tools="http://schemas.android.com/tools"
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 android:background="@android:color/white" 7 android:background="@android:color/white"
8 - android:fillViewport="true"> 8 + android:fillViewport="true"
9 + android:orientation="vertical">
9 10
10 <androidx.constraintlayout.widget.ConstraintLayout 11 <androidx.constraintlayout.widget.ConstraintLayout
11 android:id="@+id/cl_more_header" 12 android:id="@+id/cl_more_header"
...@@ -39,10 +40,9 @@ ...@@ -39,10 +40,9 @@
39 app:layout_constraintTop_toTopOf="parent" /> 40 app:layout_constraintTop_toTopOf="parent" />
40 </androidx.constraintlayout.widget.ConstraintLayout> 41 </androidx.constraintlayout.widget.ConstraintLayout>
41 42
42 - <RelativeLayout 43 + <LinearLayout
43 android:layout_width="match_parent" 44 android:layout_width="match_parent"
44 android:layout_height="match_parent" 45 android:layout_height="match_parent"
45 - android:layout_below="@+id/cl_more_header"
46 android:background="@drawable/shape_cos_loyalty_no_border" 46 android:background="@drawable/shape_cos_loyalty_no_border"
47 android:orientation="vertical"> 47 android:orientation="vertical">
48 48
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
52 android:fillViewport="true" 52 android:fillViewport="true"
53 android:overScrollMode="never"> 53 android:overScrollMode="never">
54 54
55 - <RelativeLayout 55 + <LinearLayout
56 android:layout_width="match_parent" 56 android:layout_width="match_parent"
57 android:layout_height="wrap_content" 57 android:layout_height="wrap_content"
58 android:orientation="vertical"> 58 android:orientation="vertical">
...@@ -107,21 +107,19 @@ ...@@ -107,21 +107,19 @@
107 <androidx.recyclerview.widget.RecyclerView 107 <androidx.recyclerview.widget.RecyclerView
108 android:id="@+id/rv_more_items" 108 android:id="@+id/rv_more_items"
109 android:layout_width="match_parent" 109 android:layout_width="match_parent"
110 - android:layout_height="match_parent" 110 + android:layout_height="wrap_content"
111 - android:layout_below="@+id/ll_more_popup"
112 android:layout_marginTop="4dp" 111 android:layout_marginTop="4dp"
113 android:clipToPadding="false" 112 android:clipToPadding="false"
114 android:orientation="vertical" 113 android:orientation="vertical"
114 + android:overScrollMode="never"
115 android:paddingTop="44dp" 115 android:paddingTop="44dp"
116 android:paddingBottom="24dp" 116 android:paddingBottom="24dp"
117 - android:overScrollMode="never"
118 android:visibility="gone" /> 117 android:visibility="gone" />
119 118
120 <LinearLayout 119 <LinearLayout
121 android:id="@+id/ll_research_items" 120 android:id="@+id/ll_research_items"
122 android:layout_width="match_parent" 121 android:layout_width="match_parent"
123 android:layout_height="wrap_content" 122 android:layout_height="wrap_content"
124 - android:layout_below="@+id/ll_more_popup"
125 android:orientation="vertical" 123 android:orientation="vertical"
126 android:paddingTop="44dp" 124 android:paddingTop="44dp"
127 android:visibility="gone"> 125 android:visibility="gone">
...@@ -151,7 +149,6 @@ ...@@ -151,7 +149,6 @@
151 android:id="@+id/ll_exclusive_items" 149 android:id="@+id/ll_exclusive_items"
152 android:layout_width="match_parent" 150 android:layout_width="match_parent"
153 android:layout_height="wrap_content" 151 android:layout_height="wrap_content"
154 - android:layout_below="@+id/ll_research_items"
155 android:orientation="vertical" 152 android:orientation="vertical"
156 android:visibility="gone"> 153 android:visibility="gone">
157 154
...@@ -180,7 +177,6 @@ ...@@ -180,7 +177,6 @@
180 android:id="@+id/ll_contest_items" 177 android:id="@+id/ll_contest_items"
181 android:layout_width="match_parent" 178 android:layout_width="match_parent"
182 android:layout_height="wrap_content" 179 android:layout_height="wrap_content"
183 - android:layout_below="@+id/ll_exclusive_items"
184 android:orientation="vertical" 180 android:orientation="vertical"
185 android:visibility="gone"> 181 android:visibility="gone">
186 182
...@@ -209,7 +205,6 @@ ...@@ -209,7 +205,6 @@
209 android:id="@+id/ll_contextual_items" 205 android:id="@+id/ll_contextual_items"
210 android:layout_width="match_parent" 206 android:layout_width="match_parent"
211 android:layout_height="wrap_content" 207 android:layout_height="wrap_content"
212 - android:layout_below="@+id/ll_contest_items"
213 android:orientation="vertical" 208 android:orientation="vertical"
214 android:visibility="gone"> 209 android:visibility="gone">
215 210
...@@ -233,7 +228,7 @@ ...@@ -233,7 +228,7 @@
233 android:overScrollMode="never" 228 android:overScrollMode="never"
234 android:paddingBottom="4dp" /> 229 android:paddingBottom="4dp" />
235 </LinearLayout> 230 </LinearLayout>
236 - </RelativeLayout> 231 + </LinearLayout>
237 </ScrollView> 232 </ScrollView>
238 - </RelativeLayout>
239 -</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
233 + </LinearLayout>
234 +</LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
......