Panagiotis Triantafyllou

redesign supermarket part3

Showing 23 changed files with 970 additions and 159 deletions
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc51'
PUBLISH_VERSION = '4.5.4.6rc52'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -107,6 +107,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getSharingHistory(new WarplySharingHistoryRequest()
.setExcludeFilter("supermarket")
, mSharingHistoryCallback);
}
Thread.currentThread().interrupt();
......
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan;
import io.github.inflationx.calligraphy3.TypefaceUtils;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.SharingCoupon;
import ly.warp.sdk.io.models.SharingList;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.io.request.WarplySharingHistoryRequest;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.views.adapters.ExpiredCouponAdapter;
import ly.warp.sdk.views.adapters.SharedCouponAdapter;
public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private ImageView mIvBack;
private TextView mTvCouponsValueAll, mTvSharedEmpty, mTvExpiredEmpty;
private RecyclerView mRvExpiredCoupons, mRvSharedCoupons;
private ExpiredCouponAdapter mAdapterExpiredCoupons;
private SharedCouponAdapter mAdapterSharedCoupons;
private LinearLayout mLlExpiredTab, mLlSharedTab, mLlShowMoreExpired, mLlShowMoreShared;
private RelativeLayout mRlExpiredView, mRlSharedView;
private SharingList mSharedCoupons = new SharingList();
private int mTimer = 0;
private Handler mSecondsHandler;
private ArrayList<Coupon> mExpiredMarketCoupons = new ArrayList<Coupon>();
private float countValue = 0.0f;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loyalty_market_analysis);
mSecondsHandler = new Handler();
mIvBack = findViewById(R.id.iv_loyalty_analysis_close);
mTvCouponsValueAll = findViewById(R.id.tv_expired_coupons_title);
mRvExpiredCoupons = findViewById(R.id.rv_expired_coupons);
mLlExpiredTab = findViewById(R.id.cl_tab_coupon_analysis).findViewById(R.id.ll_tab_expired);
mLlSharedTab = findViewById(R.id.cl_tab_coupon_analysis).findViewById(R.id.ll_tab_shared);
mRlExpiredView = findViewById(R.id.rl_expired_view);
mRlSharedView = findViewById(R.id.rl_shared_view);
mRvSharedCoupons = findViewById(R.id.rv_shared_coupons);
mTvSharedEmpty = findViewById(R.id.tv_shared_empty);
mTvExpiredEmpty = findViewById(R.id.tv_expired_empty);
mLlShowMoreExpired = findViewById(R.id.ll_show_more_expired);
mLlShowMoreShared = findViewById(R.id.ll_show_more_shared);
if (WarplyManagerHelper.getMarketCoupons() != null && WarplyManagerHelper.getMarketCoupons().size() > 0) {
for (UnifiedCoupon unicoupon : WarplyManagerHelper.getMarketCoupons()) {
if (unicoupon.getCoupons() != null && unicoupon.getCoupons().size() > 0) {
for (Coupon inncoupon : unicoupon.getCoupons()) {
if (inncoupon.getStatus() == 0) {
countValue += Float.valueOf(inncoupon.getDiscount());
mExpiredMarketCoupons.add(inncoupon);
}
}
}
}
}
initViews();
}
@Override
public void onResume() {
super.onResume();
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "LoyaltyHistoryScreen");
mTimer = 0;
mSecondsHandler.post(new Runnable() {
@Override
public void run() {
mTimer++;
mSecondsHandler.postDelayed(this, 1000);
}
});
mSharedCoupons.clear();
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getSharingHistory(new WarplySharingHistoryRequest()
.setType("supermarket")
, mSharingHistoryCallback);
}
Thread.currentThread().interrupt();
}).start();
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onPause() {
super.onPause();
if (mSecondsHandler != null) {
mSecondsHandler.removeCallbacksAndMessages(null);
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("time_spent_on_loyalty_sdk");
analyticsEvent.setParameter("name", "GiftsCalculator");
analyticsEvent.setParameter("seconds", String.valueOf(mTimer));
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
}
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_loyalty_analysis_close) {
onBackPressed();
return;
}
if (view.getId() == R.id.ll_tab_expired) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyHistoryScreen")
.concat(":")
.concat("TabExpired"));
mLlExpiredTab.setBackgroundResource(R.drawable.bottom_border_light_blue);
TextView expiredTab = findViewById(R.id.tv_expired_tab);
expiredTab.setTextColor(ContextCompat.getColor(this, R.color.cos_light_black));
CalligraphyTypefaceSpan typefaceBoldSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
SpannableStringBuilder sBuilderExpired = new SpannableStringBuilder();
sBuilderExpired.append(getString(R.string.cos_redeemed_coupons_tab));
sBuilderExpired.setSpan(typefaceBoldSpan, 0, getString(R.string.cos_redeemed_coupons_tab).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
expiredTab.setText(sBuilderExpired, TextView.BufferType.SPANNABLE);
mLlSharedTab.setBackgroundResource(R.drawable.bottom_border_transparent);
TextView sharedTab = findViewById(R.id.tv_shared_tab);
sharedTab.setTextColor(ContextCompat.getColor(this, R.color.cos_gray2));
CalligraphyTypefaceSpan typefaceRegularSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-SemiBold.ttf"));
SpannableStringBuilder sBuilderShared = new SpannableStringBuilder();
sBuilderShared.append(getString(R.string.cos_shared_gifts_tab));
sBuilderShared.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_shared_gifts_tab).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sharedTab.setText(sBuilderShared, TextView.BufferType.SPANNABLE);
mRlSharedView.setVisibility(View.GONE);
mRlExpiredView.setVisibility(View.VISIBLE);
return;
}
if (view.getId() == R.id.ll_tab_shared) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyHistoryScreen")
.concat(":")
.concat("TabShared"));
mLlSharedTab.setBackgroundResource(R.drawable.bottom_border_light_blue);
TextView sharedTab = findViewById(R.id.tv_shared_tab);
sharedTab.setTextColor(ContextCompat.getColor(this, R.color.cos_light_black));
CalligraphyTypefaceSpan typefaceBoldSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
SpannableStringBuilder sBuilderShared = new SpannableStringBuilder();
sBuilderShared.append(getString(R.string.cos_shared_gifts_tab));
sBuilderShared.setSpan(typefaceBoldSpan, 0, getString(R.string.cos_shared_gifts_tab).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sharedTab.setText(sBuilderShared, TextView.BufferType.SPANNABLE);
mLlExpiredTab.setBackgroundResource(R.drawable.bottom_border_transparent);
TextView expiredTab = findViewById(R.id.tv_expired_tab);
expiredTab.setTextColor(ContextCompat.getColor(this, R.color.cos_gray2));
CalligraphyTypefaceSpan typefaceRegularSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-SemiBold.ttf"));
SpannableStringBuilder sBuilderExpired = new SpannableStringBuilder();
sBuilderExpired.append(getString(R.string.cos_redeemed_coupons_tab));
sBuilderExpired.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_redeemed_coupons_tab).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
expiredTab.setText(sBuilderExpired, TextView.BufferType.SPANNABLE);
mRlExpiredView.setVisibility(View.GONE);
mRlSharedView.setVisibility(View.VISIBLE);
return;
}
if (view.getId() == R.id.ll_show_more_expired) {
mLlShowMoreExpired.setVisibility(View.GONE);
mAdapterExpiredCoupons = new ExpiredCouponAdapter(this, mExpiredMarketCoupons, true);
mRvExpiredCoupons.setAdapter(mAdapterExpiredCoupons);
mAdapterExpiredCoupons.notifyDataSetChanged();
return;
}
if (view.getId() == R.id.ll_show_more_shared) {
mLlShowMoreShared.setVisibility(View.GONE);
mAdapterSharedCoupons = new SharedCouponAdapter(LoyaltyMarketAnalysisActivity.this, mSharedCoupons);
mRvSharedCoupons.setAdapter(mAdapterSharedCoupons);
mAdapterSharedCoupons.notifyDataSetChanged();
}
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
mIvBack.setOnClickListener(this);
mLlExpiredTab.setOnClickListener(this);
mLlSharedTab.setOnClickListener(this);
mLlShowMoreExpired.setOnClickListener(this);
mLlShowMoreShared.setOnClickListener(this);
mLlExpiredTab.setBackgroundResource(R.drawable.bottom_border_light_blue);
TextView expiredTab = findViewById(R.id.tv_expired_tab);
expiredTab.setTextColor(ContextCompat.getColor(this, R.color.cos_light_black));
CalligraphyTypefaceSpan typefaceBoldExpiredSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
SpannableStringBuilder sBuilderExpired = new SpannableStringBuilder();
sBuilderExpired.append(getString(R.string.cos_redeemed_coupons_tab));
sBuilderExpired.setSpan(typefaceBoldExpiredSpan, 0, getString(R.string.cos_redeemed_coupons_tab).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
expiredTab.setText(sBuilderExpired, TextView.BufferType.SPANNABLE);
mLlSharedTab.setBackgroundResource(R.drawable.bottom_border_transparent);
TextView sharedTab = findViewById(R.id.tv_shared_tab);
sharedTab.setTextColor(ContextCompat.getColor(this, R.color.cos_gray2));
CalligraphyTypefaceSpan typefaceRegularSharedSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-SemiBold.ttf"));
SpannableStringBuilder sBuilderShared = new SpannableStringBuilder();
sBuilderShared.append(getString(R.string.cos_shared_gifts_tab));
sBuilderShared.setSpan(typefaceRegularSharedSpan, 0, getString(R.string.cos_shared_gifts_tab).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sharedTab.setText(sBuilderShared, TextView.BufferType.SPANNABLE);
String badgeValue = String.format("%.02f", countValue);
SpannableStringBuilder sBuilder = new SpannableStringBuilder();
sBuilder
.append(getString(R.string.cos_wallet_text3))
.append(String.format(getString(R.string.cos_value), badgeValue))
.append(getString(R.string.cos_wallet_text4))
.append(String.format(getString(R.string.cos_value2), String.valueOf(mExpiredMarketCoupons.size())))
.append(getString(R.string.cos_wallet_text5));
CalligraphyTypefaceSpan typefaceRegularSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceRegularSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceRegularSpan3 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Regular.ttf"));
CalligraphyTypefaceSpan typefaceBoldSpan = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
CalligraphyTypefaceSpan typefaceBoldSpan2 = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilder.setSpan(typefaceRegularSpan, 0, getString(R.string.cos_wallet_text3).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceBoldSpan, getString(R.string.cos_wallet_text3).length(), getString(R.string.cos_wallet_text3).length() + String.valueOf(countValue).length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceRegularSpan2, getString(R.string.cos_wallet_text3).length() + String.valueOf(countValue).length() + 1, getString(R.string.cos_wallet_text3).length() + String.valueOf(countValue).length() + 1 + getString(R.string.cos_wallet_text4).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceBoldSpan2, getString(R.string.cos_wallet_text3).length() + String.valueOf(countValue).length() + 1 + getString(R.string.cos_wallet_text4).length(), getString(R.string.cos_wallet_text3).length() + String.valueOf(countValue).length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(mExpiredMarketCoupons.size()).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sBuilder.setSpan(typefaceRegularSpan3, getString(R.string.cos_wallet_text3).length() + String.valueOf(countValue).length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(mExpiredMarketCoupons.size()).length(), getString(R.string.cos_wallet_text3).length() + String.valueOf(countValue).length() + 1 + getString(R.string.cos_wallet_text4).length() + String.valueOf(mExpiredMarketCoupons.size()).length() + getString(R.string.cos_wallet_text5).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvCouponsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE);
if (mExpiredMarketCoupons != null && mExpiredMarketCoupons.size() > 0) {
if (mExpiredMarketCoupons.size() > 3) {
ArrayList<Coupon> tempList = new ArrayList<>(mExpiredMarketCoupons.subList(0, 3));
mRvExpiredCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterExpiredCoupons = new ExpiredCouponAdapter(this, tempList, true);
mRvExpiredCoupons.setAdapter(mAdapterExpiredCoupons);
mLlShowMoreExpired.setVisibility(View.VISIBLE);
return;
}
mRvExpiredCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterExpiredCoupons = new ExpiredCouponAdapter(this, mExpiredMarketCoupons, true);
mRvExpiredCoupons.setAdapter(mAdapterExpiredCoupons);
} else {
mTvExpiredEmpty.setVisibility(View.VISIBLE);
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
private CallbackReceiver<SharingList> mSharingHistoryCallback = new CallbackReceiver<SharingList>() {
@Override
public void onSuccess(SharingList result) {
if (result != null && result.size() > 0) {
if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
for (SharingCoupon shCoupon : result) {
for (Couponset cpnset : WarplyManagerHelper.getCouponsets()) {
if (shCoupon.getCouponsetUuid().equals(cpnset.getUuid())) {
SharingCoupon newShCoupon = new SharingCoupon();
newShCoupon = shCoupon;
newShCoupon.setName(cpnset.getName());
newShCoupon.setFinal_price(cpnset.getFinal_price());
mSharedCoupons.add(newShCoupon);
break;
}
}
}
}
}
runOnUiThread(() -> {
if (mSharedCoupons != null && mSharedCoupons.size() > 0) {
if (mSharedCoupons.size() > 3) {
ArrayList<SharingCoupon> tempList = new ArrayList<>(mSharedCoupons.subList(0, 3));
mRvSharedCoupons.setLayoutManager(new LinearLayoutManager(LoyaltyMarketAnalysisActivity.this, LinearLayoutManager.VERTICAL, false));
mAdapterSharedCoupons = new SharedCouponAdapter(LoyaltyMarketAnalysisActivity.this, tempList);
mRvSharedCoupons.setAdapter(mAdapterSharedCoupons);
mLlShowMoreShared.setVisibility(View.VISIBLE);
return;
}
mRvSharedCoupons.setLayoutManager(new LinearLayoutManager(LoyaltyMarketAnalysisActivity.this, LinearLayoutManager.VERTICAL, false));
mAdapterSharedCoupons = new SharedCouponAdapter(LoyaltyMarketAnalysisActivity.this, mSharedCoupons);
mRvSharedCoupons.setAdapter(mAdapterSharedCoupons);
} else {
mTvSharedEmpty.setVisibility(View.VISIBLE);
}
});
}
@Override
public void onFailure(int errorCode) {
WarpUtils.log("SHARED_COUPONS_ERROR " + String.valueOf(errorCode));
}
};
}
......@@ -282,8 +282,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
analyticsEvent.setEventName("did_tap_market_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
// Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class); //TODO: uncomment it
// startActivity(intent);
Intent intent = new Intent(LoyaltyWallet.this, LoyaltyMarketAnalysisActivity.class);
startActivity(intent);
}
return;
}
......@@ -391,7 +391,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
if (mUnifiedCoupons != null && mUnifiedCoupons.size() > 0) {
ArrayList<UnifiedCoupon> unilist = new ArrayList<UnifiedCoupon>();
for (UnifiedCoupon unicpn : mUnifiedCoupons) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss", Locale.US);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(unicpn.getCreated());
......@@ -401,7 +401,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
unicpn.setExpirationDate(newDate);
unilist.add(unicpn);
}
Collections.sort(unilist, (coupon1, coupon2) -> coupon2.getExpirationDate().compareTo(coupon1.getExpirationDate()));
mAdapterMarketCoupons = new MarketCouponAdapter(this, unilist);
mRvMarketCoupons.setAdapter(mAdapterMarketCoupons);
mAdapterMarketCoupons.getPositionClicks()
......
......@@ -46,6 +46,7 @@ import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.request.WarplyMerchantsRequest;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.constants.WarpConstants;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -84,10 +85,12 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
setContentView(R.layout.activity_shops);
mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
for (Merchant merchant : WarplyManagerHelper.getMerchantList()) {
if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) {
mMerchant = merchant;
break;
if (mCouponset != null) {
for (Merchant merchant : WarplyManagerHelper.getMerchantList()) {
if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) {
mMerchant = merchant;
break;
}
}
}
......@@ -189,6 +192,18 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
}
Thread.currentThread().interrupt();
}).start();
} else {
ArrayList<String> catuuids = new ArrayList<>();
catuuids.add(WarplyProperty.getAppUuid(this).equals("0086a2088301440792091b9f814c2267") ? "" : "adcace6cab6049c7b7271bc85bc2b26d"); //TODO: add live cat uuid
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest()
.setIsMultilingual(true)
.setCategories(catuuids)
, mMerchantsCallback);
}
Thread.currentThread().interrupt();
}).start();
}
}
......@@ -287,7 +302,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
private void openWebsite() {
WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
if (!TextUtils.isEmpty(mMerchant.getWebsite())) {
if (mMerchant != null && !TextUtils.isEmpty(mMerchant.getWebsite())) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(mMerchant.getWebsite()));
......
......@@ -45,6 +45,7 @@ import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.request.WarplyMerchantsRequest;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.constants.WarpConstants;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -83,10 +84,12 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
setContentView(R.layout.activity_shops_huawei);
mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
for (Merchant merchant : WarplyManagerHelper.getMerchantList()) {
if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) {
mMerchant = merchant;
break;
if (mCouponset != null) {
for (Merchant merchant : WarplyManagerHelper.getMerchantList()) {
if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) {
mMerchant = merchant;
break;
}
}
}
......@@ -190,6 +193,18 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
}
Thread.currentThread().interrupt();
}).start();
} else {
ArrayList<String> catuuids = new ArrayList<>();
catuuids.add(WarplyProperty.getAppUuid(this).equals("0086a2088301440792091b9f814c2267") ? "" : "adcace6cab6049c7b7271bc85bc2b26d"); //TODO: add live cat uuid
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest()
.setIsMultilingual(true)
.setCategories(catuuids)
, mMerchantsCallback);
}
Thread.currentThread().interrupt();
}).start();
}
}
......@@ -304,7 +319,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
private void openWebsite() {
WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
if (!TextUtils.isEmpty(mMerchant.getWebsite())) {
if (mMerchant != null && !TextUtils.isEmpty(mMerchant.getWebsite())) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(mMerchant.getWebsite()));
......
package ly.warp.sdk.io.request;
import android.text.TextUtils;
import android.util.Base64;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -24,6 +26,10 @@ public class WarplySharingHistoryRequest {
private final String KEY_ACTION = "action";
private final String KEY_ACTION_VALUE = "sharing_history";
private final String KEY_EXCLUDE = "exclude";
private final String KEY_FIELD = "field";
private final String KEY_VALUE = "value";
private final String KEY_TYPE = "couponset_types";
// ===========================================================
// Fields
......@@ -31,6 +37,8 @@ public class WarplySharingHistoryRequest {
private HashMap<String, String> mFilters;
private long mCacheUpdateInterval = 0;
private String mExcludeFilter = "";
private String mType = "";
// ===========================================================
// Constructor
......@@ -128,6 +136,16 @@ public class WarplySharingHistoryRequest {
return this;
}
public WarplySharingHistoryRequest setExcludeFilter(String excludeFilter) {
mExcludeFilter = excludeFilter;
return this;
}
public WarplySharingHistoryRequest setType(String type) {
mType = type;
return this;
}
/**
* Call this to build the offers Json object
*
......@@ -137,6 +155,19 @@ public class WarplySharingHistoryRequest {
JSONObject bodyJsonObject = new JSONObject();
try {
bodyJsonObject.putOpt(KEY_ACTION, KEY_ACTION_VALUE);
if (!TextUtils.isEmpty(mExcludeFilter)) {
JSONObject excludesKey = new JSONObject();
try {
excludesKey.putOpt(KEY_FIELD, "couponset_type");
excludesKey.putOpt(KEY_VALUE, new JSONArray().put(mExcludeFilter));
} catch (JSONException e) {
e.printStackTrace();
}
bodyJsonObject.put(KEY_EXCLUDE, new JSONArray().put(excludesKey));
}
if (!TextUtils.isEmpty(mType)) {
bodyJsonObject.put(KEY_TYPE, new JSONArray().put(mType));
}
} catch (JSONException e) {
if (WarpConstants.DEBUG)
e.printStackTrace();
......
......@@ -1252,6 +1252,7 @@ public class WarplyManagerHelper {
public static ArrayList<UnifiedCoupon> getMarketCoupons() {
return mMarketCoupons;
}
public static void setMarketCoupons( ArrayList<UnifiedCoupon> marketCoupons) {
mMarketCoupons = marketCoupons;
}
......
......@@ -2286,6 +2286,14 @@ public class WarplyManager {
jsonParams.put("active", true);
jsonParams.put("visible", true);
jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext()));
JSONObject excludesKey = new JSONObject();
try {
excludesKey.putOpt("field", "couponset_type");
excludesKey.putOpt("value", new JSONArray().put("supermarket"));
} catch (JSONException e) {
e.printStackTrace();
}
jsonParams.put("exclude", new JSONArray().put(excludesKey));
jsonParamsCouponsets.put("coupon", jsonParams);
RequestBody couponsetsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCouponsets)).toString());
......
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.os.Build;
import android.text.Html;
......@@ -9,16 +10,20 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
import ly.warp.sdk.R;
......@@ -26,33 +31,39 @@ import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.utils.WarplyManagerHelper;
public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapter.ActiveCouponViewHolder> {
private Context mContext;
private CouponList mCoupons;
private final PublishSubject<Coupon> onClickSubject = PublishSubject.create();
private boolean mIsPast = false, mIsCustom = false;
public ActiveCouponAdapter(Context mContext, CouponList campaignList) {
this.mContext = mContext;
this.mCoupons = campaignList;
this.mIsPast = false;
}
public ActiveCouponAdapter(Context mContext, CouponList campaignList, boolean past) {
this.mContext = mContext;
this.mCoupons = campaignList;
this.mIsPast = past;
}
public ActiveCouponAdapter(Context mContext, CouponList campaignList, boolean past, boolean custom) {
this.mContext = mContext;
this.mCoupons = campaignList;
this.mIsPast = past;
this.mIsCustom = custom;
}
public class ActiveCouponViewHolder extends RecyclerView.ViewHolder {
private ImageView ivCouponLogo, ivCouponBackground;
private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvDateLimit,
tvCouponDescription, tvCouponDateExpired;
private ConstraintLayout clCustomLayout;
private LinearLayout lLDateLimit;
public ActiveCouponViewHolder(View view) {
super(view);
ivCouponBackground = view.findViewById(R.id.iv_past_coupon_background);
......@@ -67,6 +78,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
lLDateLimit = view.findViewById(R.id.ll_date_limit);
}
}
@Override
public int getItemCount() {
if (mCoupons == null)
......@@ -74,14 +86,17 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
else
return mCoupons.size();
}
public Coupon getItem(int id) {
return mCoupons.get(id);
}
public void updateData(CouponList couponList) {
mCoupons.clear();
mCoupons.addAll(couponList);
notifyDataSetChanged();
}
@Override
public ActiveCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
......@@ -93,6 +108,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.active_coupon_layout, parent, false);
return new ActiveCouponViewHolder(itemView);
}
@Override
public void onBindViewHolder(final ActiveCouponViewHolder holder, int position) {
Coupon couponItem = mCoupons.get(position);
......@@ -106,13 +122,13 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder.tvCouponTitle.setAlpha(1.0f);
holder.tvCouponValue.setAlpha(1.0f);
holder.tvCouponDescription.setAlpha(1.0f);
holder.clCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background);
holder.clCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background_new2);
} else {
holder.ivCouponLogo.setAlpha(0.23f);
holder.tvCouponTitle.setAlpha(0.15f);
holder.tvCouponValue.setAlpha(0.15f);
holder.tvCouponDescription.setAlpha(0.15f);
holder.clCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background_gray);
holder.ivCouponLogo.setAlpha(0.29f);
holder.tvCouponTitle.setAlpha(0.29f);
holder.tvCouponValue.setAlpha(0.29f);
holder.tvCouponDescription.setAlpha(0.29f);
holder.clCustomLayout.setBackgroundResource(R.drawable.ic_coupon_background_new2);
}
if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
for (Merchant mer : WarplyManagerHelper.getMerchantList()) {
......@@ -197,16 +213,16 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
}
}
if (TextUtils.isEmpty(couponItem.getDiscount_type())) {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
holder.tvCouponValue.setText(couponItem.getDiscount().replace(".", ",") + mContext.getResources().getString(R.string.euro));
} else {
if (couponItem.getDiscount_type().equals("value")) {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
holder.tvCouponValue.setText(couponItem.getDiscount().replace(".", ",") + mContext.getResources().getString(R.string.euro));
} else if (couponItem.getDiscount_type().equals("percentage")) {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.percentage));
} else if (couponItem.getDiscount_type().equals("plus_one")) {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.plus_one));
} else {
holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
holder.tvCouponValue.setText(couponItem.getDiscount().replace(".", ",") + mContext.getResources().getString(R.string.euro));
}
}
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
......@@ -295,6 +311,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
}
}
private long getDaysBetweenDates(String start, String end) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Date startDate, endDate;
......@@ -308,13 +325,16 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
}
return numberOfDays;
}
private long getUnitBetweenDates(Date startDate, Date endDate, TimeUnit unit) {
long timeDiff = endDate.getTime() - startDate.getTime();
return unit.convert(timeDiff, TimeUnit.MILLISECONDS);
}
public Observable<Coupon> getPositionClicks() {
return onClickSubject.cache();
}
private long getDifferenceDays(Date d1, Date d2) {
long diff = d2.getTime() - d1.getTime();
return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
......
......@@ -32,6 +32,7 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
private Context mContext;
private /*CouponList*/ ArrayList<Coupon> mCoupons;
private final PublishSubject<Coupon> onClickSubject = PublishSubject.create();
private boolean mIsCustom = false;
public ExpiredCouponAdapter(Context mContext, CouponList campaignList) {
this.mContext = mContext;
......@@ -43,6 +44,12 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
this.mCoupons = /*(CouponList)*/ campaignList;
}
public ExpiredCouponAdapter(Context mContext, ArrayList<Coupon> campaignList, boolean custom) {
this.mContext = mContext;
this.mCoupons = /*(CouponList)*/ campaignList;
this.mIsCustom = custom;
}
public class ExpiredCouponViewHolder extends RecyclerView.ViewHolder {
private TextView tvCouponTitle, tvCouponValue, tvCouponDate;
private ImageView ivCouponLogo;
......@@ -89,6 +96,58 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
Merchant merchant = new Merchant();
if (couponItem != null) {
if (mIsCustom) {
if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
for (Merchant mer : WarplyManagerHelper.getMerchantList()) {
if (mer.getUuid().equals(couponItem.getMerchantUuid())) {
merchant = mer;
break;
}
}
}
if (merchant == null) {
holder.tvCouponTitle.setText(couponItem.getName());
if (!TextUtils.isEmpty(couponItem.getImage())) {
Glide.with(mContext)
// .setDefaultRequestOptions(
// RequestOptions
// .placeholderOf(R.drawable.ic_default_contact_photo)
// .error(R.drawable.ic_default_contact_photo))
.load(couponItem.getImage())
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivCouponLogo);
}
} else {
holder.tvCouponTitle.setText(merchant.getAdminName());
if (!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);
}
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(couponItem.getChangesDates().optString("redeemed"));
} catch (ParseException e) {
e.printStackTrace();
}
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
holder.tvCouponDate.setText(simpleDateFormat.format(newDate != null ? newDate : ""));
String itemValue = String.format("%.02f", Float.valueOf(couponItem.getDiscount()));
holder.tvCouponValue.setText(itemValue + mContext.getResources().getString(R.string.euro));
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
return;
}
if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
for (Merchant mer : WarplyManagerHelper.getMerchantList()) {
if (mer.getUuid().equals(couponItem.getMerchantUuid())) {
......@@ -118,11 +177,12 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(couponItem.getChangesDates().optString("redeemed"));
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
holder.tvCouponDate.setText(simpleDateFormat.format(newDate != null ? newDate : ""));
} catch (ParseException e) {
e.printStackTrace();
holder.tvCouponDate.setVisibility(View.GONE);
}
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
holder.tvCouponDate.setText(simpleDateFormat.format(newDate != null ? newDate : ""));
String itemValue = String.format("%.02f", couponItem.getFinal_price());
holder.tvCouponValue.setText(itemValue + mContext.getResources().getString(R.string.euro));
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F0E6E6"/>
<solid android:color="@color/cos_skyblue4"/>
<corners android:radius="10dp"/>
<padding android:left="4dp" android:top="2dp" android:right="4dp" android:bottom="2dp" />
</shape>
\ No newline at end of file
......
......@@ -30,9 +30,9 @@
android:id="@+id/v_separator"
android:layout_width="1dp"
android:layout_height="0dp"
android:layerType="software"
android:layout_marginVertical="16dp"
android:layout_marginStart="16dp"
android:layerType="software"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_active_coupon"
app:layout_constraintTop_toTopOf="parent"
......@@ -42,7 +42,6 @@
custom:dashThickness="1dp"
custom:orientation="vertical" />
<!-- app:layout_constraintEnd_toStartOf="@+id/gl_vertical_72_percent"-->
<LinearLayout
android:id="@+id/ll_coupon_info"
android:layout_width="0dp"
......@@ -65,38 +64,51 @@
android:textSize="16sp"
tools:text="Εκπτωτικο κουπονι 10$ για αγορες στα ΙΚΕΑ" />
<TextView
android:id="@+id/tv_active_coupons_value"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
android:textSize="42sp"
tools:text="10$" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_62_percent_inner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.62" />
<TextView
android:id="@+id/tv_active_coupons_value"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
android:textSize="42sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="10$" />
<TextView
android:id="@+id/tv_active_coupons_description"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="3"
android:textColor="@color/cos_light_black"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_62_percent_inner"
app:layout_constraintTop_toTopOf="parent"
tools:text="Εκπτωση με ελάχιστες αγορές 100€" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_active_coupons_date"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_gray"
android:textColor="@color/cos_light_black"
android:textSize="12sp"
tools:text="@string/cos_active_coupon_date" />
</LinearLayout>
<TextView
android:id="@+id/tv_active_coupons_description"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="32dp"
android:maxLines="3"
android:textColor="@color/cos_gray"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_72_percent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Εκπτωση με ελάχιστες αγορές 100€" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......
......@@ -115,6 +115,7 @@
android:layout_height="50dp"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="12dp"
android:includeFontPadding="false"
android:background="@drawable/banner_border_light_grey"
android:gravity="center"
android:textColor="@color/cos_light_black"
......@@ -142,7 +143,8 @@
<View
android:id="@+id/view5"
android:layout_width="320dp"
android:layout_width="match_parent"
android:layout_marginHorizontal="32dp"
android:layout_height="0.8dp"
android:background="#E6E6E6" />
......@@ -166,7 +168,8 @@
<View
android:id="@+id/view4"
android:layout_width="320dp"
android:layout_width="match_parent"
android:layout_marginHorizontal="32dp"
android:layout_height="0.8dp"
android:layout_marginTop="20dp"
android:background="#E6E6E6" />
......@@ -308,7 +311,7 @@
android:layout_height="wrap_content"
android:text="@string/cos_coupon_terms_title"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
android:textSize="15sp" />
<ImageView
android:id="@+id/iv_terms_arrow"
......
......@@ -125,7 +125,7 @@
android:layout_height="wrap_content"
android:text="@string/cos_coupon_terms_title"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
android:textSize="15sp" />
<ImageView
android:id="@+id/iv_terms_arrow"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rl_analysis_payment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cos_light_grey3">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_loyalty_analysis_header"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@color/white">
<ImageView
android:id="@+id/iv_loyalty_analysis_close"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:scaleType="centerInside"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_analysis"
android:textColor="@color/cos_light_black"
android:textSize="21sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/ll_tab_coupon_analysis"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cl_loyalty_analysis_header"
android:background="@color/white"
android:gravity="center_horizontal"
android:paddingHorizontal="12dp"
android:paddingTop="12dp"
android:paddingBottom="8dp">
<include
android:id="@+id/cl_tab_coupon_analysis"
layout="@layout/tab_coupon_analysis"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_tab_coupon_analysis"
android:overScrollMode="never"
android:scrollbars="none">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="24dp">
<ImageView
android:id="@+id/iv_gift_circle_logo"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_market_circle" />
<RelativeLayout
android:id="@+id/rl_expired_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_gift_circle_logo"
android:layout_marginTop="32dp"
tools:visibility="gone">
<LinearLayout
android:id="@+id/ll_expired_coupons_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:background="@drawable/shape_cos_white_border"
android:paddingVertical="16dp">
<TextView
android:id="@+id/tv_expired_coupons_title"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="32dp"
android:layout_marginVertical="8dp"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
tools:text="@string/cos_deals_win_title" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_expired_coupons_title"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="12dp"
android:background="@drawable/shape_cos_white_border"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp">
<TextView
android:id="@+id/tv_expired_title"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_analysis2"
android:textColor="@color/cos_light_black"
android:textSize="21sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_expired_title"
android:layout_marginTop="32dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_expired_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:overScrollMode="never" />
<LinearLayout
android:id="@+id/ll_show_more_expired"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:paddingBottom="8dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/tv_expired_more"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_see_more"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<ImageView
android:id="@+id/iv_expired_more_arrow"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginStart="6dp"
android:layout_marginTop="3dp"
android:src="@drawable/ic_down_dark_new" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/tv_expired_empty"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_expired_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="@string/cos_empty_expired_coupons"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_shared_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_gift_circle_logo"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="32dp"
android:background="@drawable/shape_cos_white_border"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp"
android:visibility="gone">
<TextView
android:id="@+id/tv_shared_title"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_analysis2"
android:textColor="@color/cos_light_black"
android:textSize="21sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_shared_title"
android:layout_marginTop="24dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_shared_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:overScrollMode="never" />
<LinearLayout
android:id="@+id/ll_show_more_shared"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:paddingBottom="8dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/tv_shared_more"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_see_more"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<ImageView
android:id="@+id/iv_shared_more_arrow"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginStart="6dp"
android:layout_marginTop="3dp"
android:src="@drawable/ic_down_dark_new" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_shared_empty"
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_shared_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="@string/cos_empty_shared_coupons"
android:textColor="@color/cos_light_grey2"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
\ No newline at end of file
......@@ -102,6 +102,7 @@
android:layout_height="50dp"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="12dp"
android:includeFontPadding="false"
android:background="@drawable/banner_border_light_grey"
android:gravity="center"
android:textColor="@color/cos_light_black"
......@@ -127,7 +128,8 @@
<View
android:id="@+id/view5"
android:layout_width="320dp"
android:layout_width="match_parent"
android:layout_marginHorizontal="32dp"
android:layout_height="0.8dp"
android:background="#E6E6E6" />
......@@ -152,7 +154,8 @@
<View
android:id="@+id/view4"
android:layout_width="320dp"
android:layout_width="match_parent"
android:layout_marginHorizontal="32dp"
android:layout_height="0.8dp"
android:layout_marginTop="20dp"
android:background="#E6E6E6" />
......@@ -175,7 +178,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="48dp"
android:layout_marginTop="24dp"
android:gravity="center"
android:orientation="horizontal">
......@@ -201,7 +204,7 @@
android:id="@+id/ll_market_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginTop="12dp"
android:background="@color/cos_light_grey3"
android:orientation="vertical">
......@@ -209,6 +212,7 @@
android:id="@+id/rv_active_market_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="8dp"
android:layout_marginHorizontal="2dp"
android:overScrollMode="never" />
</LinearLayout>
......@@ -219,7 +223,7 @@
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="24dp"
android:layout_marginTop="20dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal"
......@@ -241,7 +245,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="24dp"
android:layout_marginTop="20dp"
android:gravity="center">
<LinearLayout
......@@ -259,7 +263,7 @@
android:layout_height="wrap_content"
android:text="@string/cos_coupon_terms_title"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
android:textSize="15sp" />
<ImageView
android:id="@+id/iv_terms_arrow"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cl_custom_layout"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginHorizontal="4dp"
android:layout_marginVertical="4dp"
android:background="@drawable/ic_coupon_background">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_72_percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.72" />
android:background="@drawable/ic_coupon_background_new2">
<ImageView
android:id="@+id/iv_active_coupon"
......@@ -26,122 +20,140 @@
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_gifts_for_you" />
<View
<ly.warp.sdk.views.DividerView
android:id="@+id/v_separator"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_height="0dp"
android:layout_marginVertical="16dp"
android:layout_marginStart="8dp"
android:background="@drawable/shape_dashed_vertical"
android:layout_marginStart="16dp"
android:layerType="software"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_active_coupon"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
custom:color="@color/cos_gray"
custom:dashGap="10dp"
custom:dashLength="10dp"
custom:dashThickness="1dp"
custom:orientation="vertical" />
<LinearLayout
android:id="@+id/ll_coupon_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginHorizontal="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_72_percent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/v_separator"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_active_coupons_title"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#3A5266"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
tools:text="Εκπτωτικο κουπονι 10$ για αγορες στα ΙΚΕΑ" />
<TextView
android:id="@+id/tv_active_coupons_value"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#3A5266"
android:textSize="42sp"
tools:text="10$" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_62_percent_inner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.62" />
<TextView
android:id="@+id/tv_active_coupons_value"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
android:textSize="42sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="10$" />
<TextView
android:id="@+id/tv_active_coupons_description"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="3"
android:textColor="@color/cos_light_black"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_62_percent_inner"
app:layout_constraintTop_toTopOf="parent"
tools:text="Εκπτωση με ελάχιστες αγορές 100€" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_active_coupons_date"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#617181"
android:textColor="@color/cos_light_black"
android:textSize="12sp"
android:visibility="gone"
tools:text="@string/cos_active_coupon_date" />
<TextView
android:id="@+id/tv_active_coupons_date_expired"
fontPath="fonts/pf_square_sans_pro_bold.ttf"
fontPath="fonts/PeridotPE-SemiBold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#617181"
android:textColor="@color/cos_light_black"
android:textSize="12sp"
android:visibility="gone"
tools:text="@string/cos_market_coupon_expired" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_date_limit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_market_limit"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone"
android:layout_marginBottom="36dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_coupon_info"
app:layout_constraintStart_toEndOf="@+id/v_separator"
tools:visibility="visible">
<!-- <ImageView-->
<!-- android:layout_width="14dp"-->
<!-- android:layout_height="14dp"-->
<!-- android:layout_marginEnd="4dp"-->
<!-- android:src="@drawable/timer_red" />-->
<TextView
fontPath="fonts/pf_square_sans_pro_medium.ttf"
<LinearLayout
android:id="@+id/ll_date_limit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_date_limit"
android:textColor="#617181"
android:textSize="12sp" />
android:background="@drawable/shape_market_limit"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/v_separator"
app:layout_constraintTop_toBottomOf="@+id/ll_coupon_info"
tools:visibility="visible">
<TextView
android:id="@+id/tv_active_coupons_date_limit"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_date_limit"
android:textColor="#FF6B6B"
android:textSize="12sp"
tools:text="@string/cos_coupon_date_limit2" />
</LinearLayout>
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginEnd="4dp"
android:src="@drawable/timer_blue" />
<TextView
android:id="@+id/tv_active_coupons_description"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="32dp"
android:maxLines="4"
android:textColor="#617181"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_72_percent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Εκπτωση με ελάχιστες αγορές 100€" />
<TextView
fontPath="fonts/PeridotPE-SemiBold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_date_limit"
android:includeFontPadding="false"
android:textColor="@color/cos_light_black"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_active_coupons_date_limit"
fontPath="fonts/PeridotPE-SemiBold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_date_limit"
android:includeFontPadding="false"
android:textColor="@color/cos_blue6"
android:textSize="12sp"
tools:text="@string/cos_coupon_date_limit2" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......
......@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginBottom="24dp">
android:layout_marginBottom="12dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
......@@ -43,7 +43,7 @@
android:layout_marginHorizontal="12dp"
android:gravity="center"
android:maxLines="4"
android:textColor="@color/grey"
android:textColor="@color/cos_light_black"
fontPath="fonts/PeridotPE-Regular.ttf"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/gl_vertical_60_percent"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="150dp"
......@@ -26,25 +27,30 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
<ly.warp.sdk.views.DividerView
android:id="@+id/v_separator"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginVertical="16dp"
android:layout_marginStart="8dp"
android:background="@drawable/shape_dashed_vertical"
android:layout_marginStart="16dp"
android:layerType="software"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_market_coupon"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
custom:color="@color/cos_gray"
custom:dashGap="10dp"
custom:dashLength="10dp"
custom:dashThickness="1dp"
custom:orientation="vertical" />
<LinearLayout
android:id="@+id/ll_coupon_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginHorizontal="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_72_percent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/v_separator"
app:layout_constraintTop_toTopOf="parent">
......@@ -55,17 +61,17 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="3"
android:text="@string/cos_market_item_title"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:text="@string/cos_market_item_title" />
android:textSize="16sp" />
<TextView
fontPath="fonts/pf_square_sans_pro_bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#3A5266"
android:textSize="22sp"
android:text="" />
android:textSize="22sp" />
<TextView
android:id="@+id/tv_market_coupons_date"
......@@ -83,8 +89,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="32dp"
android:maxLines="4"
android:layout_marginEnd="16dp"
android:maxLines="3"
android:textColor="@color/cos_light_black"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -72,4 +72,6 @@
<color name="cos_gray2">#848484</color>
<color name="cos_light_blue">#00A5E3</color>
<color name="cos_grey_dark2">#32485A</color>
<color name="cos_blue6">#004B87</color>
<color name="cos_skyblue4">#B8E0EF</color>
</resources>
\ No newline at end of file
......