Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2022-10-03 19:23:46 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
59332a28444ec12056656cc42f3126911271e5db
59332a28
1 parent
4a8f9bbc
new keys
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
298 additions
and
260 deletions
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHook.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCampaignCouponService.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventQuestionnaireService.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreCampaignAdapter.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreContextualAdapter.java
warply_android_sdk/src/main/res/layout/activity_gifts_for_you.xml
warply_android_sdk/src/main/res/layout/activity_more_for_you.xml
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
59332a2
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"700000
0831
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
.
setGuid
(
"700000
1315
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
59332a2
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta8
0
'
PUBLISH_VERSION
=
'4.5.4-cosbeta8
1
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
View file @
59332a2
...
...
@@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentActivity;
import
com.google.android.material.bottomnavigation.BottomNavigationView
;
import
com.google.android.material.navigation.NavigationBarView
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
ly.warp.sdk.R
;
...
...
@@ -183,9 +184,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
};
private
CallbackReceiver
<
CampaignList
>
mCampaignsCallback
=
new
CallbackReceiver
<
CampaignList
>()
{
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
59332a2
...
...
@@ -21,6 +21,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
...
...
@@ -290,9 +292,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
}
};
private
CallbackReceiver
<
CampaignList
>
mCampaignsCallback
=
new
CallbackReceiver
<
CampaignList
>()
{
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
CouponsetInfoActivity
.
this
).
enqueue
(
mywork
);
// Thread.currentThread().interrupt();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
59332a2
...
...
@@ -25,9 +25,7 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.TreeMap
;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
ly.warp.sdk.R
;
...
...
@@ -160,34 +158,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
if
(
requestCode
==
1004
)
{
// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
// WorkManager.getInstance(GiftsForYouActivity.this).enqueue(mywork);
filterItems
();
if
(
WarplyManagerHelper
.
getSeasonalList
()
!=
null
&&
WarplyManagerHelper
.
getSeasonalList
().
size
()
>
0
)
{
mHashSetSeasonalList
.
clear
();
mHashSetSeasonalList
.
addAll
(
WarplyManagerHelper
.
getSeasonalList
());
mSeasonalList
.
clear
();
mSeasonalList
.
addAll
(
mHashSetSeasonalList
);
}
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
mContextualList
.
clear
();
for
(
LoyaltyContextualOfferModel
ccmsItem
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
((
TextUtils
.
isEmpty
(
ccmsItem
.
getLoyaltyCampaignId
())
||
ccmsItem
.
getLoyaltyCampaignId
().
equals
(
"NA"
))
&&
ccmsItem
.
getZone
().
equals
(
"COSMOTE_APP_GIFTS4U"
))
mContextualList
.
add
(
ccmsItem
);
}
}
mergeDatasets
(
mSeasonalList
,
mContextualList
,
mValuesList
);
initViews2
();
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
GiftsForYouActivity
.
this
).
enqueue
(
mywork
);
}
}
...
...
@@ -236,6 +208,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
if
(
mData
!=
null
&&
mData
.
size
()
>
0
)
{
mRecyclerMergedGifts
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterMergedGifts
=
new
MergedGiftsAdapter
(
this
,
mData
);
mAdapterMergedGifts
.
setHasStableIds
(
true
);
mRecyclerMergedGifts
.
setItemAnimator
(
null
);
mRecyclerMergedGifts
.
setAdapter
(
mAdapterMergedGifts
);
mAdapterMergedGifts
.
getPositionClicks
()
.
doOnNext
(
dataItem
->
{
...
...
@@ -354,7 +328,6 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
.
doOnError
(
error
->
{
})
.
subscribe
();
mAdapterMergedGifts
.
notifyDataSetChanged
();
}
}
...
...
@@ -363,127 +336,131 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
mIvPopupClose
.
setOnClickListener
(
this
);
if
(
mData
!=
null
&&
mData
.
size
()
>
0
)
{
mAdapterMergedGifts
=
new
MergedGiftsAdapter
(
GiftsForYouActivity
.
this
,
mData
);
mRecyclerMergedGifts
.
setAdapter
(
mAdapterMergedGifts
);
mAdapterMergedGifts
.
getPositionClicks
()
.
doOnNext
(
dataItem
->
{
if
(
dataItem
.
getDataType
()
==
1
)
{
WarpUtils
.
log
(
"GFY_CLICK "
+
dataItem
.
getCampaign
().
toString
());
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
LoyaltyGiftsForYouOfferClickEvent
()));
if
(
dataItem
.
getCampaign
().
getType
().
equals
(
"coupon"
))
{
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
LoyaltyContextualOfferModel
ccmsItem
=
null
;
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
dataItem
.
getCampaign
().
getSessionUUID
()))
{
ccmsItem
=
ccms
;
break
;
}
}
if
(
ccmsItem
!=
null
)
{
try
{
JSONObject
campaignSettings
=
WarpJSONParser
.
getJSONFromString
(
dataItem
.
getCampaign
().
getCampaignTypeSettings
());
if
(
campaignSettings
!=
null
)
{
if
(
campaignSettings
.
has
(
"couponset"
))
{
String
cpnUuid
=
campaignSettings
.
optString
(
"couponset"
);
for
(
Couponset
cpns
:
WarplyManagerHelper
.
getCouponsets
())
{
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
WarplyManager
.
getSingleCampaign
(
dataItem
.
getCampaign
().
getSessionUUID
());
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
dataItem
.
getCampaign
());
intent
.
putExtra
(
"ccms"
,
ccmsItem
);
startActivityForResult
(
intent
,
1004
);
break
;
}
}
}
else
{
startActivityForResult
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())),
1004
);
}
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
return
;
}
}
try
{
JSONObject
campaignSettings
=
WarpJSONParser
.
getJSONFromString
(
dataItem
.
getCampaign
().
getCampaignTypeSettings
());
if
(
campaignSettings
!=
null
)
{
if
(
campaignSettings
.
has
(
"couponset"
))
{
String
cpnUuid
=
campaignSettings
.
optString
(
"couponset"
);
for
(
Couponset
cpns
:
WarplyManagerHelper
.
getCouponsets
())
{
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
WarplyManager
.
getSingleCampaign
(
dataItem
.
getCampaign
().
getSessionUUID
());
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
dataItem
.
getCampaign
());
startActivityForResult
(
intent
,
1004
);
break
;
}
}
}
else
{
startActivityForResult
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())),
1004
);
}
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
return
;
}
// mAdapterMergedGifts = new MergedGiftsAdapter(this, mData);
// mAdapterMergedGifts.setHasStableIds(true);
// mRecyclerMergedGifts.setItemAnimator(null);
// mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts);
// mAdapterMergedGifts.getPositionClicks()
// .doOnNext(dataItem -> {
// if (dataItem.getDataType() == 1) {
// WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
// EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
//
// if (dataItem.getCampaign().getType().equals("coupon")) {
// if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
// LoyaltyContextualOfferModel ccmsItem = null;
// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
// ccmsItem = ccms;
// break;
// }
// }
//
// if (ccmsItem != null) {
// try {
// JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
// if (campaignSettings != null) {
// if (campaignSettings.has("couponset")) {
// String cpnUuid = campaignSettings.optString("couponset");
// for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
// if (cpns.getUuid().equals(cpnUuid)) {
// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
// intent.putExtra("couponset", (Serializable) cpns);
// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
// intent.putExtra("ccms", ccmsItem);
// startActivityForResult(intent, 1004);
// break;
// }
// }
// } else {
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
// }
// }
// } catch (Exception exception) {
// exception.printStackTrace();
// }
//
// return;
// }
// }
//
// try {
// JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
// if (campaignSettings != null) {
// if (campaignSettings.has("couponset")) {
// String cpnUuid = campaignSettings.optString("couponset");
// for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
// if (cpns.getUuid().equals(cpnUuid)) {
// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
// intent.putExtra("couponset", (Serializable) cpns);
// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
// startActivityForResult(intent, 1004);
// break;
// }
// }
// } else {
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
// }
// }
// } catch (Exception exception) {
// exception.printStackTrace();
// }
//
// return;
// }
//
// try {
// JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields());
// if (extraFields != null) {
// if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
// Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
// intent.putExtra("ccms", ccms);
// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
// startActivityForResult(intent, 1004);
// break;
// }
// }
// return;
// }
// if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
// WarpUtils.log("CCMS_CLICK " + ccms.toString());
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004);
// break;
// }
// }
// } else {
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
// }
// }
// } catch (Exception exception) {
// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
// }
// } else if (dataItem.getDataType() == 2) {
// LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent();
// seasonalCLick.setTitle(dataItem.getSeasonalList().getTitle());
// seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId());
// seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl());
// seasonalCLick.setContext(GiftsForYouActivity.this);
// EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick));
// } else if (dataItem.getDataType() == 3) {
// Intent intent = new Intent(GiftsForYouActivity.this, ContextualActivity.class);
// intent.putExtra("ccms", dataItem.getCCMS());
// startActivity(intent);
// }
// })
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterMergedGifts.notifyDataSetChanged();
try
{
JSONObject
extraFields
=
WarpJSONParser
.
getJSONFromString
(
dataItem
.
getCampaign
().
getExtraFields
());
if
(
extraFields
!=
null
)
{
if
(
extraFields
.
has
(
"type"
)
&&
extraFields
.
optString
(
"type"
).
equals
(
"telco"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
dataItem
.
getCampaign
().
getSessionUUID
()))
{
WarplyManager
.
getSingleCampaign
(
dataItem
.
getCampaign
().
getSessionUUID
());
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
TelcoActivity
.
class
);
intent
.
putExtra
(
"ccms"
,
ccms
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
dataItem
.
getCampaign
());
startActivityForResult
(
intent
,
1004
);
break
;
}
}
return
;
}
if
(
extraFields
.
has
(
"ccms_offer"
)
&&
extraFields
.
optString
(
"ccms_offer"
).
equals
(
"true"
))
{
for
(
LoyaltyContextualOfferModel
ccms
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
(
ccms
.
getLoyaltyCampaignId
().
equals
(
dataItem
.
getCampaign
().
getSessionUUID
()))
{
WarpUtils
.
log
(
"CCMS_CLICK "
+
ccms
.
toString
());
startActivityForResult
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCcmsUrl
(
dataItem
.
getCampaign
(),
ccms
)),
1004
);
break
;
}
}
}
else
{
startActivityForResult
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())),
1004
);
}
}
}
catch
(
Exception
exception
)
{
startActivityForResult
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())),
1004
);
}
}
else
if
(
dataItem
.
getDataType
()
==
2
)
{
LoyaltyGiftsForYouOfferClickEvent
seasonalCLick
=
new
LoyaltyGiftsForYouOfferClickEvent
();
seasonalCLick
.
setTitle
(
dataItem
.
getSeasonalList
().
getTitle
());
seasonalCLick
.
setLoyaltyPackageId
(
dataItem
.
getSeasonalList
().
getLoyaltyPackageId
());
seasonalCLick
.
setImageUrl
(
dataItem
.
getSeasonalList
().
getImageUrl
());
seasonalCLick
.
setContext
(
GiftsForYouActivity
.
this
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
seasonalCLick
));
}
else
if
(
dataItem
.
getDataType
()
==
3
)
{
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
ContextualActivity
.
class
);
intent
.
putExtra
(
"ccms"
,
dataItem
.
getCCMS
());
startActivity
(
intent
);
}
})
.
doOnError
(
error
->
{
})
.
subscribe
();
mAdapterMergedGifts
.
notifyDataSetChanged
();
mAdapterMergedGifts
.
updateData
(
mData
);
}
}
...
...
@@ -497,6 +474,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
null
);
data
.
setSeasonalList
(
seasonal
);
data
.
setCCMS
(
null
);
data
.
setDataType
(
2
);
mData
.
add
(
data
);
}
...
...
@@ -515,11 +493,19 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
}
if
(
campaignList
!=
null
&&
campaignList
.
size
()
>
0
)
{
final
ArrayList
<
Campaign
>
customs3
=
new
ArrayList
<
Campaign
>();
for
(
Campaign
campaignItem
:
campaignList
)
{
if
(!
customs3
.
contains
(
campaignItem
))
{
customs3
.
add
(
campaignItem
);
}
}
Log
.
v
(
"GIFTS_FOR_YOU"
,
String
.
valueOf
(
campaignList
.
size
()));
for
(
Campaign
campaign
:
c
ampaignList
)
{
for
(
Campaign
campaign
:
c
ustoms3
)
{
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
campaign
);
data
.
setSeasonalList
(
null
);
data
.
setCCMS
(
null
);
data
.
setDataType
(
1
);
mData
.
add
(
data
);
}
...
...
@@ -576,6 +562,14 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
WarpUtils
.
log
(
"GFY_FILTER_LIST_COUNT: "
+
String
.
valueOf
(
gfyList
.
size
()));
WarpUtils
.
log
(
"GFY_FILTER_LIST_JSON: "
+
String
.
valueOf
(
gfyList
.
toString
()));
mValuesList
.
addAll
(
gfyList
);
final
ArrayList
<
Campaign
>
customs
=
new
ArrayList
<
Campaign
>();
for
(
Campaign
campaignItem
:
mValuesList
)
{
if
(!
customs
.
contains
(
campaignItem
))
{
customs
.
add
(
campaignItem
);
}
}
mValuesList
.
clear
();
mValuesList
.
addAll
(
customs
);
WarpUtils
.
log
(
"GFY_VAR_LIST_COUNT: "
+
String
.
valueOf
(
mValuesList
.
size
()));
WarpUtils
.
log
(
"GFY_VAR_LIST_JSON: "
+
String
.
valueOf
(
mValuesList
.
toString
()));
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
View file @
59332a2
...
...
@@ -181,34 +181,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
if
(
requestCode
==
1003
)
{
// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
// WorkManager.getInstance(MoreForYouActivity.this).enqueue(mywork);
// filterItems();
/** New Implementation */
filterItemsNew
();
/** New Implementation */
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
!=
null
&&
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
>
0
)
{
mContextualList
.
clear
();
for
(
LoyaltyContextualOfferModel
ccmsItem
:
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
())
{
if
((
TextUtils
.
isEmpty
(
ccmsItem
.
getLoyaltyCampaignId
())
||
ccmsItem
.
getLoyaltyCampaignId
().
equals
(
"NA"
))
&&
ccmsItem
.
getZone
().
equals
(
"COSMOTE_APP_MORE4U"
))
mContextualList
.
add
(
ccmsItem
);
}
}
// mergeDatasets(
// mValuesList,
// mContextualList
// );
// initViews2();
/** New Implementation */
initViewsNew2
();
/** New Implementation */
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
MoreForYouActivity
.
this
).
enqueue
(
mywork
);
}
}
...
...
@@ -384,6 +358,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mResearchItems
.
setNestedScrollingEnabled
(
false
);
mResearchItems
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterResearch
=
new
MoreCampaignAdapter
(
this
,
mUniqueSectionList
.
get
(
firstKey
));
mResearchItems
.
setItemAnimator
(
null
);
mAdapterResearch
.
setHasStableIds
(
true
);
mResearchItems
.
setAdapter
(
mAdapterResearch
);
mAdapterResearch
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreItemClick
)
...
...
@@ -404,6 +380,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mExclusiveItems
.
setNestedScrollingEnabled
(
false
);
mExclusiveItems
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterExclusive
=
new
MoreCampaignAdapter
(
this
,
mUniqueSectionList
.
get
(
secondKey
));
mExclusiveItems
.
setItemAnimator
(
null
);
mAdapterExclusive
.
setHasStableIds
(
true
);
mExclusiveItems
.
setAdapter
(
mAdapterExclusive
);
mAdapterExclusive
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreItemClick
)
...
...
@@ -424,6 +402,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mContestItems
.
setNestedScrollingEnabled
(
false
);
mContestItems
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterContest
=
new
MoreCampaignAdapter
(
this
,
mUniqueSectionList
.
get
(
thirdKey
));
mContestItems
.
setItemAnimator
(
null
);
mAdapterContest
.
setHasStableIds
(
true
);
mContestItems
.
setAdapter
(
mAdapterContest
);
mAdapterContest
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreItemClick
)
...
...
@@ -442,6 +422,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mContextualItems
.
setNestedScrollingEnabled
(
false
);
mContextualItems
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterContextual
=
new
MoreContextualAdapter
(
this
,
mContextualList
);
mContextualItems
.
setItemAnimator
(
null
);
mAdapterContextual
.
setHasStableIds
(
true
);
mContextualItems
.
setAdapter
(
mAdapterContextual
);
mAdapterContextual
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreContextualItemClick
)
...
...
@@ -463,15 +445,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
String
firstKey
=
(
String
)
mUniqueSectionList
.
keySet
().
toArray
()[
0
];
if
(
mUniqueSectionList
.
get
(
firstKey
)
!=
null
&&
mUniqueSectionList
.
get
(
firstKey
).
size
()
>
0
)
{
mTvResearchSection
.
setText
(
firstKey
.
substring
(
1
));
mResearchItems
.
setNestedScrollingEnabled
(
false
);
mAdapterResearch
=
new
MoreCampaignAdapter
(
this
,
mUniqueSectionList
.
get
(
firstKey
));
mResearchItems
.
setAdapter
(
mAdapterResearch
);
mAdapterResearch
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreItemClick
)
.
doOnError
(
error
->
{
})
.
subscribe
();
mAdapterResearch
.
notifyDataSetChanged
();
// mResearchItems.setNestedScrollingEnabled(false);
// mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
// mResearchItems.setItemAnimator(null);
// mAdapterResearch.setHasStableIds(true);
// mResearchItems.setAdapter(mAdapterResearch);
// mAdapterResearch.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterResearch.notifyDataSetChanged();
mAdapterResearch
.
updateData
(
mUniqueSectionList
.
get
(
firstKey
));
mLlResearchItems
.
setVisibility
(
View
.
VISIBLE
);
}
...
...
@@ -483,15 +469,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
String
secondKey
=
(
String
)
mUniqueSectionList
.
keySet
().
toArray
()[
1
];
if
(
mUniqueSectionList
.
get
(
secondKey
)
!=
null
&&
mUniqueSectionList
.
get
(
secondKey
).
size
()
>
0
)
{
mTvExclusiveSection
.
setText
(
secondKey
.
substring
(
1
));
mExclusiveItems
.
setNestedScrollingEnabled
(
false
);
mAdapterExclusive
=
new
MoreCampaignAdapter
(
this
,
mUniqueSectionList
.
get
(
secondKey
));
mExclusiveItems
.
setAdapter
(
mAdapterExclusive
);
mAdapterExclusive
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreItemClick
)
.
doOnError
(
error
->
{
})
.
subscribe
();
mAdapterExclusive
.
notifyDataSetChanged
();
// mExclusiveItems.setNestedScrollingEnabled(false);
// mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
// mExclusiveItems.setItemAnimator(null);
// mAdapterExclusive.setHasStableIds(true);
// mExclusiveItems.setAdapter(mAdapterExclusive);
// mAdapterExclusive.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterExclusive.notifyDataSetChanged();
mAdapterExclusive
.
updateData
(
mUniqueSectionList
.
get
(
secondKey
));
mLlExclusiveItems
.
setVisibility
(
View
.
VISIBLE
);
}
...
...
@@ -503,15 +493,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
String
thirdKey
=
(
String
)
mUniqueSectionList
.
keySet
().
toArray
()[
2
];
if
(
mUniqueSectionList
.
get
(
thirdKey
)
!=
null
&&
mUniqueSectionList
.
get
(
thirdKey
).
size
()
>
0
)
{
mTvContestSection
.
setText
(
thirdKey
.
substring
(
1
));
mContestItems
.
setNestedScrollingEnabled
(
false
);
mAdapterContest
=
new
MoreCampaignAdapter
(
this
,
mUniqueSectionList
.
get
(
thirdKey
));
mContestItems
.
setAdapter
(
mAdapterContest
);
mAdapterContest
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreItemClick
)
.
doOnError
(
error
->
{
})
.
subscribe
();
mAdapterContest
.
notifyDataSetChanged
();
// mContestItems.setNestedScrollingEnabled(false);
// mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
// mContestItems.setItemAnimator(null);
// mAdapterContest.setHasStableIds(true);
// mContestItems.setAdapter(mAdapterContest);
// mAdapterContest.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterContest.notifyDataSetChanged();
mAdapterContest
.
updateData
(
mUniqueSectionList
.
get
(
thirdKey
));
mLlContestItems
.
setVisibility
(
View
.
VISIBLE
);
}
...
...
@@ -521,15 +515,19 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
if
(
mContextualList
!=
null
&&
mContextualList
.
size
()
>
0
)
{
mTvContextualSection
.
setText
(
getString
(
R
.
string
.
cos_mfy_other
));
mContextualItems
.
setNestedScrollingEnabled
(
false
);
mAdapterContextual
=
new
MoreContextualAdapter
(
this
,
mContextualList
);
mContextualItems
.
setAdapter
(
mAdapterContextual
);
mAdapterContextual
.
getPositionClicks
()
.
doOnNext
(
this
::
handleMoreContextualItemClick
)
.
doOnError
(
error
->
{
})
.
subscribe
();
mAdapterContextual
.
notifyDataSetChanged
();
// mContextualItems.setNestedScrollingEnabled(false);
// mAdapterContextual = new MoreContextualAdapter(this, mContextualList);
// mContextualItems.setItemAnimator(null);
// mAdapterContextual.setHasStableIds(true);
// mContextualItems.setAdapter(mAdapterContextual);
// mAdapterContextual.getPositionClicks()
// .doOnNext(this::handleMoreContextualItemClick)
// .doOnError(error -> {
// })
// .subscribe();
// mAdapterContextual.notifyDataSetChanged();
mAdapterContextual
.
updateData
(
mContextualList
);
mLlContextualItems
.
setVisibility
(
View
.
VISIBLE
);
}
...
...
@@ -663,8 +661,15 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mUniqueSectionList
.
clear
();
ArrayList
<
Campaign
>
mfyList
=
new
ArrayList
<>();
if
(
WarplyManagerHelper
.
getCampaignListAll
()
!=
null
&&
WarplyManagerHelper
.
getCampaignListAll
().
size
()
>
0
)
{
final
ArrayList
<
Campaign
>
customs
=
new
ArrayList
<
Campaign
>();
for
(
Campaign
campaignItem:
WarplyManagerHelper
.
getCampaignListAll
())
{
if
(!
customs
.
contains
(
campaignItem
))
{
customs
.
add
(
campaignItem
);
}
}
if
(
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
()
==
null
||
WarplyManagerHelper
.
getCCMSLoyaltyCampaigns
().
size
()
==
0
)
{
for
(
Campaign
camp
:
WarplyManagerHelper
.
getCampaignListAll
()
)
{
for
(
Campaign
camp
:
customs
)
{
if
(
camp
.
getOfferCategory
().
equals
(
"more_for_you"
))
{
try
{
JSONObject
extraFields
=
WarpJSONParser
.
getJSONFromString
(
camp
.
getExtraFields
());
...
...
@@ -679,7 +684,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
}
}
}
else
{
for
(
Campaign
camp
:
WarplyManagerHelper
.
getCampaignListAll
()
)
{
for
(
Campaign
camp
:
customs
)
{
if
(
camp
.
getOfferCategory
().
equals
(
"more_for_you"
))
{
try
{
JSONObject
extraFields
=
WarpJSONParser
.
getJSONFromString
(
camp
.
getExtraFields
());
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHook.java
View file @
59332a2
...
...
@@ -27,6 +27,8 @@ package ly.warp.sdk.io.callbacks;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.NewCampaign
;
...
...
@@ -38,10 +40,10 @@ import ly.warp.sdk.io.models.NewCampaignList;
public
class
NewCampaignsHook
implements
CallbackReceiver
<
JSONObject
>
{
private
final
CallbackReceiver
<
CampaignList
>
mListener
;
private
final
CallbackReceiver
<
ArrayList
<
Campaign
>
>
mListener
;
private
final
String
mRequestSignature
;
public
NewCampaignsHook
(
CallbackReceiver
<
CampaignList
>
listener
,
String
requestSignature
)
{
public
NewCampaignsHook
(
CallbackReceiver
<
ArrayList
<
Campaign
>
>
listener
,
String
requestSignature
)
{
this
.
mListener
=
listener
;
this
.
mRequestSignature
=
requestSignature
;
}
...
...
@@ -52,7 +54,7 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
{
NewCampaignList
cmpList
=
new
NewCampaignList
(
result
,
mRequestSignature
);
CampaignList
tempCampaigns
=
new
CampaignList
();
ArrayList
<
Campaign
>
tempCampaigns
=
new
ArrayList
<>
();
for
(
NewCampaign
newCamp
:
cmpList
)
{
Campaign
camp
=
new
Campaign
();
camp
.
setIndexUrl
(
newCamp
.
getIndexUrl
());
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCampaignCouponService.java
View file @
59332a2
...
...
@@ -10,9 +10,12 @@ import androidx.work.WorkerParameters;
import
org.greenrobot.eventbus.EventBus
;
import
java.util.ArrayList
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.activities.CouponsetInfoActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.CouponsEventModel
;
...
...
@@ -55,9 +58,9 @@ public class EventCampaignCouponService extends Worker {
}
};
private
CallbackReceiver
<
CampaignList
>
mCampaignsCallback
=
new
CallbackReceiver
<
CampaignList
>()
{
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
LoyaltyEventModel
campaignsAdded
=
new
LoyaltyEventModel
();
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
campaignsAdded
));
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventQuestionnaireService.java
View file @
59332a2
...
...
@@ -8,8 +8,11 @@ import androidx.work.WorkerParameters;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.Consumer
;
import
ly.warp.sdk.io.request.WarplyConsumerRequest
;
...
...
@@ -45,9 +48,9 @@ public class EventQuestionnaireService extends Worker {
}
}
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
new
CallbackReceiver
<
CampaignList
>()
{
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
new
CallbackReceiver
<
ArrayList
<
Campaign
>
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
WarpUtils
.
log
(
"SUCCESS_QUESTIONNAIRE_EVENT"
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
View file @
59332a2
...
...
@@ -67,7 +67,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
private
float
[]
velRing
=
new
float
[
VEL_RING_SIZE
];
private
long
lastStepTimeNs
=
0
;
private
float
oldVelocityEstimate
=
0
;
private
double
eventMeters
=
0.0d
;
private
double
eventMeters
=
0.0d
,
pacingMeters
=
0.0d
;
private
int
sumSteps
=
0
;
// ===========================================================
...
...
@@ -85,10 +85,11 @@ public class WarplyHealthService extends Service implements SensorEventListener
mSensorManager
=
(
SensorManager
)
getSystemService
(
Context
.
SENSOR_SERVICE
);
mSensor
=
mSensorManager
.
getDefaultSensor
(
Sensor
.
TYPE_ACCELEROMETER
);
registerStepSensor
();
// registerStepSensor();
WarplyManager
.
getPacingDetails
(
new
PacingDetailsRequest
(),
mPacingCallback
);
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
//
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
NotificationManager
notificationManager
=
(
NotificationManager
)
getSystemService
(
NOTIFICATION_SERVICE
);
...
...
@@ -141,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
WarplyManagerHelper
.
mStepsWebview
=
0
;
WarplyManagerHelper
.
mMetersWebview
=
0.0d
;
eventMeters
=
0.0d
;
pacingMeters
=
0.0d
;
sumSteps
=
0
;
sendSteps
();
}
...
...
@@ -222,8 +224,8 @@ public class WarplyHealthService extends Service implements SensorEventListener
// healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022
// healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022
eventMeters
=
(
sumSteps
*
0.762
);
WarpUtils
.
log
(
"WIDGET_METERS: "
+
String
.
valueOf
(
eventMeters
));
healthSteps
.
setMeters
(
eventMeters
);
WarpUtils
.
log
(
"WIDGET_METERS: "
+
String
.
valueOf
(
pacingMeters
+
eventMeters
));
healthSteps
.
setMeters
(
pacingMeters
+
eventMeters
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthSteps
));
lastStepTimeNs
=
timeNs
;
...
...
@@ -292,4 +294,17 @@ public class WarplyHealthService extends Service implements SensorEventListener
});
}
}
private
CallbackReceiver
<
PacingDetails
>
mPacingCallback
=
new
CallbackReceiver
<
PacingDetails
>()
{
@Override
public
void
onSuccess
(
PacingDetails
result
)
{
pacingMeters
=
result
.
getMeters
().
getDay
().
getValue
();
registerStepSensor
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
};
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
View file @
59332a2
...
...
@@ -36,12 +36,13 @@ import ly.warp.sdk.utils.WarplyManagerHelper;
public
class
MergedGiftsAdapter
extends
RecyclerView
.
Adapter
<
MergedGiftsAdapter
.
MergedGiftsViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
MergedGifts
>
mMergedGifts
;
private
ArrayList
<
MergedGifts
>
mMergedGifts
=
new
ArrayList
<>()
;
private
final
PublishSubject
<
MergedGifts
>
onClickSubject
=
PublishSubject
.
create
();
public
MergedGiftsAdapter
(
Context
mContext
,
ArrayList
<
MergedGifts
>
mergedgifts
)
{
this
.
mContext
=
mContext
;
this
.
mMergedGifts
=
mergedgifts
;
this
.
mMergedGifts
.
clear
();
this
.
mMergedGifts
.
addAll
(
mergedgifts
);
}
public
class
MergedGiftsViewHolder
extends
RecyclerView
.
ViewHolder
{
...
...
@@ -64,6 +65,11 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.
return
mMergedGifts
.
size
();
}
@Override
public
long
getItemId
(
int
position
)
{
// return super.getItemId(position);
return
Double
.
valueOf
(
Math
.
random
()).
longValue
();
}
public
MergedGifts
getItem
(
int
id
)
{
return
mMergedGifts
.
get
(
id
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreCampaignAdapter.java
View file @
59332a2
...
...
@@ -25,12 +25,13 @@ import ly.warp.sdk.io.models.Campaign;
public
class
MoreCampaignAdapter
extends
RecyclerView
.
Adapter
<
MoreCampaignAdapter
.
MoreCampaignViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
Campaign
>
mCampaigns
;
private
ArrayList
<
Campaign
>
mCampaigns
=
new
ArrayList
<>()
;
private
final
PublishSubject
<
Campaign
>
onClickSubject
=
PublishSubject
.
create
();
public
MoreCampaignAdapter
(
Context
mContext
,
ArrayList
<
Campaign
>
campaignList
)
{
this
.
mContext
=
mContext
;
this
.
mCampaigns
=
campaignList
;
this
.
mCampaigns
.
clear
();
this
.
mCampaigns
.
addAll
(
campaignList
);
}
public
class
MoreCampaignViewHolder
extends
RecyclerView
.
ViewHolder
{
...
...
@@ -67,6 +68,12 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte
}
@Override
public
long
getItemId
(
int
position
)
{
// return super.getItemId(position);
return
Double
.
valueOf
(
Math
.
random
()).
longValue
();
}
@Override
public
MoreCampaignViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
itemView
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreContextualAdapter.java
View file @
59332a2
...
...
@@ -26,12 +26,13 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
public
class
MoreContextualAdapter
extends
RecyclerView
.
Adapter
<
MoreContextualAdapter
.
MoreContextualViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
LoyaltyContextualOfferModel
>
mCampaigns
;
private
ArrayList
<
LoyaltyContextualOfferModel
>
mCampaigns
=
new
ArrayList
<>()
;
private
final
PublishSubject
<
LoyaltyContextualOfferModel
>
onClickSubject
=
PublishSubject
.
create
();
public
MoreContextualAdapter
(
Context
mContext
,
ArrayList
<
LoyaltyContextualOfferModel
>
campaignList
)
{
this
.
mContext
=
mContext
;
this
.
mCampaigns
=
campaignList
;
this
.
mCampaigns
.
clear
();
this
.
mCampaigns
.
addAll
(
campaignList
);
}
public
class
MoreContextualViewHolder
extends
RecyclerView
.
ViewHolder
{
...
...
@@ -56,6 +57,11 @@ public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAd
return
mCampaigns
.
size
();
}
@Override
public
long
getItemId
(
int
position
)
{
// return super.getItemId(position);
return
Double
.
valueOf
(
Math
.
random
()).
longValue
();
}
public
LoyaltyContextualOfferModel
getItem
(
int
id
)
{
return
mCampaigns
.
get
(
id
);
...
...
warply_android_sdk/src/main/res/layout/activity_gifts_for_you.xml
View file @
59332a2
...
...
@@ -40,7 +40,7 @@
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<
Relative
Layout
<
Linear
Layout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_cos_loyalty_no_border"
...
...
@@ -97,7 +97,6 @@
android:id=
"@+id/rv_merged_gifts"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_gifts_popup"
android:layout_marginTop=
"4dp"
android:clipToPadding=
"false"
android:orientation=
"vertical"
...
...
@@ -213,5 +212,5 @@
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
</
Relative
Layout>
</
Linear
Layout>
</LinearLayout>
\ No newline at end of file
...
...
warply_android_sdk/src/main/res/layout/activity_more_for_you.xml
View file @
59332a2
<?xml version="1.0" encoding="utf-8"?>
<
Relative
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
android:fillViewport=
"true"
>
android:fillViewport=
"true"
android:orientation=
"vertical"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_more_header"
...
...
@@ -39,10 +40,9 @@
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<
Relative
Layout
<
Linear
Layout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/cl_more_header"
android:background=
"@drawable/shape_cos_loyalty_no_border"
android:orientation=
"vertical"
>
...
...
@@ -52,7 +52,7 @@
android:fillViewport=
"true"
android:overScrollMode=
"never"
>
<
Relative
Layout
<
Linear
Layout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
...
...
@@ -107,21 +107,19 @@
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_more_items"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/ll_more_popup"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:clipToPadding=
"false"
android:orientation=
"vertical"
android:overScrollMode=
"never"
android:paddingTop=
"44dp"
android:paddingBottom=
"24dp"
android:overScrollMode=
"never"
android:visibility=
"gone"
/>
<LinearLayout
android:id=
"@+id/ll_research_items"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_more_popup"
android:orientation=
"vertical"
android:paddingTop=
"44dp"
android:visibility=
"gone"
>
...
...
@@ -151,7 +149,6 @@
android:id=
"@+id/ll_exclusive_items"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_research_items"
android:orientation=
"vertical"
android:visibility=
"gone"
>
...
...
@@ -180,7 +177,6 @@
android:id=
"@+id/ll_contest_items"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_exclusive_items"
android:orientation=
"vertical"
android:visibility=
"gone"
>
...
...
@@ -209,7 +205,6 @@
android:id=
"@+id/ll_contextual_items"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_contest_items"
android:orientation=
"vertical"
android:visibility=
"gone"
>
...
...
@@ -233,7 +228,7 @@
android:overScrollMode=
"never"
android:paddingBottom=
"4dp"
/>
</LinearLayout>
</
Relative
Layout>
</
Linear
Layout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment