Panagiotis Triantafyllou

more for you screen

......@@ -94,7 +94,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mTvCouponCode.setText(mCoupon.getCoupon());
mTvCouponTitle.setText(mCoupon.getName());
mTvCouponSubtitle.setText(mCoupon.getDescription());
String strCurrentDate = mCoupon.getCreated();
String strCurrentDate = mCoupon.getExpiration();
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
Date newDate = new Date();
try {
......
......@@ -67,8 +67,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mTvTitle.setText(getIntent().getStringExtra("title"));
if (WarplyManagerHelper.getUniqueCampaignList().get("more_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("more_for_you").size() > 0) {
mRecyclerMore.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mAdapterMore = new ProfileCampaignAdapter(this, WarplyManagerHelper.getUniqueCampaignList().get("more_for_you"));
mRecyclerMore.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterMore = new ProfileCampaignAdapter(this, WarplyManagerHelper.getUniqueCampaignList().get("more_for_you"), true);
mRecyclerMore.setAdapter(mAdapterMore);
mAdapterMore.getPositionClicks()
.doOnNext(gift -> {
......
......@@ -22,8 +22,6 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
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.CouponsetsList;
......@@ -101,13 +99,16 @@ public class CouponsetsAdapter extends RecyclerView.Adapter<CouponsetsAdapter.Co
holder.tvCouponTitle.setText(couponsetItem.getName());
holder.tvCouponDescription.setText(Html.fromHtml(couponsetItem.getDescription()));
Date date = null;
String strCurrentDate = couponsetItem.getExpiration();
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
Date newDate = new Date();
try {
date = new SimpleDateFormat().parse(couponsetItem.getExpiration());
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_active_coupon_date), String.valueOf(getDifferenceDays(date, new Date()))));
newDate = format.parse(strCurrentDate);
} catch (ParseException e) {
e.printStackTrace();
}
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), format.format(newDate)));
holder.tvCouponValue.setText(couponsetItem.getDiscount());
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponsetItem));
......
......@@ -27,21 +27,37 @@ public class ProfileCampaignAdapter extends RecyclerView.Adapter<ProfileCampaign
private Context mContext;
private CampaignList mCampaigns;
private final PublishSubject<Campaign> onClickSubject = PublishSubject.create();
private boolean mIsVertical = false;
public ProfileCampaignAdapter(Context mContext, CampaignList campaignList) {
this.mContext = mContext;
this.mCampaigns = campaignList;
this.mIsVertical = false;
}
public ProfileCampaignAdapter(Context mContext, CampaignList campaignList, boolean vertical) {
this.mContext = mContext;
this.mCampaigns = campaignList;
this.mIsVertical = vertical;
}
public class ProfileCampaignViewHolder extends RecyclerView.ViewHolder {
private ImageView ivCampaignTitle;
private TextView tvCampaignTitle;
private TextView tvCampaignTitle, tvCampaignSubtitle;
public ProfileCampaignViewHolder(View view) {
super(view);
ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo);
tvCampaignTitle = view.findViewById(R.id.tv_campaign_title);
}
public ProfileCampaignViewHolder(View view, boolean vertical) {
super(view);
ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo);
tvCampaignTitle = view.findViewById(R.id.tv_campaign_title);
if (vertical)
tvCampaignSubtitle = view.findViewById(R.id.tv_campaign_subtitle);
}
}
@Override
......@@ -63,11 +79,16 @@ public class ProfileCampaignAdapter extends RecyclerView.Adapter<ProfileCampaign
notifyDataSetChanged();
}
@Override
public ProfileCampaignViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler, parent, false);
return new ProfileCampaignViewHolder(itemView);
View itemView;
if (!mIsVertical) {
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler, parent, false);
return new ProfileCampaignViewHolder(itemView);
} else {
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler_vertical, parent, false);
return new ProfileCampaignViewHolder(itemView, true);
}
}
@Override
......@@ -88,6 +109,8 @@ public class ProfileCampaignAdapter extends RecyclerView.Adapter<ProfileCampaign
}
holder.tvCampaignTitle.setText(campaignItem.getTitle());
if (mIsVertical)
holder.tvCampaignSubtitle.setText(campaignItem.getSubtitle());
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(campaignItem));
}
......
......@@ -100,13 +100,16 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
holder.tvCouponTitle.setText(couponItem.getName());
holder.tvCouponDescription.setText(couponItem.getDescription());
Date date = null;
String strCurrentDate = couponItem.getExpiration();
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
Date newDate = new Date();
try {
date = new SimpleDateFormat().parse(couponItem.getExpiration());
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_active_coupon_date), String.valueOf(getDifferenceDays(date, new Date()))));
newDate = format.parse(strCurrentDate);
} catch (ParseException e) {
e.printStackTrace();
}
holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), format.format(newDate)));
holder.tvCouponValue.setText(couponItem.getDiscount());
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
......
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="318.547dp"
android:height="237dp"
android:viewportWidth="318.547"
android:viewportHeight="237">
<path
android:fillColor="#fff"
android:pathData="M318.546,237H5a5.006,5.006,0,0,1-5-5V5A5.006,5.006,0,0,1,5,0H212.609A73.158,73.158,0,0,1,268.8,66h0.2V187a49.958,49.958,0,0,0,49.546,50Z" />
</vector>
\ No newline at end of file
......@@ -6,12 +6,6 @@
android:background="@android:color/white"
android:fillViewport="true">
<!-- <LinearLayout-->
<!-- android:id="@+id/cl_bill_payment"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="vertical">-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_more_header"
android:layout_width="match_parent"
......@@ -48,43 +42,16 @@
android:layout_height="match_parent"
android:layout_below="@+id/cl_more_header"
android:background="@drawable/shape_cos_profile_gradient"
android:orientation="vertical"
android:paddingBottom="24dp">
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_more"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="48dp"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingEnd="24dp" />
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:id="@+id/cl_recycler_inner3"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_below="@+id/cl_recycler_inner2"-->
<!-- android:layout_marginTop="36dp"-->
<!-- android:paddingBottom="4dp"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_coupons_title"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="10dp"-->
<!-- android:text="@string/cos_coupons_title"-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textSize="18sp"-->
<!-- android:textStyle="bold"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
android:paddingBottom="24dp" />
</RelativeLayout>
<!-- </LinearLayout>-->
</RelativeLayout>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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:layout_width="match_parent"
android:layout_height="240dp"
android:layout_marginBottom="16dp"
app:cardCornerRadius="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/selector_cos_campaign">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_80_percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.8" />
<ImageView
android:id="@+id/iv_campaign_logo"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_cosmote_logo_horizontal_grey" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/svg_background_more"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_80_percent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_vertical_80_percent_inner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.8" />
<TextView
android:id="@+id/tv_campaign_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="20dp"
android:maxLines="2"
android:textColor="@color/blue_dark"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_80_percent_inner"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="ΔΙΑΓΩΝΙΣΜΟΣ ΑΓΙΟΥ ΒΑΛΕΝΤΙΝΟΥ!" />
<TextView
android:id="@+id/tv_campaign_subtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginBottom="20dp"
android:maxLines="4"
android:textColor="@color/blue_dark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_80_percent_inner"
app:layout_constraintStart_toStartOf="parent"
tools:text="Σπάσε την πινιάτα και κέρδισε μοναδικά δώρα εσύ και το ταίρι σου!" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
......@@ -26,4 +26,5 @@
<color name="cos_green4">#6DBC7A</color>
<color name="cos_green5">#79BF14</color>
<color name="cos_green5_tr">#6679BF14</color>
<color name="blue_dark">#3A5266</color>
</resources>
\ No newline at end of file
......
......@@ -26,7 +26,7 @@
<string name="cos_gifts_loyalty_title">Τα δώρα μου</string>
<string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string>
<string name="cos_coupon_info_title">Εκπτωτικό κουπόνι</string>
<string name="cos_coupon_date">Το κουπόνι ισχύει έως %1$s</string>
<string name="cos_coupon_date">Ισχύει έως %1$s</string>
<string name="cos_dl_title">Μόλις έλαβες δώρο %1$s συμμετοχές στο My Lucky Day Draw!</string>
<string name="cos_active_coupons">Έχεις %1$s ενεργά\nκουπόνια</string>
<string name="cos_active_coupon_date">Λήγει σε %1$s ημέρες</string>
......