thkouk00

home coupon recycler added v2

...@@ -76,8 +76,8 @@ public class HomeFragment extends Fragment { ...@@ -76,8 +76,8 @@ public class HomeFragment extends Fragment {
76 /********* TEST DATA **********/ 76 /********* TEST DATA **********/
77 CouponList clist = new CouponList(); 77 CouponList clist = new CouponList();
78 try { 78 try {
79 - clist.add(new Coupon("{\"session_uuid\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"title\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"subtitle\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"offer_message\": null, \"message\": null, \"index_url\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\", \"logo_url\": \"https://warply.s3.amazonaws.com/temp/96322898cc824981aece923d8b5afc88/drggtdr.jpg\", \"starts\": 1644494400, \"expires\": 1881522000, \"delivered\": 1644607293, \"action\": 0, \"opened\": 1, \"offer_category\": \"standard-offer\", \"sorting\": 0, \"is_new\": true, \"session_metadata\": \"\\\"\\\"\", \"display_type\": null, \"delivery_method\": 2, \"extra_fields\": \"{}\", \"campaign_type\": null, \"campaign_type_settings\": null, \"actions\": null, \"show\": true, \"expired\": false, \"audience\": \"all\"}")); 79 + 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\"}"));
80 - clist.add(new Coupon("{\"session_uuid\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"title\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"subtitle\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"offer_message\": null, \"message\": null, \"index_url\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\", \"logo_url\": \"https://warply.s3.amazonaws.com/temp/96322898cc824981aece923d8b5afc88/drggtdr.jpg\", \"starts\": 1644494400, \"expires\": 1881522000, \"delivered\": 1644607293, \"action\": 0, \"opened\": 1, \"offer_category\": \"standard-offer\", \"sorting\": 0, \"is_new\": true, \"session_metadata\": \"\\\"\\\"\", \"display_type\": null, \"delivery_method\": 2, \"extra_fields\": \"{}\", \"campaign_type\": null, \"campaign_type_settings\": null, \"actions\": null, \"show\": true, \"expired\": false, \"audience\": \"all\"}")); 80 + 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\"}"));
81 } catch (JSONException e) { 81 } catch (JSONException e) {
82 e.printStackTrace(); 82 e.printStackTrace();
83 } 83 }
...@@ -91,7 +91,7 @@ public class HomeFragment extends Fragment { ...@@ -91,7 +91,7 @@ public class HomeFragment extends Fragment {
91 .doOnNext(coupon -> { 91 .doOnNext(coupon -> {
92 getContext().startActivity( 92 getContext().startActivity(
93 WarpViewActivity.createIntentFromSessionUUID(getContext(), 93 WarpViewActivity.createIntentFromSessionUUID(getContext(),
94 - coupon.getSessionUUID())); 94 + coupon.getCoupon()));
95 }) 95 })
96 .doOnError(error -> { 96 .doOnError(error -> {
97 }) 97 })
......
...@@ -31,13 +31,13 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho ...@@ -31,13 +31,13 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
31 } 31 }
32 32
33 public class HomeCouponViewHolder extends RecyclerView.ViewHolder { 33 public class HomeCouponViewHolder extends RecyclerView.ViewHolder {
34 - private ImageView ivCampaignTitle; 34 + private ImageView ivCouponTitle;
35 - private TextView tvCampaignTitle; 35 + private TextView tvCouponTitle;
36 36
37 public HomeCouponViewHolder(View view) { 37 public HomeCouponViewHolder(View view) {
38 super(view); 38 super(view);
39 - ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo); 39 + ivCouponTitle = view.findViewById(R.id.iv_coupon_logo);
40 - tvCampaignTitle = view.findViewById(R.id.tv_campaign_title); 40 + tvCouponTitle = view.findViewById(R.id.tv_coupon_subtitle);
41 } 41 }
42 } 42 }
43 43
...@@ -72,22 +72,22 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho ...@@ -72,22 +72,22 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
72 Coupon couponItem = mCoupons.get(position); 72 Coupon couponItem = mCoupons.get(position);
73 73
74 if (couponItem != null) { 74 if (couponItem != null) {
75 - if (!TextUtils.isEmpty(couponItem.getLogoUrl())) { 75 +// if (!TextUtils.isEmpty(couponItem.getImage())) {
76 - Glide.with(mContext) 76 +// Glide.with(mContext)
77 -// .setDefaultRequestOptions( 77 +//// .setDefaultRequestOptions(
78 -// RequestOptions 78 +//// RequestOptions
79 -// .placeholderOf(R.drawable.ic_default_contact_photo) 79 +//// .placeholderOf(R.drawable.ic_default_contact_photo)
80 -// .error(R.drawable.ic_default_contact_photo)) 80 +//// .error(R.drawable.ic_default_contact_photo))
81 - .load(couponItem.getLogoUrl()) 81 +// .load(couponItem.getImage())
82 - .diskCacheStrategy(DiskCacheStrategy.DATA) 82 +// .diskCacheStrategy(DiskCacheStrategy.DATA)
83 - .into(holder.ivCampaignTitle); 83 +// .into(holder.ivCouponTitle);
84 - } else { 84 +// } else {
85 - Glide.with(mContext) 85 +// Glide.with(mContext)
86 - .load(R.drawable.ic_cosmote_logo_horizontal_grey) 86 +// .load(R.drawable.ic_cosmote_logo_horizontal_grey)
87 - .into(holder.ivCampaignTitle); 87 +// .into(holder.ivCouponTitle);
88 - } 88 +// }
89 - 89 +
90 - holder.tvCampaignTitle.setText(couponItem.getTitle()); 90 +// holder.tvCouponTitle.setText(couponItem.getName());
91 91
92 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); 92 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
93 } 93 }
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
66 app:layout_constraintVertical_bias="0.2" /> 66 app:layout_constraintVertical_bias="0.2" />
67 67
68 <ImageView 68 <ImageView
69 + android:id="@+id/iv_coupon_logo"
69 android:layout_width="80dp" 70 android:layout_width="80dp"
70 android:layout_height="60dp" 71 android:layout_height="60dp"
71 android:src="@drawable/sklavenitis_logo" 72 android:src="@drawable/sklavenitis_logo"
......
...@@ -103,18 +103,15 @@ ...@@ -103,18 +103,15 @@
103 android:layout_width="match_parent" 103 android:layout_width="match_parent"
104 android:layout_height="wrap_content" 104 android:layout_height="wrap_content"
105 android:layout_below="@id/rl_home_campaigns" 105 android:layout_below="@id/rl_home_campaigns"
106 - android:layout_marginVertical="25dp"
107 android:paddingHorizontal="15dp"> 106 android:paddingHorizontal="15dp">
108 - <!-- <androidx.recyclerview.widget.RecyclerView--> 107 + <androidx.recyclerview.widget.RecyclerView
109 - <!-- android:id="@+id/rv_home_coupons"--> 108 + android:id="@+id/rv_home_coupons"
110 - <!-- android:layout_width="match_parent"--> 109 + android:layout_width="match_parent"
111 - <!-- android:layout_height="wrap_content"--> 110 + android:layout_height="wrap_content"
112 - <!-- android:layout_marginBottom="8dp"--> 111 + android:layout_marginBottom="8dp"
113 - <!-- android:clipToPadding="false"--> 112 + android:clipToPadding="false"
114 - <!-- android:orientation="horizontal"--> 113 + android:orientation="horizontal"
115 - <!-- android:paddingEnd="10dp"--> 114 + android:paddingEnd="10dp"/>
116 - <!-- />-->
117 - <include layout="@layout/coupon_layout" />
118 </LinearLayout> 115 </LinearLayout>
119 116
120 <androidx.constraintlayout.widget.ConstraintLayout 117 <androidx.constraintlayout.widget.ConstraintLayout
......