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-11-25 11:35:42 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
52823187e9cf406074d3b1853bb69703eaf03fa0
52823187
1 parent
19c70aba
retrofit fixes
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
377 additions
and
318 deletions
.idea/misc.xml
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/HomeFragment.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCampaignCouponService.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/res/layout/fragment_home.xml
.idea/misc.xml
View file @
5282318
...
...
@@ -100,7 +100,7 @@
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_active_coupons.xml"
value=
"0.358695652173913"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_active_gifts.xml"
value=
"0.36666666666666664"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_active_rewards.xml"
value=
"0.358695652173913"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_base_fragment.xml"
value=
"0.
358695652173913
"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_base_fragment.xml"
value=
"0.
25
"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_bill_payment.xml"
value=
"0.358695652173913"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_contextual.xml"
value=
"0.36666666666666664"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_coupon_gift.xml"
value=
"0.36666666666666664"
/>
...
...
@@ -133,7 +133,7 @@
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/dl_share.xml"
value=
"0.36666666666666664"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/dlg_success.xml"
value=
"0.358695652173913"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/expired_coupon_layout.xml"
value=
"0.36666666666666664"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/fragment_home.xml"
value=
"0.
358695652173913
"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/fragment_home.xml"
value=
"0.
22
"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/fragment_loyalty.xml"
value=
"0.358695652173913"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/fragment_profile.xml"
value=
"0.358695652173913"
/>
<entry
key=
"..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/gift_layout.xml"
value=
"0.358695652173913"
/>
...
...
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
5282318
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"60
10139202"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990
, live 3000184910
.
setGuid
(
"60
05892749"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749
, live 3000184910
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
5282318
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4.6rc2
0
'
PUBLISH_VERSION
=
'4.5.4.6rc2
1
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
@@ -42,6 +42,7 @@ android {
dependencies
{
//------------------------------ Support -----------------------------//
implementation
'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation
'androidx.appcompat:appcompat:1.4.1'
implementation
'androidx.recyclerview:recyclerview:1.2.1'
implementation
'androidx.cardview:cardview:1.0.0'
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
View file @
5282318
...
...
@@ -7,6 +7,7 @@ import android.os.Looper;
import
android.view.MenuItem
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.fragment.app.Fragment
;
...
...
@@ -136,28 +137,27 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
// Inner and Anonymous Classes
// ===========================================================
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
private
final
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
Toast
.
makeText
(
BaseFragmentActivity
.
this
,
"Campaigns Success"
,
Toast
.
LENGTH_SHORT
).
show
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Toast
.
makeText
(
BaseFragmentActivity
.
this
,
"Campaigns Error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
};
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
Toast
.
makeText
(
BaseFragmentActivity
.
this
,
"Coupons Success "
+
String
.
valueOf
(
result
.
size
()),
Toast
.
LENGTH_SHORT
).
show
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Toast
.
makeText
(
BaseFragmentActivity
.
this
,
"Coupons Error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
};
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.java
View file @
5282318
...
...
@@ -325,7 +325,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
String
message
=
result
.
optString
(
"msg"
,
""
);
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
runOnUiThread
(()
->
{
if
(
status
==
1
)
acceptSharingDialog
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
5282318
...
...
@@ -212,7 +212,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
showDialog
(
true
,
1
);
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
mCampaignsCallback
);
}
}).
start
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/HomeFragment.java
View file @
5282318
...
...
@@ -9,20 +9,29 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.fragment.app.Fragment
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
java.util.ArrayList
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.activities.ActiveCouponsActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.request.WarplyGetCampaignsRequest
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
import
ly.warp.sdk.views.adapters.HomeCampaignAdapter
;
public
class
HomeFragment
extends
Fragment
implements
View
.
OnClickListener
{
public
class
HomeFragment
extends
Fragment
implements
View
.
OnClickListener
,
SwipeRefreshLayout
.
OnRefreshListener
{
private
RelativeLayout
mOptionOne
,
mOptionTwo
,
mOptionThree
;
private
RecyclerView
mRecyclerCampaigns
;
...
...
@@ -31,6 +40,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
private
TextView
mTvUsername
,
mTvActiveCoupons
;
private
ConstraintLayout
mClActiveCoupons
;
private
ImageView
mIvStepsActivity
;
private
SwipeRefreshLayout
mSwipeRefresh
;
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
...
...
@@ -40,6 +50,8 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
public
void
onViewCreated
(
@NonNull
View
view
,
Bundle
savedInstanceState
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
);
mSwipeRefresh
=
view
.
findViewById
(
R
.
id
.
sw_refresh
);
mSwipeRefresh
.
setOnRefreshListener
(
this
);
mOptionOne
=
view
.
findViewById
(
R
.
id
.
info_button
);
TextView
mOptionOneText
=
mOptionOne
.
findViewById
(
R
.
id
.
option_text
);
ImageView
mOptionOneImage
=
mOptionOne
.
findViewById
(
R
.
id
.
option_icon
);
...
...
@@ -93,6 +105,13 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
}
@Override
public
void
onRefresh
()
{
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
mCampaignsCallback
);
mSwipeRefresh
.
setRefreshing
(
false
);
}
@Override
public
void
onClick
(
View
view
)
{
if
(
view
.
getId
()
==
R
.
id
.
cl_coupon
)
{
Intent
intent
=
new
Intent
(
getContext
(),
ActiveCouponsActivity
.
class
);
...
...
@@ -105,4 +124,29 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
HomeFragment
homeFragment
=
new
HomeFragment
();
return
homeFragment
;
}
private
final
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
Toast
.
makeText
(
getActivity
(),
"Campaigns Success"
,
Toast
.
LENGTH_SHORT
).
show
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Toast
.
makeText
(
getActivity
(),
"Campaigns Error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
};
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
Toast
.
makeText
(
getActivity
(),
"Coupons Success "
+
String
.
valueOf
(
result
.
size
()),
Toast
.
LENGTH_SHORT
).
show
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Toast
.
makeText
(
getActivity
(),
"Coupons Error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
};
}
\ No newline at end of file
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCampaignCouponService.java
View file @
5282318
...
...
@@ -38,7 +38,7 @@ public class EventCampaignCouponService extends Worker {
@NonNull
@Override
public
Result
doWork
()
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
mCampaignsCallback
);
return
Result
.
success
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
5282318
...
...
@@ -261,7 +261,7 @@ public class WarplyManagerHelper {
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
new
CallbackReceiver
<
CouponList
>()
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
...
...
@@ -393,7 +393,7 @@ public class WarplyManagerHelper {
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
new
CallbackReceiver
<
CouponList
>()
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
5282318
...
...
@@ -32,6 +32,7 @@ import android.app.AlarmManager;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.Looper
;
...
...
@@ -2593,80 +2594,87 @@ public class WarplyManager {
dynatraceEvent
.
setEventName
(
"custom_success_user_coupons_loyalty"
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
dynatraceEvent
));
CouponList
mActiveCouponList
=
new
CouponList
();
final
ExecutorService
executor
=
Executors
.
newFixedThreadPool
(
2
);
executor
.
submit
(()
->
{
CouponList
mCouponList
=
new
CouponList
();
for
(
CouponModel
.
CouponResult
coupon
:
responseCoupons
.
body
().
getResult
())
{
for
(
CouponsetModel
.
MappCoupon
couponset
:
response
.
body
().
getContext
().
getMappCoupon
())
{
if
(
coupon
.
getCouponsetUuid
().
equals
(
couponset
.
getUuid
()))
{
Coupon
newCoupon
=
new
Coupon
();
newCoupon
.
setStatus
(
coupon
.
getStatus
());
JSONObject
obj
=
new
JSONObject
();
new
AsyncTask
<
Void
,
CouponList
,
CouponList
>()
{
@Override
protected
CouponList
doInBackground
(
Void
...
voids
)
{
CouponList
mCouponList
=
new
CouponList
();
for
(
CouponModel
.
CouponResult
coupon
:
responseCoupons
.
body
().
getResult
())
{
for
(
CouponsetModel
.
MappCoupon
couponset
:
response
.
body
().
getContext
().
getMappCoupon
())
{
if
(
coupon
.
getCouponsetUuid
().
equals
(
couponset
.
getUuid
()))
{
Coupon
newCoupon
=
new
Coupon
();
newCoupon
.
setStatus
(
coupon
.
getStatus
());
JSONObject
obj
=
new
JSONObject
();
try
{
obj
.
putOpt
(
"assigned"
,
coupon
.
getChangesDates
().
getAssigned
());
obj
.
putOpt
(
"created"
,
coupon
.
getChangesDates
().
getCreated
());
newCoupon
.
setChangesDates
(
obj
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
newCoupon
.
setImage
(
couponset
.
getImgPreview
());
newCoupon
.
setMerchantUuid
(
coupon
.
getMerchantUuid
());
newCoupon
.
setCoupon
(
coupon
.
getCoupon
());
newCoupon
.
setCouponsetUuid
(
coupon
.
getCouponsetUuid
());
newCoupon
.
setDiscount
(
coupon
.
getDiscount
());
newCoupon
.
setExpiration
(
coupon
.
getExpiration
());
newCoupon
.
setDescription
(
couponset
.
getShortDescription
());
newCoupon
.
setName
(
couponset
.
getName
());
newCoupon
.
setMerchantUuid
(
couponset
.
getMerchantUuid
());
newCoupon
.
setInnerText
(
couponset
.
getInnerText
());
newCoupon
.
setDiscount_type
(
couponset
.
getDiscountType
());
newCoupon
.
setFinal_price
(
couponset
.
getFinalPrice
());
mCouponList
.
add
(
newCoupon
);
}
}
}
WarplyManagerHelper
.
setCouponList
(
mCouponList
);
CouponList
mActiveCouponList
=
new
CouponList
();
for
(
Coupon
coupon
:
mCouponList
)
{
if
(
coupon
.
getStatus
()
==
1
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
try
{
obj
.
putOpt
(
"assigned"
,
coupon
.
getChangesDates
().
getAssigned
());
obj
.
putOpt
(
"created"
,
coupon
.
getChangesDates
().
getCreated
());
newCoupon
.
setChangesDates
(
obj
);
}
catch
(
JSONException
e
)
{
newDate
=
simpleDateFormat
.
parse
(
coupon
.
getExpiration
());
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
newCoupon
.
setImage
(
coupon
.
getImage
());
newCoupon
.
setMerchantUuid
(
coupon
.
getMerchantUuid
());
newCoupon
.
setCoupon
(
coupon
.
getCoupon
());
newCoupon
.
setCouponsetUuid
(
coupon
.
getCouponsetUuid
());
newCoupon
.
setDiscount
(
coupon
.
getDiscount
());
newCoupon
.
setExpiration
(
coupon
.
getExpiration
());
newCoupon
.
setDescription
(
couponset
.
getShortDescription
());
newCoupon
.
setName
(
couponset
.
getName
());
newCoupon
.
setMerchantUuid
(
couponset
.
getMerchantUuid
());
newCoupon
.
setInnerText
(
couponset
.
getInnerText
());
newCoupon
.
setDiscount_type
(
couponset
.
getDiscountType
());
newCoupon
.
setFinal_price
(
couponset
.
getFinalPrice
());
mCouponList
.
add
(
newCoupon
);
coupon
.
setExpirationDate
(
newDate
);
mActiveCouponList
.
add
(
coupon
);
}
}
}
WarplyManagerHelper
.
setCouponList
(
mCouponList
);
for
(
Coupon
coupon
:
mCouponList
)
{
if
(
coupon
.
getStatus
()
==
1
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
try
{
newDate
=
simpleDateFormat
.
parse
(
coupon
.
getExpiration
());
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
coupon
.
setExpirationDate
(
newDate
);
mActiveCouponList
.
add
(
coupon
);
Collections
.
sort
(
mActiveCouponList
,
(
coupon1
,
coupon2
)
->
coupon1
.
getExpirationDate
().
compareTo
(
coupon2
.
getExpirationDate
()));
CouponsetsList
newCouponstList
=
new
CouponsetsList
();
for
(
CouponsetModel
.
MappCoupon
couponsetOld
:
response
.
body
().
getContext
().
getMappCoupon
())
{
Couponset
newCouponset
=
new
Couponset
();
newCouponset
.
setUuid
(
couponsetOld
.
getUuid
());
newCouponset
.
setImg_preview
(
couponsetOld
.
getImgPreview
());
newCouponset
.
setExpiration
(
couponsetOld
.
getExpiration
().
getValue
());
newCouponset
.
setName
(
couponsetOld
.
getName
());
newCouponset
.
setDescription
(
couponsetOld
.
getDescription
());
newCouponset
.
setShort_description
(
couponsetOld
.
getShortDescription
());
newCouponset
.
setDiscount
(
couponsetOld
.
getDiscount
());
newCouponset
.
setTerms
(
couponsetOld
.
getTerms
());
newCouponset
.
setMerchantUuid
(
couponsetOld
.
getMerchantUuid
());
newCouponset
.
setInnerText
(
couponsetOld
.
getInnerText
());
newCouponset
.
setDiscount_type
(
couponsetOld
.
getDiscountType
());
newCouponset
.
setFinal_price
(
couponsetOld
.
getFinalPrice
());
newCouponstList
.
add
(
newCouponset
);
}
}
WarplyManagerHelper
.
setCouponsets
(
newCouponstList
);
Collections
.
sort
(
mActiveCouponList
,
(
coupon1
,
coupon2
)
->
coupon1
.
getExpirationDate
().
compareTo
(
coupon2
.
getExpirationDate
()));
CouponsetsList
newCouponstList
=
new
CouponsetsList
();
for
(
CouponsetModel
.
MappCoupon
couponsetOld
:
response
.
body
().
getContext
().
getMappCoupon
())
{
Couponset
newCouponset
=
new
Couponset
();
newCouponset
.
setUuid
(
couponsetOld
.
getUuid
());
newCouponset
.
setImg_preview
(
couponsetOld
.
getImgPreview
());
newCouponset
.
setExpiration
(
couponsetOld
.
getExpiration
().
getValue
());
newCouponset
.
setName
(
couponsetOld
.
getName
());
newCouponset
.
setDescription
(
couponsetOld
.
getDescription
());
newCouponset
.
setShort_description
(
couponsetOld
.
getShortDescription
());
newCouponset
.
setDiscount
(
couponsetOld
.
getDiscount
());
newCouponset
.
setTerms
(
couponsetOld
.
getTerms
());
newCouponset
.
setMerchantUuid
(
couponsetOld
.
getMerchantUuid
());
newCouponset
.
setInnerText
(
couponsetOld
.
getInnerText
());
newCouponset
.
setDiscount_type
(
couponsetOld
.
getDiscountType
());
newCouponset
.
setFinal_price
(
couponsetOld
.
getFinalPrice
());
newCouponstList
.
add
(
newCouponset
);
return
mActiveCouponList
;
}
WarplyManagerHelper
.
setCouponsets
(
newCouponstList
);
});
executor
.
shutdownNow
();
new
Handler
(
Looper
.
getMainLooper
()).
post
(()
->
receiver
.
onSuccess
(
mActiveCouponList
));
@Override
protected
void
onPostExecute
(
CouponList
couponsResponse
)
{
super
.
onPostExecute
(
couponsResponse
);
receiver
.
onSuccess
(
couponsResponse
);
}
}.
execute
();
}
else
{
LoyaltySDKDynatraceEventModel
dynatraceEvent
=
new
LoyaltySDKDynatraceEventModel
();
dynatraceEvent
.
setEventName
(
"custom_error_user_coupons_loyalty"
);
...
...
warply_android_sdk/src/main/res/layout/fragment_home.xml
View file @
5282318
<?xml version="1.0" encoding="utf-8"?>
<
ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
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/sw_refresh"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
>
android:layout_height=
"match_parent"
>
<
RelativeLayout
<
ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/rl_header"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@android:color/white"
android:paddingHorizontal=
"16dp"
android:paddingTop=
"16dp"
>
<de.hdodenhof.circleimageview.CircleImageView
android:id=
"@+id/user_img"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:src=
"@drawable/profile_photo"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<RelativeLayout
android:id=
"@+id/rl_user_info"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:paddingLeft=
"10dp"
app:layout_constraintEnd_toStartOf=
"@+id/iv_settings"
app:layout_constraintStart_toEndOf=
"@+id/user_img"
app:layout_constraintTop_toTopOf=
"@+id/user_img"
>
<TextView
android:id=
"@+id/welcome_user_txt"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:maxLines=
"1"
android:scrollHorizontally=
"true"
android:textColor=
"#415564"
tools:text=
"@string/welcome_user"
/>
<ImageView
android:id=
"@+id/cosmote_one"
android:layout_width=
"100dp"
android:layout_height=
"30dp"
android:layout_below=
"@+id/welcome_user_txt"
android:layout_marginTop=
"0dp"
android:src=
"@drawable/cosmote_one"
/>
android:layout_height=
"match_parent"
>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/cosmote_one"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/rl_header"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@android:color/white"
android:paddingHorizontal=
"16dp"
android:paddingTop=
"16dp"
>
<de.hdodenhof.circleimageview.CircleImageView
android:id=
"@+id/user_img"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:src=
"@drawable/profile_photo"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<include
android:id=
"@+id/info_button"
layout=
"@layout/button_with_image"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<RelativeLayout
android:id=
"@+id/rl_user_info"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:paddingLeft=
"10dp"
app:layout_constraintEnd_toStartOf=
"@+id/iv_settings"
app:layout_constraintStart_toEndOf=
"@+id/user_img"
app:layout_constraintTop_toTopOf=
"@+id/user_img"
>
<include
android:id=
"@+id/info_button2"
layout=
"@layout/button_with_image"
android:layout_width=
"wrap_content"
<TextView
android:id=
"@+id/welcome_user_txt"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
/>
android:layout_marginBottom=
"8dp"
android:maxLines=
"1"
android:scrollHorizontally=
"true"
android:textColor=
"#415564"
tools:text=
"@string/welcome_user"
/>
<ImageView
android:id=
"@+id/cosmote_one"
android:layout_width=
"100dp"
android:layout_height=
"30dp"
android:layout_below=
"@+id/welcome_user_txt"
android:layout_marginTop=
"0dp"
android:src=
"@drawable/cosmote_one"
/>
<include
android:id=
"@+id/info_button3"
layout=
"@layout/button_with_image"
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
/>
</LinearLayout>
</RelativeLayout>
<ImageView
android:id=
"@+id/iv_settings"
android:layout_width=
"25dp"
android:layout_height=
"25dp"
android:src=
"@drawable/filters_icon"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/user_img"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_below=
"@+id/cosmote_one"
>
<include
android:id=
"@+id/info_button"
layout=
"@layout/button_with_image"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<include
android:id=
"@+id/info_button2"
layout=
"@layout/button_with_image"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
/>
<include
android:id=
"@+id/info_button3"
layout=
"@layout/button_with_image"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/rl_header"
android:background=
"@drawable/home_bg"
>
<ImageView
android:id=
"@+id/iv_settings"
android:layout_width=
"25dp"
android:layout_height=
"25dp"
android:src=
"@drawable/filters_icon"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/user_img"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:id=
"@+id/rl_home_campaigns"
android:layout_width=
"match_parent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"50dp"
>
android:layout_below=
"@+id/rl_header"
android:background=
"@drawable/home_bg"
>
<
androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/r
v
_home_campaigns"
<
RelativeLayout
android:id=
"@+id/r
l
_home_campaigns"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:background=
"#80FFFFFF"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingVertical=
"15dp"
android:paddingStart=
"10dp"
android:paddingEnd=
"10dp"
/>
</RelativeLayout>
android:layout_marginTop=
"50dp"
>
<LinearLayout
android:id=
"@+id/rl_home_coupons"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/rl_home_campaigns"
android:visibility=
"gone"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_home_coupons"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingStart=
"10dp"
android:paddingEnd=
"10dp"
/>
</LinearLayout>
<include
android:id=
"@+id/rl_home_info_widget"
layout=
"@layout/info_widget"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/rl_home_coupons"
android:layout_marginHorizontal=
"8dp"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_coupon"
android:layout_width=
"match_parent"
android:layout_height=
"140dp"
android:layout_below=
"@+id/rl_home_info_widget"
android:layout_marginTop=
"24dp"
android:background=
"@drawable/ic_coupon_background"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_home_campaigns"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:background=
"#80FFFFFF"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingVertical=
"15dp"
android:paddingStart=
"10dp"
android:paddingEnd=
"10dp"
/>
</RelativeLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:id=
"@+id/rl_home_coupons"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"40dp"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:id=
"@+id/tv_active_coupons"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:textColor=
"#3A5266"
android:textFontWeight=
"600"
android:textSize=
"16sp"
tools:text=
"@string/cos_active_coupons"
/>
android:layout_below=
"@id/rl_home_campaigns"
android:visibility=
"gone"
>
<TextView
android:layout_width=
"wrap_content"
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_home_coupons"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:text=
"Δες τα όλα ->"
android:textColor=
"#3A5266"
/>
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingStart=
"10dp"
android:paddingEnd=
"10dp"
/>
</LinearLayout>
<ImageView
android:layout_width=
"90dp"
android:layout_height=
"90dp"
android:layout_marginEnd=
"32dp"
android:src=
"@drawable/ic_gifts_for_you"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id=
"@+id/hsv_title"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:layout_below=
"@+id/cl_coupon"
android:layout_marginTop=
"24dp"
android:background=
"@android:color/white"
android:paddingHorizontal=
"25dp"
android:paddingTop=
"10dp"
android:text=
"Βρες γρήγορα"
android:textColor=
"#3C464F"
/>
<HorizontalScrollView
android:id=
"@+id/ll_add"
android:layout_width=
"match_parent"
android:layout_height=
"110dp"
android:layout_below=
"@id/hsv_title"
android:background=
"@android:color/white"
android:paddingBottom=
"15dp"
android:scrollbars=
"none"
>
<include
android:id=
"@+id/rl_home_info_widget"
layout=
"@layout/info_widget"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/rl_home_coupons"
android:layout_marginHorizontal=
"8dp"
/>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_coupon"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:divider=
"@drawable/divider"
android:showDividers=
"middle"
>
android:layout_height=
"140dp"
android:layout_below=
"@+id/rl_home_info_widget"
android:layout_marginTop=
"24dp"
android:background=
"@drawable/ic_coupon_background"
>
<LinearLayout
android:id=
"@+id/ll_bill_payment"
android:layout_width=
"150dp"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"40dp"
android:orientation=
"vertical"
android:paddingHorizontal=
"10dp"
>
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:src=
"@drawable/doc"
/>
<TextView
android:id=
"@+id/tv_active_coupons"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:textColor=
"#3A5266"
android:textFontWeight=
"600"
android:textSize=
"16sp"
tools:text=
"@string/cos_active_coupons"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:gravity=
"center"
android:scrollHorizontally=
"true"
android:text=
"Πληρωμή λογαριασμού"
android:textAlignment=
"center"
android:textColor=
"#3C464F"
/>
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:text=
"Δες τα όλα ->"
android:textColor=
"#3A5266"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"150dp"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingHorizontal=
"10dp"
>
<ImageView
android:layout_width=
"90dp"
android:layout_height=
"90dp"
android:layout_marginEnd=
"32dp"
android:src=
"@drawable/ic_gifts_for_you"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:src=
"@drawable/message"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:gravity=
"center"
android:scrollHorizontally=
"true"
android:text=
"Υποστήριξη"
android:textAlignment=
"center"
android:textColor=
"#3C464F"
/>
</LinearLayout>
<TextView
android:id=
"@+id/hsv_title"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:layout_below=
"@+id/cl_coupon"
android:layout_marginTop=
"24dp"
android:background=
"@android:color/white"
android:paddingHorizontal=
"25dp"
android:paddingTop=
"10dp"
android:text=
"Βρες γρήγορα"
android:textColor=
"#3C464F"
/>
<HorizontalScrollView
android:id=
"@+id/ll_add"
android:layout_width=
"match_parent"
android:layout_height=
"110dp"
android:layout_below=
"@id/hsv_title"
android:background=
"@android:color/white"
android:paddingBottom=
"15dp"
android:scrollbars=
"none"
>
<LinearLayout
android:layout_width=
"
150dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingHorizontal=
"10dp"
>
<ImageView
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:src=
"@drawable/doc"
/>
android:divider=
"@drawable/divider"
android:showDividers=
"middle"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
<LinearLayout
android:id=
"@+id/ll_bill_payment"
android:layout_width=
"150dp"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingHorizontal=
"10dp"
>
<ImageView
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:src=
"@drawable/doc"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:gravity=
"center"
android:scrollHorizontally=
"true"
android:text=
"Πληρωμή λογαριασμού"
android:textAlignment=
"center"
android:textColor=
"#3C464F"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"150dp"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingHorizontal=
"10dp"
>
<ImageView
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:src=
"@drawable/message"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:gravity=
"center"
android:scrollHorizontally=
"true"
android:text=
"Υποστήριξη"
android:textAlignment=
"center"
android:textColor=
"#3C464F"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"150dp"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:scrollHorizontally=
"true"
android:text=
"Πληρωμή λογαριασμού"
android:textAlignment=
"center"
android:textColor=
"#3C464F"
/>
android:orientation=
"vertical"
android:paddingHorizontal=
"10dp"
>
<ImageView
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:src=
"@drawable/doc"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:gravity=
"center"
android:scrollHorizontally=
"true"
android:text=
"Πληρωμή λογαριασμού"
android:textAlignment=
"center"
android:textColor=
"#3C464F"
/>
</LinearLayout>
</LinearLayout>
</
LinearLayout
>
</
HorizontalScrollView
>
</
HorizontalScrollView
>
</
RelativeLayout
>
</RelativeLayout>
</
RelativeLayout
>
</
ScrollView
>
</
ScrollView
>
</
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
>
...
...
Please
register
or
login
to post a comment