Showing
13 changed files
with
292 additions
and
5 deletions
This diff is collapsed. Click to expand it.
| 1 | +/* | ||
| 2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
| 3 | + * | ||
| 4 | + * Redistribution and use in source and binary forms, without modification, are | ||
| 5 | + * permitted provided that the following conditions are met: | ||
| 6 | + * | ||
| 7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
| 8 | + * this list of conditions and the following disclaimer. | ||
| 9 | + * | ||
| 10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
| 11 | + * this list of conditions and the following disclaimer in the documentation | ||
| 12 | + * and/or other materials provided with the distribution. | ||
| 13 | + * | ||
| 14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
| 15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
| 17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
| 20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
| 21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| 22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
| 23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 24 | + */ | ||
| 25 | + | ||
| 26 | +package ly.warp.sdk.io.models; | ||
| 27 | + | ||
| 28 | +/** | ||
| 29 | + * Created by Panagiotis Triantafyllou on 10-May-22. | ||
| 30 | + */ | ||
| 31 | + | ||
| 32 | +public class MergedGifts { | ||
| 33 | + private int dataType = 0; | ||
| 34 | + private Couponset couponset; | ||
| 35 | + private Campaign campaign; | ||
| 36 | + | ||
| 37 | + public void setDataType(int dataType) { | ||
| 38 | + this.dataType = dataType; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public void setCouponset(Couponset couponset) { | ||
| 42 | + this.couponset = couponset; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public void setCampaign(Campaign campaign) { | ||
| 46 | + this.campaign = campaign; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public int getDataType() { | ||
| 50 | + return dataType; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public Couponset getCouponset() { | ||
| 54 | + return couponset; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public Campaign getCampaign() { | ||
| 58 | + return campaign; | ||
| 59 | + } | ||
| 60 | +} |
| ... | @@ -127,6 +127,10 @@ public class WarpUtils { | ... | @@ -127,6 +127,10 @@ public class WarpUtils { |
| 127 | + "device_info_data"; | 127 | + "device_info_data"; |
| 128 | private static final String PREFERENCES_KEY_LIFECYCLE_ANALYTICS_ENABLED = PREFERENCES_PREFIX | 128 | private static final String PREFERENCES_KEY_LIFECYCLE_ANALYTICS_ENABLED = PREFERENCES_PREFIX |
| 129 | + "lifecycle_analytics_enabled"; | 129 | + "lifecycle_analytics_enabled"; |
| 130 | + private static final String PREFERENCES_KEY_GIFTS_POPUP = PREFERENCES_PREFIX | ||
| 131 | + + "gifts_popup"; | ||
| 132 | + private static final String PREFERENCES_KEY_MORE_POPUP = PREFERENCES_PREFIX | ||
| 133 | + + "more_popup"; | ||
| 130 | 134 | ||
| 131 | private static SharedPreferences _prefs; | 135 | private static SharedPreferences _prefs; |
| 132 | 136 | ||
| ... | @@ -180,6 +184,28 @@ public class WarpUtils { | ... | @@ -180,6 +184,28 @@ public class WarpUtils { |
| 180 | editor.apply(); | 184 | editor.apply(); |
| 181 | } | 185 | } |
| 182 | 186 | ||
| 187 | + public static boolean getGiftsPopup(Context context) { | ||
| 188 | + SharedPreferences prefs = getPreferences(context); | ||
| 189 | + return prefs.getBoolean(PREFERENCES_KEY_GIFTS_POPUP, true); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + public static void setGiftsPopup(Context context, boolean visible) { | ||
| 193 | + SharedPreferences.Editor editor = getPreferences(context).edit(); | ||
| 194 | + editor.putBoolean(PREFERENCES_KEY_GIFTS_POPUP, visible); | ||
| 195 | + editor.apply(); | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + public static boolean getMorePopup(Context context) { | ||
| 199 | + SharedPreferences prefs = getPreferences(context); | ||
| 200 | + return prefs.getBoolean(PREFERENCES_KEY_MORE_POPUP, true); | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + public static void setMorePopup(Context context, boolean visible) { | ||
| 204 | + SharedPreferences.Editor editor = getPreferences(context).edit(); | ||
| 205 | + editor.putBoolean(PREFERENCES_KEY_MORE_POPUP, visible); | ||
| 206 | + editor.apply(); | ||
| 207 | + } | ||
| 208 | + | ||
| 183 | static boolean isRegisteredGCMOrWaiting(Context context) { | 209 | static boolean isRegisteredGCMOrWaiting(Context context) { |
| 184 | 210 | ||
| 185 | return isRegisteredGCM(context) || isWaitingGCM(context); | 211 | return isRegisteredGCM(context) || isWaitingGCM(context); | ... | ... |
| 1 | +package ly.warp.sdk.views.adapters; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.text.TextUtils; | ||
| 5 | +import android.view.LayoutInflater; | ||
| 6 | +import android.view.View; | ||
| 7 | +import android.view.ViewGroup; | ||
| 8 | +import android.widget.ImageView; | ||
| 9 | +import android.widget.TextView; | ||
| 10 | + | ||
| 11 | +import androidx.recyclerview.widget.RecyclerView; | ||
| 12 | + | ||
| 13 | +import com.bumptech.glide.Glide; | ||
| 14 | +import com.bumptech.glide.load.engine.DiskCacheStrategy; | ||
| 15 | +import com.bumptech.glide.load.resource.bitmap.CenterCrop; | ||
| 16 | +import com.bumptech.glide.load.resource.bitmap.RoundedCorners; | ||
| 17 | + | ||
| 18 | +import java.util.ArrayList; | ||
| 19 | +import java.util.Date; | ||
| 20 | +import java.util.concurrent.TimeUnit; | ||
| 21 | + | ||
| 22 | +import io.reactivex.Observable; | ||
| 23 | +import io.reactivex.subjects.PublishSubject; | ||
| 24 | +import ly.warp.sdk.R; | ||
| 25 | +import ly.warp.sdk.io.models.MergedGifts; | ||
| 26 | + | ||
| 27 | +public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.MergedGiftsViewHolder> { | ||
| 28 | + | ||
| 29 | + private Context mContext; | ||
| 30 | + private ArrayList<MergedGifts> mMergedGifts; | ||
| 31 | + private final PublishSubject<MergedGifts> onClickSubject = PublishSubject.create(); | ||
| 32 | + | ||
| 33 | + public MergedGiftsAdapter(Context mContext, ArrayList<MergedGifts> mergedgifts) { | ||
| 34 | + this.mContext = mContext; | ||
| 35 | + this.mMergedGifts = mergedgifts; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public class MergedGiftsViewHolder extends RecyclerView.ViewHolder { | ||
| 39 | + private ImageView ivMergedGiftsLogo; | ||
| 40 | + private TextView tvMergedGiftsTitle; | ||
| 41 | + | ||
| 42 | + public MergedGiftsViewHolder(View view) { | ||
| 43 | + super(view); | ||
| 44 | + ivMergedGiftsLogo = view.findViewById(R.id.iv_campaign_logo); | ||
| 45 | + tvMergedGiftsTitle = view.findViewById(R.id.tv_campaign_title); | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @Override | ||
| 50 | + public int getItemCount() { | ||
| 51 | + if (mMergedGifts == null) | ||
| 52 | + return 0; | ||
| 53 | + else | ||
| 54 | + return mMergedGifts.size(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + public MergedGifts getItem(int id) { | ||
| 59 | + return mMergedGifts.get(id); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void updateData(ArrayList<MergedGifts> mergedgifts) { | ||
| 63 | + mMergedGifts.clear(); | ||
| 64 | + mMergedGifts.addAll(mergedgifts); | ||
| 65 | + notifyDataSetChanged(); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public MergedGiftsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
| 71 | + View itemView; | ||
| 72 | + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_merged_gifts_recycler, parent, false); | ||
| 73 | + return new MergedGiftsViewHolder(itemView); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @Override | ||
| 77 | + public void onBindViewHolder(final MergedGiftsViewHolder holder, int position) { | ||
| 78 | + MergedGifts mergedgiftsItem = mMergedGifts.get(position); | ||
| 79 | + if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 1) { | ||
| 80 | + if (!TextUtils.isEmpty(mergedgiftsItem.getCampaign().getLogoUrl())) { | ||
| 81 | + Glide.with(mContext) | ||
| 82 | + .load(mergedgiftsItem.getCampaign().getLogoUrl()) | ||
| 83 | + .transform(new CenterCrop(), new RoundedCorners(4)) | ||
| 84 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
| 85 | + .into(holder.ivMergedGiftsLogo); | ||
| 86 | + } else { | ||
| 87 | + Glide.with(mContext) | ||
| 88 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
| 89 | + .into(holder.ivMergedGiftsLogo); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + holder.tvMergedGiftsTitle.setText(mergedgiftsItem.getCampaign().getTitle()); | ||
| 93 | + } else if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 2) { | ||
| 94 | + if (!TextUtils.isEmpty(mergedgiftsItem.getCouponset().getImgPreview())) { | ||
| 95 | + Glide.with(mContext) | ||
| 96 | +// .setDefaultRequestOptions( | ||
| 97 | +// RequestOptions | ||
| 98 | +// .placeholderOf(R.drawable.ic_default_contact_photo) | ||
| 99 | +// .error(R.drawable.ic_default_contact_photo)) | ||
| 100 | + .load(mergedgiftsItem.getCouponset().getImgPreview()) | ||
| 101 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
| 102 | + .into(holder.ivMergedGiftsLogo); | ||
| 103 | + } else { | ||
| 104 | + Glide.with(mContext) | ||
| 105 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
| 106 | + .into(holder.ivMergedGiftsLogo); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + holder.tvMergedGiftsTitle.setText(mergedgiftsItem.getCouponset().getName()); | ||
| 110 | +// holder.tvMergedGiftsTitle.setText(Html.fromHtml(mergedgiftsItem.getCouponset().getDescription())); | ||
| 111 | + | ||
| 112 | +// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
| 113 | +// Date newDate = new Date(); | ||
| 114 | +// try { | ||
| 115 | +// newDate = simpleDateFormat.parse(mergedgiftsItem.getExpiration()); | ||
| 116 | +// } catch (ParseException e) { | ||
| 117 | +// e.printStackTrace(); | ||
| 118 | +// } | ||
| 119 | +// simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); | ||
| 120 | +// holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
| 121 | +// | ||
| 122 | +// holder.tvCouponValue.setText(mergedgiftsItem.getDiscount()); | ||
| 123 | + } | ||
| 124 | + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedgiftsItem)); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public Observable<MergedGifts> getPositionClicks() { | ||
| 128 | + return onClickSubject.cache(); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + private long getDifferenceDays(Date d1, Date d2) { | ||
| 132 | + long diff = d2.getTime() - d1.getTime(); | ||
| 133 | + return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); | ||
| 134 | + } | ||
| 135 | +} |
486 Bytes
3.73 KB
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + android:shape="rectangle"> | ||
| 4 | + <gradient | ||
| 5 | + android:startColor="@color/cos_blue3" | ||
| 6 | + android:endColor="@color/cos_green8" | ||
| 7 | + android:type="linear"/> | ||
| 8 | + <corners | ||
| 9 | + android:radius="8dp"/> | ||
| 10 | +</shape> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -25,7 +25,7 @@ | ... | @@ -25,7 +25,7 @@ |
| 25 | <shape xmlns:android="http://schemas.android.com/apk/res/android" | 25 | <shape xmlns:android="http://schemas.android.com/apk/res/android" |
| 26 | android:shape="rectangle"> | 26 | android:shape="rectangle"> |
| 27 | <corners android:topLeftRadius="30dp" /> | 27 | <corners android:topLeftRadius="30dp" /> |
| 28 | - <solid android:color="@color/grey_light" /> | 28 | + <solid android:color="@color/cos_grey5" /> |
| 29 | 29 | ||
| 30 | <!-- <stroke--> | 30 | <!-- <stroke--> |
| 31 | <!-- android:width="1dp"--> | 31 | <!-- android:width="1dp"--> | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -93,7 +93,7 @@ | ... | @@ -93,7 +93,7 @@ |
| 93 | <RelativeLayout | 93 | <RelativeLayout |
| 94 | android:layout_width="match_parent" | 94 | android:layout_width="match_parent" |
| 95 | android:layout_height="match_parent" | 95 | android:layout_height="match_parent" |
| 96 | - android:background="@drawable/shape_cos_profile_gradient" | 96 | + android:background="@drawable/shape_cos_loyalty" |
| 97 | android:orientation="vertical" | 97 | android:orientation="vertical" |
| 98 | android:paddingBottom="24dp"> | 98 | android:paddingBottom="24dp"> |
| 99 | 99 | ... | ... |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 4 | + xmlns:tools="http://schemas.android.com/tools" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="150dp" | ||
| 7 | + android:layout_marginHorizontal="16dp" | ||
| 8 | + android:layout_marginBottom="24dp" | ||
| 9 | + app:cardCornerRadius="4dp"> | ||
| 10 | + | ||
| 11 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
| 12 | + android:layout_width="match_parent" | ||
| 13 | + android:layout_height="match_parent" | ||
| 14 | + android:background="@drawable/selector_cos_campaign"> | ||
| 15 | + | ||
| 16 | + <androidx.constraintlayout.widget.Guideline | ||
| 17 | + android:id="@+id/gl_vertical_60_percent" | ||
| 18 | + android:layout_width="wrap_content" | ||
| 19 | + android:layout_height="wrap_content" | ||
| 20 | + android:orientation="vertical" | ||
| 21 | + app:layout_constraintGuide_percent="0.6" /> | ||
| 22 | + | ||
| 23 | + <ImageView | ||
| 24 | + android:id="@+id/iv_campaign_logo" | ||
| 25 | + android:layout_width="0dp" | ||
| 26 | + android:layout_height="0dp" | ||
| 27 | + android:scaleType="centerCrop" | ||
| 28 | + app:layout_constraintBottom_toBottomOf="parent" | ||
| 29 | + app:layout_constraintHorizontal_bias="0.0" | ||
| 30 | + app:layout_constraintLeft_toLeftOf="parent" | ||
| 31 | + app:layout_constraintRight_toLeftOf="@+id/gl_vertical_60_percent" | ||
| 32 | + app:layout_constraintTop_toTopOf="parent" | ||
| 33 | + app:layout_constraintVertical_bias="0.0" | ||
| 34 | + tools:src="@drawable/ic_cosmote_logo_horizontal_grey" /> | ||
| 35 | + | ||
| 36 | + <TextView | ||
| 37 | + android:id="@+id/tv_campaign_title" | ||
| 38 | + android:layout_width="0dp" | ||
| 39 | + android:layout_height="wrap_content" | ||
| 40 | + android:layout_marginHorizontal="12dp" | ||
| 41 | + android:gravity="center" | ||
| 42 | + android:maxLines="4" | ||
| 43 | + android:textColor="@color/grey" | ||
| 44 | + app:layout_constraintBottom_toBottomOf="parent" | ||
| 45 | + app:layout_constraintLeft_toRightOf="@+id/gl_vertical_60_percent" | ||
| 46 | + app:layout_constraintRight_toRightOf="parent" | ||
| 47 | + app:layout_constraintTop_toTopOf="parent" | ||
| 48 | + tools:text="-10% in all products from IKEA" /> | ||
| 49 | + | ||
| 50 | + </androidx.constraintlayout.widget.ConstraintLayout> | ||
| 51 | +</androidx.cardview.widget.CardView> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -40,4 +40,7 @@ | ... | @@ -40,4 +40,7 @@ |
| 40 | <color name="cos_dark_blue">#355168</color> | 40 | <color name="cos_dark_blue">#355168</color> |
| 41 | <color name="cos_grey4">#617181</color> | 41 | <color name="cos_grey4">#617181</color> |
| 42 | <color name="grey_light3">#E3E3E3</color> | 42 | <color name="grey_light3">#E3E3E3</color> |
| 43 | + <color name="cos_grey5">#385267</color> | ||
| 44 | + <color name="cos_blue3">#03A1D6</color> | ||
| 45 | + <color name="cos_green8">#3AB588</color> | ||
| 43 | </resources> | 46 | </resources> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -14,8 +14,8 @@ | ... | @@ -14,8 +14,8 @@ |
| 14 | <string name="cos_profile_title">My Loyalty Wallet</string> | 14 | <string name="cos_profile_title">My Loyalty Wallet</string> |
| 15 | <string name="cos_deals_title">Deals for You</string> | 15 | <string name="cos_deals_title">Deals for You</string> |
| 16 | <string name="cos_profile_more">Δες περισσότερα</string> | 16 | <string name="cos_profile_more">Δες περισσότερα</string> |
| 17 | - <string name="cos_gifts_title">Gifts for You</string> | 17 | + <string name="cos_gifts_title">GIFTS for YOU</string> |
| 18 | - <string name="cos_more_title">More for You</string> | 18 | + <string name="cos_more_title">MORE for YOU</string> |
| 19 | <string name="menu_home">Αρχική</string> | 19 | <string name="menu_home">Αρχική</string> |
| 20 | <string name="menu_explore">Ανακάλυψε</string> | 20 | <string name="menu_explore">Ανακάλυψε</string> |
| 21 | <string name="menu_shop">Shop</string> | 21 | <string name="menu_shop">Shop</string> |
| ... | @@ -55,12 +55,14 @@ | ... | @@ -55,12 +55,14 @@ |
| 55 | <string name="cos_analysis2">Αναλυτικά</string> | 55 | <string name="cos_analysis2">Αναλυτικά</string> |
| 56 | <string name="euro">€</string> | 56 | <string name="euro">€</string> |
| 57 | <string name="cos_profile_questionnaire">+ Ερωτηματολόγιο</string> | 57 | <string name="cos_profile_questionnaire">+ Ερωτηματολόγιο</string> |
| 58 | - <string name="cos_active_all_coupons">Όλα τα κουπόνια μου</string> | 58 | + <string name="cos_active_all_coupons">Ενεργά κουπόνια</string> |
| 59 | <string name="cos_active_all_rewards">Όλα τα δώρα μου</string> | 59 | <string name="cos_active_all_rewards">Όλα τα δώρα μου</string> |
| 60 | <string name="cos_no_active_coupons">Δεν υπάρχουν κουπόνια</string> | 60 | <string name="cos_no_active_coupons">Δεν υπάρχουν κουπόνια</string> |
| 61 | <string name="cos_no_active_rewards">Δεν υπάρχουν δώρα</string> | 61 | <string name="cos_no_active_rewards">Δεν υπάρχουν δώρα</string> |
| 62 | <string name="cos_past_all_coupons">Παλαιότερα κουπόνια</string> | 62 | <string name="cos_past_all_coupons">Παλαιότερα κουπόνια</string> |
| 63 | <string name="cos_coupon_expired_date">Εξαργυρώθηκε την %1$s</string> | 63 | <string name="cos_coupon_expired_date">Εξαργυρώθηκε την %1$s</string> |
| 64 | + <string name="cos_popup_gifts_title">COSMOTE GIFTS FOR YOU</string> | ||
| 65 | + <string name="cos_popup_gifts_subtitle">Εδώ μπορείς να βρεις τα διαθέσιμα\nδώρα και προσφορές!</string> | ||
| 64 | 66 | ||
| 65 | <string-array name="coupons_array"> | 67 | <string-array name="coupons_array"> |
| 66 | <item>Κουπόνια</item> | 68 | <item>Κουπόνια</item> | ... | ... |
-
Please register or login to post a comment