Panagiotis Triantafyllou

uat fixes and changes

......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("6012049321"), //6012049321, 6012049322, 6012049323
.setGuid("6012049139"), //6012049321, 6012049322, 6012049323
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -46,7 +46,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
private ImageView mIvBack, mIvCouponPhoto, mIvBarcode;
private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate,
mTvTermsValue;
mTvTermsValue, mTvFullBarcode;
private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms;
private Coupon mCoupon;
private Couponset mCouponset;
......@@ -77,6 +77,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mLlBarcodeContainer = findViewById(R.id.ll_barcode_container_items);
mLlTerms = findViewById(R.id.ll_terms_inner);
mTvTermsValue = findViewById(R.id.tv_terms_value);
mTvFullBarcode = findViewById(R.id.tv_full_barcode);
initViews();
}
......@@ -149,7 +150,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
private void initViews() {
mTvCouponCode.setText(mCoupon.getCoupon());
mTvCouponTitle.setText(mCoupon.getName());
mTvCouponSubtitle.setText(mCoupon.getDescription());
// mTvCouponSubtitle.setText(mCoupon.getDescription());
if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
for (Couponset couponset : WarplyManagerHelper.getCouponsets()) {
......@@ -161,6 +162,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
if (mCouponset != null) {
mTvCouponSubtitle.setText(mCouponset.getShortDescription());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
mTvTermsValue.setText(Html.fromHtml(mCouponset.getTerms(), Html.FROM_HTML_MODE_COMPACT));
} else {
......@@ -219,6 +221,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
}
mIvBarcode.setImageBitmap(bmp);
mTvFullBarcode.setText(barcodeString);
} catch (Exception e) {
e.printStackTrace();
......
......@@ -61,6 +61,7 @@ public class Coupon implements Parcelable, Serializable {
private static final String CHANGES_DATES = "changes_dates";
private static final String COUPONSET_UUID = "couponset_uuid";
private static final String MERCHANT_UUID = "merchant_uuid";
private static final String INNER_TEXT = "inner_text";
/* Member variables of the Campaign object */
......@@ -79,6 +80,7 @@ public class Coupon implements Parcelable, Serializable {
private JSONObject changesDates = new JSONObject();
private String couponsetUuid = "";
private String merchantUuid = "";
private String innerText = "";
/**
* Basic constructor used to create an object from a String, representing a
......@@ -113,6 +115,7 @@ public class Coupon implements Parcelable, Serializable {
this.changesDates = json.optJSONObject(CHANGES_DATES);
this.couponsetUuid = json.optString(COUPONSET_UUID);
this.merchantUuid = json.optString(MERCHANT_UUID);
this.innerText = json.optString(INNER_TEXT);
}
}
......@@ -131,6 +134,7 @@ public class Coupon implements Parcelable, Serializable {
this.transactionUuid = source.readString();
this.couponsetUuid = source.readString();
this.merchantUuid = source.readString();
this.innerText = source.readString();
}
@Override
......@@ -149,6 +153,7 @@ public class Coupon implements Parcelable, Serializable {
dest.writeString(this.transactionUuid);
dest.writeString(this.couponsetUuid);
dest.writeString(this.merchantUuid);
dest.writeString(this.innerText);
}
/**
......@@ -174,6 +179,7 @@ public class Coupon implements Parcelable, Serializable {
jObj.putOpt(CHANGES_DATES, this.changesDates);
jObj.putOpt(COUPONSET_UUID, this.couponsetUuid);
jObj.putOpt(MERCHANT_UUID, this.merchantUuid);
jObj.putOpt(INNER_TEXT, this.innerText);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
......@@ -333,6 +339,14 @@ public class Coupon implements Parcelable, Serializable {
this.merchantUuid = merchantUuid;
}
public String getInnerText() {
return innerText;
}
public void setInnerText(String innerText) {
this.innerText = innerText;
}
@Override
public int describeContents() {
return 0;
......
......@@ -73,6 +73,7 @@ public class Couponset implements Parcelable, Serializable {
private static final String TERMS = "terms";
private static final String AVAILABILITY = "availability";
private static final String MERCHANT_UUID = "merchant_uuid";
private static final String INNER_TEXT = "inner_text";
/* Member variables of the Campaign object */
......@@ -102,6 +103,7 @@ public class Couponset implements Parcelable, Serializable {
private String terms = "";
private int availability = 0;
private String merchantUuid = "";
private String innerText = "";
/**
* Basic constructor used to create an object from a String, representing a
......@@ -153,6 +155,7 @@ public class Couponset implements Parcelable, Serializable {
this.terms = json.optString(TERMS);
this.availability = json.optInt(AVAILABILITY);
this.merchantUuid = json.optString(MERCHANT_UUID);
this.innerText = json.optString(INNER_TEXT);
}
}
......@@ -180,6 +183,7 @@ public class Couponset implements Parcelable, Serializable {
this.terms = source.readString();
this.availability = source.readInt();
this.merchantUuid = source.readString();
this.innerText = source.readString();
}
@Override
......@@ -207,6 +211,7 @@ public class Couponset implements Parcelable, Serializable {
dest.writeString(this.terms);
dest.writeInt(this.availability);
dest.writeString(this.merchantUuid);
dest.writeString(this.innerText);
}
/**
......@@ -242,6 +247,7 @@ public class Couponset implements Parcelable, Serializable {
jObj.putOpt(TERMS, this.terms);
jObj.putOpt(AVAILABILITY, this.availability);
jObj.putOpt(MERCHANT_UUID, this.merchantUuid);
jObj.putOpt(INNER_TEXT, this.innerText);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
......@@ -381,6 +387,10 @@ public class Couponset implements Parcelable, Serializable {
return merchantUuid;
}
public String getInnerText() {
return innerText;
}
@Override
public int describeContents() {
return 0;
......
......@@ -2189,6 +2189,7 @@ public class WarplyManager {
coupon.setImage(couponset.getImgPreview());
coupon.setName(couponset.getName());
coupon.setMerchantUuid(couponset.getMerchantUuid());
coupon.setInnerText(couponset.getInnerText());
mCouponList.add(coupon);
}
}
......
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.os.Build;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
......@@ -126,8 +128,13 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
}
holder.tvCouponTitle.setText(couponItem.getName());
if (!mIsPast)
holder.tvCouponDescription.setText(couponItem.getDescription());
if (!mIsPast) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText(), Html.FROM_HTML_MODE_COMPACT));
} else {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText()));
}
}
} else {
if (!TextUtils.isEmpty(merchant.getImage())) {
Glide.with(mContext)
......@@ -145,8 +152,13 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
}
holder.tvCouponTitle.setText(merchant.getAdminName());
if (!mIsPast)
holder.tvCouponDescription.setText(merchant.getShortDescription());
if (!mIsPast) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText(), Html.FROM_HTML_MODE_COMPACT));
} else {
holder.tvCouponDescription.setText(Html.fromHtml(couponItem.getInnerText()));
}
}
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
......
......@@ -167,6 +167,15 @@
app:layout_constraintTop_toBottomOf="@+id/view5"
tools:srcCompat="@tools:sample/avatars" />
<TextView
android:id="@+id/tv_full_barcode"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:textColor="@color/grey"
android:textSize="20sp"
tools:text="@string/cos_show_barcode" />
<View
android:id="@+id/view4"
......