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-10-24 17:37:22 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
935fa9c75ba152d5db709d69d21ccce3477de611
935fa9c7
1 parent
3aa057ba
feedback fixes
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
136 additions
and
54 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveUnifiedCouponsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/MyRewardsFragment.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Couponset.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/ActiveCouponAdapter.java
warply_android_sdk/src/main/res/layout/activity_active_unified_coupons.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveUnifiedCouponsActivity.java
View file @
935fa9c
...
...
@@ -81,6 +81,7 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
mFontHeader
=
findViewById
(
R
.
id
.
textView3
);
mIvInfo
=
findViewById
(
R
.
id
.
iv_coupons_info
);
mClInfoView
=
findViewById
(
R
.
id
.
cl_info_view
);
mClInfoView
.
setOnTouchListener
((
v
,
event
)
->
true
);
mTvInnerTitle
=
mClInfoView
.
findViewById
(
R
.
id
.
tv_inner_title
);
mTvInnerSubtitle
=
mClInfoView
.
findViewById
(
R
.
id
.
tv_inner_subtitle
);
mIvInfoClose
=
mClInfoView
.
findViewById
(
R
.
id
.
iv_loyalty_history_close
);
...
...
@@ -136,7 +137,7 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
@Subscribe
()
public
void
onMessageEvent
(
WarplyEventBusManager
event
)
{
if
(
event
.
getRefreshUnifiedCouponsAdded
()
!=
null
)
{
if
(
event
.
getRefreshUnifiedCouponsAdded
()
!=
null
||
event
.
getRefreshVouchersEventModel
()
!=
null
)
{
WarplyManager
.
getUnifiedCouponsDeals
(
mUnifiedCallback
);
}
}
...
...
@@ -208,6 +209,7 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
if
(
WarplyManagerHelper
.
getMarketCouponsList
()
!=
null
&&
WarplyManagerHelper
.
getMarketCouponsList
().
isEmpty
()
&&
WarplyManagerHelper
.
getSmCouponsList
()
!=
null
&&
WarplyManagerHelper
.
getSmCouponsList
().
isEmpty
())
{
mTvEmptyUnifiedCoupons
.
setVisibility
(
View
.
VISIBLE
);
mLlActivateunified
.
setVisibility
(
View
.
GONE
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponInfoActivity.java
View file @
935fa9c
...
...
@@ -442,6 +442,21 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mLlActiveGiftIt
.
setVisibility
(
View
.
VISIBLE
);
mLlShops
.
setVisibility
(
View
.
GONE
);
mLlSMFindIt
.
setVisibility
(
View
.
VISIBLE
);
}
else
if
(
mIsUnified
)
{
if
(
TextUtils
.
isEmpty
(
mCoupon
.
getDiscount_type
()))
{
mTvActiveSmCouponValue
.
setText
(
"-"
+
mCoupon
.
getDiscount
().
replace
(
"."
,
","
)
+
getString
(
R
.
string
.
euro
));
}
else
{
if
(
mCoupon
.
getDiscount_type
().
equals
(
"value"
))
{
mTvActiveSmCouponValue
.
setText
(
"-"
+
mCoupon
.
getDiscount
().
replace
(
"."
,
","
)
+
getString
(
R
.
string
.
euro
));
}
else
if
(
mCoupon
.
getDiscount_type
().
equals
(
"percentage"
))
{
mTvActiveSmCouponValue
.
setText
(
"-"
+
mCoupon
.
getDiscount
()
+
getString
(
R
.
string
.
percentage
));
}
else
if
(
mCoupon
.
getDiscount_type
().
equals
(
"plus_one"
))
{
mTvActiveSmCouponValue
.
setText
(
mCoupon
.
getDiscount
()
+
getString
(
R
.
string
.
plus_one
));
}
else
{
mTvActiveSmCouponValue
.
setText
(
"-"
+
mCoupon
.
getDiscount
().
replace
(
"."
,
","
)
+
getString
(
R
.
string
.
euro
));
}
}
mLlActiveSmCouponValue
.
setVisibility
(
View
.
VISIBLE
);
}
}
else
{
if
(
mCoupon
.
getMerchantDetails
()
!=
null
)
{
...
...
@@ -478,19 +493,26 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
}
if
(
mIsUnified
)
{
if
(
mIsUnified
||
mIsActiveUnified
)
{
mIvCouponPhoto
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_INSIDE
);
if
(
mCoupon
!=
null
)
{
if
(!
TextUtils
.
isEmpty
(
mCoupon
.
getImage
()))
{
Glide
.
with
(
this
)
if
(
mCoupon
.
getCouponsetDetails
().
getImg
()
!=
null
&&
mCoupon
.
getCouponsetDetails
().
getImg
().
length
()
>
0
)
{
try
{
String
couponImage
=
(
String
)
mCoupon
.
getCouponsetDetails
().
getImg
().
get
(
0
);
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
);
.
load
(
couponImage
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
mIvCouponPhoto
);
}
catch
(
JSONException
e
)
{
Glide
.
with
(
this
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
mIvCouponPhoto
);
}
}
else
{
Glide
.
with
(
this
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
...
...
@@ -591,6 +613,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mErrorAlertDialog
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
cos_dlg_error_supermarket
)
.
setPositiveButton
(
R
.
string
.
cos_dlg_positive_button2
,
(
dialogPositive
,
whichPositive
)
->
{
mIsFindItPressed
=
false
;
dialogPositive
.
dismiss
();
})
.
setCancelable
(
false
)
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/MyRewardsFragment.java
View file @
935fa9c
...
...
@@ -480,13 +480,13 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
/** Vouchers */
return
;
}
if
(
event
.
getUnifiedCouponsAdded
()
!=
null
)
{
if
(
event
.
getUnifiedCouponsAdded
()
!=
null
||
event
.
getRefreshUnifiedCouponsAdded
()
!=
null
||
event
.
getRefreshVouchersEventModel
()
!=
null
)
{
Handler
mUIHandler
=
new
Handler
(
Looper
.
getMainLooper
());
mUIHandler
.
post
(()
->
{
if
(
WarplyManagerHelper
.
getMarketCouponsList
()
!=
null
&&
WarplyManagerHelper
.
getMarketCouponsList
().
size
()
>
0
)
mTvUnifiedCountBadge
.
setText
(
String
.
valueOf
(
WarplyManagerHelper
.
getMarketCouponsList
().
size
()));
else
mTvUnifiedCountBadge
.
setText
(
"0"
);
//
if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0)
mTvUnifiedCountBadge
.
setText
(
String
.
valueOf
(
WarplyManagerHelper
.
getMarketCouponsList
().
size
()
+
WarplyManagerHelper
.
getSmCouponsList
().
size
()
));
//
else
//
mTvUnifiedCountBadge.setText("0");
// checkHistoryEmpty();
checkForEmpty
();
});
...
...
@@ -690,10 +690,10 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
/** Deals Badge */
/** Unified Coupons List */
if
(
WarplyManagerHelper
.
getMarketCouponsList
()
!=
null
&&
WarplyManagerHelper
.
getMarketCouponsList
().
size
()
>
0
)
mTvUnifiedCountBadge
.
setText
(
String
.
valueOf
(
WarplyManagerHelper
.
getMarketCouponsList
().
size
()));
else
mTvUnifiedCountBadge
.
setText
(
"0"
);
//
if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0)
mTvUnifiedCountBadge
.
setText
(
String
.
valueOf
(
WarplyManagerHelper
.
getMarketCouponsList
().
size
()
+
WarplyManagerHelper
.
getSmCouponsList
().
size
()
));
//
else
//
mTvUnifiedCountBadge.setText("0");
/** Unified Coupons List */
/** Coupon List */
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Couponset.java
View file @
935fa9c
...
...
@@ -193,7 +193,12 @@ public class Couponset implements Parcelable, Serializable {
this
.
created
=
json
.
optString
(
CREATED
);
this
.
updated
=
json
.
optString
(
UPDATED
);
this
.
app_uuid
=
json
.
optString
(
APP_UUID
);
this
.
img
=
json
.
optJSONArray
(
IMG
);
// this.img = json.optJSONArray(IMG);
try
{
this
.
img
=
new
JSONArray
(
json
.
optString
(
IMG
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
this
.
img_preview
=
json
.
optString
(
IMG_PREVIEW
);
this
.
sorting
=
json
.
optInt
(
SORTING
);
this
.
active
=
json
.
optBoolean
(
ACTIVE
);
...
...
@@ -236,7 +241,12 @@ public class Couponset implements Parcelable, Serializable {
this
.
admin_name
=
json
.
optString
(
ADMIN_NAME
);
this
.
created
=
json
.
optString
(
CREATED
);
this
.
updated
=
json
.
optString
(
UPDATED
);
this
.
img
=
json
.
optJSONArray
(
IMG
);
// this.img = json.optJSONArray(IMG);
try
{
this
.
img
=
new
JSONArray
(
json
.
optString
(
IMG
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
this
.
active
=
json
.
optBoolean
(
ACTIVE
);
this
.
buyable
=
json
.
optBoolean
(
BUYABLE
);
this
.
name
=
json
.
optString
(
NAME
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
935fa9c
...
...
@@ -545,7 +545,12 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
// EventBus.getDefault().post(new WarplyEventBusManager(openMyRewards));
//Now the client does nothing, the sdk opens the active unified screen
WarplyManager
.
getUnifiedCouponsDeals
(
mUnifiedCallback
);
/* New Addition start */
// WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
Intent
intent
=
new
Intent
((
WarpActivity
!=
null
&&
!
WarpActivity
.
isFinishing
())
?
WarpActivity
:
getContext
(),
ActiveUnifiedCouponsActivity
.
class
);
getContext
().
startActivity
(
intent
);
/* New Addition end */
RefreshVouchersEventModel
vouchersRefreshed
=
new
RefreshVouchersEventModel
();
vouchersRefreshed
.
setRefreshed
(
true
);
...
...
@@ -949,19 +954,19 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
}
}
private
final
CallbackReceiver
<
ArrayList
<
UnifiedCoupon
>>
mUnifiedCallback
=
new
CallbackReceiver
<
ArrayList
<
UnifiedCoupon
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
UnifiedCoupon
>
result
)
{
Intent
intent
=
new
Intent
((
WarpActivity
!=
null
&&
!
WarpActivity
.
isFinishing
())
?
WarpActivity
:
getContext
(),
ActiveUnifiedCouponsActivity
.
class
);
getContext
().
startActivity
(
intent
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Intent
intent
=
new
Intent
((
WarpActivity
!=
null
&&
!
WarpActivity
.
isFinishing
())
?
WarpActivity
:
getContext
(),
ActiveUnifiedCouponsActivity
.
class
);
getContext
().
startActivity
(
intent
);
}
};
//
private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
//
@Override
//
public void onSuccess(ArrayList<UnifiedCoupon> result) {
//
Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), ActiveUnifiedCouponsActivity.class);
//
getContext().startActivity(intent);
//
}
//
//
@Override
//
public void onFailure(int errorCode) {
//
Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), ActiveUnifiedCouponsActivity.class);
//
getContext().startActivity(intent);
//
}
//
};
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/ActiveCouponAdapter.java
View file @
935fa9c
...
...
@@ -30,6 +30,7 @@ import io.reactivex.subjects.PublishSubject;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.Couponset
;
import
ly.warp.sdk.io.models.Merchant
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
...
...
@@ -160,6 +161,13 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
}
}
for
(
Couponset
cpns
:
WarplyManagerHelper
.
getCouponsetsDeals
())
{
if
(
cpns
.
getUuid
().
equals
(
couponItem
.
getCouponsetUuid
()))
{
couponItem
.
setCouponsetDetails
(
cpns
);
break
;
}
}
if
(
couponItem
.
getStatus
()
==
1
)
{
holder
.
ivCouponLogo
.
setAlpha
(
1.0f
);
holder
.
tvCouponTitle
.
setAlpha
(
1.0f
);
...
...
@@ -174,7 +182,23 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder
.
clCustomLayout
.
setBackgroundResource
(
R
.
drawable
.
ic_coupon_background_new2
);
}
if
(
merchant
!=
null
&&
!
TextUtils
.
isEmpty
(
merchant
.
getImgPreview
()))
{
/* New Addition start */
// if (merchant != null && !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);
// }
if
(!
TextUtils
.
isEmpty
(
couponItem
.
getCouponsetDetails
().
getImgPreview
()))
{
Glide
.
with
(
mContext
)
// .setDefaultRequestOptions(
// RequestOptions
...
...
@@ -188,6 +212,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCouponLogo
);
}
/* New Addition end */
holder
.
tvCouponTitle
.
setText
(!
TextUtils
.
isEmpty
(
merchant
.
getAdminName
())
?
merchant
.
getAdminName
()
:
couponItem
.
getName
());
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
...
...
@@ -268,28 +293,45 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
});
}
if
(!
TextUtils
.
isEmpty
(
couponItem
.
getMerchantDetails
().
getImgPreview
()))
{
Glide
.
with
(
mContext
)
if
(
mIsActiveSM
)
{
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
(
couponItem
.
getMerchantDetails
().
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCouponLogo
);
}
else
if
(!
TextUtils
.
isEmpty
(
couponItem
.
getCouponsetDetails
().
getImgPreview
()))
{
Glide
.
with
(
mContext
)
.
load
(
couponItem
.
getCouponsetDetails
().
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCouponLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCouponLogo
);
}
}
else
{
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
.
getCouponsetDetails
().
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCouponLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCouponLogo
);
.
load
(
couponItem
.
getMerchantDetails
().
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCouponLogo
);
}
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
(
couponItem
.
getCouponsetDetails
().
getImgPreview
())
.
diskCacheStrategy
(
DiskCacheStrategy
.
DATA
)
.
into
(
holder
.
ivCouponLogo
);
}
else
{
Glide
.
with
(
mContext
)
.
load
(
R
.
drawable
.
ic_cosmote_logo_horizontal_grey
)
.
into
(
holder
.
ivCouponLogo
);
}
}
if
(!
TextUtils
.
isEmpty
(
couponItem
.
getMerchantDetails
().
getAdminName
()))
...
...
warply_android_sdk/src/main/res/layout/activity_active_unified_coupons.xml
View file @
935fa9c
...
...
@@ -58,7 +58,7 @@
android:id=
"@+id/cl_info_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"1
6
dp"
android:layout_marginHorizontal=
"1
4
dp"
android:layout_marginTop=
"48dp"
android:translationZ=
"1dp"
android:visibility=
"gone"
...
...
@@ -81,8 +81,8 @@
android:layout_height=
"wrap_content"
android:background=
"@drawable/background_grey_shadow"
android:orientation=
"horizontal"
android:paddingTop=
"
20
dp"
android:paddingBottom=
"1
6
dp"
android:paddingTop=
"
18
dp"
android:paddingBottom=
"1
4
dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/iv_arrow"
>
...
...
@@ -115,10 +115,10 @@
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"24dp"
android:layout_marginTop=
"1
6
dp"
android:layout_marginTop=
"1
4
dp"
android:text=
"@string/cos_market_subtitle"
android:textColor=
"@color/cos_light_black"
android:textSize=
"1
7
sp"
android:textSize=
"1
6
sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_inner_title"
/>
...
...
@@ -127,11 +127,11 @@
android:id=
"@+id/tv_inner_close"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"1
6
dp"
android:layout_marginTop=
"1
4
dp"
android:layout_marginEnd=
"24dp"
android:text=
"@string/cos_market_close"
android:textColor=
"@color/cos_light_black"
android:textSize=
"1
6
sp"
android:textSize=
"1
5
sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_inner_subtitle"
/>
...
...
Please
register
or
login
to post a comment