Panagiotis Triantafyllou

fixed coupons

...@@ -5,7 +5,15 @@ import android.os.Bundle; ...@@ -5,7 +5,15 @@ import android.os.Bundle;
5 import android.view.View; 5 import android.view.View;
6 import android.widget.ImageView; 6 import android.widget.ImageView;
7 7
8 +import androidx.recyclerview.widget.LinearLayoutManager;
9 +import androidx.recyclerview.widget.RecyclerView;
10 +
11 +import org.json.JSONException;
12 +
8 import ly.warp.sdk.R; 13 import ly.warp.sdk.R;
14 +import ly.warp.sdk.io.models.Coupon;
15 +import ly.warp.sdk.io.models.CouponList;
16 +import ly.warp.sdk.views.adapters.HomeCouponAdapter;
9 17
10 18
11 public class LoyaltyActivity extends Activity implements View.OnClickListener { 19 public class LoyaltyActivity extends Activity implements View.OnClickListener {
...@@ -19,6 +27,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -19,6 +27,8 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
19 // =========================================================== 27 // ===========================================================
20 28
21 private ImageView mIvBack; 29 private ImageView mIvBack;
30 + private RecyclerView mRecyclerCoupons;
31 + private HomeCouponAdapter mAdapterCoupons;
22 32
23 // =========================================================== 33 // ===========================================================
24 // Methods for/from SuperClass/Interfaces 34 // Methods for/from SuperClass/Interfaces
...@@ -31,6 +41,28 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener { ...@@ -31,6 +41,28 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener {
31 41
32 mIvBack = findViewById(R.id.iv_back); 42 mIvBack = findViewById(R.id.iv_back);
33 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);
55 + mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
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 +
34 initViews(); 66 initViews();
35 } 67 }
36 68
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <gradient
5 + android:startColor="@color/cos_green2"
6 + android:centerColor="@color/green_dark"
7 + android:endColor="@color/cos_blue2"
8 + android:type="linear"/>
9 + <corners
10 + android:radius="1000dp"/>
11 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 - xmlns:tools="http://schemas.android.com/tools" 4 + android:layout_width="360dp"
5 - android:layout_width="match_parent" 5 + android:layout_height="wrap_content"
6 - android:layout_height="250dp"> 6 + android:layout_marginStart="10dp">
7 7
8 <androidx.constraintlayout.widget.Guideline 8 <androidx.constraintlayout.widget.Guideline
9 android:id="@+id/horizontal_guideline" 9 android:id="@+id/horizontal_guideline"
10 android:layout_width="wrap_content" 10 android:layout_width="wrap_content"
11 android:layout_height="wrap_content" 11 android:layout_height="wrap_content"
12 android:orientation="horizontal" 12 android:orientation="horizontal"
13 - app:layout_constraintGuide_percent="0.18" /> 13 + app:layout_constraintGuide_percent="0.12" />
14 14
15 <androidx.constraintlayout.widget.Guideline 15 <androidx.constraintlayout.widget.Guideline
16 android:id="@+id/horizontal_guideline2" 16 android:id="@+id/horizontal_guideline2"
17 android:layout_width="wrap_content" 17 android:layout_width="wrap_content"
18 android:layout_height="wrap_content" 18 android:layout_height="wrap_content"
19 android:orientation="horizontal" 19 android:orientation="horizontal"
20 - app:layout_constraintGuide_percent="0.75" /> 20 + app:layout_constraintGuide_percent="0.88" />
21 21
22 <androidx.constraintlayout.widget.Guideline 22 <androidx.constraintlayout.widget.Guideline
23 android:id="@+id/vertical_guideline" 23 android:id="@+id/vertical_guideline"
24 android:layout_width="wrap_content" 24 android:layout_width="wrap_content"
25 android:layout_height="wrap_content" 25 android:layout_height="wrap_content"
26 android:orientation="vertical" 26 android:orientation="vertical"
27 - app:layout_constraintGuide_percent="0.85" /> 27 + app:layout_constraintGuide_percent="0.94" />
28 28
29 <androidx.constraintlayout.widget.Guideline 29 <androidx.constraintlayout.widget.Guideline
30 android:id="@+id/vertical_guideline2" 30 android:id="@+id/vertical_guideline2"
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:orientation="vertical" 33 android:orientation="vertical"
34 - app:layout_constraintGuide_percent="0.14" /> 34 + app:layout_constraintGuide_percent="0.06" />
35 35
36 <ImageView 36 <ImageView
37 android:id="@+id/imageView2" 37 android:id="@+id/imageView2"
38 - android:layout_width="403dp" 38 + android:layout_width="match_parent"
39 - android:layout_height="238dp" 39 + android:layout_height="250dp"
40 - android:scaleType="fitXY" 40 + android:src="@drawable/coupon_wrapper2"
41 - android:src="@drawable/coupon_wrapper"
42 app:layout_constraintBottom_toBottomOf="parent" 41 app:layout_constraintBottom_toBottomOf="parent"
43 app:layout_constraintEnd_toEndOf="parent" 42 app:layout_constraintEnd_toEndOf="parent"
44 app:layout_constraintStart_toStartOf="parent" 43 app:layout_constraintStart_toStartOf="parent"
45 app:layout_constraintTop_toTopOf="parent" /> 44 app:layout_constraintTop_toTopOf="parent" />
46 45
47 <androidx.constraintlayout.widget.ConstraintLayout 46 <androidx.constraintlayout.widget.ConstraintLayout
48 - android:layout_width="300dp" 47 + android:layout_width="0dp"
49 - android:layout_height="150dp" 48 + android:layout_height="0dp"
50 - android:paddingHorizontal="5dp"
51 app:layout_constraintBottom_toTopOf="@+id/horizontal_guideline2" 49 app:layout_constraintBottom_toTopOf="@+id/horizontal_guideline2"
52 app:layout_constraintEnd_toStartOf="@+id/vertical_guideline" 50 app:layout_constraintEnd_toStartOf="@+id/vertical_guideline"
53 app:layout_constraintStart_toStartOf="@+id/vertical_guideline2" 51 app:layout_constraintStart_toStartOf="@+id/vertical_guideline2"
...@@ -55,50 +53,56 @@ ...@@ -55,50 +53,56 @@
55 53
56 <TextView 54 <TextView
57 android:id="@+id/tv_coupon_title" 55 android:id="@+id/tv_coupon_title"
58 - android:layout_width="wrap_content" 56 + android:layout_width="0dp"
59 android:layout_height="wrap_content" 57 android:layout_height="wrap_content"
60 - android:layout_marginTop="16dp"
61 android:maxLines="1" 58 android:maxLines="1"
62 android:text="Αποκλειστικά για σένα" 59 android:text="Αποκλειστικά για σένα"
63 - app:layout_constraintBottom_toTopOf="@+id/tv_coupon_subtitle" 60 + android:textColor="@color/grey"
61 + android:textSize="18sp"
62 + android:textStyle="bold"
63 + android:layout_marginTop="16dp"
64 + app:layout_constraintEnd_toStartOf="@+id/iv_coupon_logo"
64 app:layout_constraintStart_toStartOf="parent" 65 app:layout_constraintStart_toStartOf="parent"
65 - app:layout_constraintTop_toTopOf="parent" 66 + app:layout_constraintTop_toTopOf="parent" />
66 - app:layout_constraintVertical_bias="0.2" />
67 -
68 - <ImageView
69 - android:id="@+id/iv_coupon_logo"
70 - android:layout_width="80dp"
71 - android:layout_height="60dp"
72 - android:src="@drawable/sklavenitis_logo"
73 - app:layout_constraintBottom_toTopOf="@+id/tv_coupon_subtitle"
74 - app:layout_constraintEnd_toEndOf="@+id/tv_coupon_subtitle"
75 - app:layout_constraintHorizontal_bias="1.0"
76 - app:layout_constraintStart_toEndOf="@+id/tv_coupon_title"
77 - app:layout_constraintTop_toTopOf="parent"
78 - app:layout_constraintVertical_bias="1.0" />
79 67
80 <TextView 68 <TextView
81 android:id="@+id/tv_coupon_subtitle" 69 android:id="@+id/tv_coupon_subtitle"
82 - android:layout_width="wrap_content" 70 + android:layout_width="0dp"
83 android:layout_height="wrap_content" 71 android:layout_height="wrap_content"
84 android:layout_marginBottom="24dp" 72 android:layout_marginBottom="24dp"
85 android:maxLines="2" 73 android:maxLines="2"
74 + android:layout_marginTop="8dp"
86 android:text="10€ έκπτωση στα ψώνια σου στα supermarket Σκλαβενίτης!" 75 android:text="10€ έκπτωση στα ψώνια σου στα supermarket Σκλαβενίτης!"
87 - app:layout_constraintBottom_toTopOf="@+id/button" 76 + android:textColor="@color/grey"
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/sklavenitis_logo"
88 app:layout_constraintEnd_toEndOf="parent" 89 app:layout_constraintEnd_toEndOf="parent"
89 - app:layout_constraintStart_toStartOf="parent" /> 90 + app:layout_constraintTop_toTopOf="parent" />
90 91
91 - <Button 92 + <TextView
92 android:id="@+id/button" 93 android:id="@+id/button"
93 - android:layout_width="150dp" 94 + android:layout_width="wrap_content"
94 - android:layout_height="40dp" 95 + android:layout_height="wrap_content"
95 - android:background="@drawable/round_border" 96 + android:background="@drawable/shape_cos_gradient3"
97 + android:paddingHorizontal="16dp"
98 + android:paddingVertical="4dp"
96 android:text="Εξαργύρωση" 99 android:text="Εξαργύρωση"
97 android:textAlignment="center" 100 android:textAlignment="center"
98 - android:textSize="11dp" 101 + android:textColor="@android:color/white"
102 + android:textFontWeight="600"
103 + android:textSize="15dp"
104 + android:layout_marginBottom="16dp"
99 app:layout_constraintBottom_toBottomOf="parent" 105 app:layout_constraintBottom_toBottomOf="parent"
100 - app:layout_constraintEnd_toEndOf="parent" 106 + app:layout_constraintEnd_toEndOf="parent" />
101 - app:layout_constraintHorizontal_bias="1.0"
102 - app:layout_constraintStart_toStartOf="parent" />
103 </androidx.constraintlayout.widget.ConstraintLayout> 107 </androidx.constraintlayout.widget.ConstraintLayout>
104 </androidx.constraintlayout.widget.ConstraintLayout> 108 </androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
93 android:layout_height="wrap_content" 93 android:layout_height="wrap_content"
94 android:layout_below="@id/rl_header" 94 android:layout_below="@id/rl_header"
95 android:layout_marginTop="16dp"> 95 android:layout_marginTop="16dp">
96 +
96 <androidx.recyclerview.widget.RecyclerView 97 <androidx.recyclerview.widget.RecyclerView
97 android:id="@+id/rv_home_campaigns" 98 android:id="@+id/rv_home_campaigns"
98 android:layout_width="match_parent" 99 android:layout_width="match_parent"
...@@ -100,7 +101,7 @@ ...@@ -100,7 +101,7 @@
100 android:layout_marginBottom="8dp" 101 android:layout_marginBottom="8dp"
101 android:clipToPadding="false" 102 android:clipToPadding="false"
102 android:orientation="horizontal" 103 android:orientation="horizontal"
103 - android:paddingEnd="10dp"/> 104 + android:paddingEnd="10dp" />
104 </RelativeLayout> 105 </RelativeLayout>
105 106
106 <LinearLayout 107 <LinearLayout
......
...@@ -23,4 +23,5 @@ ...@@ -23,4 +23,5 @@
23 <string name="cos_profile_loyalty_name">Γιώργος Γεωργίου</string> 23 <string name="cos_profile_loyalty_name">Γιώργος Γεωργίου</string>
24 <string name="cos_questionnaire">Ερωτηματολόγιο</string> 24 <string name="cos_questionnaire">Ερωτηματολόγιο</string>
25 <string name="cos_gifts_loyalty_title">Τα δώρα μου</string> 25 <string name="cos_gifts_loyalty_title">Τα δώρα μου</string>
26 + <string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string>
26 </resources> 27 </resources>
...\ No newline at end of file ...\ No newline at end of file
......