Panagiotis Triantafyllou

loyalty profile wip2

...@@ -27,8 +27,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -27,8 +27,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
27 // =========================================================== 27 // ===========================================================
28 28
29 private ImageView mIvBack; 29 private ImageView mIvBack;
30 - private RecyclerView mRecyclerCoupons; 30 + private RecyclerView mRecyclerCoupons ,mRecyclerBurntCoupons;
31 - private HomeCouponAdapter mAdapterCoupons; 31 + private HomeCouponAdapter mAdapterCoupons, mAdapterBurntCoupons;
32 32
33 // =========================================================== 33 // ===========================================================
34 // Methods for/from SuperClass/Interfaces 34 // Methods for/from SuperClass/Interfaces
...@@ -41,27 +41,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -41,27 +41,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
41 41
42 mIvBack = findViewById(R.id.iv_back); 42 mIvBack = findViewById(R.id.iv_back);
43 43
44 - /********* TEST COUPONS DATA **********/
45 - CouponList clist = new CouponList();
46 - try {
47 - 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\"}"));
48 - 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\"}"));
49 - } catch (JSONException e) {
50 - e.printStackTrace();
51 - }
52 - /********* TEST COUPONS DATA **********/
53 -
54 mRecyclerCoupons = findViewById(R.id.rv_loyalty_coupons); 44 mRecyclerCoupons = findViewById(R.id.rv_loyalty_coupons);
55 - mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)); 45 + mRecyclerBurntCoupons = findViewById(R.id.rv_loyalty_burnt_coupons);
56 - mAdapterCoupons = new HomeCouponAdapter(this, clist);
57 - mRecyclerCoupons.setAdapter(mAdapterCoupons);
58 - mAdapterCoupons.getPositionClicks()
59 - .doOnNext(coupon -> {
60 -// startActivity(WarpViewActivity.createIntentFromSessionUUID(this, coupon.getCoupon()));
61 - })
62 - .doOnError(error -> {
63 - })
64 - .subscribe();
65 46
66 initViews(); 47 initViews();
67 } 48 }
...@@ -74,7 +55,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -74,7 +55,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
74 @Override 55 @Override
75 public void onClick(View view) { 56 public void onClick(View view) {
76 if (view.getId() == R.id.iv_back) { 57 if (view.getId() == R.id.iv_back) {
77 - finish(); 58 + onBackPressed();
78 } 59 }
79 } 60 }
80 61
...@@ -83,7 +64,32 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -83,7 +64,32 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
83 // =========================================================== 64 // ===========================================================
84 65
85 private void initViews() { 66 private void initViews() {
67 + /********* TEST COUPONS DATA **********/
68 + CouponList clist = new CouponList();
69 + try {
70 + 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\"}"));
71 + 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\"}"));
72 + } catch (JSONException e) {
73 + e.printStackTrace();
74 + }
75 + /********* TEST COUPONS DATA **********/
76 +
86 mIvBack.setOnClickListener(this); 77 mIvBack.setOnClickListener(this);
78 +
79 + mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
80 + mAdapterCoupons = new HomeCouponAdapter(this, clist);
81 + mRecyclerCoupons.setAdapter(mAdapterCoupons);
82 + mAdapterCoupons.getPositionClicks()
83 + .doOnNext(coupon -> {
84 +// startActivity(WarpViewActivity.createIntentFromSessionUUID(this, coupon.getCoupon()));
85 + })
86 + .doOnError(error -> {
87 + })
88 + .subscribe();
89 +
90 + mRecyclerBurntCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
91 + mAdapterBurntCoupons = new HomeCouponAdapter(this, clist, true);
92 + mRecyclerBurntCoupons.setAdapter(mAdapterBurntCoupons);
87 } 93 }
88 94
89 // =========================================================== 95 // ===========================================================
......
...@@ -8,6 +8,7 @@ import android.view.ViewGroup; ...@@ -8,6 +8,7 @@ import android.view.ViewGroup;
8 import android.widget.ImageView; 8 import android.widget.ImageView;
9 import android.widget.TextView; 9 import android.widget.TextView;
10 10
11 +import androidx.core.content.ContextCompat;
11 import androidx.recyclerview.widget.RecyclerView; 12 import androidx.recyclerview.widget.RecyclerView;
12 13
13 import com.bumptech.glide.Glide; 14 import com.bumptech.glide.Glide;
...@@ -24,20 +25,28 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho ...@@ -24,20 +25,28 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
24 private Context mContext; 25 private Context mContext;
25 private CouponList mCoupons; 26 private CouponList mCoupons;
26 private final PublishSubject<Coupon> onClickSubject = PublishSubject.create(); 27 private final PublishSubject<Coupon> onClickSubject = PublishSubject.create();
28 + private boolean isBurnt = false;
27 29
28 public HomeCouponAdapter(Context mContext, CouponList campaignList) { 30 public HomeCouponAdapter(Context mContext, CouponList campaignList) {
29 this.mContext = mContext; 31 this.mContext = mContext;
30 this.mCoupons = campaignList; 32 this.mCoupons = campaignList;
33 + this.isBurnt = false;
34 + }
35 +
36 + public HomeCouponAdapter(Context mContext, CouponList campaignList, boolean isBurnt) {
37 + this.mContext = mContext;
38 + this.mCoupons = campaignList;
39 + this.isBurnt = isBurnt;
31 } 40 }
32 41
33 public class HomeCouponViewHolder extends RecyclerView.ViewHolder { 42 public class HomeCouponViewHolder extends RecyclerView.ViewHolder {
34 - private ImageView ivCouponTitle; 43 + private ImageView ivCouponBackground;
35 private TextView tvCouponTitle; 44 private TextView tvCouponTitle;
36 45
37 public HomeCouponViewHolder(View view) { 46 public HomeCouponViewHolder(View view) {
38 super(view); 47 super(view);
39 - ivCouponTitle = view.findViewById(R.id.iv_coupon_logo); 48 + ivCouponBackground = view.findViewById(R.id.imageView2);
40 - tvCouponTitle = view.findViewById(R.id.tv_coupon_subtitle); 49 +// tvCouponTitle = view.findViewById(R.id.tv_coupon_subtitle);
41 } 50 }
42 } 51 }
43 52
...@@ -63,7 +72,11 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho ...@@ -63,7 +72,11 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
63 72
64 @Override 73 @Override
65 public HomeCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 74 public HomeCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
66 - View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.coupon_layout, parent, false); 75 + View itemView;
76 + if (isBurnt)
77 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.burnt_coupon_layout, parent, false);
78 + else
79 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.coupon_layout, parent, false);
67 return new HomeCouponViewHolder(itemView); 80 return new HomeCouponViewHolder(itemView);
68 } 81 }
69 82
...@@ -89,6 +102,8 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho ...@@ -89,6 +102,8 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
89 102
90 // holder.tvCouponTitle.setText(couponItem.getName()); 103 // holder.tvCouponTitle.setText(couponItem.getName());
91 104
105 + if (isBurnt)
106 + holder.ivCouponBackground.setColorFilter(ContextCompat.getColor(mContext, R.color.grey_light2), android.graphics.PorterDuff.Mode.MULTIPLY);
92 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); 107 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
93 } 108 }
94 } 109 }
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + android:layout_width="360dp"
5 + android:layout_height="wrap_content"
6 + android:layout_marginStart="10dp">
7 +
8 + <androidx.constraintlayout.widget.Guideline
9 + android:id="@+id/horizontal_guideline"
10 + android:layout_width="wrap_content"
11 + android:layout_height="wrap_content"
12 + android:orientation="horizontal"
13 + app:layout_constraintGuide_percent="0.12" />
14 +
15 + <androidx.constraintlayout.widget.Guideline
16 + android:id="@+id/horizontal_guideline2"
17 + android:layout_width="wrap_content"
18 + android:layout_height="wrap_content"
19 + android:orientation="horizontal"
20 + app:layout_constraintGuide_percent="0.88" />
21 +
22 + <androidx.constraintlayout.widget.Guideline
23 + android:id="@+id/vertical_guideline"
24 + android:layout_width="wrap_content"
25 + android:layout_height="wrap_content"
26 + android:orientation="vertical"
27 + app:layout_constraintGuide_percent="0.94" />
28 +
29 + <androidx.constraintlayout.widget.Guideline
30 + android:id="@+id/vertical_guideline2"
31 + android:layout_width="wrap_content"
32 + android:layout_height="wrap_content"
33 + android:orientation="vertical"
34 + app:layout_constraintGuide_percent="0.06" />
35 +
36 + <ImageView
37 + android:id="@+id/imageView2"
38 + android:layout_width="match_parent"
39 + android:layout_height="250dp"
40 + android:src="@drawable/coupon_wrapper2"
41 + app:layout_constraintBottom_toBottomOf="parent"
42 + app:layout_constraintEnd_toEndOf="parent"
43 + app:layout_constraintStart_toStartOf="parent"
44 + app:layout_constraintTop_toTopOf="parent" />
45 +
46 + <androidx.constraintlayout.widget.ConstraintLayout
47 + android:layout_width="0dp"
48 + android:layout_height="0dp"
49 + app:layout_constraintBottom_toTopOf="@+id/horizontal_guideline2"
50 + app:layout_constraintEnd_toStartOf="@+id/vertical_guideline"
51 + app:layout_constraintStart_toStartOf="@+id/vertical_guideline2"
52 + app:layout_constraintTop_toTopOf="@+id/horizontal_guideline">
53 +
54 + <TextView
55 + android:id="@+id/tv_coupon_title"
56 + android:layout_width="0dp"
57 + android:layout_height="wrap_content"
58 + android:maxLines="1"
59 + android:text="Εκπτωτικό κουπόνι -10€"
60 + android:textColor="@color/grey_tr"
61 + android:textSize="18sp"
62 + android:textStyle="bold"
63 + android:layout_marginTop="16dp"
64 + app:layout_constraintEnd_toStartOf="@+id/iv_coupon_logo"
65 + app:layout_constraintStart_toStartOf="parent"
66 + app:layout_constraintTop_toTopOf="parent" />
67 +
68 + <TextView
69 + android:id="@+id/tv_coupon_subtitle"
70 + android:layout_width="0dp"
71 + android:layout_height="wrap_content"
72 + android:layout_marginBottom="24dp"
73 + android:maxLines="2"
74 + android:layout_marginTop="8dp"
75 + android:text="-10€ έκπτωση για το επόμενο γέμισμά σου!"
76 + android:textColor="@color/grey_tr"
77 + android:textFontWeight="600"
78 + android:textSize="16sp"
79 + app:layout_constraintEnd_toStartOf="@+id/iv_coupon_logo"
80 + app:layout_constraintStart_toStartOf="parent"
81 + app:layout_constraintTop_toBottomOf="@+id/tv_coupon_title" />
82 +
83 + <ImageView
84 + android:id="@+id/iv_coupon_logo"
85 + android:layout_width="80dp"
86 + android:layout_height="60dp"
87 + android:layout_marginTop="16dp"
88 + android:src="@drawable/ic_shell"
89 + app:layout_constraintEnd_toEndOf="parent"
90 + app:layout_constraintTop_toTopOf="parent" />
91 + </androidx.constraintlayout.widget.ConstraintLayout>
92 +</androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
19 19
20 <de.hdodenhof.circleimageview.CircleImageView 20 <de.hdodenhof.circleimageview.CircleImageView
21 android:id="@+id/iv_profile_photo" 21 android:id="@+id/iv_profile_photo"
22 - android:layout_width="50dp" 22 + android:layout_width="60dp"
23 - android:layout_height="50dp" 23 + android:layout_height="60dp"
24 android:src="@drawable/profile_photo" 24 android:src="@drawable/profile_photo"
25 app:layout_constraintBottom_toBottomOf="parent" 25 app:layout_constraintBottom_toBottomOf="parent"
26 app:layout_constraintLeft_toLeftOf="parent" 26 app:layout_constraintLeft_toLeftOf="parent"
...@@ -31,8 +31,9 @@ ...@@ -31,8 +31,9 @@
31 android:layout_width="wrap_content" 31 android:layout_width="wrap_content"
32 android:layout_height="wrap_content" 32 android:layout_height="wrap_content"
33 android:layout_marginStart="8dp" 33 android:layout_marginStart="8dp"
34 - android:layout_marginTop="2dp" 34 + android:layout_marginTop="6dp"
35 android:text="@string/cos_profile_name" 35 android:text="@string/cos_profile_name"
36 + android:maxLines="1"
36 android:textColor="@color/grey" 37 android:textColor="@color/grey"
37 app:layout_constraintLeft_toRightOf="@+id/iv_profile_photo" 38 app:layout_constraintLeft_toRightOf="@+id/iv_profile_photo"
38 app:layout_constraintTop_toTopOf="@+id/iv_profile_photo" /> 39 app:layout_constraintTop_toTopOf="@+id/iv_profile_photo" />
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
41 android:layout_width="wrap_content" 42 android:layout_width="wrap_content"
42 android:layout_height="wrap_content" 43 android:layout_height="wrap_content"
43 android:layout_marginStart="8dp" 44 android:layout_marginStart="8dp"
44 - android:layout_marginBottom="6dp" 45 + android:layout_marginBottom="10dp"
45 android:background="@drawable/shape_cos_gradient" 46 android:background="@drawable/shape_cos_gradient"
46 android:gravity="center" 47 android:gravity="center"
47 android:paddingHorizontal="4dp" 48 android:paddingHorizontal="4dp"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
4 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:app="http://schemas.android.com/apk/res-auto"
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 - android:layout_height="150dp" 6 + android:layout_height="160dp"
7 android:layout_marginHorizontal="32dp" 7 android:layout_marginHorizontal="32dp"
8 android:background="@drawable/shape_cos_gradient2" 8 android:background="@drawable/shape_cos_gradient2"
9 android:paddingHorizontal="20dp" 9 android:paddingHorizontal="20dp"
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
64 <TextView 64 <TextView
65 android:layout_width="wrap_content" 65 android:layout_width="wrap_content"
66 android:layout_height="wrap_content" 66 android:layout_height="wrap_content"
67 + android:layout_marginBottom="4dp"
67 android:background="@drawable/round_border_tr" 68 android:background="@drawable/round_border_tr"
68 android:paddingHorizontal="8dp" 69 android:paddingHorizontal="8dp"
69 android:paddingVertical="4dp" 70 android:paddingVertical="4dp"
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + android:layout_width="360dp"
5 + android:layout_height="240dp"
6 + android:layout_marginStart="10dp">
7 +
8 + <androidx.constraintlayout.widget.ConstraintLayout
9 + android:layout_width="360dp"
10 + android:layout_height="240dp">
11 +
12 + <androidx.constraintlayout.widget.Guideline
13 + android:id="@+id/gl_horizontal_75_guideline"
14 + android:layout_width="wrap_content"
15 + android:layout_height="wrap_content"
16 + android:orientation="horizontal"
17 + app:layout_constraintGuide_percent="0.75" />
18 +
19 + <androidx.constraintlayout.widget.Guideline
20 + android:id="@+id/gl_horizontal_60_guideline"
21 + android:layout_width="wrap_content"
22 + android:layout_height="wrap_content"
23 + android:orientation="horizontal"
24 + app:layout_constraintGuide_percent="0.6" />
25 +
26 + <ImageView
27 + android:id="@+id/iv_gift_item_logo"
28 + android:layout_width="match_parent"
29 + android:layout_height="match_parent"
30 + android:background="@drawable/shape_cos_transparent_rounded"
31 + android:clipToOutline="true"
32 + android:scaleType="centerCrop"
33 + android:src="@drawable/ic_banner_redeemed_gift"
34 + app:layout_constraintBottom_toTopOf="@+id/gl_horizontal_75_guideline"
35 + app:layout_constraintEnd_toEndOf="parent"
36 + app:layout_constraintStart_toStartOf="parent"
37 + app:layout_constraintTop_toTopOf="parent" />
38 +
39 + <RelativeLayout
40 + android:layout_width="0dp"
41 + android:layout_height="0dp"
42 + app:layout_constraintBottom_toBottomOf="parent"
43 + app:layout_constraintEnd_toEndOf="parent"
44 + app:layout_constraintStart_toStartOf="parent"
45 + app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_60_guideline">
46 +
47 + <LinearLayout
48 + android:id="@+id/ll_loyalty_item1"
49 + android:layout_width="match_parent"
50 + android:layout_height="wrap_content"
51 + android:background="@color/white_tr3"
52 + android:paddingHorizontal="16dp"
53 + android:paddingTop="16dp"
54 + android:paddingBottom="4dp">
55 +
56 + <TextView
57 + android:layout_width="wrap_content"
58 + android:layout_height="wrap_content"
59 + android:text="BOX κουπόνι 4€"
60 + android:textColor="@color/grey_tr2"
61 + android:textSize="16sp"
62 + android:textStyle="bold" />
63 + </LinearLayout>
64 +
65 + <androidx.constraintlayout.widget.ConstraintLayout
66 + android:layout_width="match_parent"
67 + android:layout_height="match_parent"
68 + android:layout_below="@+id/ll_loyalty_item1"
69 + android:background="@drawable/shape_cos_white_rounded_lower"
70 + android:orientation="vertical"
71 + android:paddingHorizontal="16dp">
72 +
73 + <TextView
74 + android:id="@+id/tv_loyalty_item_subtitle"
75 + android:layout_width="0dp"
76 + android:layout_height="wrap_content"
77 + android:maxLines="2"
78 + android:text="4€ έκπτωση για την επόμενη παραγγελία σου!"
79 + android:textColor="@color/grey_tr2"
80 + android:textSize="16sp"
81 + app:layout_constraintBottom_toBottomOf="parent"
82 + app:layout_constraintEnd_toEndOf="parent"
83 + app:layout_constraintStart_toStartOf="parent"
84 + app:layout_constraintTop_toTopOf="parent" />
85 + </androidx.constraintlayout.widget.ConstraintLayout>
86 + </RelativeLayout>
87 + </androidx.constraintlayout.widget.ConstraintLayout>
88 +</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -17,4 +17,7 @@ ...@@ -17,4 +17,7 @@
17 <color name="cos_blue2">#0478BE</color> 17 <color name="cos_blue2">#0478BE</color>
18 <color name="white_tr2">#77FFFFFF</color> 18 <color name="white_tr2">#77FFFFFF</color>
19 <color name="white_tr3">#E6FFFFFF</color> 19 <color name="white_tr3">#E6FFFFFF</color>
20 + <color name="grey_tr">#A3415564</color>
21 + <color name="grey_light2">#F9F9F9</color>
22 + <color name="grey_tr2">#D4415564</color>
20 </resources> 23 </resources>
...\ No newline at end of file ...\ No newline at end of file
......