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-03-23 20:25:26 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ac53a7ce450ba56b83fabb82e58564e5ca96b3b8
ac53a7ce
1 parent
328b6627
loyalty profile wip2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
238 additions
and
32 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/HomeCouponAdapter.java
warply_android_sdk/src/main/res/drawable-xhdpi/ic_banner_redeemed_gift.png
warply_android_sdk/src/main/res/drawable-xhdpi/ic_shell.png
warply_android_sdk/src/main/res/layout/activity_loyalty.xml
warply_android_sdk/src/main/res/layout/burnt_coupon_layout.xml
warply_android_sdk/src/main/res/layout/fragment_loyalty.xml
warply_android_sdk/src/main/res/layout/loyalty_banner.xml
warply_android_sdk/src/main/res/layout/redeemed_gift_layout.xml
warply_android_sdk/src/main/res/values/colors.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyActivity.java
View file @
ac53a7c
...
...
@@ -27,8 +27,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
// ===========================================================
private
ImageView
mIvBack
;
private
RecyclerView
mRecyclerCoupons
;
private
HomeCouponAdapter
mAdapterCoupons
;
private
RecyclerView
mRecyclerCoupons
,
mRecyclerBurntCoupons
;
private
HomeCouponAdapter
mAdapterCoupons
,
mAdapterBurntCoupons
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -41,27 +41,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
mIvBack
=
findViewById
(
R
.
id
.
iv_back
);
/********* TEST COUPONS DATA **********/
CouponList
clist
=
new
CouponList
();
try
{
clist
.
add
(
new
Coupon
(
"{\"barcode\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"coupon\": \"123456789\", \"name\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"description\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"image\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\"}"
));
clist
.
add
(
new
Coupon
(
"{\"barcode\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"coupon\": \"12345678910\", \"name\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"description\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"image\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\"}"
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
/********* TEST COUPONS DATA **********/
mRecyclerCoupons
=
findViewById
(
R
.
id
.
rv_loyalty_coupons
);
mRecyclerCoupons
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterCoupons
=
new
HomeCouponAdapter
(
this
,
clist
);
mRecyclerCoupons
.
setAdapter
(
mAdapterCoupons
);
mAdapterCoupons
.
getPositionClicks
()
.
doOnNext
(
coupon
->
{
// startActivity(WarpViewActivity.createIntentFromSessionUUID(this, coupon.getCoupon()));
})
.
doOnError
(
error
->
{
})
.
subscribe
();
mRecyclerBurntCoupons
=
findViewById
(
R
.
id
.
rv_loyalty_burnt_coupons
);
initViews
();
}
...
...
@@ -74,7 +55,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
@Override
public
void
onClick
(
View
view
)
{
if
(
view
.
getId
()
==
R
.
id
.
iv_back
)
{
finish
();
onBackPressed
();
}
}
...
...
@@ -83,7 +64,32 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
// ===========================================================
private
void
initViews
()
{
/********* TEST COUPONS DATA **********/
CouponList
clist
=
new
CouponList
();
try
{
clist
.
add
(
new
Coupon
(
"{\"barcode\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"coupon\": \"123456789\", \"name\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"description\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"image\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\"}"
));
clist
.
add
(
new
Coupon
(
"{\"barcode\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"coupon\": \"12345678910\", \"name\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"description\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"image\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\"}"
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
/********* TEST COUPONS DATA **********/
mIvBack
.
setOnClickListener
(
this
);
mRecyclerCoupons
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterCoupons
=
new
HomeCouponAdapter
(
this
,
clist
);
mRecyclerCoupons
.
setAdapter
(
mAdapterCoupons
);
mAdapterCoupons
.
getPositionClicks
()
.
doOnNext
(
coupon
->
{
// startActivity(WarpViewActivity.createIntentFromSessionUUID(this, coupon.getCoupon()));
})
.
doOnError
(
error
->
{
})
.
subscribe
();
mRecyclerBurntCoupons
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterBurntCoupons
=
new
HomeCouponAdapter
(
this
,
clist
,
true
);
mRecyclerBurntCoupons
.
setAdapter
(
mAdapterBurntCoupons
);
}
// ===========================================================
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/HomeCouponAdapter.java
View file @
ac53a7c
...
...
@@ -8,6 +8,7 @@ import android.view.ViewGroup;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
androidx.core.content.ContextCompat
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.bumptech.glide.Glide
;
...
...
@@ -24,20 +25,28 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
private
Context
mContext
;
private
CouponList
mCoupons
;
private
final
PublishSubject
<
Coupon
>
onClickSubject
=
PublishSubject
.
create
();
private
boolean
isBurnt
=
false
;
public
HomeCouponAdapter
(
Context
mContext
,
CouponList
campaignList
)
{
this
.
mContext
=
mContext
;
this
.
mCoupons
=
campaignList
;
this
.
isBurnt
=
false
;
}
public
HomeCouponAdapter
(
Context
mContext
,
CouponList
campaignList
,
boolean
isBurnt
)
{
this
.
mContext
=
mContext
;
this
.
mCoupons
=
campaignList
;
this
.
isBurnt
=
isBurnt
;
}
public
class
HomeCouponViewHolder
extends
RecyclerView
.
ViewHolder
{
private
ImageView
ivCoupon
Title
;
private
ImageView
ivCoupon
Background
;
private
TextView
tvCouponTitle
;
public
HomeCouponViewHolder
(
View
view
)
{
super
(
view
);
ivCoupon
Title
=
view
.
findViewById
(
R
.
id
.
iv_coupon_logo
);
tvCouponTitle
=
view
.
findViewById
(
R
.
id
.
tv_coupon_subtitle
);
ivCoupon
Background
=
view
.
findViewById
(
R
.
id
.
imageView2
);
//
tvCouponTitle = view.findViewById(R.id.tv_coupon_subtitle);
}
}
...
...
@@ -63,7 +72,11 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
@Override
public
HomeCouponViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
itemView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
coupon_layout
,
parent
,
false
);
View
itemView
;
if
(
isBurnt
)
itemView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
burnt_coupon_layout
,
parent
,
false
);
else
itemView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
coupon_layout
,
parent
,
false
);
return
new
HomeCouponViewHolder
(
itemView
);
}
...
...
@@ -89,6 +102,8 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
// holder.tvCouponTitle.setText(couponItem.getName());
if
(
isBurnt
)
holder
.
ivCouponBackground
.
setColorFilter
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
grey_light2
),
android
.
graphics
.
PorterDuff
.
Mode
.
MULTIPLY
);
holder
.
itemView
.
setOnClickListener
(
v
->
onClickSubject
.
onNext
(
couponItem
));
}
}
...
...
warply_android_sdk/src/main/res/drawable-xhdpi/ic_banner_redeemed_gift.png
0 → 100644
View file @
ac53a7c
53.7 KB
warply_android_sdk/src/main/res/drawable-xhdpi/ic_shell.png
0 → 100644
View file @
ac53a7c
21.6 KB
warply_android_sdk/src/main/res/layout/activity_loyalty.xml
View file @
ac53a7c
This diff is collapsed. Click to expand it.
warply_android_sdk/src/main/res/layout/burnt_coupon_layout.xml
0 → 100644
View file @
ac53a7c
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"360dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/horizontal_guideline"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
app:layout_constraintGuide_percent=
"0.12"
/>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/horizontal_guideline2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
app:layout_constraintGuide_percent=
"0.88"
/>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/vertical_guideline"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintGuide_percent=
"0.94"
/>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/vertical_guideline2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintGuide_percent=
"0.06"
/>
<ImageView
android:id=
"@+id/imageView2"
android:layout_width=
"match_parent"
android:layout_height=
"250dp"
android:src=
"@drawable/coupon_wrapper2"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"0dp"
android:layout_height=
"0dp"
app:layout_constraintBottom_toTopOf=
"@+id/horizontal_guideline2"
app:layout_constraintEnd_toStartOf=
"@+id/vertical_guideline"
app:layout_constraintStart_toStartOf=
"@+id/vertical_guideline2"
app:layout_constraintTop_toTopOf=
"@+id/horizontal_guideline"
>
<TextView
android:id=
"@+id/tv_coupon_title"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:maxLines=
"1"
android:text=
"Εκπτωτικό κουπόνι -10€"
android:textColor=
"@color/grey_tr"
android:textSize=
"18sp"
android:textStyle=
"bold"
android:layout_marginTop=
"16dp"
app:layout_constraintEnd_toStartOf=
"@+id/iv_coupon_logo"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_coupon_subtitle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"24dp"
android:maxLines=
"2"
android:layout_marginTop=
"8dp"
android:text=
"-10€ έκπτωση για το επόμενο γέμισμά σου!"
android:textColor=
"@color/grey_tr"
android:textFontWeight=
"600"
android:textSize=
"16sp"
app:layout_constraintEnd_toStartOf=
"@+id/iv_coupon_logo"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_coupon_title"
/>
<ImageView
android:id=
"@+id/iv_coupon_logo"
android:layout_width=
"80dp"
android:layout_height=
"60dp"
android:layout_marginTop=
"16dp"
android:src=
"@drawable/ic_shell"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
warply_android_sdk/src/main/res/layout/fragment_loyalty.xml
View file @
ac53a7c
...
...
@@ -19,8 +19,8 @@
<de.hdodenhof.circleimageview.CircleImageView
android:id=
"@+id/iv_profile_photo"
android:layout_width=
"
5
0dp"
android:layout_height=
"
5
0dp"
android:layout_width=
"
6
0dp"
android:layout_height=
"
6
0dp"
android:src=
"@drawable/profile_photo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
...
...
@@ -31,8 +31,9 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:layout_marginTop=
"
2
dp"
android:layout_marginTop=
"
6
dp"
android:text=
"@string/cos_profile_name"
android:maxLines=
"1"
android:textColor=
"@color/grey"
app:layout_constraintLeft_toRightOf=
"@+id/iv_profile_photo"
app:layout_constraintTop_toTopOf=
"@+id/iv_profile_photo"
/>
...
...
@@ -41,7 +42,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:layout_marginBottom=
"
6
dp"
android:layout_marginBottom=
"
10
dp"
android:background=
"@drawable/shape_cos_gradient"
android:gravity=
"center"
android:paddingHorizontal=
"4dp"
...
...
warply_android_sdk/src/main/res/layout/loyalty_banner.xml
View file @
ac53a7c
...
...
@@ -3,7 +3,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"1
5
0dp"
android:layout_height=
"1
6
0dp"
android:layout_marginHorizontal=
"32dp"
android:background=
"@drawable/shape_cos_gradient2"
android:paddingHorizontal=
"20dp"
...
...
@@ -64,6 +64,7 @@
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"4dp"
android:background=
"@drawable/round_border_tr"
android:paddingHorizontal=
"8dp"
android:paddingVertical=
"4dp"
...
...
warply_android_sdk/src/main/res/layout/redeemed_gift_layout.xml
0 → 100644
View file @
ac53a7c
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"360dp"
android:layout_height=
"240dp"
android:layout_marginStart=
"10dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"360dp"
android:layout_height=
"240dp"
>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/gl_horizontal_75_guideline"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
app:layout_constraintGuide_percent=
"0.75"
/>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/gl_horizontal_60_guideline"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
app:layout_constraintGuide_percent=
"0.6"
/>
<ImageView
android:id=
"@+id/iv_gift_item_logo"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_cos_transparent_rounded"
android:clipToOutline=
"true"
android:scaleType=
"centerCrop"
android:src=
"@drawable/ic_banner_redeemed_gift"
app:layout_constraintBottom_toTopOf=
"@+id/gl_horizontal_75_guideline"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<RelativeLayout
android:layout_width=
"0dp"
android:layout_height=
"0dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/gl_horizontal_60_guideline"
>
<LinearLayout
android:id=
"@+id/ll_loyalty_item1"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/white_tr3"
android:paddingHorizontal=
"16dp"
android:paddingTop=
"16dp"
android:paddingBottom=
"4dp"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"BOX κουπόνι 4€"
android:textColor=
"@color/grey_tr2"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/ll_loyalty_item1"
android:background=
"@drawable/shape_cos_white_rounded_lower"
android:orientation=
"vertical"
android:paddingHorizontal=
"16dp"
>
<TextView
android:id=
"@+id/tv_loyalty_item_subtitle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:maxLines=
"2"
android:text=
"4€ έκπτωση για την επόμενη παραγγελία σου!"
android:textColor=
"@color/grey_tr2"
android:textSize=
"16sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
\ No newline at end of file
warply_android_sdk/src/main/res/values/colors.xml
View file @
ac53a7c
...
...
@@ -17,4 +17,7 @@
<color
name=
"cos_blue2"
>
#0478BE
</color>
<color
name=
"white_tr2"
>
#77FFFFFF
</color>
<color
name=
"white_tr3"
>
#E6FFFFFF
</color>
<color
name=
"grey_tr"
>
#A3415564
</color>
<color
name=
"grey_light2"
>
#F9F9F9
</color>
<color
name=
"grey_tr2"
>
#D4415564
</color>
</resources>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment