Panagiotis Triantafyllou

new fixes

...@@ -5,13 +5,17 @@ import android.content.Context; ...@@ -5,13 +5,17 @@ import android.content.Context;
5 import android.content.Intent; 5 import android.content.Intent;
6 import android.graphics.Bitmap; 6 import android.graphics.Bitmap;
7 import android.graphics.Color; 7 import android.graphics.Color;
8 +import android.os.Build;
8 import android.os.Bundle; 9 import android.os.Bundle;
10 +import android.text.Html;
9 import android.text.TextUtils; 11 import android.text.TextUtils;
10 import android.view.View; 12 import android.view.View;
11 import android.widget.ImageView; 13 import android.widget.ImageView;
12 import android.widget.LinearLayout; 14 import android.widget.LinearLayout;
13 import android.widget.TextView; 15 import android.widget.TextView;
14 16
17 +import androidx.core.content.ContextCompat;
18 +
15 import com.bumptech.glide.Glide; 19 import com.bumptech.glide.Glide;
16 import com.bumptech.glide.load.engine.DiskCacheStrategy; 20 import com.bumptech.glide.load.engine.DiskCacheStrategy;
17 import com.google.zxing.BarcodeFormat; 21 import com.google.zxing.BarcodeFormat;
...@@ -41,10 +45,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -41,10 +45,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
41 // =========================================================== 45 // ===========================================================
42 46
43 private ImageView mIvBack, mIvCouponPhoto, mIvBarcode; 47 private ImageView mIvBack, mIvCouponPhoto, mIvBarcode;
44 - private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate; 48 + private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate,
45 - private LinearLayout mLlGiftIt, mLlShops; 49 + mTvTermsValue;
50 + private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms;
46 private Coupon mCoupon; 51 private Coupon mCoupon;
47 private Couponset mCouponset; 52 private Couponset mCouponset;
53 + private boolean mIsBarcodeShown = false, mIsTermsShown = false;
48 54
49 // =========================================================== 55 // ===========================================================
50 // Methods for/from SuperClass/Interfaces 56 // Methods for/from SuperClass/Interfaces
...@@ -67,6 +73,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -67,6 +73,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
67 mIvCouponPhoto = findViewById(R.id.imageView6); 73 mIvCouponPhoto = findViewById(R.id.imageView6);
68 mIvBarcode = findViewById(R.id.iv_barcode); 74 mIvBarcode = findViewById(R.id.iv_barcode);
69 mLlShops = findViewById(R.id.ll_shops); 75 mLlShops = findViewById(R.id.ll_shops);
76 + mLlBarcodeShown = findViewById(R.id.ll_show_barcode);
77 + mLlBarcodeContainer = findViewById(R.id.ll_barcode_container_items);
78 + mLlTerms = findViewById(R.id.ll_terms_inner);
79 + mTvTermsValue = findViewById(R.id.tv_terms_value);
70 80
71 initViews(); 81 initViews();
72 } 82 }
...@@ -92,6 +102,38 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -92,6 +102,38 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
92 Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class); 102 Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class);
93 intent.putExtra("couponset", (Serializable) mCouponset); 103 intent.putExtra("couponset", (Serializable) mCouponset);
94 startActivity(intent); 104 startActivity(intent);
105 + return;
106 + }
107 + if (view.getId() == R.id.ll_show_barcode) {
108 + if (mIsBarcodeShown) {
109 + mLlBarcodeContainer.setVisibility(View.GONE);
110 + TextView barcodeButtonTitle = mLlBarcodeShown.findViewById(R.id.tv_barcode);
111 + ImageView barcodeButtonArrow = mLlBarcodeShown.findViewById(R.id.iv_barcode_arrow);
112 + barcodeButtonTitle.setText(getString(R.string.cos_show_barcode));
113 + barcodeButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_down_dark));
114 + mIsBarcodeShown = false;
115 + } else {
116 + mLlBarcodeContainer.setVisibility(View.VISIBLE);
117 + TextView barcodeButtonTitle = mLlBarcodeShown.findViewById(R.id.tv_barcode);
118 + ImageView barcodeButtonArrow = mLlBarcodeShown.findViewById(R.id.iv_barcode_arrow);
119 + barcodeButtonTitle.setText(getString(R.string.cos_hide_barcode));
120 + barcodeButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_up_dark));
121 + mIsBarcodeShown = true;
122 + }
123 + return;
124 + }
125 + if (view.getId() == R.id.ll_terms_inner) {
126 + if (mIsTermsShown) {
127 + mTvTermsValue.setVisibility(View.GONE);
128 + ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow);
129 + termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_down_dark));
130 + mIsTermsShown = false;
131 + } else {
132 + mTvTermsValue.setVisibility(View.VISIBLE);
133 + ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow);
134 + termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_up_dark));
135 + mIsTermsShown = true;
136 + }
95 } 137 }
96 } 138 }
97 139
...@@ -118,6 +160,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -118,6 +160,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
118 } 160 }
119 } 161 }
120 162
163 + if (mCouponset != null) {
164 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
165 + mTvTermsValue.setText(Html.fromHtml(mCouponset.getTerms(), Html.FROM_HTML_MODE_COMPACT));
166 + } else {
167 + mTvTermsValue.setText(Html.fromHtml(mCouponset.getTerms()));
168 + }
169 + }
170 +
121 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); 171 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
122 Date newDate = new Date(); 172 Date newDate = new Date();
123 try { 173 try {
...@@ -146,6 +196,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -146,6 +196,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
146 // mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); 196 // mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
147 mLlGiftIt.setOnClickListener(this); 197 mLlGiftIt.setOnClickListener(this);
148 mLlShops.setOnClickListener(this); 198 mLlShops.setOnClickListener(this);
199 + mLlBarcodeShown.setOnClickListener(this);
200 + mLlTerms.setOnClickListener(this);
149 201
150 String tempCoupon = mCoupon.getCoupon(); 202 String tempCoupon = mCoupon.getCoupon();
151 for (int i = 0; i < (12 - mCoupon.getCoupon().length()); i++) { 203 for (int i = 0; i < (12 - mCoupon.getCoupon().length()); i++) {
......
...@@ -67,6 +67,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -67,6 +67,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
67 mIvBack = findViewById(R.id.iv_shops_back); 67 mIvBack = findViewById(R.id.iv_shops_back);
68 mMapView = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mv_shops); 68 mMapView = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mv_shops);
69 mMapView.getMapAsync(this); 69 mMapView.getMapAsync(this);
70 + mIvBack.setOnClickListener(this);
70 } 71 }
71 72
72 @Override 73 @Override
......
...@@ -60,6 +60,7 @@ public class Coupon implements Parcelable, Serializable { ...@@ -60,6 +60,7 @@ public class Coupon implements Parcelable, Serializable {
60 private static final String TRANSACTION_UUID = "transaction_uuid"; 60 private static final String TRANSACTION_UUID = "transaction_uuid";
61 private static final String CHANGES_DATES = "changes_dates"; 61 private static final String CHANGES_DATES = "changes_dates";
62 private static final String COUPONSET_UUID = "couponset_uuid"; 62 private static final String COUPONSET_UUID = "couponset_uuid";
63 + private static final String MERCHANT_UUID = "merchant_uuid";
63 64
64 /* Member variables of the Campaign object */ 65 /* Member variables of the Campaign object */
65 66
...@@ -77,6 +78,7 @@ public class Coupon implements Parcelable, Serializable { ...@@ -77,6 +78,7 @@ public class Coupon implements Parcelable, Serializable {
77 private String transactionUuid = ""; 78 private String transactionUuid = "";
78 private JSONObject changesDates = new JSONObject(); 79 private JSONObject changesDates = new JSONObject();
79 private String couponsetUuid = ""; 80 private String couponsetUuid = "";
81 + private String merchantUuid = "";
80 82
81 /** 83 /**
82 * Basic constructor used to create an object from a String, representing a 84 * Basic constructor used to create an object from a String, representing a
...@@ -110,6 +112,7 @@ public class Coupon implements Parcelable, Serializable { ...@@ -110,6 +112,7 @@ public class Coupon implements Parcelable, Serializable {
110 this.transactionUuid = json.optString(TRANSACTION_UUID); 112 this.transactionUuid = json.optString(TRANSACTION_UUID);
111 this.changesDates = json.optJSONObject(CHANGES_DATES); 113 this.changesDates = json.optJSONObject(CHANGES_DATES);
112 this.couponsetUuid = json.optString(COUPONSET_UUID); 114 this.couponsetUuid = json.optString(COUPONSET_UUID);
115 + this.merchantUuid = json.optString(MERCHANT_UUID);
113 } 116 }
114 } 117 }
115 118
...@@ -127,6 +130,7 @@ public class Coupon implements Parcelable, Serializable { ...@@ -127,6 +130,7 @@ public class Coupon implements Parcelable, Serializable {
127 this.transactionDate = source.readString(); 130 this.transactionDate = source.readString();
128 this.transactionUuid = source.readString(); 131 this.transactionUuid = source.readString();
129 this.couponsetUuid = source.readString(); 132 this.couponsetUuid = source.readString();
133 + this.merchantUuid = source.readString();
130 } 134 }
131 135
132 @Override 136 @Override
...@@ -144,6 +148,7 @@ public class Coupon implements Parcelable, Serializable { ...@@ -144,6 +148,7 @@ public class Coupon implements Parcelable, Serializable {
144 dest.writeString(this.transactionDate); 148 dest.writeString(this.transactionDate);
145 dest.writeString(this.transactionUuid); 149 dest.writeString(this.transactionUuid);
146 dest.writeString(this.couponsetUuid); 150 dest.writeString(this.couponsetUuid);
151 + dest.writeString(this.merchantUuid);
147 } 152 }
148 153
149 /** 154 /**
...@@ -168,6 +173,7 @@ public class Coupon implements Parcelable, Serializable { ...@@ -168,6 +173,7 @@ public class Coupon implements Parcelable, Serializable {
168 jObj.putOpt(TRANSACTION_UUID, this.transactionUuid); 173 jObj.putOpt(TRANSACTION_UUID, this.transactionUuid);
169 jObj.putOpt(CHANGES_DATES, this.changesDates); 174 jObj.putOpt(CHANGES_DATES, this.changesDates);
170 jObj.putOpt(COUPONSET_UUID, this.couponsetUuid); 175 jObj.putOpt(COUPONSET_UUID, this.couponsetUuid);
176 + jObj.putOpt(MERCHANT_UUID, this.merchantUuid);
171 } catch (JSONException e) { 177 } catch (JSONException e) {
172 if (WarpConstants.DEBUG) { 178 if (WarpConstants.DEBUG) {
173 e.printStackTrace(); 179 e.printStackTrace();
...@@ -319,6 +325,14 @@ public class Coupon implements Parcelable, Serializable { ...@@ -319,6 +325,14 @@ public class Coupon implements Parcelable, Serializable {
319 this.couponsetUuid = couponsetUuid; 325 this.couponsetUuid = couponsetUuid;
320 } 326 }
321 327
328 + public String getMerchantUuid() {
329 + return merchantUuid;
330 + }
331 +
332 + public void setMerchantUuid(String merchantUuid) {
333 + this.merchantUuid = merchantUuid;
334 + }
335 +
322 @Override 336 @Override
323 public int describeContents() { 337 public int describeContents() {
324 return 0; 338 return 0;
......
...@@ -136,6 +136,50 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { ...@@ -136,6 +136,50 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
136 private JSONObject product = new JSONObject(); 136 private JSONObject product = new JSONObject();
137 private LatLng coordinates; 137 private LatLng coordinates;
138 138
139 + public Merchant() {
140 + this.address = "";
141 + this.id = "";
142 + this.store_id = "";
143 + this.name = "";
144 + this.logo = "";
145 + this.website = "";
146 + this.email = "";
147 + this.telephone = "";
148 + this.category = "";
149 + this.description = "";
150 + this.short_description = "";
151 + this.region = "";
152 + this.latitude = 0.0;
153 + this.longitude = 0.0;
154 + this.image = "";
155 + this.extra_fields = new JSONObject();
156 + this.active = true;
157 + this.city = "";
158 + this.country = "";
159 + this.postal_code = "";
160 + this.vat = "";
161 + this.uuid = "";
162 + this.category_uuid = "";
163 + this.created = "";
164 + this.parent = "";
165 + this.img = new JSONArray();
166 + this.img_preview = "";
167 + this.admin_name = "";
168 + this.sorting = 0;
169 + this.body = "";
170 + this.owner_name = "";
171 + this.preview = "";
172 + this.merchant_metadata = new JSONObject();
173 + this.promoted = false;
174 + this.distance = 0;
175 + this.default_shown = true;
176 + this.hidden = false;
177 + this.working_hours = new JSONObject();
178 + this.tags = new JSONArray();
179 + this.product = new JSONObject();
180 + coordinates = new LatLng(this.latitude, this.longitude);
181 + }
182 +
139 /** 183 /**
140 * Basic constructor used to create an object from a String, representing a 184 * Basic constructor used to create an object from a String, representing a
141 * JSON Object 185 * JSON Object
......
...@@ -61,6 +61,7 @@ import ly.warp.sdk.io.models.CustomerStateModel; ...@@ -61,6 +61,7 @@ import ly.warp.sdk.io.models.CustomerStateModel;
61 import ly.warp.sdk.io.models.LoyaltyBadgeModel; 61 import ly.warp.sdk.io.models.LoyaltyBadgeModel;
62 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; 62 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
63 import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; 63 import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
64 +import ly.warp.sdk.io.models.MerchantList;
64 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; 65 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
65 import ly.warp.sdk.io.request.CosmoteSharingRequest; 66 import ly.warp.sdk.io.request.CosmoteSharingRequest;
66 import ly.warp.sdk.io.request.WarplyIntegrationRequest; 67 import ly.warp.sdk.io.request.WarplyIntegrationRequest;
...@@ -96,6 +97,7 @@ public class WarplyManagerHelper { ...@@ -96,6 +97,7 @@ public class WarplyManagerHelper {
96 mAlertDialogReturnSharing, mAlertDialogErrorSharing; 97 mAlertDialogReturnSharing, mAlertDialogErrorSharing;
97 private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel(); 98 private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel();
98 private static float mDealsSum = 0.0f; 99 private static float mDealsSum = 0.0f;
100 + private static MerchantList mMerchantList = new MerchantList();
99 101
100 // =========================================================== 102 // ===========================================================
101 // Methods for/from SuperClass/Interfaces 103 // Methods for/from SuperClass/Interfaces
...@@ -908,6 +910,14 @@ public class WarplyManagerHelper { ...@@ -908,6 +910,14 @@ public class WarplyManagerHelper {
908 mCouponsetsList = couponsets; 910 mCouponsetsList = couponsets;
909 } 911 }
910 912
913 + public static void setMerchantList(MerchantList merchantList) {
914 + mMerchantList = merchantList;
915 + }
916 +
917 + public static MerchantList getMerchantList() {
918 + return mMerchantList;
919 + }
920 +
911 public static float getDealsCouponsSum() { 921 public static float getDealsCouponsSum() {
912 return mDealsSum; 922 return mDealsSum;
913 } 923 }
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
25 25
26 package ly.warp.sdk.utils.managers; 26 package ly.warp.sdk.utils.managers;
27 27
28 +import android.os.Handler;
29 +import android.os.Looper;
30 +import android.util.Log;
31 +
28 import org.json.JSONArray; 32 import org.json.JSONArray;
29 import org.json.JSONException; 33 import org.json.JSONException;
30 import org.json.JSONObject; 34 import org.json.JSONObject;
...@@ -2163,65 +2167,80 @@ public class WarplyManager { ...@@ -2163,65 +2167,80 @@ public class WarplyManager {
2163 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); 2167 WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active");
2164 WarpUtils.log("**************************************************"); 2168 WarpUtils.log("**************************************************");
2165 2169
2166 - getCouponsets(new WarplyGetCouponsetsRequest() 2170 + WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest()
2167 - .setLanguage(WarplyProperty.getLanguage(Warply.getWarplyContext())), new CallbackReceiver<CouponsetsList>() { 2171 + .setIsMultilingual(true)
2168 - @Override 2172 + , new CallbackReceiver<MerchantList>() {
2169 - public void onSuccess(CouponsetsList result) {
2170 - Warply.postReceiveMicroappData(WarpConstants.MICROAPP_COUPONS, true, "context", request.toJson(), new CouponsHook(new CallbackReceiver<CouponList>() {
2171 @Override 2173 @Override
2172 - public void onSuccess(CouponList response) { 2174 + public void onSuccess(MerchantList result) {
2173 - CouponList mCouponList = new CouponList(); 2175 + WarplyManagerHelper.setMerchantList(result);
2174 - for (Coupon coupon : response) {
2175 - for (Couponset couponset : result) {
2176 - if (coupon.getCouponsetUuid().equals(couponset.getUuid())) {
2177 - coupon.setDescription(couponset.getShortDescription());
2178 - coupon.setImage(couponset.getImgPreview());
2179 - coupon.setName(couponset.getName());
2180 - mCouponList.add(coupon);
2181 - }
2182 - }
2183 - }
2184 - WarplyManagerHelper.setCouponList(mCouponList);
2185 2176
2186 - CouponList mActiveCouponList = new CouponList(); 2177 + getCouponsets(new WarplyGetCouponsetsRequest()
2187 - for (Coupon coupon : mCouponList) { 2178 + .setLanguage(WarplyProperty.getLanguage(Warply.getWarplyContext())), new CallbackReceiver<CouponsetsList>() {
2188 - if (coupon.getStatus() == 1) 2179 + @Override
2189 - mActiveCouponList.add(coupon); 2180 + public void onSuccess(CouponsetsList result) {
2190 - } 2181 + Warply.postReceiveMicroappData(WarpConstants.MICROAPP_COUPONS, true, "context", request.toJson(), new CouponsHook(new CallbackReceiver<CouponList>() {
2182 + @Override
2183 + public void onSuccess(CouponList response) {
2184 + CouponList mCouponList = new CouponList();
2185 + for (Coupon coupon : response) {
2186 + for (Couponset couponset : result) {
2187 + if (coupon.getCouponsetUuid().equals(couponset.getUuid())) {
2188 + coupon.setDescription(couponset.getShortDescription());
2189 + coupon.setImage(couponset.getImgPreview());
2190 + coupon.setName(couponset.getName());
2191 + coupon.setMerchantUuid(couponset.getMerchantUuid());
2192 + mCouponList.add(coupon);
2193 + }
2194 + }
2195 + }
2196 + WarplyManagerHelper.setCouponList(mCouponList);
2197 +
2198 + CouponList mActiveCouponList = new CouponList();
2199 + for (Coupon coupon : mCouponList) {
2200 + if (coupon.getStatus() == 1)
2201 + mActiveCouponList.add(coupon);
2202 + }
2203 +
2204 + receiver.onSuccess(mActiveCouponList);
2205 + }
2206 +
2207 + @Override
2208 + public void onFailure(int errorCode) {
2209 + if (errorCode == 401) {
2210 + refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
2211 + @Override
2212 + public void onSuccess(JSONObject result) {
2213 + int status = result.optInt("status", 2);
2214 + if (status == 1)
2215 + getUserCoupons(request, receiver);
2216 + else
2217 + receiver.onFailure(status);
2218 + }
2219 +
2220 + @Override
2221 + public void onFailure(int errorCode) {
2222 + receiver.onFailure(errorCode);
2223 + }
2224 + });
2225 + } else
2226 + receiver.onFailure(errorCode);
2227 + }
2228 + },
2229 + request.getSignature()));
2230 + }
2191 2231
2192 - receiver.onSuccess(mActiveCouponList); 2232 + @Override
2233 + public void onFailure(int errorCode) {
2234 + receiver.onFailure(errorCode);
2235 + }
2236 + });
2193 } 2237 }
2194 2238
2195 @Override 2239 @Override
2196 public void onFailure(int errorCode) { 2240 public void onFailure(int errorCode) {
2197 - if (errorCode == 401) {
2198 - refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
2199 - @Override
2200 - public void onSuccess(JSONObject result) {
2201 - int status = result.optInt("status", 2);
2202 - if (status == 1)
2203 - getUserCoupons(request, receiver);
2204 - else
2205 - receiver.onFailure(status);
2206 - }
2207 2241
2208 - @Override
2209 - public void onFailure(int errorCode) {
2210 - receiver.onFailure(errorCode);
2211 - }
2212 - });
2213 - } else
2214 - receiver.onFailure(errorCode);
2215 } 2242 }
2216 - }, 2243 + });
2217 - request.getSignature()));
2218 - }
2219 -
2220 - @Override
2221 - public void onFailure(int errorCode) {
2222 - receiver.onFailure(errorCode);
2223 - }
2224 - });
2225 } 2244 }
2226 2245
2227 public static void getCosmoteUser(WarplyCosmoteUserRequest request, final CallbackReceiver<JSONObject> receiver) { 2246 public static void getCosmoteUser(WarplyCosmoteUserRequest request, final CallbackReceiver<JSONObject> receiver) {
......
...@@ -24,6 +24,8 @@ import io.reactivex.subjects.PublishSubject; ...@@ -24,6 +24,8 @@ import io.reactivex.subjects.PublishSubject;
24 import ly.warp.sdk.R; 24 import ly.warp.sdk.R;
25 import ly.warp.sdk.io.models.Coupon; 25 import ly.warp.sdk.io.models.Coupon;
26 import ly.warp.sdk.io.models.CouponList; 26 import ly.warp.sdk.io.models.CouponList;
27 +import ly.warp.sdk.io.models.Merchant;
28 +import ly.warp.sdk.utils.WarplyManagerHelper;
27 29
28 public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapter.ActiveCouponViewHolder> { 30 public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapter.ActiveCouponViewHolder> {
29 31
...@@ -92,30 +94,61 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte ...@@ -92,30 +94,61 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
92 @Override 94 @Override
93 public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) { 95 public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) {
94 Coupon couponItem = mCoupons.get(position); 96 Coupon couponItem = mCoupons.get(position);
97 + Merchant merchant = new Merchant();
95 98
96 if (mIsPast) 99 if (mIsPast)
97 holder.ivCouponBackground.setColorFilter(ContextCompat.getColor(mContext, R.color.grey_light3), android.graphics.PorterDuff.Mode.MULTIPLY); 100 holder.ivCouponBackground.setColorFilter(ContextCompat.getColor(mContext, R.color.grey_light3), android.graphics.PorterDuff.Mode.MULTIPLY);
98 101
99 if (couponItem != null) { 102 if (couponItem != null) {
100 - if (!TextUtils.isEmpty(couponItem.getImage())) { 103 + if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
101 - Glide.with(mContext) 104 + for (Merchant mer : WarplyManagerHelper.getMerchantList()) {
105 + if (mer.getUuid().equals(couponItem.getMerchantUuid())) {
106 + merchant = mer;
107 + break;
108 + }
109 + }
110 + }
111 +
112 + if (merchant == null) {
113 + if (!TextUtils.isEmpty(couponItem.getImage())) {
114 + Glide.with(mContext)
102 // .setDefaultRequestOptions( 115 // .setDefaultRequestOptions(
103 // RequestOptions 116 // RequestOptions
104 // .placeholderOf(R.drawable.ic_default_contact_photo) 117 // .placeholderOf(R.drawable.ic_default_contact_photo)
105 // .error(R.drawable.ic_default_contact_photo)) 118 // .error(R.drawable.ic_default_contact_photo))
106 - .load(couponItem.getImage()) 119 + .load(couponItem.getImage())
107 - .diskCacheStrategy(DiskCacheStrategy.DATA) 120 + .diskCacheStrategy(DiskCacheStrategy.DATA)
108 - .into(holder.ivCouponLogo); 121 + .into(holder.ivCouponLogo);
122 + } else {
123 + Glide.with(mContext)
124 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
125 + .into(holder.ivCouponLogo);
126 + }
127 +
128 + holder.tvCouponTitle.setText(couponItem.getName());
129 + if (!mIsPast)
130 + holder.tvCouponDescription.setText(couponItem.getDescription());
109 } else { 131 } else {
110 - Glide.with(mContext) 132 + if (!TextUtils.isEmpty(merchant.getImage())) {
111 - .load(R.drawable.ic_cosmote_logo_horizontal_grey) 133 + Glide.with(mContext)
112 - .into(holder.ivCouponLogo); 134 +// .setDefaultRequestOptions(
135 +// RequestOptions
136 +// .placeholderOf(R.drawable.ic_default_contact_photo)
137 +// .error(R.drawable.ic_default_contact_photo))
138 + .load(merchant.getImage())
139 + .diskCacheStrategy(DiskCacheStrategy.DATA)
140 + .into(holder.ivCouponLogo);
141 + } else {
142 + Glide.with(mContext)
143 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
144 + .into(holder.ivCouponLogo);
145 + }
146 +
147 + holder.tvCouponTitle.setText(merchant.getAdminName());
148 + if (!mIsPast)
149 + holder.tvCouponDescription.setText(merchant.getShortDescription());
113 } 150 }
114 151
115 - holder.tvCouponTitle.setText(couponItem.getName());
116 - if (!mIsPast)
117 - holder.tvCouponDescription.setText(couponItem.getDescription());
118 -
119 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); 152 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
120 Date newDate = new Date(); 153 Date newDate = new Date();
121 try { 154 try {
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
22 app:layout_constraintTop_toTopOf="parent" /> 22 app:layout_constraintTop_toTopOf="parent" />
23 23
24 <TextView 24 <TextView
25 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
25 android:layout_width="wrap_content" 26 android:layout_width="wrap_content"
26 android:layout_height="wrap_content" 27 android:layout_height="wrap_content"
27 android:text="@string/cos_coupon_info_title" 28 android:text="@string/cos_coupon_info_title"
28 android:textColor="@color/grey" 29 android:textColor="@color/grey"
29 android:textSize="17sp" 30 android:textSize="17sp"
30 - fontPath="fonts/pf_square_sans_pro_medium.ttf"
31 app:layout_constraintBottom_toBottomOf="parent" 31 app:layout_constraintBottom_toBottomOf="parent"
32 app:layout_constraintEnd_toEndOf="parent" 32 app:layout_constraintEnd_toEndOf="parent"
33 app:layout_constraintStart_toStartOf="parent" 33 app:layout_constraintStart_toStartOf="parent"
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
67 67
68 <TextView 68 <TextView
69 android:id="@+id/textView13" 69 android:id="@+id/textView13"
70 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
70 android:layout_width="match_parent" 71 android:layout_width="match_parent"
71 android:layout_height="wrap_content" 72 android:layout_height="wrap_content"
72 android:layout_marginTop="32dp" 73 android:layout_marginTop="32dp"
...@@ -74,7 +75,6 @@ ...@@ -74,7 +75,6 @@
74 android:paddingHorizontal="32dp" 75 android:paddingHorizontal="32dp"
75 android:textColor="#415564" 76 android:textColor="#415564"
76 android:textSize="18sp" 77 android:textSize="18sp"
77 - fontPath="fonts/pf_square_sans_pro_medium.ttf"
78 app:layout_constraintEnd_toEndOf="parent" 78 app:layout_constraintEnd_toEndOf="parent"
79 app:layout_constraintHorizontal_bias="0.509" 79 app:layout_constraintHorizontal_bias="0.509"
80 app:layout_constraintStart_toStartOf="parent" 80 app:layout_constraintStart_toStartOf="parent"
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
83 83
84 <TextView 84 <TextView
85 android:id="@+id/textView14" 85 android:id="@+id/textView14"
86 + fontPath="fonts/pf_square_sans_pro_regular.ttf"
86 android:layout_width="match_parent" 87 android:layout_width="match_parent"
87 android:layout_height="wrap_content" 88 android:layout_height="wrap_content"
88 android:layout_marginTop="16dp" 89 android:layout_marginTop="16dp"
...@@ -90,7 +91,6 @@ ...@@ -90,7 +91,6 @@
90 android:paddingHorizontal="32dp" 91 android:paddingHorizontal="32dp"
91 android:textColor="#415564" 92 android:textColor="#415564"
92 android:textSize="16sp" 93 android:textSize="16sp"
93 - fontPath="fonts/pf_square_sans_pro_regular.ttf"
94 app:layout_constraintEnd_toEndOf="parent" 94 app:layout_constraintEnd_toEndOf="parent"
95 app:layout_constraintStart_toStartOf="parent" 95 app:layout_constraintStart_toStartOf="parent"
96 app:layout_constraintTop_toBottomOf="@+id/textView13" 96 app:layout_constraintTop_toBottomOf="@+id/textView13"
...@@ -98,13 +98,13 @@ ...@@ -98,13 +98,13 @@
98 98
99 <TextView 99 <TextView
100 android:id="@+id/textView15" 100 android:id="@+id/textView15"
101 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
101 android:layout_width="wrap_content" 102 android:layout_width="wrap_content"
102 android:layout_height="wrap_content" 103 android:layout_height="wrap_content"
103 android:layout_marginTop="48dp" 104 android:layout_marginTop="48dp"
104 android:text="Κωδικός Κουπονιού" 105 android:text="Κωδικός Κουπονιού"
105 android:textColor="#415564" 106 android:textColor="#415564"
106 - fontPath="fonts/pf_square_sans_pro_medium.ttf" 107 + android:textSize="18sp"
107 - android:textSize="16sp"
108 app:layout_constraintEnd_toEndOf="parent" 108 app:layout_constraintEnd_toEndOf="parent"
109 app:layout_constraintHorizontal_bias="0.498" 109 app:layout_constraintHorizontal_bias="0.498"
110 app:layout_constraintStart_toStartOf="parent" 110 app:layout_constraintStart_toStartOf="parent"
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
112 112
113 <TextView 113 <TextView
114 android:id="@+id/textView16" 114 android:id="@+id/textView16"
115 + fontPath="fonts/pf_square_sans_pro_bold.ttf"
115 android:layout_width="match_parent" 116 android:layout_width="match_parent"
116 android:layout_height="50dp" 117 android:layout_height="50dp"
117 android:layout_marginHorizontal="32dp" 118 android:layout_marginHorizontal="32dp"
...@@ -120,43 +121,101 @@ ...@@ -120,43 +121,101 @@
120 android:gravity="center" 121 android:gravity="center"
121 android:textColor="@color/grey" 122 android:textColor="@color/grey"
122 android:textSize="25dp" 123 android:textSize="25dp"
123 - fontPath="fonts/pf_square_sans_pro_bold.ttf"
124 app:layout_constraintEnd_toEndOf="parent" 124 app:layout_constraintEnd_toEndOf="parent"
125 app:layout_constraintStart_toStartOf="parent" 125 app:layout_constraintStart_toStartOf="parent"
126 app:layout_constraintTop_toBottomOf="@+id/textView15" 126 app:layout_constraintTop_toBottomOf="@+id/textView15"
127 tools:text="1A2C378" /> 127 tools:text="1A2C378" />
128 128
129 - <View 129 + <LinearLayout
130 - android:id="@+id/view4" 130 + android:id="@+id/ll_barcode_container"
131 - android:layout_width="320dp" 131 + android:layout_width="match_parent"
132 - android:layout_height="0.8dp" 132 + android:layout_height="wrap_content"
133 android:layout_marginTop="20dp" 133 android:layout_marginTop="20dp"
134 - android:background="#E6E6E6" 134 + android:gravity="center"
135 + android:orientation="vertical"
135 app:layout_constraintEnd_toEndOf="parent" 136 app:layout_constraintEnd_toEndOf="parent"
136 - app:layout_constraintHorizontal_bias="0.505"
137 app:layout_constraintStart_toStartOf="parent" 137 app:layout_constraintStart_toStartOf="parent"
138 - app:layout_constraintTop_toBottomOf="@+id/iv_barcode" /> 138 + app:layout_constraintTop_toBottomOf="@+id/textView16">
139 139
140 - <View 140 + <LinearLayout
141 - android:id="@+id/view5" 141 + android:id="@+id/ll_barcode_container_items"
142 - android:layout_width="320dp" 142 + android:layout_width="match_parent"
143 - android:layout_height="0.8dp" 143 + android:layout_height="wrap_content"
144 - android:layout_marginTop="16dp" 144 + android:gravity="center"
145 - android:background="#E6E6E6" 145 + android:orientation="vertical"
146 - app:layout_constraintEnd_toEndOf="parent" 146 + android:visibility="gone"
147 - app:layout_constraintStart_toStartOf="parent" 147 + tools:visibility="visible">
148 - app:layout_constraintTop_toBottomOf="@+id/textView16" /> 148 +
149 + <View
150 + android:id="@+id/view5"
151 + android:layout_width="320dp"
152 + android:layout_height="0.8dp"
153 + android:background="#E6E6E6"
154 + app:layout_constraintEnd_toEndOf="parent"
155 + app:layout_constraintStart_toStartOf="parent"
156 + app:layout_constraintTop_toBottomOf="@+id/textView16" />
157 +
158 + <ImageView
159 + android:id="@+id/iv_barcode"
160 + android:layout_width="284dp"
161 + android:layout_height="86dp"
162 + android:layout_marginTop="16dp"
163 + android:scaleType="fitXY"
164 + app:layout_constraintBottom_toTopOf="@+id/view4"
165 + app:layout_constraintEnd_toEndOf="parent"
166 + app:layout_constraintStart_toStartOf="parent"
167 + app:layout_constraintTop_toBottomOf="@+id/view5"
168 + tools:srcCompat="@tools:sample/avatars" />
169 +
170 +
171 + <View
172 + android:id="@+id/view4"
173 + android:layout_width="320dp"
174 + android:layout_height="0.8dp"
175 + android:layout_marginTop="20dp"
176 + android:background="#E6E6E6"
177 + app:layout_constraintEnd_toEndOf="parent"
178 + app:layout_constraintHorizontal_bias="0.505"
179 + app:layout_constraintStart_toStartOf="parent"
180 + app:layout_constraintTop_toBottomOf="@+id/iv_barcode" />
181 + </LinearLayout>
182 +
183 + <LinearLayout
184 + android:id="@+id/ll_show_barcode"
185 + android:layout_width="wrap_content"
186 + android:layout_height="wrap_content"
187 + android:layout_marginTop="20dp"
188 + android:gravity="center"
189 + android:orientation="horizontal">
190 +
191 + <TextView
192 + android:id="@+id/tv_barcode"
193 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
194 + android:layout_width="wrap_content"
195 + android:layout_height="wrap_content"
196 + android:text="@string/cos_show_barcode"
197 + android:textColor="@color/grey"
198 + android:textSize="16sp" />
199 +
200 + <ImageView
201 + android:id="@+id/iv_barcode_arrow"
202 + android:layout_width="14dp"
203 + android:layout_height="14dp"
204 + android:layout_marginStart="6dp"
205 + android:src="@drawable/ic_down_dark" />
206 + </LinearLayout>
207 + </LinearLayout>
149 208
150 <TextView 209 <TextView
151 android:id="@+id/textView17" 210 android:id="@+id/textView17"
211 + fontPath="fonts/pf_square_sans_pro_regular.ttf"
152 android:layout_width="wrap_content" 212 android:layout_width="wrap_content"
153 android:layout_height="wrap_content" 213 android:layout_height="wrap_content"
154 android:layout_marginTop="40dp" 214 android:layout_marginTop="40dp"
155 android:textColor="#415564" 215 android:textColor="#415564"
156 - fontPath="fonts/pf_square_sans_pro_regular.ttf"
157 app:layout_constraintEnd_toEndOf="parent" 216 app:layout_constraintEnd_toEndOf="parent"
158 app:layout_constraintStart_toStartOf="parent" 217 app:layout_constraintStart_toStartOf="parent"
159 - app:layout_constraintTop_toBottomOf="@+id/view4" 218 + app:layout_constraintTop_toBottomOf="@+id/ll_barcode_container"
160 tools:text="@string/cos_coupon_date" /> 219 tools:text="@string/cos_coupon_date" />
161 220
162 <LinearLayout 221 <LinearLayout
...@@ -174,12 +233,12 @@ ...@@ -174,12 +233,12 @@
174 app:layout_constraintTop_toBottomOf="@+id/textView17"> 233 app:layout_constraintTop_toBottomOf="@+id/textView17">
175 234
176 <TextView 235 <TextView
236 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
177 android:layout_width="wrap_content" 237 android:layout_width="wrap_content"
178 android:layout_height="wrap_content" 238 android:layout_height="wrap_content"
179 android:gravity="center" 239 android:gravity="center"
180 android:text="@string/cos_gift_it" 240 android:text="@string/cos_gift_it"
181 android:textColor="@color/white" 241 android:textColor="@color/white"
182 - fontPath="fonts/pf_square_sans_pro_medium.ttf"
183 android:textSize="17dp" /> 242 android:textSize="17dp" />
184 </LinearLayout> 243 </LinearLayout>
185 244
...@@ -198,12 +257,12 @@ ...@@ -198,12 +257,12 @@
198 app:layout_constraintTop_toBottomOf="@+id/ll_gift_it"> 257 app:layout_constraintTop_toBottomOf="@+id/ll_gift_it">
199 258
200 <TextView 259 <TextView
260 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
201 android:layout_width="wrap_content" 261 android:layout_width="wrap_content"
202 android:layout_height="wrap_content" 262 android:layout_height="wrap_content"
203 android:gravity="center" 263 android:gravity="center"
204 android:text="@string/cos_shops" 264 android:text="@string/cos_shops"
205 android:textColor="@color/cos_green6" 265 android:textColor="@color/cos_green6"
206 - fontPath="fonts/pf_square_sans_pro_medium.ttf"
207 android:textSize="17dp" /> 266 android:textSize="17dp" />
208 </LinearLayout> 267 </LinearLayout>
209 268
...@@ -227,34 +286,32 @@ ...@@ -227,34 +286,32 @@
227 286
228 <TextView 287 <TextView
229 android:id="@+id/tv_terms" 288 android:id="@+id/tv_terms"
289 + fontPath="fonts/pf_square_sans_pro_regular.ttf"
230 android:layout_width="wrap_content" 290 android:layout_width="wrap_content"
231 android:layout_height="wrap_content" 291 android:layout_height="wrap_content"
232 android:text="Όροι χρήσης" 292 android:text="Όροι χρήσης"
233 - fontPath="fonts/pf_square_sans_pro_regular.ttf"
234 android:textColor="@color/grey" 293 android:textColor="@color/grey"
235 - android:textSize="15sp" /> 294 + android:textSize="16sp" />
236 295
237 <ImageView 296 <ImageView
238 android:id="@+id/iv_terms_arrow" 297 android:id="@+id/iv_terms_arrow"
239 android:layout_width="14dp" 298 android:layout_width="14dp"
240 android:layout_height="14dp" 299 android:layout_height="14dp"
241 android:layout_marginStart="6dp" 300 android:layout_marginStart="6dp"
242 - android:layout_marginTop="2dp"
243 android:src="@drawable/ic_down_dark" /> 301 android:src="@drawable/ic_down_dark" />
244 </LinearLayout> 302 </LinearLayout>
245 - </RelativeLayout>
246 303
247 - <ImageView 304 + <TextView
248 - android:id="@+id/iv_barcode" 305 + android:id="@+id/tv_terms_value"
249 - android:layout_width="284dp" 306 + fontPath="fonts/pf_square_sans_pro_regular.ttf"
250 - android:layout_height="86dp" 307 + android:layout_width="wrap_content"
251 - android:layout_marginTop="16dp" 308 + android:layout_height="wrap_content"
252 - android:scaleType="fitXY" 309 + android:layout_below="@+id/ll_terms_inner"
253 - app:layout_constraintEnd_toEndOf="parent" 310 + android:layout_marginHorizontal="32dp"
254 - app:layout_constraintHorizontal_bias="0.496" 311 + android:layout_marginTop="16dp"
255 - app:layout_constraintStart_toStartOf="parent" 312 + android:textColor="#415564"
256 - app:layout_constraintTop_toBottomOf="@+id/view5" 313 + android:visibility="gone" />
257 - tools:srcCompat="@tools:sample/avatars" /> 314 + </RelativeLayout>
258 315
259 </androidx.constraintlayout.widget.ConstraintLayout> 316 </androidx.constraintlayout.widget.ConstraintLayout>
260 </androidx.constraintlayout.widget.ConstraintLayout> 317 </androidx.constraintlayout.widget.ConstraintLayout>
......
...@@ -121,6 +121,8 @@ ...@@ -121,6 +121,8 @@
121 <string name="cos_wallet_text4">&#160;σε προσφορές από&#160;</string> 121 <string name="cos_wallet_text4">&#160;σε προσφορές από&#160;</string>
122 <string name="cos_wallet_text5">&#160;κουπόνια!</string> 122 <string name="cos_wallet_text5">&#160;κουπόνια!</string>
123 <string name="cos_value2">%1$s</string> 123 <string name="cos_value2">%1$s</string>
124 + <string name="cos_show_barcode">Εμφάνιση barcode</string>
125 + <string name="cos_hide_barcode">Απόκρυψη barcode</string>
124 126
125 <string-array name="coupons_array"> 127 <string-array name="coupons_array">
126 <item>Κουπόνια</item> 128 <item>Κουπόνια</item>
......