Panagiotis Triantafyllou

sm deals fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc64'
PUBLISH_VERSION = '4.5.4.6rc65'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -59,7 +59,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
private Coupon mCoupon;
private Couponset mCouponset;
private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false,
mShopsPressed = false, mGiftPressed = false, mEshopPressed = false;
mShopsPressed = false, mGiftPressed = false, mEshopPressed = false, mIsUnified = false;
private Merchant mMerchant;
// ===========================================================
......@@ -73,6 +73,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mCoupon = (Coupon) getIntent().getSerializableExtra("coupon");
mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false);
mIsUnified = getIntent().getBooleanExtra("isUnified", false);
mIvBack = findViewById(R.id.iv_coupon_info_back);
mTvTerms = findViewById(R.id.tv_terms);
......@@ -213,7 +214,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
// ===========================================================
private void initViews() {
if (mIsFromWallet) {
if (mIsUnified) {
mTvCouponCodeTitle.setVisibility(View.GONE);
mTvCouponCode.setVisibility(View.GONE);
mLlGiftIt.setVisibility(View.GONE);
......@@ -222,8 +223,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mLlBarcodeContainer.setVisibility(View.GONE);
mIvBarcode.setVisibility(View.GONE);
if (mIsUnified) {
mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getInnerText(), HtmlCompat.FROM_HTML_MODE_COMPACT));
} else {
mTvCouponCode.setText(mCoupon.getCoupon());
mTvCouponTitle.setText(mCoupon.getName());
}
// mTvCouponSubtitle.setText(mCoupon.getDescription());
if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
......@@ -274,12 +279,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
}
if (mMerchant != null && !TextUtils.isEmpty(mMerchant.getBody()) && !mMerchant.getBody().equals("null")) {
mTvDescription.setText(HtmlCompat.fromHtml(mMerchant.getBody(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvDescription.setMovementMethod(LinkMovementMethod.getInstance());
} else {
// if (mMerchant != null && !TextUtils.isEmpty(mMerchant.getBody()) && !mMerchant.getBody().equals("null")) {
// mTvDescription.setText(HtmlCompat.fromHtml(mMerchant.getBody(), HtmlCompat.FROM_HTML_MODE_COMPACT));
// mTvDescription.setMovementMethod(LinkMovementMethod.getInstance());
// } else {
mTvDescription.setVisibility(View.GONE);
}
// }
// if (mMerchant != null) {
// 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
// }
}
if(mIsUnified) {
mTvCouponSubtitle.setText(HtmlCompat.fromHtml(mCoupon.getDescription(), HtmlCompat.FROM_HTML_MODE_COMPACT));
} else {
mTvCouponSubtitle.setText(mCoupon.getShort_description());
}
mTvTermsValue.setText(HtmlCompat.fromHtml(mCoupon.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance());
}
......@@ -308,6 +317,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mTvCouponDate.setText(String.format(getResources().getString(R.string.cos_mycoupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
if (!TextUtils.isEmpty(mCoupon.getImage())) {
if (mIsUnified) {
mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
} else {
mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
......
......@@ -213,6 +213,7 @@ public class UnifiedCouponInfoActivity extends Activity implements View.OnClickL
Intent intent = new Intent(UnifiedCouponInfoActivity.this, CouponInfoActivity.class);
intent.putExtra("coupon", (Serializable) coupon);
intent.putExtra("isFromWallet", true);
intent.putExtra("isUnified", true);
startActivity(intent);
}
})
......
......@@ -145,6 +145,9 @@ public class Coupon implements Parcelable, Serializable {
this.created = json.optString(CREATED);
this.description = json.optString(DESCRIPTION);
this.discount = json.optString(DISCOUNT);
if (this.discount.contains(",")) {
this.discount = this.discount.replace(",", ".");
}
this.expiration = json.optString(EXPIRATION);
this.image = json.optString(IMAGE);
this.name = json.optString(NAME);
......