thkouk00

home coupon recycler added v2

......@@ -76,8 +76,8 @@ public class HomeFragment extends Fragment {
/********* TEST DATA **********/
CouponList clist = new CouponList();
try {
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\"}"));
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\"}"));
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();
}
......@@ -91,7 +91,7 @@ public class HomeFragment extends Fragment {
.doOnNext(coupon -> {
getContext().startActivity(
WarpViewActivity.createIntentFromSessionUUID(getContext(),
coupon.getSessionUUID()));
coupon.getCoupon()));
})
.doOnError(error -> {
})
......
......@@ -31,13 +31,13 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
}
public class HomeCouponViewHolder extends RecyclerView.ViewHolder {
private ImageView ivCampaignTitle;
private TextView tvCampaignTitle;
private ImageView ivCouponTitle;
private TextView tvCouponTitle;
public HomeCouponViewHolder(View view) {
super(view);
ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo);
tvCampaignTitle = view.findViewById(R.id.tv_campaign_title);
ivCouponTitle = view.findViewById(R.id.iv_coupon_logo);
tvCouponTitle = view.findViewById(R.id.tv_coupon_subtitle);
}
}
......@@ -72,22 +72,22 @@ public class HomeCouponAdapter extends RecyclerView.Adapter<HomeCouponAdapter.Ho
Coupon couponItem = mCoupons.get(position);
if (couponItem != null) {
if (!TextUtils.isEmpty(couponItem.getLogoUrl())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(couponItem.getLogoUrl())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCampaignTitle);
} else {
Glide.with(mContext)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCampaignTitle);
}
holder.tvCampaignTitle.setText(couponItem.getTitle());
// if (!TextUtils.isEmpty(couponItem.getImage())) {
// Glide.with(mContext)
//// .setDefaultRequestOptions(
//// RequestOptions
//// .placeholderOf(R.drawable.ic_default_contact_photo)
//// .error(R.drawable.ic_default_contact_photo))
// .load(couponItem.getImage())
// .diskCacheStrategy(DiskCacheStrategy.DATA)
// .into(holder.ivCouponTitle);
// } else {
// Glide.with(mContext)
// .load(R.drawable.ic_cosmote_logo_horizontal_grey)
// .into(holder.ivCouponTitle);
// }
// holder.tvCouponTitle.setText(couponItem.getName());
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
}
......
......@@ -66,6 +66,7 @@
app:layout_constraintVertical_bias="0.2" />
<ImageView
android:id="@+id/iv_coupon_logo"
android:layout_width="80dp"
android:layout_height="60dp"
android:src="@drawable/sklavenitis_logo"
......
......@@ -103,18 +103,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rl_home_campaigns"
android:layout_marginVertical="25dp"
android:paddingHorizontal="15dp">
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rv_home_coupons"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginBottom="8dp"-->
<!-- android:clipToPadding="false"-->
<!-- android:orientation="horizontal"-->
<!-- android:paddingEnd="10dp"-->
<!-- />-->
<include layout="@layout/coupon_layout" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_home_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingEnd="10dp"/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
......