Panagiotis Triantafyllou

feedback fixes

......@@ -81,6 +81,7 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
mFontHeader = findViewById(R.id.textView3);
mIvInfo = findViewById(R.id.iv_coupons_info);
mClInfoView = findViewById(R.id.cl_info_view);
mClInfoView.setOnTouchListener((v, event) -> true);
mTvInnerTitle = mClInfoView.findViewById(R.id.tv_inner_title);
mTvInnerSubtitle = mClInfoView.findViewById(R.id.tv_inner_subtitle);
mIvInfoClose = mClInfoView.findViewById(R.id.iv_loyalty_history_close);
......@@ -136,7 +137,7 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getRefreshUnifiedCouponsAdded() != null) {
if (event.getRefreshUnifiedCouponsAdded() != null || event.getRefreshVouchersEventModel() != null) {
WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
}
}
......@@ -208,6 +209,7 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().isEmpty()
&& WarplyManagerHelper.getSmCouponsList() != null && WarplyManagerHelper.getSmCouponsList().isEmpty()) {
mTvEmptyUnifiedCoupons.setVisibility(View.VISIBLE);
mLlActivateunified.setVisibility(View.GONE);
}
......
......@@ -442,6 +442,21 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mLlActiveGiftIt.setVisibility(View.VISIBLE);
mLlShops.setVisibility(View.GONE);
mLlSMFindIt.setVisibility(View.VISIBLE);
} else if (mIsUnified) {
if (TextUtils.isEmpty(mCoupon.getDiscount_type())) {
mTvActiveSmCouponValue.setText("-" + mCoupon.getDiscount().replace(".", ",") + getString(R.string.euro));
} else {
if (mCoupon.getDiscount_type().equals("value")) {
mTvActiveSmCouponValue.setText("-" + mCoupon.getDiscount().replace(".", ",") + getString(R.string.euro));
} else if (mCoupon.getDiscount_type().equals("percentage")) {
mTvActiveSmCouponValue.setText("-" + mCoupon.getDiscount() + getString(R.string.percentage));
} else if (mCoupon.getDiscount_type().equals("plus_one")) {
mTvActiveSmCouponValue.setText(mCoupon.getDiscount() + getString(R.string.plus_one));
} else {
mTvActiveSmCouponValue.setText("-" + mCoupon.getDiscount().replace(".", ",") + getString(R.string.euro));
}
}
mLlActiveSmCouponValue.setVisibility(View.VISIBLE);
}
} else {
if (mCoupon.getMerchantDetails() != null) {
......@@ -478,19 +493,26 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
}
if (mIsUnified) {
if (mIsUnified || mIsActiveUnified) {
mIvCouponPhoto.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
if (mCoupon != null) {
if (!TextUtils.isEmpty(mCoupon.getImage())) {
if (mCoupon.getCouponsetDetails().getImg() != null && mCoupon.getCouponsetDetails().getImg().length() > 0) {
try {
String couponImage = (String) mCoupon.getCouponsetDetails().getImg().get(0);
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(mCoupon.getImage())
.load(couponImage)
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(mIvCouponPhoto);
} catch (JSONException e) {
Glide.with(this)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(mIvCouponPhoto);
}
} else {
Glide.with(this)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
......@@ -591,6 +613,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mErrorAlertDialog = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_error_supermarket)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
mIsFindItPressed = false;
dialogPositive.dismiss();
})
.setCancelable(false)
......
......@@ -480,13 +480,13 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
/** Vouchers */
return;
}
if (event.getUnifiedCouponsAdded() != null) {
if (event.getUnifiedCouponsAdded() != null || event.getRefreshUnifiedCouponsAdded() != null || event.getRefreshVouchersEventModel() != null) {
Handler mUIHandler = new Handler(Looper.getMainLooper());
mUIHandler.post(() -> {
if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0)
mTvUnifiedCountBadge.setText(String.valueOf(WarplyManagerHelper.getMarketCouponsList().size()));
else
mTvUnifiedCountBadge.setText("0");
// if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0)
mTvUnifiedCountBadge.setText(String.valueOf(WarplyManagerHelper.getMarketCouponsList().size() + WarplyManagerHelper.getSmCouponsList().size()));
// else
// mTvUnifiedCountBadge.setText("0");
// checkHistoryEmpty();
checkForEmpty();
});
......@@ -690,10 +690,10 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
/** Deals Badge */
/** Unified Coupons List */
if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0)
mTvUnifiedCountBadge.setText(String.valueOf(WarplyManagerHelper.getMarketCouponsList().size()));
else
mTvUnifiedCountBadge.setText("0");
// if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0)
mTvUnifiedCountBadge.setText(String.valueOf(WarplyManagerHelper.getMarketCouponsList().size() + WarplyManagerHelper.getSmCouponsList().size()));
// else
// mTvUnifiedCountBadge.setText("0");
/** Unified Coupons List */
/** Coupon List */
......
......@@ -193,7 +193,12 @@ public class Couponset implements Parcelable, Serializable {
this.created = json.optString(CREATED);
this.updated = json.optString(UPDATED);
this.app_uuid = json.optString(APP_UUID);
this.img = json.optJSONArray(IMG);
// this.img = json.optJSONArray(IMG);
try {
this.img = new JSONArray(json.optString(IMG));
} catch (JSONException e) {
e.printStackTrace();
}
this.img_preview = json.optString(IMG_PREVIEW);
this.sorting = json.optInt(SORTING);
this.active = json.optBoolean(ACTIVE);
......@@ -236,7 +241,12 @@ public class Couponset implements Parcelable, Serializable {
this.admin_name = json.optString(ADMIN_NAME);
this.created = json.optString(CREATED);
this.updated = json.optString(UPDATED);
this.img = json.optJSONArray(IMG);
// this.img = json.optJSONArray(IMG);
try {
this.img = new JSONArray(json.optString(IMG));
} catch (JSONException e) {
e.printStackTrace();
}
this.active = json.optBoolean(ACTIVE);
this.buyable = json.optBoolean(BUYABLE);
this.name = json.optString(NAME);
......
......@@ -545,7 +545,12 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
// EventBus.getDefault().post(new WarplyEventBusManager(openMyRewards));
//Now the client does nothing, the sdk opens the active unified screen
WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
/* New Addition start */
// WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), ActiveUnifiedCouponsActivity.class);
getContext().startActivity(intent);
/* New Addition end */
RefreshVouchersEventModel vouchersRefreshed = new RefreshVouchersEventModel();
vouchersRefreshed.setRefreshed(true);
......@@ -949,19 +954,19 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
}
}
private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
@Override
public void onSuccess(ArrayList<UnifiedCoupon> result) {
Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), ActiveUnifiedCouponsActivity.class);
getContext().startActivity(intent);
}
@Override
public void onFailure(int errorCode) {
Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), ActiveUnifiedCouponsActivity.class);
getContext().startActivity(intent);
}
};
// private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
// @Override
// public void onSuccess(ArrayList<UnifiedCoupon> result) {
// Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), ActiveUnifiedCouponsActivity.class);
// getContext().startActivity(intent);
// }
//
// @Override
// public void onFailure(int errorCode) {
// Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), ActiveUnifiedCouponsActivity.class);
// getContext().startActivity(intent);
// }
// };
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
......
......@@ -30,6 +30,7 @@ import io.reactivex.subjects.PublishSubject;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
......@@ -160,6 +161,13 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
}
}
for (Couponset cpns : WarplyManagerHelper.getCouponsetsDeals()) {
if (cpns.getUuid().equals(couponItem.getCouponsetUuid())) {
couponItem.setCouponsetDetails(cpns);
break;
}
}
if (couponItem.getStatus() == 1) {
holder.ivCouponLogo.setAlpha(1.0f);
holder.tvCouponTitle.setAlpha(1.0f);
......@@ -174,7 +182,23 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder.clCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background_new2);
}
if (merchant != null && !TextUtils.isEmpty(merchant.getImgPreview())) {
/* New Addition start */
// if (merchant != null && !TextUtils.isEmpty(merchant.getImgPreview())) {
// Glide.with(mContext)
//// .setDefaultRequestOptions(
//// RequestOptions
//// .placeholderOf(R.drawable.ic_default_contact_photo)
//// .error(R.drawable.ic_default_contact_photo))
// .load(merchant.getImgPreview())
// .diskCacheStrategy(DiskCacheStrategy.DATA)
// .into(holder.ivCouponLogo);
// } else {
// Glide.with(mContext)
// .load(R.drawable.ic_cosmote_logo_horizontal_grey)
// .into(holder.ivCouponLogo);
// }
if (!TextUtils.isEmpty(couponItem.getCouponsetDetails().getImgPreview())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
......@@ -188,6 +212,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCouponLogo);
}
/* New Addition end */
holder.tvCouponTitle.setText(!TextUtils.isEmpty(merchant.getAdminName()) ? merchant.getAdminName() : couponItem.getName());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
......@@ -268,6 +293,22 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
});
}
if (mIsActiveSM) {
if (!TextUtils.isEmpty(couponItem.getCouponsetDetails().getImgPreview())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(couponItem.getCouponsetDetails().getImgPreview())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCouponLogo);
} else {
Glide.with(mContext)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCouponLogo);
}
} else {
if (!TextUtils.isEmpty(couponItem.getMerchantDetails().getImgPreview())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
......@@ -291,6 +332,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivCouponLogo);
}
}
if (!TextUtils.isEmpty(couponItem.getMerchantDetails().getAdminName()))
holder.tvCouponTitle.setText(couponItem.getMerchantDetails().getAdminName());
......
......@@ -58,7 +58,7 @@
android:id="@+id/cl_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginHorizontal="14dp"
android:layout_marginTop="48dp"
android:translationZ="1dp"
android:visibility="gone"
......@@ -81,8 +81,8 @@
android:layout_height="wrap_content"
android:background="@drawable/background_grey_shadow"
android:orientation="horizontal"
android:paddingTop="20dp"
android:paddingBottom="16dp"
android:paddingTop="18dp"
android:paddingBottom="14dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_arrow">
......@@ -115,10 +115,10 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp"
android:layout_marginTop="14dp"
android:text="@string/cos_market_subtitle"
android:textColor="@color/cos_light_black"
android:textSize="17sp"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_inner_title" />
......@@ -127,11 +127,11 @@
android:id="@+id/tv_inner_close"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginTop="14dp"
android:layout_marginEnd="24dp"
android:text="@string/cos_market_close"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_inner_subtitle" />
......