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-05-10 15:54:05 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1b469e4e17d4ec48ab3c66880bc3929a3a969bfa
1b469e4e
1 parent
c9e3b583
active coupons redesign, gifts for you redesign
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
618 additions
and
204 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/MergedGifts.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarpUtils.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
warply_android_sdk/src/main/res/drawable-xhdpi/ic_close_white.png
warply_android_sdk/src/main/res/drawable-xhdpi/ic_gifts_for_you_white.png
warply_android_sdk/src/main/res/drawable/shape_cos_gradient5.xml
warply_android_sdk/src/main/res/drawable/shape_cos_loyalty.xml
warply_android_sdk/src/main/res/layout/activity_gifts_for_you.xml
warply_android_sdk/src/main/res/layout/fragment_loyalty.xml
warply_android_sdk/src/main/res/layout/item_merged_gifts_recycler.xml
warply_android_sdk/src/main/res/values/colors.xml
warply_android_sdk/src/main/res/values/strings.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
1b469e4
...
...
@@ -5,6 +5,7 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
...
...
@@ -15,13 +16,19 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.Couponset
;
import
ly.warp.sdk.io.models.CouponsetsList
;
import
ly.warp.sdk.io.models.MergedGifts
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.views.adapters.CouponsetsAdapter
;
import
ly.warp.sdk.views.adapters.MergedGiftsAdapter
;
import
ly.warp.sdk.views.adapters.ProfileCampaignAdapter
;
...
...
@@ -35,36 +42,53 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
// Fields
// ===========================================================
private
ImageView
mIvBack
;
private
RecyclerView
mRecyclerGifts
,
mRecyclerRewards
,
mRecyclerCoupons
;
private
ImageView
mIvBack
,
mIvPopupClose
;
private
TextView
mTvTitle
;
private
ProfileCampaignAdapter
mAdapterGifts
,
mAdapterRewards
;
private
CouponsetsAdapter
mAdapterCoupons
;
private
ConstraintLayout
mClGiftsOuter
,
mClRewardsOuter
,
mClCouponsOuter
;
/**** Old functionality ****/
// private RecyclerView mRecyclerGifts, mRecyclerRewards, mRecyclerCoupons;
// private ProfileCampaignAdapter mAdapterGifts, mAdapterRewards;
// private CouponsetsAdapter mAdapterCoupons;
// private ConstraintLayout mClGiftsOuter, mClRewardsOuter, mClCouponsOuter;
private
HashMap
<
String
,
CampaignList
>
mUniqueGiftsList
=
new
HashMap
<
String
,
CampaignList
>();
/**** Old functionality ****/
private
LinearLayout
mLlGiftsPopup
;
private
ArrayList
<
MergedGifts
>
mData
=
new
ArrayList
();
private
RecyclerView
mRecyclerMergedGifts
;
private
MergedGiftsAdapter
mAdapterMergedGifts
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_gifts_for_you
);
getCampaignsBySubcategory
();
/**** Old functionality ****/
// getCampaignsBySubcategory();
/**** Old functionality ****/
mergeDatasets
(
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"gifts_for_you"
),
WarplyManagerHelper
.
getCouponsets
()
);
mIvBack
=
findViewById
(
R
.
id
.
iv_list_close
);
mTvTitle
=
findViewById
(
R
.
id
.
textView3
);
mIvPopupClose
=
findViewById
(
R
.
id
.
iv_popup_gifts_close
);
mLlGiftsPopup
=
findViewById
(
R
.
id
.
ll_gifts_popup
);
/**** Old functionality ****/
// mClGiftsOuter = findViewById(R.id.cl_recycler_inner);
// mRecyclerGifts = findViewById(R.id.rv_gifts);
mClGiftsOuter
=
findViewById
(
R
.
id
.
cl_recycler_inner
);
mRecyclerGifts
=
findViewById
(
R
.
id
.
rv_gift
s
);
// mClRewardsOuter = findViewById(R.id.cl_recycler_inner2
);
// mRecyclerRewards = findViewById(R.id.rv_reward
s);
mClRewardsOuter
=
findViewById
(
R
.
id
.
cl_recycler_inner2
);
mRecyclerRewards
=
findViewById
(
R
.
id
.
rv_rewards
);
// mClCouponsOuter = findViewById(R.id.cl_recycler_inner3);
// mRecyclerCoupons = findViewById(R.id.rv_coupons);
/**** Old functionality ****/
mClCouponsOuter
=
findViewById
(
R
.
id
.
cl_recycler_inner3
);
mRecyclerCoupons
=
findViewById
(
R
.
id
.
rv_coupons
);
mRecyclerMergedGifts
=
findViewById
(
R
.
id
.
rv_merged_gifts
);
initViews
();
}
...
...
@@ -78,6 +102,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
public
void
onClick
(
View
view
)
{
if
(
view
.
getId
()
==
R
.
id
.
iv_list_close
)
{
onBackPressed
();
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
iv_popup_gifts_close
)
{
mLlGiftsPopup
.
setVisibility
(
View
.
GONE
);
WarpUtils
.
setGiftsPopup
(
this
,
false
);
}
}
...
...
@@ -88,52 +117,79 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
private
void
initViews
()
{
mIvBack
.
setOnClickListener
(
this
);
mTvTitle
.
setText
(
getIntent
().
getStringExtra
(
"title"
));
if
(
mUniqueGiftsList
.
get
(
"gifts"
)
!=
null
&&
mUniqueGiftsList
.
get
(
"gifts"
).
size
()
>
0
)
{
mRecyclerGifts
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterGifts
=
new
ProfileCampaignAdapter
(
this
,
mUniqueGiftsList
.
get
(
"gifts"
));
mRecyclerGifts
.
setAdapter
(
mAdapterGifts
);
mAdapterGifts
.
getPositionClicks
()
.
doOnNext
(
gift
->
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
gift
)));
})
.
doOnError
(
error
->
{
})
.
subscribe
();
}
else
{
mClGiftsOuter
.
setVisibility
(
View
.
GONE
);
}
if
(
mUniqueGiftsList
.
get
(
"rewards"
)
!=
null
&&
mUniqueGiftsList
.
get
(
"rewards"
).
size
()
>
0
)
{
mRecyclerRewards
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterRewards
=
new
ProfileCampaignAdapter
(
this
,
mUniqueGiftsList
.
get
(
"rewards"
));
mRecyclerRewards
.
setAdapter
(
mAdapterRewards
);
mAdapterRewards
.
getPositionClicks
()
.
doOnNext
(
reward
->
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
reward
)));
})
.
doOnError
(
error
->
{
})
.
subscribe
();
}
else
{
mClRewardsOuter
.
setVisibility
(
View
.
GONE
);
}
if
(
WarplyManagerHelper
.
getCouponsets
()
!=
null
&&
WarplyManagerHelper
.
getCouponsets
().
size
()
>
0
)
{
mRecyclerCoupons
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterCoupons
=
new
CouponsetsAdapter
(
this
,
WarplyManagerHelper
.
getCouponsets
());
mRecyclerCoupons
.
setAdapter
(
mAdapterCoupons
);
mAdapterCoupons
.
getPositionClicks
()
.
doOnNext
(
couponset
->
{
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
couponset
);
startActivity
(
intent
);
mIvPopupClose
.
setOnClickListener
(
this
);
if
(
WarpUtils
.
getGiftsPopup
(
this
))
mLlGiftsPopup
.
setVisibility
(
View
.
VISIBLE
);
/**** Old functionality ****/
// if (mUniqueGiftsList.get("gifts") != null && mUniqueGiftsList.get("gifts").size() > 0) {
// mRecyclerGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
// mAdapterGifts = new ProfileCampaignAdapter(this, mUniqueGiftsList.get("gifts"));
// mRecyclerGifts.setAdapter(mAdapterGifts);
// mAdapterGifts.getPositionClicks()
// .doOnNext(gift -> {
// startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(gift)));
// })
// .doOnError(error -> {
// })
// .subscribe();
// } else {
// mClGiftsOuter.setVisibility(View.GONE);
// }
// if (mUniqueGiftsList.get("rewards") != null && mUniqueGiftsList.get("rewards").size() > 0) {
// mRecyclerRewards.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
// mAdapterRewards = new ProfileCampaignAdapter(this, mUniqueGiftsList.get("rewards"));
// mRecyclerRewards.setAdapter(mAdapterRewards);
// mAdapterRewards.getPositionClicks()
// .doOnNext(reward -> {
// startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(reward)));
// })
// .doOnError(error -> {
// })
// .subscribe();
// } else {
// mClRewardsOuter.setVisibility(View.GONE);
// }
// if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
// mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
// mAdapterCoupons = new CouponsetsAdapter(this, WarplyManagerHelper.getCouponsets());
// mRecyclerCoupons.setAdapter(mAdapterCoupons);
// mAdapterCoupons.getPositionClicks()
// .doOnNext(couponset -> {
// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
// intent.putExtra("couponset", (Serializable) couponset);
// startActivity(intent);
// })
// .doOnError(error -> {
// })
// .subscribe();
// } else {
// mClCouponsOuter.setVisibility(View.GONE);
// }
/**** Old functionality ****/
if
(
mData
!=
null
&&
mData
.
size
()
>
0
)
{
mRecyclerMergedGifts
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mAdapterMergedGifts
=
new
MergedGiftsAdapter
(
this
,
mData
);
mRecyclerMergedGifts
.
setAdapter
(
mAdapterMergedGifts
);
mAdapterMergedGifts
.
getPositionClicks
()
.
doOnNext
(
dataItem
->
{
if
(
dataItem
.
getDataType
()
==
1
)
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())));
}
else
if
(
dataItem
.
getDataType
()
==
2
)
{
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
dataItem
.
getCouponset
());
startActivity
(
intent
);
}
})
.
doOnError
(
error
->
{
})
.
subscribe
();
}
else
{
mClCouponsOuter
.
setVisibility
(
View
.
GONE
);
//
mClCouponsOuter.setVisibility(View.GONE);
}
}
...
...
@@ -162,6 +218,30 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
}
}
private
ArrayList
<
MergedGifts
>
mergeDatasets
(
CampaignList
campaignList
,
CouponsetsList
couponsetsList
)
{
if
(
campaignList
.
size
()
>
0
)
{
for
(
Campaign
campaign
:
campaignList
)
{
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
campaign
);
data
.
setCouponset
(
null
);
data
.
setDataType
(
1
);
mData
.
add
(
data
);
}
}
if
(
couponsetsList
.
size
()
>
0
)
{
for
(
Couponset
couponset
:
couponsetsList
)
{
MergedGifts
data
=
new
MergedGifts
();
data
.
setCampaign
(
null
);
data
.
setCouponset
(
couponset
);
data
.
setDataType
(
2
);
mData
.
add
(
data
);
}
}
return
mData
;
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/MergedGifts.java
0 → 100644
View file @
1b469e4
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package
ly
.
warp
.
sdk
.
io
.
models
;
/**
* Created by Panagiotis Triantafyllou on 10-May-22.
*/
public
class
MergedGifts
{
private
int
dataType
=
0
;
private
Couponset
couponset
;
private
Campaign
campaign
;
public
void
setDataType
(
int
dataType
)
{
this
.
dataType
=
dataType
;
}
public
void
setCouponset
(
Couponset
couponset
)
{
this
.
couponset
=
couponset
;
}
public
void
setCampaign
(
Campaign
campaign
)
{
this
.
campaign
=
campaign
;
}
public
int
getDataType
()
{
return
dataType
;
}
public
Couponset
getCouponset
()
{
return
couponset
;
}
public
Campaign
getCampaign
()
{
return
campaign
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarpUtils.java
View file @
1b469e4
...
...
@@ -127,6 +127,10 @@ public class WarpUtils {
+
"device_info_data"
;
private
static
final
String
PREFERENCES_KEY_LIFECYCLE_ANALYTICS_ENABLED
=
PREFERENCES_PREFIX
+
"lifecycle_analytics_enabled"
;
private
static
final
String
PREFERENCES_KEY_GIFTS_POPUP
=
PREFERENCES_PREFIX
+
"gifts_popup"
;
private
static
final
String
PREFERENCES_KEY_MORE_POPUP
=
PREFERENCES_PREFIX
+
"more_popup"
;
private
static
SharedPreferences
_prefs
;
...
...
@@ -180,6 +184,28 @@ public class WarpUtils {
editor
.
apply
();
}
public
static
boolean
getGiftsPopup
(
Context
context
)
{
SharedPreferences
prefs
=
getPreferences
(
context
);
return
prefs
.
getBoolean
(
PREFERENCES_KEY_GIFTS_POPUP
,
true
);
}
public
static
void
setGiftsPopup
(
Context
context
,
boolean
visible
)
{
SharedPreferences
.
Editor
editor
=
getPreferences
(
context
).
edit
();
editor
.
putBoolean
(
PREFERENCES_KEY_GIFTS_POPUP
,
visible
);
editor
.
apply
();
}
public
static
boolean
getMorePopup
(
Context
context
)
{
SharedPreferences
prefs
=
getPreferences
(
context
);
return
prefs
.
getBoolean
(
PREFERENCES_KEY_MORE_POPUP
,
true
);
}
public
static
void
setMorePopup
(
Context
context
,
boolean
visible
)
{
SharedPreferences
.
Editor
editor
=
getPreferences
(
context
).
edit
();
editor
.
putBoolean
(
PREFERENCES_KEY_MORE_POPUP
,
visible
);
editor
.
apply
();
}
static
boolean
isRegisteredGCMOrWaiting
(
Context
context
)
{
return
isRegisteredGCM
(
context
)
||
isWaitingGCM
(
context
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedGiftsAdapter.java
0 → 100644
View file @
1b469e4
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
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
import
io.reactivex.Observable
;
import
io.reactivex.subjects.PublishSubject
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.MergedGifts
;
public
class
MergedGiftsAdapter
extends
RecyclerView
.
Adapter
<
MergedGiftsAdapter
.
MergedGiftsViewHolder
>
{
private
Context
mContext
;
private
ArrayList
<
MergedGifts
>
mMergedGifts
;
private
final
PublishSubject
<
MergedGifts
>
onClickSubject
=
PublishSubject
.
create
();
public
MergedGiftsAdapter
(
Context
mContext
,
ArrayList
<
MergedGifts
>
mergedgifts
)
{
this
.
mContext
=
mContext
;
this
.
mMergedGifts
=
mergedgifts
;
}
public
class
MergedGiftsViewHolder
extends
RecyclerView
.
ViewHolder
{
private
ImageView
ivMergedGiftsLogo
;
private
TextView
tvMergedGiftsTitle
;
public
MergedGiftsViewHolder
(
View
view
)
{
super
(
view
);
ivMergedGiftsLogo
=
view
.
findViewById
(
R
.
id
.
iv_campaign_logo
);
tvMergedGiftsTitle
=
view
.
findViewById
(
R
.
id
.
tv_campaign_title
);
}
}
@Override
public
int
getItemCount
()
{
if
(
mMergedGifts
==
null
)
return
0
;
else
return
mMergedGifts
.
size
();
}
public
MergedGifts
getItem
(
int
id
)
{
return
mMergedGifts
.
get
(
id
);
}
public
void
updateData
(
ArrayList
<
MergedGifts
>
mergedgifts
)
{
mMergedGifts
.
clear
();
mMergedGifts
.
addAll
(
mergedgifts
);
notifyDataSetChanged
();
}
@Override
public
MergedGiftsViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
itemView
;
itemView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
item_merged_gifts_recycler
,
parent
,
false
);
return
new
MergedGiftsViewHolder
(
itemView
);
}
@Override
public
void
onBindViewHolder
(
final
MergedGiftsViewHolder
holder
,
int
position
)
{
MergedGifts
mergedgiftsItem
=
mMergedGifts
.
get
(
position
);
if
(
mergedgiftsItem
!=
null
&&
mergedgiftsItem
.
getDataType
()
==
1
)
{
if
(!
TextUtils
.
isEmpty
(
mergedgiftsItem
.
getCampaign
().
getLogoUrl
()))
{
Glide
.
with
(
mContext
)
.
load
(
mergedgiftsItem
.
getCampaign
().
getLogoUrl
())
.
transform
(
new
CenterCrop
(),
new
RoundedCorners
(
4
))
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
holder
.
tvMergedGiftsTitle
.
setText
(
mergedgiftsItem
.
getCampaign
().
getTitle
());
}
else
if
(
mergedgiftsItem
!=
null
&&
mergedgiftsItem
.
getDataType
()
==
2
)
{
if
(!
TextUtils
.
isEmpty
(
mergedgiftsItem
.
getCouponset
().
getImgPreview
()))
{
Glide
.
with
(
mContext
)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.
load
(
mergedgiftsItem
.
getCouponset
().
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivMergedGiftsLogo
);
}
holder
.
tvMergedGiftsTitle
.
setText
(
mergedgiftsItem
.
getCouponset
().
getName
());
// holder.tvMergedGiftsTitle.setText(Html.fromHtml(mergedgiftsItem.getCouponset().getDescription()));
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
// Date newDate = new Date();
// try {
// newDate = simpleDateFormat.parse(mergedgiftsItem.getExpiration());
// } catch (ParseException e) {
// e.printStackTrace();
// }
// simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
// holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
//
// holder.tvCouponValue.setText(mergedgiftsItem.getDiscount());
}
holder
.
itemView
.
setOnClickListener
(
v
->
onClickSubject
.
onNext
(
mergedgiftsItem
));
}
public
Observable
<
MergedGifts
>
getPositionClicks
()
{
return
onClickSubject
.
cache
();
}
private
long
getDifferenceDays
(
Date
d1
,
Date
d2
)
{
long
diff
=
d2
.
getTime
()
-
d1
.
getTime
();
return
TimeUnit
.
DAYS
.
convert
(
diff
,
TimeUnit
.
MILLISECONDS
);
}
}
warply_android_sdk/src/main/res/drawable-xhdpi/ic_close_white.png
0 → 100644
View file @
1b469e4
486 Bytes
warply_android_sdk/src/main/res/drawable-xhdpi/ic_gifts_for_you_white.png
0 → 100644
View file @
1b469e4
3.73 KB
warply_android_sdk/src/main/res/drawable/shape_cos_gradient5.xml
0 → 100644
View file @
1b469e4
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<gradient
android:startColor=
"@color/cos_blue3"
android:endColor=
"@color/cos_green8"
android:type=
"linear"
/>
<corners
android:radius=
"8dp"
/>
</shape>
\ No newline at end of file
warply_android_sdk/src/main/res/drawable/shape_cos_loyalty.xml
View file @
1b469e4
...
...
@@ -25,7 +25,7 @@
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:topLeftRadius=
"30dp"
/>
<solid
android:color=
"@color/
grey_light
"
/>
<solid
android:color=
"@color/
cos_grey5
"
/>
<!-- <stroke-->
<!-- android:width="1dp"-->
...
...
warply_android_sdk/src/main/res/layout/activity_gifts_for_you.xml
View file @
1b469e4
<?xml version="1.0" encoding="utf-8"?>
<
ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
LinearLayout
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:id=
"@+id/cl_bill_payment
"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
android:
fillViewport=
"true
"
>
android:
orientation=
"vertical
"
>
<LinearLayout
android:id=
"@+id/cl_bill_payment"
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_bill_header"
android:layout_width=
"match_parent"
android:layout_height=
"80dp"
android:background=
"@android:color/white"
>
<ImageView
android:id=
"@+id/iv_list_close"
android:layout_width=
"21dp"
android:layout_height=
"20dp"
android:layout_marginStart=
"24dp"
android:layout_marginTop=
"4dp"
android:src=
"@drawable/ic_back"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/textView3"
/>
<TextView
android:id=
"@+id/textView3"
android:layout_width=
"206dp"
android:layout_height=
"32dp"
android:gravity=
"center"
android:textColor=
"@color/grey"
android:textSize=
"17sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.356"
app:layout_constraintStart_toEndOf=
"@+id/iv_list_close"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_cos_loyalty"
android:orientation=
"vertical"
>
<
androidx.constraintlayout.widget.Constraint
Layout
android:id=
"@+id/
cl_bill_header
"
<
Linear
Layout
android:id=
"@+id/
ll_gifts_popup
"
android:layout_width=
"match_parent"
android:layout_height=
"80dp"
app:layout_constraintTop_toTopOf=
"parent"
>
android:layout_height=
"wrap_content"
android:layout_marginTop=
"24dp"
android:background=
"@drawable/shape_cos_gradient5"
android:orientation=
"vertical"
android:paddingVertical=
"16dp"
android:visibility=
"gone"
>
<ImageView
android:id=
"@+id/iv_
list
_close"
android:layout_width=
"2
1
dp"
android:id=
"@+id/iv_
popup_gifts
_close"
android:layout_width=
"2
0
dp"
android:layout_height=
"20dp"
android:layout_marginStart=
"24dp"
android:layout_marginTop=
"4dp"
android:src=
"@drawable/ic_back"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/textView3"
/>
android:layout_marginStart=
"16dp"
android:src=
"@drawable/ic_close_white"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:scaleType=
"centerInside"
android:src=
"@drawable/ic_gifts_for_you_white"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginTop=
"24dp"
android:layout_marginBottom=
"12dp"
android:text=
"@string/cos_popup_gifts_title"
android:textColor=
"@android:color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
<TextView
android:
id=
"@+id/textView3
"
android:layout_
width=
"206dp
"
android:layout_
height=
"32dp
"
android:
layout_width=
"wrap_content
"
android:layout_
height=
"wrap_content
"
android:layout_
gravity=
"center
"
android:gravity=
"center"
android:textColor=
"@color/grey"
android:textSize=
"17sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.356"
app:layout_constraintStart_toEndOf=
"@+id/iv_list_close"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:text=
"@string/cos_popup_gifts_subtitle"
android:textColor=
"@android:color/white"
android:textSize=
"16sp"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_merged_gifts"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_cos_profile_gradient"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_gifts_popup"
android:layout_marginTop=
"4dp"
android:clipToPadding=
"false"
android:orientation=
"vertical"
android:padding
Bottom=
"24dp"
>
android:padding
Top=
"44dp"
/
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_recycler_inner"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"36dp"
android:paddingBottom=
"4dp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:id=
"@+id/tv_gifts_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:text=
"@string/cos_gifts_title2"
android:textColor=
"@android:color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_gifts"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"24dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingEnd=
"10dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_gifts_title"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_recycler_inner2"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/cl_recycler_inner"
android:layout_marginTop=
"36dp"
android:paddingBottom=
"4dp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:id=
"@+id/tv_rewards_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:text=
"@string/cos_rewards_title"
android:textColor=
"@android:color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_rewards"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"24dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingEnd=
"10dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_rewards_title"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_recycler_inner3"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/cl_recycler_inner2"
android:layout_marginTop=
"36dp"
android:paddingBottom=
"4dp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:id=
"@+id/tv_coupons_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:text=
"@string/cos_coupons_title"
android:textColor=
"@android:color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_coupons"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"24dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingEnd=
"24dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_coupons_title"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:id="@+id/cl_recycler_inner"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="36dp"-->
<!-- android:paddingBottom="4dp"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_gifts_title"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="10dp"-->
<!-- android:text="@string/cos_gifts_title2"-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textSize="18sp"-->
<!-- android:textStyle="bold"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rv_gifts"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="24dp"-->
<!-- android:clipToPadding="false"-->
<!-- android:orientation="horizontal"-->
<!-- android:paddingEnd="10dp"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_gifts_title" />-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:id="@+id/cl_recycler_inner2"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_below="@+id/cl_recycler_inner"-->
<!-- android:layout_marginTop="36dp"-->
<!-- android:paddingBottom="4dp"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_rewards_title"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="10dp"-->
<!-- android:text="@string/cos_rewards_title"-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textSize="18sp"-->
<!-- android:textStyle="bold"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rv_rewards"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="24dp"-->
<!-- android:clipToPadding="false"-->
<!-- android:orientation="horizontal"-->
<!-- android:paddingEnd="10dp"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_rewards_title" />-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:id="@+id/cl_recycler_inner3"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_below="@+id/cl_recycler_inner2"-->
<!-- android:layout_marginTop="36dp"-->
<!-- android:paddingBottom="4dp"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_coupons_title"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="10dp"-->
<!-- android:text="@string/cos_coupons_title"-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textSize="18sp"-->
<!-- android:textStyle="bold"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rv_coupons"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="24dp"-->
<!-- android:clipToPadding="false"-->
<!-- android:orientation="horizontal"-->
<!-- android:paddingEnd="24dp"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
...
...
warply_android_sdk/src/main/res/layout/fragment_loyalty.xml
View file @
1b469e4
...
...
@@ -93,7 +93,7 @@
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_cos_
profile_gradient
"
android:background=
"@drawable/shape_cos_
loyalty
"
android:orientation=
"vertical"
android:paddingBottom=
"24dp"
>
...
...
warply_android_sdk/src/main/res/layout/item_merged_gifts_recycler.xml
0 → 100644
View file @
1b469e4
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
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=
"150dp"
android:layout_marginHorizontal=
"16dp"
android:layout_marginBottom=
"24dp"
app:cardCornerRadius=
"4dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/selector_cos_campaign"
>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/gl_vertical_60_percent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintGuide_percent=
"0.6"
/>
<ImageView
android:id=
"@+id/iv_campaign_logo"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:scaleType=
"centerCrop"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/gl_vertical_60_percent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
tools:src=
"@drawable/ic_cosmote_logo_horizontal_grey"
/>
<TextView
android:id=
"@+id/tv_campaign_title"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"12dp"
android:gravity=
"center"
android:maxLines=
"4"
android:textColor=
"@color/grey"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@+id/gl_vertical_60_percent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"-10% in all products from IKEA"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
warply_android_sdk/src/main/res/values/colors.xml
View file @
1b469e4
...
...
@@ -40,4 +40,7 @@
<color
name=
"cos_dark_blue"
>
#355168
</color>
<color
name=
"cos_grey4"
>
#617181
</color>
<color
name=
"grey_light3"
>
#E3E3E3
</color>
<color
name=
"cos_grey5"
>
#385267
</color>
<color
name=
"cos_blue3"
>
#03A1D6
</color>
<color
name=
"cos_green8"
>
#3AB588
</color>
</resources>
\ No newline at end of file
...
...
warply_android_sdk/src/main/res/values/strings.xml
View file @
1b469e4
...
...
@@ -14,8 +14,8 @@
<string
name=
"cos_profile_title"
>
My Loyalty Wallet
</string>
<string
name=
"cos_deals_title"
>
Deals for You
</string>
<string
name=
"cos_profile_more"
>
Δες περισσότερα
</string>
<string
name=
"cos_gifts_title"
>
G
ifts for You
</string>
<string
name=
"cos_more_title"
>
M
ore for You
</string>
<string
name=
"cos_gifts_title"
>
G
IFTS for YOU
</string>
<string
name=
"cos_more_title"
>
M
ORE for YOU
</string>
<string
name=
"menu_home"
>
Αρχική
</string>
<string
name=
"menu_explore"
>
Ανακάλυψε
</string>
<string
name=
"menu_shop"
>
Shop
</string>
...
...
@@ -55,12 +55,14 @@
<string
name=
"cos_analysis2"
>
Αναλυτικά
</string>
<string
name=
"euro"
>
€
</string>
<string
name=
"cos_profile_questionnaire"
>
+ Ερωτηματολόγιο
</string>
<string
name=
"cos_active_all_coupons"
>
Όλα τα κουπόνια μου
</string>
<string
name=
"cos_active_all_coupons"
>
Ενεργά κουπόνια
</string>
<string
name=
"cos_active_all_rewards"
>
Όλα τα δώρα μου
</string>
<string
name=
"cos_no_active_coupons"
>
Δεν υπάρχουν κουπόνια
</string>
<string
name=
"cos_no_active_rewards"
>
Δεν υπάρχουν δώρα
</string>
<string
name=
"cos_past_all_coupons"
>
Παλαιότερα κουπόνια
</string>
<string
name=
"cos_coupon_expired_date"
>
Εξαργυρώθηκε την %1$s
</string>
<string
name=
"cos_popup_gifts_title"
>
COSMOTE GIFTS FOR YOU
</string>
<string
name=
"cos_popup_gifts_subtitle"
>
Εδώ μπορείς να βρεις τα διαθέσιμα\nδώρα και προσφορές!
</string>
<string-array
name=
"coupons_array"
>
<item>
Κουπόνια
</item>
...
...
Please
register
or
login
to post a comment