Panagiotis Triantafyllou

sm deals fixes

...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2 2
3 ext { 3 ext {
4 PUBLISH_GROUP_ID = 'ly.warp' 4 PUBLISH_GROUP_ID = 'ly.warp'
5 - PUBLISH_VERSION = '4.5.4.6rc64' 5 + PUBLISH_VERSION = '4.5.4.6rc65'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -59,7 +59,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -59,7 +59,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
59 private Coupon mCoupon; 59 private Coupon mCoupon;
60 private Couponset mCouponset; 60 private Couponset mCouponset;
61 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false, 61 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
62 - mShopsPressed = false, mGiftPressed = false, mEshopPressed = false; 62 + mShopsPressed = false, mGiftPressed = false, mEshopPressed = false, mIsUnified = false;
63 private Merchant mMerchant; 63 private Merchant mMerchant;
64 64
65 // =========================================================== 65 // ===========================================================
...@@ -73,6 +73,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -73,6 +73,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
73 73
74 mCoupon = (Coupon) getIntent().getSerializableExtra("coupon"); 74 mCoupon = (Coupon) getIntent().getSerializableExtra("coupon");
75 mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false); 75 mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false);
76 + mIsUnified = getIntent().getBooleanExtra("isUnified", false);
76 77
77 mIvBack = findViewById(R.id.iv_coupon_info_back); 78 mIvBack = findViewById(R.id.iv_coupon_info_back);
78 mTvTerms = findViewById(R.id.tv_terms); 79 mTvTerms = findViewById(R.id.tv_terms);
...@@ -213,7 +214,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -213,7 +214,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
213 // =========================================================== 214 // ===========================================================
214 215
215 private void initViews() { 216 private void initViews() {
216 - if (mIsFromWallet) { 217 + if (mIsUnified) {
217 mTvCouponCodeTitle.setVisibility(View.GONE); 218 mTvCouponCodeTitle.setVisibility(View.GONE);
218 mTvCouponCode.setVisibility(View.GONE); 219 mTvCouponCode.setVisibility(View.GONE);
219 mLlGiftIt.setVisibility(View.GONE); 220 mLlGiftIt.setVisibility(View.GONE);
...@@ -222,8 +223,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -222,8 +223,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
222 mLlBarcodeContainer.setVisibility(View.GONE); 223 mLlBarcodeContainer.setVisibility(View.GONE);
223 mIvBarcode.setVisibility(View.GONE); 224 mIvBarcode.setVisibility(View.GONE);
224 225
225 - mTvCouponCode.setText(mCoupon.getCoupon()); 226 + if (mIsUnified) {
226 - mTvCouponTitle.setText(mCoupon.getName()); 227 + mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getInnerText(), HtmlCompat.FROM_HTML_MODE_COMPACT));
228 + } else {
229 + mTvCouponCode.setText(mCoupon.getCoupon());
230 + mTvCouponTitle.setText(mCoupon.getName());
231 + }
227 // mTvCouponSubtitle.setText(mCoupon.getDescription()); 232 // mTvCouponSubtitle.setText(mCoupon.getDescription());
228 233
229 if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) { 234 if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
...@@ -274,12 +279,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -274,12 +279,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
274 } 279 }
275 } 280 }
276 281
277 - if (mMerchant != null && !TextUtils.isEmpty(mMerchant.getBody()) && !mMerchant.getBody().equals("null")) { 282 +// if (mMerchant != null && !TextUtils.isEmpty(mMerchant.getBody()) && !mMerchant.getBody().equals("null")) {
278 - mTvDescription.setText(HtmlCompat.fromHtml(mMerchant.getBody(), HtmlCompat.FROM_HTML_MODE_COMPACT)); 283 +// mTvDescription.setText(HtmlCompat.fromHtml(mMerchant.getBody(), HtmlCompat.FROM_HTML_MODE_COMPACT));
279 - mTvDescription.setMovementMethod(LinkMovementMethod.getInstance()); 284 +// mTvDescription.setMovementMethod(LinkMovementMethod.getInstance());
280 - } else { 285 +// } else {
281 - mTvDescription.setVisibility(View.GONE); 286 + mTvDescription.setVisibility(View.GONE);
282 - } 287 +// }
283 288
284 // if (mMerchant != null) { 289 // if (mMerchant != null) {
285 // if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("show_map") && (mMerchant.getExtraFields().optBoolean("show_map") || mMerchant.getExtraFields().optString("show_map").equals("true"))) { 290 // if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("show_map") && (mMerchant.getExtraFields().optBoolean("show_map") || mMerchant.getExtraFields().optString("show_map").equals("true"))) {
...@@ -291,7 +296,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -291,7 +296,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
291 // } 296 // }
292 } 297 }
293 298
294 - mTvCouponSubtitle.setText(mCoupon.getShort_description()); 299 + if(mIsUnified) {
300 + mTvCouponSubtitle.setText(HtmlCompat.fromHtml(mCoupon.getDescription(), HtmlCompat.FROM_HTML_MODE_COMPACT));
301 + } else {
302 + mTvCouponSubtitle.setText(mCoupon.getShort_description());
303 + }
295 mTvTermsValue.setText(HtmlCompat.fromHtml(mCoupon.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT)); 304 mTvTermsValue.setText(HtmlCompat.fromHtml(mCoupon.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT));
296 mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance()); 305 mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance());
297 } 306 }
...@@ -308,6 +317,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -308,6 +317,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
308 mTvCouponDate.setText(String.format(getResources().getString(R.string.cos_mycoupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); 317 mTvCouponDate.setText(String.format(getResources().getString(R.string.cos_mycoupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
309 318
310 if (!TextUtils.isEmpty(mCoupon.getImage())) { 319 if (!TextUtils.isEmpty(mCoupon.getImage())) {
320 + if (mIsUnified) {
321 + mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
322 + } else {
323 + mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_CROP);
324 + }
325 +
311 Glide.with(this) 326 Glide.with(this)
312 // .setDefaultRequestOptions( 327 // .setDefaultRequestOptions(
313 // RequestOptions 328 // RequestOptions
......
...@@ -213,6 +213,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL ...@@ -213,6 +213,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
213 Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class); 213 Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class);
214 intent.putExtra("coupon", (Serializable) coupon); 214 intent.putExtra("coupon", (Serializable) coupon);
215 intent.putExtra("isFromWallet", true); 215 intent.putExtra("isFromWallet", true);
216 + intent.putExtra("isUnified", true);
216 startActivity(intent); 217 startActivity(intent);
217 } 218 }
218 }) 219 })
......
...@@ -145,6 +145,9 @@ public class Coupon implements Parcelable, Serializable { ...@@ -145,6 +145,9 @@ public class Coupon implements Parcelable, Serializable {
145 this.created = json.optString(CREATED); 145 this.created = json.optString(CREATED);
146 this.description = json.optString(DESCRIPTION); 146 this.description = json.optString(DESCRIPTION);
147 this.discount = json.optString(DISCOUNT); 147 this.discount = json.optString(DISCOUNT);
148 + if (this.discount.contains(",")) {
149 + this.discount = this.discount.replace(",", ".");
150 + }
148 this.expiration = json.optString(EXPIRATION); 151 this.expiration = json.optString(EXPIRATION);
149 this.image = json.optString(IMAGE); 152 this.image = json.optString(IMAGE);
150 this.name = json.optString(NAME); 153 this.name = json.optString(NAME);
......