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
2026-03-13 16:40:43 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f7ed5d4f668588f1ef93b340d2ddb8b8d6698f25
f7ed5d4f
1 parent
db1622bc
my coupons filtering
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
40 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ProfileActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/adapters/CouponAdapter.java
warply_android_sdk/src/main/res/drawable/shape_rounded_transparent_black_border.xml
warply_android_sdk/src/main/res/layout/activity_coupons.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsActivity.java
View file @
f7ed5d4
...
...
@@ -32,10 +32,11 @@ public class CouponsActivity extends Activity implements View.OnClickListener,
// ===========================================================
private
ImageView
mIvBack
;
private
LinearLayout
mLlFilterActive
,
mLlFilterExpired
;
private
LinearLayout
mLlFilterActive
,
mLlFilterExpired
,
mLlActiveCount
,
mLlExpiredCount
;
private
RecyclerView
mRvCoupons
;
private
CouponAdapter
mCouponsAdapter
;
private
TextView
mBtnFilterActive
,
mBtnFilterExpired
,
mTvHeaderTitle
;
private
TextView
mBtnFilterActive
,
mBtnFilterExpired
,
mTvHeaderTitle
,
mTvActiveCount
,
mTvExpiredCount
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -66,9 +67,9 @@ public class CouponsActivity extends Activity implements View.OnClickListener,
if
(
id
==
R
.
id
.
iv_back
)
{
onBackPressed
();
}
else
if
(
id
==
R
.
id
.
ll_filter_active
)
{
// filterCoupons(CouponItem.STATUS_ACTIVE
);
filterCoupons
(
1
);
}
else
if
(
id
==
R
.
id
.
ll_filter_redeemed
)
{
// filterCoupons(CouponItem.STATUS_REDEEMED
);
filterCoupons
(-
1
);
}
}
...
...
@@ -79,11 +80,6 @@ public class CouponsActivity extends Activity implements View.OnClickListener,
startActivity
(
myIntent
);
}
@Override
public
void
onFavoriteClick
(
Coupon
couponItem
,
int
position
)
{
// Handle favorite click if needed
}
// ===========================================================
// Methods
// ===========================================================
...
...
@@ -99,12 +95,16 @@ public class CouponsActivity extends Activity implements View.OnClickListener,
mLlFilterExpired
=
findViewById
(
R
.
id
.
ll_filter_redeemed
);
mBtnFilterExpired
=
findViewById
(
R
.
id
.
btn_filter_redeemed
);
mTvHeaderTitle
=
findViewById
(
R
.
id
.
tv_header_title
);
mLlActiveCount
=
findViewById
(
R
.
id
.
ll_active_count
);
mLlExpiredCount
=
findViewById
(
R
.
id
.
ll_expired_count
);
mTvActiveCount
=
findViewById
(
R
.
id
.
tv_active_count
);
mTvExpiredCount
=
findViewById
(
R
.
id
.
tv_expired_count
);
// Set click listeners for filter buttons
mLlFilterActive
.
setOnClickListener
(
this
);
mLlFilterExpired
.
setOnClickListener
(
this
);
WarpUtils
.
renderCustomFont
(
this
,
R
.
font
.
ping_lcg_bold
,
mTvHeaderTitle
,
mBtnFilterActive
,
mBtnFilterExpired
);
mBtnFilterActive
,
mBtnFilterExpired
,
mTvActiveCount
,
mTvExpiredCount
);
}
private
void
setupMyCouponsSection
()
{
...
...
@@ -114,34 +114,44 @@ public class CouponsActivity extends Activity implements View.OnClickListener,
mCouponsAdapter
=
new
CouponAdapter
(
this
,
WarplyManagerHelper
.
getCoupons
());
mCouponsAdapter
.
setOnCouponClickListener
(
this
);
filterCoupons
(
1
);
mRvCoupons
.
setAdapter
(
mCouponsAdapter
);
int
verticalSpacingInPixels
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
16
,
getResources
().
getDisplayMetrics
());
mRvCoupons
.
addItemDecoration
(
new
VerticalSpaceItemDecoration
(
verticalSpacingInPixels
));
// filterCoupons(CouponItem.STATUS_ACTIVE);
int
activeCount
=
0
,
expiredCount
=
0
;
for
(
Coupon
c
:
WarplyManagerHelper
.
getCoupons
())
{
if
(
c
.
getStatus
()
==
1
)
activeCount
++;
else
if
(
c
.
getStatus
()
==
-
1
)
expiredCount
++;
}
mTvActiveCount
.
setText
(
String
.
valueOf
(
activeCount
));
mTvExpiredCount
.
setText
(
String
.
valueOf
(
expiredCount
));
}
private
void
filterCoupons
(
String
status
)
{
// Reset all filter button styles
// mBtnFilterActive.setBackgroundResource(R.drawable.shape_transparent_black_border);
// mBtnFilterActive.setTextColor(getResources().getColor(R.color.custom_black2));
// mBtnFilterRedeemed.setBackgroundResource(R.drawable.shape_transparent_black_border);
// mBtnFilterRedeemed.setTextColor(getResources().getColor(R.color.custom_black2));
// Set selected filter button style
// if (CouponItem.STATUS_ACTIVE.equals(status)) {
// mBtnFilterActive.setBackgroundResource(R.drawable.shape_rectangle_rounded_black);
// mBtnFilterActive.setTextColor(Color.WHITE);
// } else if (CouponItem.STATUS_REDEEMED.equals(status)) {
// mBtnFilterRedeemed.setBackgroundResource(R.drawable.shape_rectangle_rounded_black);
// mBtnFilterRedeemed.setTextColor(Color.WHITE);
// }
// Apply filter to adapter
// mCouponsAdapter.filterByStatus(status);
private
void
filterCoupons
(
int
status
)
{
mCouponsAdapter
.
filterByStatus
(
status
);
if
(
status
==
1
)
{
mLlFilterActive
.
setBackgroundResource
(
R
.
drawable
.
shape_rectangle_rounded_black2
);
mBtnFilterActive
.
setTextColor
(
getColor
(
R
.
color
.
white
));
mLlActiveCount
.
setBackgroundResource
(
R
.
drawable
.
shape_rounded_transparent_white_border
);
mTvActiveCount
.
setTextColor
(
getColor
(
R
.
color
.
white
));
mLlFilterExpired
.
setBackgroundResource
(
R
.
drawable
.
shape_rectangle_rounded_grey4
);
mBtnFilterExpired
.
setTextColor
(
getColor
(
R
.
color
.
custom_black6
));
mLlExpiredCount
.
setBackgroundResource
(
R
.
drawable
.
shape_rounded_transparent_black_border
);
mTvExpiredCount
.
setTextColor
(
getColor
(
R
.
color
.
custom_black6
));
}
else
{
mLlFilterExpired
.
setBackgroundResource
(
R
.
drawable
.
shape_rectangle_rounded_black2
);
mBtnFilterExpired
.
setTextColor
(
getColor
(
R
.
color
.
white
));
mLlExpiredCount
.
setBackgroundResource
(
R
.
drawable
.
shape_rounded_transparent_white_border
);
mTvExpiredCount
.
setTextColor
(
getColor
(
R
.
color
.
white
));
mLlFilterActive
.
setBackgroundResource
(
R
.
drawable
.
shape_rectangle_rounded_grey4
);
mBtnFilterActive
.
setTextColor
(
getColor
(
R
.
color
.
custom_black6
));
mLlActiveCount
.
setBackgroundResource
(
R
.
drawable
.
shape_rounded_transparent_black_border
);
mTvActiveCount
.
setTextColor
(
getColor
(
R
.
color
.
custom_black6
));
}
}
// ===========================================================
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ProfileActivity.java
View file @
f7ed5d4
...
...
@@ -2,7 +2,6 @@ package ly.warp.sdk.activities;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.os.Parcelable
;
import
android.util.TypedValue
;
...
...
@@ -110,11 +109,6 @@ public class ProfileActivity extends Activity implements View.OnClickListener, O
startActivity
(
myIntent
);
}
@Override
public
void
onFavoriteClick
(
Coupon
couponItem
,
int
position
)
{
// Handle favorite click if needed
}
// ===========================================================
// Methods
// ===========================================================
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/adapters/CouponAdapter.java
View file @
f7ed5d4
...
...
@@ -43,8 +43,6 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView
*/
public
interface
OnCouponClickListener
{
void
onCouponClick
(
Coupon
couponItem
,
int
position
);
void
onFavoriteClick
(
Coupon
couponItem
,
int
position
);
}
/**
...
...
@@ -56,7 +54,7 @@ public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponView
public
CouponAdapter
(
Context
context
,
ArrayList
<
Coupon
>
couponItems
)
{
this
.
context
=
context
;
this
.
allCouponItems
=
couponItems
;
this
.
filteredCouponItems
=
couponItems
;
this
.
filteredCouponItems
=
new
ArrayList
<>(
couponItems
)
;
}
/**
...
...
warply_android_sdk/src/main/res/drawable/shape_rounded_transparent_black_border.xml
0 → 100644
View file @
f7ed5d4
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"1000dp"
/>
<solid
android:color=
"@android:color/transparent"
/>
<stroke
android:width=
"2dp"
android:color=
"@color/custom_black6"
/>
</shape>
\ No newline at end of file
warply_android_sdk/src/main/res/layout/activity_coupons.xml
View file @
f7ed5d4
...
...
@@ -97,6 +97,7 @@
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"8dp"
android:background=
"@drawable/shape_rectangle_rounded_black2"
android:gravity=
"center"
android:paddingHorizontal=
"20dp"
android:paddingVertical=
"12dp"
>
...
...
@@ -108,6 +109,28 @@
android:text=
"@string/demo_active"
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
<View
android:layout_width=
"12dp"
android:layout_height=
"match_parent"
/>
<LinearLayout
android:id=
"@+id/ll_active_count"
android:layout_width=
"21dp"
android:layout_height=
"21dp"
android:background=
"@drawable/shape_rounded_transparent_white_border"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_active_count"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:includeFontPadding=
"false"
android:text=
"0"
android:textColor=
"@color/white"
android:textSize=
"10sp"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
...
...
@@ -116,18 +139,41 @@
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"8dp"
android:background=
"@drawable/shape_rectangle_rounded_grey4"
android:gravity=
"center"
android:paddingHorizontal=
"20dp"
android:paddingVertical=
"12dp"
>
<TextView
android:id=
"@+id/btn_filter_redeemed"
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:includeFontPadding=
"false"
android:text=
"@string/demo_expired"
android:textColor=
"@color/custom_black6"
android:textSize=
"14sp"
/>
<View
android:layout_width=
"12dp"
android:layout_height=
"match_parent"
/>
<LinearLayout
android:id=
"@+id/ll_expired_count"
android:layout_width=
"21dp"
android:layout_height=
"21dp"
android:background=
"@drawable/shape_rounded_transparent_black_border"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_expired_count"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:includeFontPadding=
"false"
android:text=
"0"
android:textColor=
"@color/custom_black6"
android:textSize=
"10sp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
...
...
Please
register
or
login
to post a comment