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
2024-03-07 16:48:44 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4f3b6010c311a7c6b6a6d8ad78f643e1d5410b49
4f3b6010
1 parent
d27ec90d
new coupons request part3, fixes in active coupons, sm coupons, map
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
148 additions
and
172 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveCouponsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveGiftsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ShopsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ShopsHuaweiActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/UnifiedCouponInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Couponset.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Merchant.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/ActiveCouponAdapter.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveCouponsActivity.java
View file @
4f3b601
...
...
@@ -116,7 +116,7 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe
mCouponsPressed
=
true
;
WarplyAnalyticsManager
.
logTrackersEvent
(
this
,
"click"
,
(
"Coupon"
).
concat
(
":"
).
concat
(
coupon
.
getName
()));
Intent
intent
=
new
Intent
(
ActiveCouponsActivity
.
this
,
CouponInfoActivity
.
class
);
intent
.
putExtra
(
"coupon"
,
(
Serializable
)
coupon
);
intent
.
putExtra
(
"coupon"
,
coupon
.
getCoupon
()
);
startActivity
(
intent
);
}
})
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveGiftsActivity.java
View file @
4f3b601
...
...
@@ -93,7 +93,7 @@ public class ActiveGiftsActivity extends Activity implements View.OnClickListene
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
this
,
WarplyManagerHelper
.
constructCampaignUrl
(
dataItem
.
getCampaign
())));
}
else
if
(
dataItem
.
getDataType
()
==
2
)
{
Intent
intent
=
new
Intent
(
ActiveGiftsActivity
.
this
,
CouponInfoActivity
.
class
);
intent
.
putExtra
(
"coupon"
,
(
Serializable
)
dataItem
.
getCoupon
());
intent
.
putExtra
(
"coupon"
,
dataItem
.
getCoupon
()
.
getCoupon
());
startActivity
(
intent
);
}
})
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponInfoActivity.java
View file @
4f3b601
...
...
@@ -35,8 +35,7 @@ import java.util.Date;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.Couponset
;
import
ly.warp.sdk.io.models.Merchant
;
import
ly.warp.sdk.io.models.UnifiedCoupon
;
import
ly.warp.sdk.services.EventCouponsService
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyAnalyticsManager
;
...
...
@@ -57,10 +56,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mTvTermsValue
,
mTvFullBarcode
,
mTvDescription
,
mTvCouponCodeTitle
;
private
LinearLayout
mLlGiftIt
,
mLlShops
,
mLlBarcodeShown
,
mLlBarcodeContainer
,
mLlTerms
,
mLlWebsite
;
private
Coupon
mCoupon
;
private
Couponset
mCouponset
;
private
boolean
mIsBarcodeShown
=
false
,
mIsTermsShown
=
false
,
mIsFromWallet
=
false
,
mShopsPressed
=
false
,
mGiftPressed
=
false
,
mEshopPressed
=
false
,
mIsUnified
=
false
;
private
Merchant
mMerchant
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -71,10 +68,32 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_coupon_info
);
mCoupon
=
(
Coupon
)
getIntent
().
getSerializable
Extra
(
"coupon"
);
String
couponCode
=
getIntent
().
getString
Extra
(
"coupon"
);
mIsFromWallet
=
getIntent
().
getBooleanExtra
(
"isFromWallet"
,
false
);
mIsUnified
=
getIntent
().
getBooleanExtra
(
"isUnified"
,
false
);
if
(
mIsUnified
)
{
String
couponUnifiedCode
=
getIntent
().
getStringExtra
(
"unifiedCoupon"
);
for
(
UnifiedCoupon
couponItem
:
WarplyManagerHelper
.
getMarketCoupons
())
{
if
(
couponItem
.
getBarcode
().
equals
(
couponUnifiedCode
))
{
for
(
Coupon
cpn
:
couponItem
.
getCoupons
())
{
if
(
cpn
.
getCoupon
().
equals
(
couponCode
))
{
mCoupon
=
cpn
;
break
;
}
}
break
;
}
}
}
else
{
for
(
Coupon
cpn
:
WarplyManagerHelper
.
getCouponList
())
{
if
(
cpn
.
getCoupon
().
equals
(
couponCode
))
{
mCoupon
=
cpn
;
break
;
}
}
}
mIvBack
=
findViewById
(
R
.
id
.
iv_coupon_info_back
);
mTvTerms
=
findViewById
(
R
.
id
.
tv_terms
);
mLlGiftIt
=
findViewById
(
R
.
id
.
ll_gift_it
);
...
...
@@ -147,12 +166,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
if
(
GoogleApiAvailability
.
getInstance
().
isGooglePlayServicesAvailable
(
CouponInfoActivity
.
this
)
==
ConnectionResult
.
SUCCESS
)
{
Intent
intent
=
new
Intent
(
CouponInfoActivity
.
this
,
ShopsActivity
.
class
);
intent
.
putExtra
(
"coupon
set"
,
(
Serializable
)
mCouponset
);
intent
.
putExtra
(
"coupon
"
,
mCoupon
.
getCoupon
()
);
startActivity
(
intent
);
return
;
}
else
{
Intent
intent
=
new
Intent
(
CouponInfoActivity
.
this
,
ShopsHuaweiActivity
.
class
);
intent
.
putExtra
(
"coupon
set"
,
(
Serializable
)
mCouponset
);
intent
.
putExtra
(
"coupon
"
,
mCoupon
.
getCoupon
()
);
startActivity
(
intent
);
return
;
}
...
...
@@ -163,9 +182,9 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mEshopPressed
=
true
;
WarplyAnalyticsManager
.
logTrackersEvent
(
this
,
"click"
,
"SeeShopWebsite"
);
if
(
!
TextUtils
.
isEmpty
(
mMerchant
.
getWebsite
()))
{
if
(
mCoupon
!=
null
&&
mCoupon
.
getMerchantDetails
()
!=
null
&&
!
TextUtils
.
isEmpty
(
mCoupon
.
getMerchantDetails
()
.
getWebsite
()))
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
intent
.
setData
(
Uri
.
parse
(
m
Merchant
.
getWebsite
()));
intent
.
setData
(
Uri
.
parse
(
m
Coupon
.
getMerchantDetails
()
.
getWebsite
()));
startActivity
(
intent
);
}
}
...
...
@@ -227,81 +246,37 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mTvCouponTitle
.
setText
(
HtmlCompat
.
fromHtml
(
mCoupon
.
getName
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
}
else
{
mTvCouponCode
.
setText
(
mCoupon
.
getCoupon
());
mTvCouponTitle
.
setText
(
mCoupon
.
getName
());
}
// mTvCouponSubtitle.setText(mCoupon.getDescription());
if
(
WarplyManagerHelper
.
getCouponsets
()
!=
null
&&
WarplyManagerHelper
.
getCouponsets
().
size
()
>
0
)
{
for
(
Couponset
couponset
:
WarplyManagerHelper
.
getCouponsets
())
{
if
(
couponset
.
getUuid
().
equals
(
mCoupon
.
getCouponsetUuid
()))
{
mCouponset
=
couponset
;
break
;
}
}
}
if
(
mCouponset
!=
null
)
{
if
(
WarplyManagerHelper
.
getMerchantList
()
!=
null
&&
WarplyManagerHelper
.
getMerchantList
().
size
()
>
0
)
{
for
(
Merchant
merchant
:
WarplyManagerHelper
.
getMerchantList
())
{
if
(
merchant
.
getUuid
().
equals
(
mCouponset
.
getMerchantUuid
()))
{
mMerchant
=
merchant
;
break
;
}
mTvCouponTitle
.
setText
(
mCoupon
.
getCouponsetDetails
().
getName
());
}
if
(
mMerchant
!=
null
&&
!
TextUtils
.
isEmpty
(
mMerchant
.
getBody
())
&&
!
mMerchant
.
getBody
().
equals
(
"null"
))
{
mTvDescription
.
setText
(
HtmlCompat
.
fromHtml
(
mMerchant
.
getBody
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
mTvDescription
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
}
else
{
if
(
mCoupon
!=
null
)
{
if
(
mIsFromWallet
)
{
if
(
mCoupon
.
getMerchantDetails
()
!=
null
)
{
mTvDescription
.
setVisibility
(
View
.
GONE
);
}
// if (mMerchant != null) {
// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("show_map") && (mMerchant.getExtraFields().optBoolean("show_map") || mMerchant.getExtraFields().optString("show_map").equals("true"))) {
mLlShops
.
setVisibility
(
View
.
VISIBLE
);
// }
// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("eshop") && (mMerchant.getExtraFields().optBoolean("eshop") || mMerchant.getExtraFields().optString("eshop").equals("true"))) {
// mLlWebsite.setVisibility(View.VISIBLE);
// }
// }
}
mTvCouponSubtitle
.
setText
(
mCouponset
.
getShortDescription
());
mTvTermsValue
.
setText
(
HtmlCompat
.
fromHtml
(
mCouponset
.
getTerms
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
mTvTermsValue
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
if
(
mIsUnified
)
{
mTvCouponSubtitle
.
setText
(
HtmlCompat
.
fromHtml
(
mCoupon
.
getDescription
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
}
else
{
if
(
mIsFromWallet
)
{
if
(
WarplyManagerHelper
.
getMerchantList
()
!=
null
&&
WarplyManagerHelper
.
getMerchantList
().
size
()
>
0
)
{
for
(
Merchant
merchant
:
WarplyManagerHelper
.
getMerchantList
())
{
if
(
merchant
.
getUuid
().
equals
(
mCoupon
.
getMerchantUuid
()))
{
mMerchant
=
merchant
;
break
;
mTvCouponSubtitle
.
setText
(
mCoupon
.
getCouponsetDetails
().
getShortDescription
());
}
}
// if (mMerchant != null && !TextUtils.isEmpty(mMerchant.getBody()) && !mMerchant.getBody().equals("null")) {
// mTvDescription.setText(HtmlCompat.fromHtml(mMerchant.getBody(), HtmlCompat.FROM_HTML_MODE_COMPACT));
// mTvDescription.setMovementMethod(LinkMovementMethod.getInstance());
// } else {
mTvTermsValue
.
setText
(
HtmlCompat
.
fromHtml
(
mCoupon
.
getTerms
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
mTvTermsValue
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
}
else
{
if
(
mCoupon
.
getMerchantDetails
()
!=
null
)
{
if
(
mCoupon
.
getMerchantDetails
()
!=
null
&&
!
TextUtils
.
isEmpty
(
mCoupon
.
getMerchantDetails
().
getBody
())
&&
!
mCoupon
.
getMerchantDetails
().
getBody
().
equals
(
"null"
))
{
mTvDescription
.
setText
(
HtmlCompat
.
fromHtml
(
mCoupon
.
getMerchantDetails
().
getBody
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
mTvDescription
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
}
else
{
mTvDescription
.
setVisibility
(
View
.
GONE
);
//
}
}
// if (mMerchant != null) {
// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("show_map") && (mMerchant.getExtraFields().optBoolean("show_map") || mMerchant.getExtraFields().optString("show_map").equals("true"))) {
mLlShops
.
setVisibility
(
View
.
VISIBLE
);
// }
// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("eshop") && (mMerchant.getExtraFields().optBoolean("eshop") || mMerchant.getExtraFields().optString("eshop").equals("true"))) {
// mLlWebsite.setVisibility(View.VISIBLE);
// }
// }
}
if
(
mIsUnified
)
{
mTvCouponSubtitle
.
setText
(
HtmlCompat
.
fromHtml
(
mCoupon
.
getDescription
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
}
else
{
mTvCouponSubtitle
.
setText
(
mCoupon
.
getShort_description
());
}
mTvTermsValue
.
setText
(
HtmlCompat
.
fromHtml
(
mCoupon
.
getTerms
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
mTvCouponSubtitle
.
setText
(
mCoupon
.
getCouponsetDetails
().
getShortDescription
());
mTvTermsValue
.
setText
(
HtmlCompat
.
fromHtml
(
mCoupon
.
getCouponsetDetails
().
getTerms
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
mTvTermsValue
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
}
}
...
...
@@ -316,19 +291,33 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
simpleDateFormat
=
new
SimpleDateFormat
(
"dd/MM/yyyy"
);
mTvCouponDate
.
setText
(
String
.
format
(
getResources
().
getString
(
R
.
string
.
cos_mycoupon_date
),
simpleDateFormat
.
format
(
newDate
!=
null
?
newDate
:
""
)));
if
(!
TextUtils
.
isEmpty
(
mCoupon
.
getImage
()))
{
if
(
mIsUnified
)
{
mIvCouponPhoto
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_INSIDE
);
if
(!
TextUtils
.
isEmpty
(
mCoupon
.
getImage
()))
{
Glide
.
with
(
this
)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.
load
(
mCoupon
.
getImage
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
mIvCouponPhoto
);
}
else
{
mIvCouponPhoto
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_CROP
);
Glide
.
with
(
this
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
mIvCouponPhoto
);
}
}
else
{
mIvCouponPhoto
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_CROP
);
if
(!
TextUtils
.
isEmpty
(
mCoupon
.
getCouponsetDetails
().
getImgPreview
()))
{
Glide
.
with
(
this
)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.
load
(
mCoupon
.
getImage
())
.
load
(
mCoupon
.
getCouponsetDetails
().
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
mIvCouponPhoto
);
}
else
{
...
...
@@ -336,8 +325,9 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
mIvCouponPhoto
);
}
}
mIvBack
.
setOnClickListener
(
this
);
// mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
mLlGiftIt
.
setOnClickListener
(
this
);
mLlShops
.
setOnClickListener
(
this
);
mLlWebsite
.
setOnClickListener
(
this
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ShopsActivity.java
View file @
4f3b601
...
...
@@ -39,7 +39,7 @@ import java.util.ArrayList;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Coupon
set
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.Merchant
;
import
ly.warp.sdk.io.models.MerchantList
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
...
...
@@ -64,7 +64,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
// ===========================================================
private
ImageView
mIvBack
;
private
Coupon
set
mCouponset
;
private
Coupon
mCoupon
;
private
GoogleMap
mMap
;
private
ClusterManager
<
Merchant
>
mClusterManager
;
private
SupportMapFragment
mMapView
;
...
...
@@ -82,15 +82,14 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_shops
);
mCouponset
=
(
Couponset
)
getIntent
().
getSerializableExtra
(
"couponset
"
);
if
(
mCouponset
!=
null
)
{
for
(
Merchant
merchant
:
WarplyManagerHelper
.
getMerchantList
(
))
{
if
(
merchant
.
getUuid
().
equals
(
mCouponset
.
getMerchantUuid
()))
{
mMerchant
=
merchant
;
String
couponCode
=
getIntent
().
getStringExtra
(
"coupon
"
);
for
(
Coupon
cpn
:
WarplyManagerHelper
.
getCouponList
()
)
{
if
(
cpn
.
getCoupon
().
equals
(
couponCode
))
{
mCoupon
=
cpn
;
mMerchant
=
cpn
.
getMerchantDetails
()
;
break
;
}
}
}
mIvBack
=
findViewById
(
R
.
id
.
iv_shops_back
);
mMapView
=
(
SupportMapFragment
)
getSupportFragmentManager
().
findFragmentById
(
R
.
id
.
mv_shops
);
...
...
@@ -178,9 +177,9 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
//// mMap.setOnMarkerClickListener(/*mClusterManager*/this);
// }
if
(
mCoupon
set
!=
null
)
{
if
(
mCoupon
!=
null
)
{
ArrayList
<
String
>
uuids
=
new
ArrayList
<>();
uuids
.
add
(
mCoupon
set
.
getMerchantUuid
());
uuids
.
add
(
mCoupon
.
getMerchantUuid
());
WarplyManager
.
getMerchantsMultilingual
(
true
,
uuids
,
mMerchantsCallback
);
}
else
{
ArrayList
<
String
>
catuuids
=
new
ArrayList
<>();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ShopsHuaweiActivity.java
View file @
4f3b601
...
...
@@ -38,7 +38,7 @@ import java.util.ArrayList;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Coupon
set
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.Merchant
;
import
ly.warp.sdk.io.models.MerchantList
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
...
...
@@ -62,7 +62,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
// ===========================================================
private
ImageView
mIvBack
;
private
Coupon
set
mCouponset
;
private
Coupon
mCoupon
;
private
HuaweiMap
mMap
;
// private ClusterManager<Merchant> mClusterManager;
private
SupportMapFragment
mSupportMapFragment
;
...
...
@@ -81,15 +81,14 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
MapsInitializer
.
initialize
(
this
);
setContentView
(
R
.
layout
.
activity_shops_huawei
);
mCouponset
=
(
Couponset
)
getIntent
().
getSerializableExtra
(
"couponset
"
);
if
(
mCouponset
!=
null
)
{
for
(
Merchant
merchant
:
WarplyManagerHelper
.
getMerchantList
(
))
{
if
(
merchant
.
getUuid
().
equals
(
mCouponset
.
getMerchantUuid
()))
{
mMerchant
=
merchant
;
String
couponCode
=
getIntent
().
getStringExtra
(
"coupon
"
);
for
(
Coupon
cpn
:
WarplyManagerHelper
.
getCouponList
()
)
{
if
(
cpn
.
getCoupon
().
equals
(
couponCode
))
{
mCoupon
=
cpn
;
mMerchant
=
cpn
.
getMerchantDetails
()
;
break
;
}
}
}
mIvBack
=
findViewById
(
R
.
id
.
iv_shops_back
);
mSupportMapFragment
=
(
SupportMapFragment
)
getSupportFragmentManager
().
findFragmentById
(
R
.
id
.
mv_shops_huawei
);
...
...
@@ -179,9 +178,9 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
//// mMap.setOnMarkerClickListener(/*mClusterManager*/this);
// }
//
if
(
mCoupon
set
!=
null
)
{
if
(
mCoupon
!=
null
)
{
ArrayList
<
String
>
uuids
=
new
ArrayList
<>();
uuids
.
add
(
mCoupon
set
.
getMerchantUuid
());
uuids
.
add
(
mCoupon
.
getMerchantUuid
());
WarplyManager
.
getMerchantsMultilingual
(
true
,
uuids
,
mMerchantsCallback
);
}
else
{
ArrayList
<
String
>
catuuids
=
new
ArrayList
<>();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/UnifiedCouponInfoActivity.java
View file @
4f3b601
...
...
@@ -235,9 +235,10 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
mCouponPressed
=
true
;
WarplyAnalyticsManager
.
logTrackersEvent
(
this
,
"click"
,
(
"MarketCoupon"
).
concat
(
":"
).
concat
(
coupon
.
getName
()));
Intent
intent
=
new
Intent
(
UnifiedCouponInfoActivity
.
this
,
CouponInfoActivity
.
class
);
intent
.
putExtra
(
"coupon"
,
(
Serializable
)
coupon
);
intent
.
putExtra
(
"coupon"
,
coupon
.
getCoupon
()
);
intent
.
putExtra
(
"isFromWallet"
,
true
);
intent
.
putExtra
(
"isUnified"
,
true
);
intent
.
putExtra
(
"unifiedCoupon"
,
mCoupon
.
getBarcode
());
startActivity
(
intent
);
}
})
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Couponset.java
View file @
4f3b601
...
...
@@ -112,6 +112,7 @@ public class Couponset implements Parcelable, Serializable {
private
String
discount_type
=
""
;
private
double
final_price
=
0.0d
;
private
Date
endDate
=
new
Date
();
private
String
couponsetType
=
""
;
public
Couponset
()
{
this
.
uuid
=
""
;
...
...
@@ -159,6 +160,9 @@ public class Couponset implements Parcelable, Serializable {
this
.
updated
=
""
;
this
.
uuid
=
""
;
// this.endDate = new Date();
this
.
couponsetType
=
""
;
this
.
img_preview
=
""
;
this
.
innerText
=
""
;
}
/**
...
...
@@ -232,6 +236,9 @@ public class Couponset implements Parcelable, Serializable {
this
.
category
=
json
.
optString
(
CATEGORY
);
this
.
terms
=
json
.
optString
(
TERMS
);
this
.
discount_type
=
json
.
isNull
(
DISCOUNT_TYPE
)
?
""
:
json
.
optString
(
DISCOUNT_TYPE
);
this
.
couponsetType
=
json
.
optString
(
"couponset_type"
);
this
.
img_preview
=
json
.
optString
(
IMG_PREVIEW
);
this
.
innerText
=
json
.
optString
(
INNER_TEXT
);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
// Date newDate = new Date();
// String tempRedeemDate = json.optString("end_date");
...
...
@@ -625,6 +632,14 @@ public class Couponset implements Parcelable, Serializable {
this
.
final_price
=
final_price
;
}
public
String
getCouponsetType
()
{
return
couponsetType
;
}
public
void
setCouponsetType
(
String
couponsetType
)
{
this
.
couponsetType
=
couponsetType
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Merchant.java
View file @
4f3b601
...
...
@@ -191,6 +191,9 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
this
.
region
=
""
;
this
.
telephone
=
""
;
this
.
merchant_metadata
=
new
JSONObject
();
this
.
admin_name
=
""
;
this
.
img_preview
=
""
;
this
.
website
=
""
;
}
/**
...
...
@@ -267,6 +270,9 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
this
.
region
=
json
.
optString
(
REGION
);
this
.
telephone
=
json
.
isNull
(
TELEPHONE
)
?
""
:
json
.
optString
(
TELEPHONE
);
this
.
merchant_metadata
=
json
.
optJSONObject
(
MERCHANT_METADATA
);
this
.
admin_name
=
json
.
optString
(
ADMIN_NAME
);
this
.
img_preview
=
json
.
optString
(
IMG_PREVIEW
);
this
.
website
=
json
.
optString
(
WEBSITE
);
// this.id = json.optString(ID);
// this.store_id = json.optString(STORE_ID);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
4f3b601
...
...
@@ -4352,11 +4352,12 @@ public class WarplyManager {
executorCoupons
.
submit
(()
->
{
for
(
int
i
=
0
;
i
<
finalJCouponsBody
.
length
();
++
i
)
{
Coupon
tempCoupon
=
new
Coupon
(
finalJCouponsBody
.
optJSONObject
(
i
),
true
);
if
(
TextUtils
.
isEmpty
(
tempCoupon
.
getCouponsetDetails
().
getCouponsetType
())
||
!
tempCoupon
.
getCouponsetDetails
().
getCouponsetType
().
equals
(
"supermarket"
))
mCouponsList
.
add
(
tempCoupon
);
if
(
tempCoupon
.
getStatus
()
==
0
)
{
mCouponRedeemedList
.
add
(
tempCoupon
);
}
else
if
(
tempCoupon
.
getStatus
()
==
1
)
{
}
else
if
(
tempCoupon
.
getStatus
()
==
1
&&
(
TextUtils
.
isEmpty
(
tempCoupon
.
getCouponsetDetails
().
getCouponsetType
())
||
!
tempCoupon
.
getCouponsetDetails
().
getCouponsetType
().
equals
(
"supermarket"
))
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
try
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/ActiveCouponAdapter.java
View file @
4f3b601
...
...
@@ -21,7 +21,6 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Locale
;
import
java.util.concurrent.TimeUnit
;
import
io.reactivex.Observable
;
...
...
@@ -117,6 +116,15 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder
.
ivCouponBackground
.
setColorFilter
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
grey_light3
),
android
.
graphics
.
PorterDuff
.
Mode
.
MULTIPLY
);
if
(
couponItem
!=
null
)
{
if
(
mIsCustom
)
{
if
(
WarplyManagerHelper
.
getMerchantList
()
!=
null
&&
WarplyManagerHelper
.
getMerchantList
().
size
()
>
0
)
{
for
(
Merchant
mer
:
WarplyManagerHelper
.
getMerchantList
())
{
if
(
mer
.
getUuid
().
equals
(
couponItem
.
getMerchantUuid
()))
{
merchant
=
mer
;
break
;
}
}
}
if
(
couponItem
.
getStatus
()
==
1
)
{
holder
.
ivCouponLogo
.
setAlpha
(
1.0f
);
holder
.
tvCouponTitle
.
setAlpha
(
1.0f
);
...
...
@@ -130,15 +138,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder
.
tvCouponDescription
.
setAlpha
(
0.29f
);
holder
.
clCustomLayout
.
setBackgroundResource
(
R
.
drawable
.
ic_coupon_background_new2
);
}
if
(
WarplyManagerHelper
.
getMerchantList
()
!=
null
&&
WarplyManagerHelper
.
getMerchantList
().
size
()
>
0
)
{
for
(
Merchant
mer
:
WarplyManagerHelper
.
getMerchantList
())
{
if
(
mer
.
getUuid
().
equals
(
couponItem
.
getMerchantUuid
()))
{
merchant
=
mer
;
break
;
}
}
}
if
(
merchant
==
null
)
{
if
(!
TextUtils
.
isEmpty
(
couponItem
.
getImage
()))
{
Glide
.
with
(
mContext
)
// .setDefaultRequestOptions(
...
...
@@ -153,34 +153,14 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCouponLogo
);
}
holder
.
tvCouponTitle
.
setText
(
couponItem
.
getName
());
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getDescription
().
equals
(
"null"
)
||
TextUtils
.
isEmpty
(
couponItem
.
getDescription
())
?
""
:
couponItem
.
getDescription
(),
Html
.
FROM_HTML_MODE_COMPACT
));
}
else
{
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getDescription
().
equals
(
"null"
)
||
TextUtils
.
isEmpty
(
couponItem
.
getDescription
())
?
""
:
couponItem
.
getDescription
()));
}
}
else
{
if
(!
TextUtils
.
isEmpty
(
merchant
.
getImgPreview
()))
{
Glide
.
with
(
mContext
)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.
load
(
merchant
.
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCouponLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCouponLogo
);
}
holder
.
tvCouponTitle
.
setText
(
merchant
.
getAdminName
());
holder
.
tvCouponTitle
.
setText
(!
TextUtils
.
isEmpty
(
merchant
.
getAdminName
())
?
merchant
.
getAdminName
()
:
couponItem
.
getName
());
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getInnerText
().
equals
(
"null"
)
||
TextUtils
.
isEmpty
(
couponItem
.
getInnerText
())
?
""
:
couponItem
.
getInnerText
(),
Html
.
FROM_HTML_MODE_COMPACT
));
}
else
{
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getInnerText
().
equals
(
"null"
)
||
TextUtils
.
isEmpty
(
couponItem
.
getInnerText
())
?
""
:
couponItem
.
getInnerText
()));
}
}
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
try
{
...
...
@@ -212,6 +192,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder
.
tvCouponDateExpired
.
setText
(
mContext
.
getString
(
R
.
string
.
cos_market_coupon_expired
));
}
}
if
(
TextUtils
.
isEmpty
(
couponItem
.
getDiscount_type
()))
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
getDiscount
().
replace
(
"."
,
","
)
+
mContext
.
getResources
().
getString
(
R
.
string
.
euro
));
}
else
{
...
...
@@ -228,45 +209,23 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder
.
itemView
.
setOnClickListener
(
v
->
onClickSubject
.
onNext
(
couponItem
));
return
;
}
if
(
WarplyManagerHelper
.
getMerchantList
()
!=
null
&&
WarplyManagerHelper
.
getMerchantList
().
size
()
>
0
)
{
for
(
Merchant
mer
:
WarplyManagerHelper
.
getMerchantList
())
{
if
(
mer
.
getUuid
().
equals
(
couponItem
.
getMerchantUuid
()))
{
merchant
=
mer
;
break
;
}
}
}
if
(
merchant
==
null
)
{
if
(!
TextUtils
.
isEmpty
(
couponItem
.
getImage
()))
{
if
(!
TextUtils
.
isEmpty
(
couponItem
.
getMerchantDetails
().
getImgPreview
()))
{
Glide
.
with
(
mContext
)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.
load
(
couponItem
.
getImage
())
.
load
(
couponItem
.
getMerchantDetails
().
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCouponLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCouponLogo
);
}
holder
.
tvCouponTitle
.
setText
(
couponItem
.
getName
());
if
(!
mIsPast
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getInnerText
(),
Html
.
FROM_HTML_MODE_COMPACT
));
}
else
{
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getInnerText
()));
}
}
}
else
{
if
(!
TextUtils
.
isEmpty
(
merchant
.
getImgPreview
()))
{
}
else
if
(!
TextUtils
.
isEmpty
(
couponItem
.
getCouponsetDetails
().
getImgPreview
()))
{
Glide
.
with
(
mContext
)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.
load
(
merchant
.
getImgPreview
())
.
load
(
couponItem
.
getCouponsetDetails
()
.
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCouponLogo
);
}
else
{
...
...
@@ -274,15 +233,20 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCouponLogo
);
}
holder
.
tvCouponTitle
.
setText
(
merchant
.
getAdminName
());
if
(!
TextUtils
.
isEmpty
(
couponItem
.
getMerchantDetails
().
getAdminName
()))
holder
.
tvCouponTitle
.
setText
(
couponItem
.
getMerchantDetails
().
getAdminName
());
else
holder
.
tvCouponTitle
.
setText
(
couponItem
.
getCouponsetDetails
().
getName
());
if
(!
mIsPast
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getInnerText
(),
Html
.
FROM_HTML_MODE_COMPACT
));
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getCouponsetDetails
()
.
getInnerText
(),
Html
.
FROM_HTML_MODE_COMPACT
));
}
else
{
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getInnerText
()));
}
holder
.
tvCouponDescription
.
setText
(
Html
.
fromHtml
(
couponItem
.
getCouponsetDetails
().
getInnerText
()));
}
}
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
try
{
...
...
@@ -295,17 +259,18 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder
.
tvCouponDate
.
setText
(
String
.
format
(
mContext
.
getString
(
R
.
string
.
cos_coupon_expired_date
),
simpleDateFormat
.
format
(
newDate
!=
null
?
newDate
:
""
)));
else
holder
.
tvCouponDate
.
setText
(
String
.
format
(
mContext
.
getString
(
R
.
string
.
cos_coupon_date
),
simpleDateFormat
.
format
(
newDate
!=
null
?
newDate
:
""
)));
if
(
TextUtils
.
isEmpty
(
couponItem
.
getDiscount_type
()))
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
getDiscount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
euro
));
if
(
TextUtils
.
isEmpty
(
couponItem
.
getCouponsetDetails
().
getDiscount_type
()))
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
getCouponsetDetails
().
getDiscount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
euro
));
}
else
{
if
(
couponItem
.
getDiscount_type
().
equals
(
"value"
))
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
getDiscount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
euro
));
}
else
if
(
couponItem
.
getDiscount_type
().
equals
(
"percentage"
))
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
getDiscount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
percentage
));
}
else
if
(
couponItem
.
getDiscount_type
().
equals
(
"plus_one"
))
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
getDiscount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
plus_one
));
if
(
couponItem
.
get
CouponsetDetails
().
get
Discount_type
().
equals
(
"value"
))
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
get
CouponsetDetails
().
get
Discount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
euro
));
}
else
if
(
couponItem
.
get
CouponsetDetails
().
get
Discount_type
().
equals
(
"percentage"
))
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
get
CouponsetDetails
().
get
Discount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
percentage
));
}
else
if
(
couponItem
.
get
CouponsetDetails
().
get
Discount_type
().
equals
(
"plus_one"
))
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
get
CouponsetDetails
().
get
Discount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
plus_one
));
}
else
{
holder
.
tvCouponValue
.
setText
(
couponItem
.
getDiscount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
euro
));
holder
.
tvCouponValue
.
setText
(
couponItem
.
get
CouponsetDetails
().
get
Discount
()
+
mContext
.
getResources
().
getString
(
R
.
string
.
euro
));
}
}
holder
.
itemView
.
setOnClickListener
(
v
->
onClickSubject
.
onNext
(
couponItem
));
...
...
Please
register
or
login
to post a comment