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-07-05 16:56:13 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
14a87e996216f8b39df7639f756522ce997485fa
14a87e99
1 parent
7be5e5f2
possible duplicate fix
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
18 deletions
warply_android_sdk/build.gradle
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/utils/WarplyManagerHelper.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreCampaignAdapter.java
warply_android_sdk/src/main/res/layout/activity_more_for_you.xml
warply_android_sdk/build.gradle
View file @
14a87e9
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta2
4
'
PUBLISH_VERSION
=
'4.5.4-cosbeta2
5
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
14a87e9
...
...
@@ -16,6 +16,7 @@ import org.greenrobot.eventbus.EventBus;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.Campaign
;
...
...
@@ -49,16 +50,35 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
private
RecyclerView
mRecyclerMergedGifts
;
private
MergedGiftsAdapter
mAdapterMergedGifts
;
private
ArrayList
<
Campaign
>
mValuesList
=
new
ArrayList
<>();
private
HashSet
<
Campaign
>
mHashSetList
=
new
HashSet
<>();
private
ArrayList
<
LoyaltyGiftsForYouPackage
>
mSeasonalList
=
new
ArrayList
<>();
private
HashSet
<
LoyaltyGiftsForYouPackage
>
mHashSetSeasonalList
=
new
HashSet
<>();
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_gifts_for_you
);
if
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"gifts_for_you"
)
!=
null
&&
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"gifts_for_you"
).
size
()
>
0
)
{
mHashSetList
.
addAll
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"gifts_for_you"
));
mValuesList
.
clear
();
mValuesList
.
addAll
(
mHashSetList
);
}
if
(
WarplyManagerHelper
.
getSeasonalList
()
!=
null
&&
WarplyManagerHelper
.
getSeasonalList
().
size
()
>
0
)
{
mHashSetSeasonalList
.
addAll
(
WarplyManagerHelper
.
getSeasonalList
());
mSeasonalList
.
clear
();
mSeasonalList
.
addAll
(
mHashSetSeasonalList
);
}
mergeDatasets
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"gifts_for_you"
)
,
WarplyManagerHelper
.
getSeasonalList
()
mValuesList
,
mSeasonalList
);
mIvBack
=
findViewById
(
R
.
id
.
iv_list_close
);
...
...
@@ -142,7 +162,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
}
}
private
ArrayList
<
MergedGifts
>
mergeDatasets
(
CampaignList
campaignList
,
ArrayList
<
LoyaltyGiftsForYouPackage
>
seasonalList
)
{
private
void
mergeDatasets
(
ArrayList
<
Campaign
>
campaignList
,
ArrayList
<
LoyaltyGiftsForYouPackage
>
seasonalList
)
{
if
(
campaignList
!=
null
&&
campaignList
.
size
()
>
0
)
{
Log
.
v
(
"GIFTS_FOR_YOU"
,
String
.
valueOf
(
campaignList
.
size
()));
for
(
Campaign
campaign
:
campaignList
)
{
...
...
@@ -155,6 +175,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
}
if
(
seasonalList
!=
null
&&
seasonalList
.
size
()
>
0
)
{
Log
.
v
(
"GIFTS_FOR_YOU"
,
String
.
valueOf
(
seasonalList
.
size
()));
for
(
LoyaltyGiftsForYouPackage
seasonal
:
seasonalList
)
{
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
null
);
...
...
@@ -163,8 +184,6 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
mData
.
add
(
data
);
}
}
return
mData
;
}
// ===========================================================
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/MoreForYouActivity.java
View file @
14a87e9
...
...
@@ -13,12 +13,16 @@ import androidx.recyclerview.widget.RecyclerView;
import
org.greenrobot.eventbus.EventBus
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.views.adapters.
Profil
eCampaignAdapter
;
import
ly.warp.sdk.views.adapters.
Mor
eCampaignAdapter
;
public
class
MoreForYouActivity
extends
Activity
implements
View
.
OnClickListener
{
...
...
@@ -34,8 +38,10 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
private
ImageView
mIvBack
,
mIvPopupClose
;
private
RecyclerView
mRecyclerMore
;
private
TextView
mTvTitle
;
private
Profil
eCampaignAdapter
mAdapterMore
;
private
Mor
eCampaignAdapter
mAdapterMore
;
private
LinearLayout
mLlMorePopup
;
private
ArrayList
<
Campaign
>
mValuesList
=
new
ArrayList
<>();
private
HashSet
<
Campaign
>
mHashSetList
=
new
HashSet
<>();
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -51,7 +57,14 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mIvPopupClose
=
findViewById
(
R
.
id
.
iv_popup_more_close
);
mLlMorePopup
=
findViewById
(
R
.
id
.
ll_more_popup
);
mRecyclerMore
=
findViewById
(
R
.
id
.
rv_more
);
mRecyclerMore
=
findViewById
(
R
.
id
.
rv_more_items
);
if
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
)
!=
null
&&
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
).
size
()
>
0
)
{
mHashSetList
.
addAll
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
));
mValuesList
.
clear
();
mValuesList
.
addAll
(
mHashSetList
);
}
initViews
();
}
...
...
@@ -85,10 +98,10 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
// if (WarpUtils.getMorePopup(this))
// mLlMorePopup.setVisibility(View.VISIBLE);
if
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
)
!=
null
&&
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
)
.
size
()
>
0
)
{
Log
.
v
(
"MORE_FOR_YOU"
,
String
.
valueOf
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
)
.
size
()));
if
(
mValuesList
!=
null
&&
mValuesList
.
size
()
>
0
)
{
Log
.
v
(
"MORE_FOR_YOU"
,
String
.
valueOf
(
mValuesList
.
size
()));
mRecyclerMore
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterMore
=
new
ProfileCampaignAdapter
(
this
,
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"more_for_you"
),
true
);
mAdapterMore
=
new
MoreCampaignAdapter
(
this
,
mValuesList
);
mRecyclerMore
.
setAdapter
(
mAdapterMore
);
mAdapterMore
.
getPositionClicks
()
.
doOnNext
(
gift
->
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
14a87e9
...
...
@@ -567,10 +567,6 @@ public class WarplyManagerHelper {
mConsumer
=
consumer
;
}
public
static
void
setUniqueCampaignList
(
HashMap
<
String
,
CampaignList
>
uniqueCampaignList
)
{
mUniqueCampaignList
=
uniqueCampaignList
;
}
public
static
void
setUniqueCampaignList
(
CampaignList
campaignList
)
{
mCampaignList
=
campaignList
;
if
(
campaignList
!=
null
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MoreCampaignAdapter.java
0 → 100644
View file @
14a87e9
package
ly
.
warp
.
sdk
.
views
.
adapters
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.bumptech.glide.load.resource.bitmap.CenterCrop
;
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
;
import
java.util.ArrayList
;
import
io.reactivex.Observable
;
import
io.reactivex.subjects.PublishSubject
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.Campaign
;
public
class
MoreCampaignAdapter
extends
RecyclerView
.
Adapter
<
MoreCampaignAdapter
.
ProfileCampaignViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
Campaign
>
mCampaigns
;
private
final
PublishSubject
<
Campaign
>
onClickSubject
=
PublishSubject
.
create
();
public
MoreCampaignAdapter
(
Context
mContext
,
ArrayList
<
Campaign
>
campaignList
)
{
this
.
mContext
=
mContext
;
this
.
mCampaigns
=
campaignList
;
}
public
class
ProfileCampaignViewHolder
extends
RecyclerView
.
ViewHolder
{
private
ImageView
ivCampaignTitle
,
ivIsNew
;
private
TextView
tvCampaignTitle
,
tvCampaignSubtitle
,
tvCampaignMessage
;
public
ProfileCampaignViewHolder
(
View
view
)
{
super
(
view
);
ivCampaignTitle
=
view
.
findViewById
(
R
.
id
.
iv_campaign_logo
);
tvCampaignTitle
=
view
.
findViewById
(
R
.
id
.
tv_campaign_title
);
}
public
ProfileCampaignViewHolder
(
View
view
,
boolean
vertical
)
{
super
(
view
);
ivCampaignTitle
=
view
.
findViewById
(
R
.
id
.
iv_campaign_logo
);
tvCampaignTitle
=
view
.
findViewById
(
R
.
id
.
tv_campaign_title
);
ivIsNew
=
view
.
findViewById
(
R
.
id
.
iv_campaign_new
);
if
(
vertical
)
{
tvCampaignSubtitle
=
view
.
findViewById
(
R
.
id
.
tv_campaign_subtitle
);
tvCampaignMessage
=
view
.
findViewById
(
R
.
id
.
tv_campaign_message
);
}
}
}
@Override
public
int
getItemCount
()
{
if
(
mCampaigns
==
null
)
return
0
;
else
return
mCampaigns
.
size
();
}
public
Campaign
getItem
(
int
id
)
{
return
mCampaigns
.
get
(
id
);
}
public
void
updateData
(
ArrayList
<
Campaign
>
campaignList
)
{
mCampaigns
.
clear
();
mCampaigns
.
addAll
(
campaignList
);
notifyDataSetChanged
();
}
@Override
public
ProfileCampaignViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
itemView
;
itemView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
item_profile_recycler_vertical
,
parent
,
false
);
return
new
ProfileCampaignViewHolder
(
itemView
,
true
);
}
@Override
public
void
onBindViewHolder
(
final
ProfileCampaignViewHolder
holder
,
int
position
)
{
Campaign
campaignItem
=
mCampaigns
.
get
(
position
);
if
(
campaignItem
!=
null
)
{
if
(!
TextUtils
.
isEmpty
(
campaignItem
.
getLogoUrl
()))
{
Glide
.
with
(
mContext
)
.
load
(
campaignItem
.
getLogoUrl
())
.
transform
(
new
CenterCrop
(),
new
RoundedCorners
(
4
))
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCampaignTitle
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCampaignTitle
);
}
holder
.
tvCampaignTitle
.
setText
(
campaignItem
.
getTitle
());
holder
.
tvCampaignSubtitle
.
setText
(
campaignItem
.
getSubtitle
());
holder
.
tvCampaignMessage
.
setText
(
campaignItem
.
getMessage
());
if
(
campaignItem
.
getIsNew
())
holder
.
ivIsNew
.
setVisibility
(
View
.
VISIBLE
);
else
holder
.
ivIsNew
.
setVisibility
(
View
.
GONE
);
holder
.
itemView
.
setOnClickListener
(
v
->
onClickSubject
.
onNext
(
campaignItem
));
}
}
public
Observable
<
Campaign
>
getPositionClicks
()
{
return
onClickSubject
.
cache
();
}
}
warply_android_sdk/src/main/res/layout/activity_more_for_you.xml
View file @
14a87e9
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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"
xmlns:tools=
"http://schemas.android.com/tools"
android:background=
"@android:color/white"
android:fillViewport=
"true"
>
...
...
@@ -93,7 +93,7 @@
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_more"
android:id=
"@+id/rv_more
_items
"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/ll_more_popup"
...
...
Please
register
or
login
to post a comment