Showing
15 changed files
with
589 additions
and
34 deletions
| ... | @@ -87,6 +87,11 @@ | ... | @@ -87,6 +87,11 @@ |
| 87 | android:screenOrientation="portrait" /> | 87 | android:screenOrientation="portrait" /> |
| 88 | 88 | ||
| 89 | <activity | 89 | <activity |
| 90 | + android:name="ly.warp.sdk.activities.ActiveGiftsActivity" | ||
| 91 | + android:exported="false" | ||
| 92 | + android:screenOrientation="portrait" /> | ||
| 93 | + | ||
| 94 | + <activity | ||
| 90 | android:name="ly.warp.sdk.dexter.PermissionsActivity" | 95 | android:name="ly.warp.sdk.dexter.PermissionsActivity" |
| 91 | android:exported="false" | 96 | android:exported="false" |
| 92 | android:launchMode="singleInstance" | 97 | android:launchMode="singleInstance" | ... | ... |
| 1 | +package ly.warp.sdk.activities; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.Intent; | ||
| 5 | +import android.os.Bundle; | ||
| 6 | +import android.view.View; | ||
| 7 | +import android.widget.ImageView; | ||
| 8 | + | ||
| 9 | +import androidx.recyclerview.widget.LinearLayoutManager; | ||
| 10 | +import androidx.recyclerview.widget.RecyclerView; | ||
| 11 | + | ||
| 12 | +import java.io.Serializable; | ||
| 13 | +import java.util.ArrayList; | ||
| 14 | + | ||
| 15 | +import ly.warp.sdk.R; | ||
| 16 | +import ly.warp.sdk.io.models.Campaign; | ||
| 17 | +import ly.warp.sdk.io.models.CampaignList; | ||
| 18 | +import ly.warp.sdk.io.models.Coupon; | ||
| 19 | +import ly.warp.sdk.io.models.CouponList; | ||
| 20 | +import ly.warp.sdk.io.models.MergedActiveGifts; | ||
| 21 | +import ly.warp.sdk.utils.WarplyManagerHelper; | ||
| 22 | +import ly.warp.sdk.views.adapters.MergedActiveGiftsAdapter; | ||
| 23 | + | ||
| 24 | + | ||
| 25 | +public class ActiveGiftsActivity extends Activity implements View.OnClickListener { | ||
| 26 | + | ||
| 27 | + // =========================================================== | ||
| 28 | + // Constants | ||
| 29 | + // =========================================================== | ||
| 30 | + | ||
| 31 | + // =========================================================== | ||
| 32 | + // Fields | ||
| 33 | + // =========================================================== | ||
| 34 | + | ||
| 35 | + private ImageView mIvBack; | ||
| 36 | + private ArrayList<MergedActiveGifts> mData = new ArrayList(); | ||
| 37 | + private RecyclerView mRecyclerMergedActiveGifts; | ||
| 38 | + private MergedActiveGiftsAdapter mAdapterMergedActiveGifts; | ||
| 39 | + | ||
| 40 | + // =========================================================== | ||
| 41 | + // Methods for/from SuperClass/Interfaces | ||
| 42 | + // =========================================================== | ||
| 43 | + @Override | ||
| 44 | + public void onCreate(Bundle savedInstanceState) { | ||
| 45 | + super.onCreate(savedInstanceState); | ||
| 46 | + setContentView(R.layout.activity_active_gifts); | ||
| 47 | + | ||
| 48 | + mergeDatasets( | ||
| 49 | + /*WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you")*/null, | ||
| 50 | + WarplyManagerHelper.getCouponList() | ||
| 51 | + ); | ||
| 52 | + | ||
| 53 | + mIvBack = findViewById(R.id.iv_list_close); | ||
| 54 | + | ||
| 55 | + mRecyclerMergedActiveGifts = findViewById(R.id.rv_merged_active_gifts); | ||
| 56 | + | ||
| 57 | + initViews(); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @Override | ||
| 61 | + public void onResume() { | ||
| 62 | + super.onResume(); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Override | ||
| 66 | + public void onClick(View view) { | ||
| 67 | + if (view.getId() == R.id.iv_list_close) { | ||
| 68 | + onBackPressed(); | ||
| 69 | + return; | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + // =========================================================== | ||
| 74 | + // Methods | ||
| 75 | + // =========================================================== | ||
| 76 | + | ||
| 77 | + private void initViews() { | ||
| 78 | + mIvBack.setOnClickListener(this); | ||
| 79 | + | ||
| 80 | + if (mData != null && mData.size() > 0) { | ||
| 81 | + mRecyclerMergedActiveGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ||
| 82 | + mAdapterMergedActiveGifts = new MergedActiveGiftsAdapter(this, mData); | ||
| 83 | + mRecyclerMergedActiveGifts.setAdapter(mAdapterMergedActiveGifts); | ||
| 84 | + mAdapterMergedActiveGifts.getPositionClicks() | ||
| 85 | + .doOnNext(dataItem -> { | ||
| 86 | + if (dataItem.getDataType() == 1) { | ||
| 87 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | ||
| 88 | + } else if (dataItem.getDataType() == 2) { | ||
| 89 | + Intent intent = new Intent(ActiveGiftsActivity.this, CouponInfoActivity.class); | ||
| 90 | + intent.putExtra("coupon", (Serializable) dataItem.getCoupon()); | ||
| 91 | + startActivity(intent); | ||
| 92 | + } | ||
| 93 | + }) | ||
| 94 | + .doOnError(error -> { | ||
| 95 | + }) | ||
| 96 | + .subscribe(); | ||
| 97 | + } else { | ||
| 98 | +// mClCouponsOuter.setVisibility(View.GONE); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + private ArrayList<MergedActiveGifts> mergeDatasets(CampaignList campaignList, CouponList couponsList) { | ||
| 103 | + if (campaignList != null && campaignList.size() > 0) { | ||
| 104 | + for (Campaign campaign : campaignList) { | ||
| 105 | + MergedActiveGifts data = new MergedActiveGifts(); | ||
| 106 | + data.setCampaign(campaign); | ||
| 107 | + data.setCoupon(null); | ||
| 108 | + data.setDataType(1); | ||
| 109 | + mData.add(data); | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + if (couponsList.size() > 0) { | ||
| 114 | + for (Coupon coupon : couponsList) { | ||
| 115 | + MergedActiveGifts data = new MergedActiveGifts(); | ||
| 116 | + data.setCampaign(null); | ||
| 117 | + data.setCoupon(coupon); | ||
| 118 | + data.setDataType(2); | ||
| 119 | + mData.add(data); | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + return mData; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + // =========================================================== | ||
| 127 | + // Inner and Anonymous Classes | ||
| 128 | + // =========================================================== | ||
| 129 | + | ||
| 130 | +} |
| ... | @@ -31,7 +31,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -31,7 +31,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
| 31 | private ImageView mIvBack; | 31 | private ImageView mIvBack; |
| 32 | private TextView mTvUsername, mTvActiveCoupons, | 32 | private TextView mTvUsername, mTvActiveCoupons, |
| 33 | mTvActiveRewards, mTvUserBadge; | 33 | mTvActiveRewards, mTvUserBadge; |
| 34 | - private ConstraintLayout mClActiveCoupons, mClActiveRewards; | 34 | + private ConstraintLayout mClActiveCoupons, mClActiveRewards, mClActiveGifts; |
| 35 | private LinearLayout mLlAnalysisButton, mLlQuestionnaire, mLlUserBadge, | 35 | private LinearLayout mLlAnalysisButton, mLlQuestionnaire, mLlUserBadge, |
| 36 | mLlPastCoupons; | 36 | mLlPastCoupons; |
| 37 | 37 | ||
| ... | @@ -49,13 +49,16 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -49,13 +49,16 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
| 49 | mTvUsername = findViewById(R.id.tv_name); | 49 | mTvUsername = findViewById(R.id.tv_name); |
| 50 | mLlQuestionnaire = findViewById(R.id.ll_user_questionnaire); | 50 | mLlQuestionnaire = findViewById(R.id.ll_user_questionnaire); |
| 51 | mLlUserBadge = findViewById(R.id.ll_user_badge); | 51 | mLlUserBadge = findViewById(R.id.ll_user_badge); |
| 52 | - mClActiveCoupons = findViewById(R.id.cl_loyalty_coupon); | 52 | + /**** Old functionality ****/ |
| 53 | - mTvActiveCoupons = findViewById(R.id.tv_active_coupons); | 53 | +// mClActiveCoupons = findViewById(R.id.cl_loyalty_coupon); |
| 54 | - mClActiveRewards = findViewById(R.id.cl_loyalty_rewards); | 54 | +// mTvActiveCoupons = findViewById(R.id.tv_active_coupons); |
| 55 | - mTvActiveRewards = findViewById(R.id.tv_active_rewards); | 55 | +// mClActiveRewards = findViewById(R.id.cl_loyalty_rewards); |
| 56 | - mLlAnalysisButton = findViewById(R.id.ll_analysis); | 56 | +// mLlAnalysisButton = findViewById(R.id.ll_analysis); |
| 57 | +// mLlPastCoupons = findViewById(R.id.ll_old_coupons); | ||
| 58 | + /**** Old functionality ****/ | ||
| 59 | + mTvActiveRewards = findViewById(R.id.tv_active_deals_text); | ||
| 57 | mTvUserBadge = findViewById(R.id.tv_type); | 60 | mTvUserBadge = findViewById(R.id.tv_type); |
| 58 | - mLlPastCoupons = findViewById(R.id.ll_old_coupons); | 61 | + mClActiveGifts = findViewById(R.id.cl_mygifts); |
| 59 | 62 | ||
| 60 | initViews(); | 63 | initViews(); |
| 61 | } | 64 | } |
| ... | @@ -71,11 +74,13 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -71,11 +74,13 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
| 71 | onBackPressed(); | 74 | onBackPressed(); |
| 72 | return; | 75 | return; |
| 73 | } | 76 | } |
| 74 | - if (view.getId() == R.id.ll_analysis) { | 77 | + /**** Old functionality ****/ |
| 75 | - Intent intent = new Intent(this, LoyaltyActivity.class); | 78 | +// if (view.getId() == R.id.ll_analysis) { |
| 76 | - startActivity(intent); | 79 | +// Intent intent = new Intent(this, LoyaltyActivity.class); |
| 77 | - return; | 80 | +// startActivity(intent); |
| 78 | - } | 81 | +// return; |
| 82 | +// } | ||
| 83 | + /**** Old functionality ****/ | ||
| 79 | if (view.getId() == R.id.ll_user_questionnaire) { | 84 | if (view.getId() == R.id.ll_user_questionnaire) { |
| 80 | CampaignList cl = WarplyManagerHelper.getUniqueCampaignList().get("more_for_you"); | 85 | CampaignList cl = WarplyManagerHelper.getUniqueCampaignList().get("more_for_you"); |
| 81 | Campaign camp = null; | 86 | Campaign camp = null; |
| ... | @@ -94,21 +99,27 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -94,21 +99,27 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
| 94 | startActivity(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.constructCampaignUrl(camp))); | 99 | startActivity(WarpViewActivity.createIntentFromURL(LoyaltyWallet.this, WarplyManagerHelper.constructCampaignUrl(camp))); |
| 95 | return; | 100 | return; |
| 96 | } | 101 | } |
| 97 | - if (view.getId() == R.id.cl_loyalty_coupon) { | 102 | + /**** Old functionality ****/ |
| 98 | - Intent intent = new Intent(LoyaltyWallet.this, ActiveCouponsActivity.class); | 103 | +// if (view.getId() == R.id.cl_loyalty_coupon) { |
| 99 | - intent.putExtra("couponlist", WarplyManagerHelper.getCouponList()); | 104 | +// Intent intent = new Intent(LoyaltyWallet.this, ActiveCouponsActivity.class); |
| 100 | - startActivity(intent); | 105 | +// intent.putExtra("couponlist", WarplyManagerHelper.getCouponList()); |
| 101 | - return; | 106 | +// startActivity(intent); |
| 102 | - } | 107 | +// return; |
| 103 | - if (view.getId() == R.id.cl_loyalty_rewards) { | 108 | +// } |
| 104 | - Intent intent = new Intent(LoyaltyWallet.this, ActiveRewardsActivity.class); | 109 | +// if (view.getId() == R.id.cl_loyalty_rewards) { |
| 105 | - intent.putExtra("couponlist", WarplyManagerHelper.getCouponList()); | 110 | +// Intent intent = new Intent(LoyaltyWallet.this, ActiveRewardsActivity.class); |
| 106 | - startActivity(intent); | 111 | +// intent.putExtra("couponlist", WarplyManagerHelper.getCouponList()); |
| 107 | - return; | 112 | +// startActivity(intent); |
| 108 | - } | 113 | +// return; |
| 109 | - if (view.getId() == R.id.ll_old_coupons) { | 114 | +// } |
| 110 | - Intent intent = new Intent(LoyaltyWallet.this, PastCouponsActivity.class); | 115 | +// if (view.getId() == R.id.ll_old_coupons) { |
| 111 | - intent.putExtra("couponlist", WarplyManagerHelper.getCouponList()); | 116 | +// Intent intent = new Intent(LoyaltyWallet.this, PastCouponsActivity.class); |
| 117 | +// intent.putExtra("couponlist", WarplyManagerHelper.getCouponList()); | ||
| 118 | +// startActivity(intent); | ||
| 119 | +// } | ||
| 120 | + /**** Old functionality ****/ | ||
| 121 | + if (view.getId() == R.id.cl_mygifts) { | ||
| 122 | + Intent intent = new Intent(LoyaltyWallet.this, ActiveGiftsActivity.class); | ||
| 112 | startActivity(intent); | 123 | startActivity(intent); |
| 113 | } | 124 | } |
| 114 | } | 125 | } |
| ... | @@ -143,13 +154,16 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -143,13 +154,16 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
| 143 | mIvBack.setOnClickListener(this); | 154 | mIvBack.setOnClickListener(this); |
| 144 | // mTvAnalysisButton.setOnClickListener(this); | 155 | // mTvAnalysisButton.setOnClickListener(this); |
| 145 | mLlQuestionnaire.setOnClickListener(this); | 156 | mLlQuestionnaire.setOnClickListener(this); |
| 146 | - mTvActiveCoupons.setText(String.format(getResources().getString(R.string.cos_active_coupons), String.valueOf(cpnlist.size()))); | 157 | + /**** Old functionality ****/ |
| 147 | - mClActiveCoupons.setOnClickListener(this); | 158 | +// mTvActiveCoupons.setText(String.format(getResources().getString(R.string.cos_active_coupons), String.valueOf(cpnlist.size()))); |
| 159 | +// mClActiveCoupons.setOnClickListener(this); | ||
| 160 | +// mClActiveRewards.setOnClickListener(this); | ||
| 161 | +// mLlAnalysisButton.setOnClickListener(this); | ||
| 162 | +// mLlPastCoupons.setOnClickListener(this); | ||
| 163 | + /**** Old functionality ****/ | ||
| 148 | //TODO: change the parameter, for testing purposes only | 164 | //TODO: change the parameter, for testing purposes only |
| 149 | mTvActiveRewards.setText(String.format(getResources().getString(R.string.cos_active_rewards), String.valueOf(cpnlist.size()))); | 165 | mTvActiveRewards.setText(String.format(getResources().getString(R.string.cos_active_rewards), String.valueOf(cpnlist.size()))); |
| 150 | - mClActiveRewards.setOnClickListener(this); | 166 | + mClActiveGifts.setOnClickListener(this); |
| 151 | - mLlAnalysisButton.setOnClickListener(this); | ||
| 152 | - mLlPastCoupons.setOnClickListener(this); | ||
| 153 | } | 167 | } |
| 154 | 168 | ||
| 155 | // =========================================================== | 169 | // =========================================================== | ... | ... |
| 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 11-May-22. | ||
| 30 | + */ | ||
| 31 | + | ||
| 32 | +public class MergedActiveGifts { | ||
| 33 | + private int dataType = 0; | ||
| 34 | + private Coupon coupon; | ||
| 35 | + private Campaign campaign; | ||
| 36 | + | ||
| 37 | + public void setDataType(int dataType) { | ||
| 38 | + this.dataType = dataType; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public void setCoupon(Coupon coupon) { | ||
| 42 | + this.coupon = coupon; | ||
| 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 Coupon getCoupon() { | ||
| 54 | + return coupon; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public Campaign getCampaign() { | ||
| 58 | + return campaign; | ||
| 59 | + } | ||
| 60 | +} |
warply_android_sdk/src/main/java/ly/warp/sdk/views/adapters/MergedActiveGiftsAdapter.java
0 → 100644
| 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.text.ParseException; | ||
| 19 | +import java.text.SimpleDateFormat; | ||
| 20 | +import java.util.ArrayList; | ||
| 21 | +import java.util.Date; | ||
| 22 | +import java.util.concurrent.TimeUnit; | ||
| 23 | + | ||
| 24 | +import io.reactivex.Observable; | ||
| 25 | +import io.reactivex.subjects.PublishSubject; | ||
| 26 | +import ly.warp.sdk.R; | ||
| 27 | +import ly.warp.sdk.io.models.MergedActiveGifts; | ||
| 28 | +import ly.warp.sdk.io.models.MergedGifts; | ||
| 29 | + | ||
| 30 | +public class MergedActiveGiftsAdapter extends RecyclerView.Adapter<MergedActiveGiftsAdapter.MergedActiveGiftsViewHolder> { | ||
| 31 | + | ||
| 32 | + private Context mContext; | ||
| 33 | + private ArrayList<MergedActiveGifts> mMergedActiveGifts; | ||
| 34 | + private final PublishSubject<MergedActiveGifts> onClickSubject = PublishSubject.create(); | ||
| 35 | + | ||
| 36 | + public MergedActiveGiftsAdapter(Context mContext, ArrayList<MergedActiveGifts> mergedactivegifts) { | ||
| 37 | + this.mContext = mContext; | ||
| 38 | + this.mMergedActiveGifts = mergedactivegifts; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public class MergedActiveGiftsViewHolder extends RecyclerView.ViewHolder { | ||
| 42 | + private ImageView ivMergedActiveGiftsLogo; | ||
| 43 | + private TextView tvMergedActiveGiftsTitle, tvMergedActiveGiftsValue, tvMergedActiveGiftsDate, | ||
| 44 | + tvMergedActiveGiftsDescription; | ||
| 45 | + | ||
| 46 | + public MergedActiveGiftsViewHolder(View view) { | ||
| 47 | + super(view); | ||
| 48 | + ivMergedActiveGiftsLogo = view.findViewById(R.id.iv_active_coupon); | ||
| 49 | + tvMergedActiveGiftsTitle = view.findViewById(R.id.tv_active_coupons_title); | ||
| 50 | + tvMergedActiveGiftsValue = view.findViewById(R.id.tv_active_coupons_value); | ||
| 51 | + tvMergedActiveGiftsDate = view.findViewById(R.id.tv_active_coupons_date); | ||
| 52 | + tvMergedActiveGiftsDescription = view.findViewById(R.id.tv_active_coupons_description); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public int getItemCount() { | ||
| 58 | + if (mMergedActiveGifts == null) | ||
| 59 | + return 0; | ||
| 60 | + else | ||
| 61 | + return mMergedActiveGifts.size(); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + | ||
| 65 | + public MergedActiveGifts getItem(int id) { | ||
| 66 | + return mMergedActiveGifts.get(id); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public void updateData(ArrayList<MergedActiveGifts> mergedactivegifts) { | ||
| 70 | + mMergedActiveGifts.clear(); | ||
| 71 | + mMergedActiveGifts.addAll(mergedactivegifts); | ||
| 72 | + notifyDataSetChanged(); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Override | ||
| 76 | + public MergedActiveGiftsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
| 77 | + View itemView; | ||
| 78 | +// if () | ||
| 79 | +// itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_merged_gifts_recycler, parent, false); | ||
| 80 | +// else | ||
| 81 | + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.active_coupon_layout, parent, false); | ||
| 82 | + return new MergedActiveGiftsViewHolder(itemView); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + public void onBindViewHolder(final MergedActiveGiftsViewHolder holder, int position) { | ||
| 87 | + MergedActiveGifts mergedgiftsItem = mMergedActiveGifts.get(position); | ||
| 88 | + if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 1) { | ||
| 89 | + if (!TextUtils.isEmpty(mergedgiftsItem.getCampaign().getLogoUrl())) { | ||
| 90 | + Glide.with(mContext) | ||
| 91 | + .load(mergedgiftsItem.getCampaign().getLogoUrl()) | ||
| 92 | + .transform(new CenterCrop(), new RoundedCorners(4)) | ||
| 93 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
| 94 | + .into(holder.ivMergedActiveGiftsLogo); | ||
| 95 | + } else { | ||
| 96 | + Glide.with(mContext) | ||
| 97 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
| 98 | + .into(holder.ivMergedActiveGiftsLogo); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + holder.tvMergedActiveGiftsTitle.setText(mergedgiftsItem.getCampaign().getTitle()); | ||
| 102 | + } else if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 2) { | ||
| 103 | + if (!TextUtils.isEmpty(mergedgiftsItem.getCoupon().getImage())) { | ||
| 104 | + Glide.with(mContext) | ||
| 105 | +// .setDefaultRequestOptions( | ||
| 106 | +// RequestOptions | ||
| 107 | +// .placeholderOf(R.drawable.ic_default_contact_photo) | ||
| 108 | +// .error(R.drawable.ic_default_contact_photo)) | ||
| 109 | + .load(mergedgiftsItem.getCoupon().getImage()) | ||
| 110 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
| 111 | + .into(holder.ivMergedActiveGiftsLogo); | ||
| 112 | + } else { | ||
| 113 | + Glide.with(mContext) | ||
| 114 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
| 115 | + .into(holder.ivMergedActiveGiftsLogo); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + holder.tvMergedActiveGiftsTitle.setText(mergedgiftsItem.getCoupon().getName()); | ||
| 119 | + holder.tvMergedActiveGiftsDescription.setText(mergedgiftsItem.getCoupon().getDescription()); | ||
| 120 | + | ||
| 121 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
| 122 | + Date newDate = new Date(); | ||
| 123 | + try { | ||
| 124 | + newDate = simpleDateFormat.parse(mergedgiftsItem.getCoupon().getExpiration()); | ||
| 125 | + } catch (ParseException e) { | ||
| 126 | + e.printStackTrace(); | ||
| 127 | + } | ||
| 128 | + simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); | ||
| 129 | + holder.tvMergedActiveGiftsDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | ||
| 130 | + | ||
| 131 | + holder.tvMergedActiveGiftsValue.setText(mergedgiftsItem.getCoupon().getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
| 132 | + } | ||
| 133 | + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedgiftsItem)); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public Observable<MergedActiveGifts> getPositionClicks() { | ||
| 137 | + return onClickSubject.cache(); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + private long getDifferenceDays(Date d1, Date d2) { | ||
| 141 | + long diff = d2.getTime() - d1.getTime(); | ||
| 142 | + return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); | ||
| 143 | + } | ||
| 144 | +} |
12 KB
7.34 KB
4.24 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 | + <corners android:radius="5dp" /> | ||
| 5 | + | ||
| 6 | + <solid | ||
| 7 | + android:color="@color/cos_grey6" /> | ||
| 8 | +</shape> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + <item> | ||
| 4 | + <shape android:shape="rectangle"> | ||
| 5 | + <corners android:radius="5dp" /> | ||
| 6 | + | ||
| 7 | + <solid android:color="@color/cos_grey_tr" /> | ||
| 8 | + </shape> | ||
| 9 | + </item> | ||
| 10 | + <item | ||
| 11 | + android:bottom="7dp" | ||
| 12 | + android:left="7dp" | ||
| 13 | + android:right="7dp" | ||
| 14 | + android:top="7dp"> | ||
| 15 | + <shape android:shape="rectangle"> | ||
| 16 | + <solid android:color="@color/cos_grey6" /> | ||
| 17 | + <corners android:radius="5dp" /> | ||
| 18 | + </shape> | ||
| 19 | + </item> | ||
| 20 | +</layer-list> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 4 | + android:id="@+id/cl_bill_payment" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent" | ||
| 7 | + android:background="@android:color/white" | ||
| 8 | + android:orientation="vertical"> | ||
| 9 | + | ||
| 10 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
| 11 | + android:id="@+id/cl_bill_header" | ||
| 12 | + android:layout_width="match_parent" | ||
| 13 | + android:layout_height="80dp" | ||
| 14 | + android:background="@android:color/white"> | ||
| 15 | + | ||
| 16 | + <ImageView | ||
| 17 | + android:id="@+id/iv_list_close" | ||
| 18 | + android:layout_width="21dp" | ||
| 19 | + android:layout_height="20dp" | ||
| 20 | + android:layout_marginStart="24dp" | ||
| 21 | + android:layout_marginTop="4dp" | ||
| 22 | + android:src="@drawable/ic_back" | ||
| 23 | + app:layout_constraintStart_toStartOf="parent" | ||
| 24 | + app:layout_constraintTop_toTopOf="@+id/textView3" /> | ||
| 25 | + | ||
| 26 | + <TextView | ||
| 27 | + android:id="@+id/textView3" | ||
| 28 | + android:layout_width="206dp" | ||
| 29 | + android:layout_height="32dp" | ||
| 30 | + android:gravity="center" | ||
| 31 | + android:textColor="@color/grey" | ||
| 32 | + android:textSize="17sp" | ||
| 33 | + android:textStyle="bold" | ||
| 34 | + android:text="@string/cos_active_gifts_title" | ||
| 35 | + app:layout_constraintBottom_toBottomOf="parent" | ||
| 36 | + app:layout_constraintEnd_toEndOf="parent" | ||
| 37 | + app:layout_constraintHorizontal_bias="0.356" | ||
| 38 | + app:layout_constraintStart_toEndOf="@+id/iv_list_close" | ||
| 39 | + app:layout_constraintTop_toTopOf="parent" /> | ||
| 40 | + </androidx.constraintlayout.widget.ConstraintLayout> | ||
| 41 | + | ||
| 42 | + <RelativeLayout | ||
| 43 | + android:layout_width="match_parent" | ||
| 44 | + android:layout_height="match_parent" | ||
| 45 | + android:background="@drawable/shape_cos_loyalty" | ||
| 46 | + android:orientation="vertical"> | ||
| 47 | + | ||
| 48 | + <androidx.recyclerview.widget.RecyclerView | ||
| 49 | + android:id="@+id/rv_merged_active_gifts" | ||
| 50 | + android:layout_width="match_parent" | ||
| 51 | + android:layout_height="wrap_content" | ||
| 52 | + android:layout_marginTop="4dp" | ||
| 53 | + android:clipToPadding="false" | ||
| 54 | + android:orientation="vertical" | ||
| 55 | + android:paddingTop="44dp" /> | ||
| 56 | + | ||
| 57 | + <!-- <androidx.constraintlayout.widget.ConstraintLayout--> | ||
| 58 | + <!-- android:id="@+id/cl_recycler_inner"--> | ||
| 59 | + <!-- android:layout_width="match_parent"--> | ||
| 60 | + <!-- android:layout_height="wrap_content"--> | ||
| 61 | + <!-- android:layout_marginTop="36dp"--> | ||
| 62 | + <!-- android:paddingBottom="4dp"--> | ||
| 63 | + <!-- app:layout_constraintLeft_toLeftOf="parent"--> | ||
| 64 | + <!-- app:layout_constraintRight_toRightOf="parent"--> | ||
| 65 | + <!-- app:layout_constraintTop_toTopOf="parent">--> | ||
| 66 | + | ||
| 67 | + <!-- <TextView--> | ||
| 68 | + <!-- android:id="@+id/tv_gifts_title"--> | ||
| 69 | + <!-- android:layout_width="wrap_content"--> | ||
| 70 | + <!-- android:layout_height="wrap_content"--> | ||
| 71 | + <!-- android:layout_marginStart="10dp"--> | ||
| 72 | + <!-- android:text="@string/cos_gifts_title2"--> | ||
| 73 | + <!-- android:textColor="@android:color/white"--> | ||
| 74 | + <!-- android:textSize="18sp"--> | ||
| 75 | + <!-- android:textStyle="bold"--> | ||
| 76 | + <!-- app:layout_constraintStart_toStartOf="parent"--> | ||
| 77 | + <!-- app:layout_constraintTop_toTopOf="parent" />--> | ||
| 78 | + | ||
| 79 | + <!-- <androidx.recyclerview.widget.RecyclerView--> | ||
| 80 | + <!-- android:id="@+id/rv_gifts"--> | ||
| 81 | + <!-- android:layout_width="match_parent"--> | ||
| 82 | + <!-- android:layout_height="wrap_content"--> | ||
| 83 | + <!-- android:layout_marginTop="24dp"--> | ||
| 84 | + <!-- android:clipToPadding="false"--> | ||
| 85 | + <!-- android:orientation="horizontal"--> | ||
| 86 | + <!-- android:paddingEnd="10dp"--> | ||
| 87 | + <!-- app:layout_constraintBottom_toBottomOf="parent"--> | ||
| 88 | + <!-- app:layout_constraintLeft_toLeftOf="parent"--> | ||
| 89 | + <!-- app:layout_constraintRight_toRightOf="parent"--> | ||
| 90 | + <!-- app:layout_constraintTop_toBottomOf="@+id/tv_gifts_title" />--> | ||
| 91 | + <!-- </androidx.constraintlayout.widget.ConstraintLayout>--> | ||
| 92 | + | ||
| 93 | + <!-- <androidx.constraintlayout.widget.ConstraintLayout--> | ||
| 94 | + <!-- android:id="@+id/cl_recycler_inner2"--> | ||
| 95 | + <!-- android:layout_width="match_parent"--> | ||
| 96 | + <!-- android:layout_height="wrap_content"--> | ||
| 97 | + <!-- android:layout_below="@+id/cl_recycler_inner"--> | ||
| 98 | + <!-- android:layout_marginTop="36dp"--> | ||
| 99 | + <!-- android:paddingBottom="4dp"--> | ||
| 100 | + <!-- app:layout_constraintLeft_toLeftOf="parent"--> | ||
| 101 | + <!-- app:layout_constraintRight_toRightOf="parent"--> | ||
| 102 | + <!-- app:layout_constraintTop_toTopOf="parent">--> | ||
| 103 | + | ||
| 104 | + <!-- <TextView--> | ||
| 105 | + <!-- android:id="@+id/tv_rewards_title"--> | ||
| 106 | + <!-- android:layout_width="wrap_content"--> | ||
| 107 | + <!-- android:layout_height="wrap_content"--> | ||
| 108 | + <!-- android:layout_marginStart="10dp"--> | ||
| 109 | + <!-- android:text="@string/cos_rewards_title"--> | ||
| 110 | + <!-- android:textColor="@android:color/white"--> | ||
| 111 | + <!-- android:textSize="18sp"--> | ||
| 112 | + <!-- android:textStyle="bold"--> | ||
| 113 | + <!-- app:layout_constraintStart_toStartOf="parent"--> | ||
| 114 | + <!-- app:layout_constraintTop_toTopOf="parent" />--> | ||
| 115 | + | ||
| 116 | + <!-- <androidx.recyclerview.widget.RecyclerView--> | ||
| 117 | + <!-- android:id="@+id/rv_rewards"--> | ||
| 118 | + <!-- android:layout_width="match_parent"--> | ||
| 119 | + <!-- android:layout_height="wrap_content"--> | ||
| 120 | + <!-- android:layout_marginTop="24dp"--> | ||
| 121 | + <!-- android:clipToPadding="false"--> | ||
| 122 | + <!-- android:orientation="horizontal"--> | ||
| 123 | + <!-- android:paddingEnd="10dp"--> | ||
| 124 | + <!-- app:layout_constraintBottom_toBottomOf="parent"--> | ||
| 125 | + <!-- app:layout_constraintLeft_toLeftOf="parent"--> | ||
| 126 | + <!-- app:layout_constraintRight_toRightOf="parent"--> | ||
| 127 | + <!-- app:layout_constraintTop_toBottomOf="@+id/tv_rewards_title" />--> | ||
| 128 | + <!-- </androidx.constraintlayout.widget.ConstraintLayout>--> | ||
| 129 | + | ||
| 130 | + <!-- <androidx.constraintlayout.widget.ConstraintLayout--> | ||
| 131 | + <!-- android:id="@+id/cl_recycler_inner3"--> | ||
| 132 | + <!-- android:layout_width="match_parent"--> | ||
| 133 | + <!-- android:layout_height="wrap_content"--> | ||
| 134 | + <!-- android:layout_below="@+id/cl_recycler_inner2"--> | ||
| 135 | + <!-- android:layout_marginTop="36dp"--> | ||
| 136 | + <!-- android:paddingBottom="4dp"--> | ||
| 137 | + <!-- app:layout_constraintLeft_toLeftOf="parent"--> | ||
| 138 | + <!-- app:layout_constraintRight_toRightOf="parent"--> | ||
| 139 | + <!-- app:layout_constraintTop_toTopOf="parent">--> | ||
| 140 | + | ||
| 141 | + <!-- <TextView--> | ||
| 142 | + <!-- android:id="@+id/tv_coupons_title"--> | ||
| 143 | + <!-- android:layout_width="wrap_content"--> | ||
| 144 | + <!-- android:layout_height="wrap_content"--> | ||
| 145 | + <!-- android:layout_marginStart="10dp"--> | ||
| 146 | + <!-- android:text="@string/cos_coupons_title"--> | ||
| 147 | + <!-- android:textColor="@android:color/white"--> | ||
| 148 | + <!-- android:textSize="18sp"--> | ||
| 149 | + <!-- android:textStyle="bold"--> | ||
| 150 | + <!-- app:layout_constraintStart_toStartOf="parent"--> | ||
| 151 | + <!-- app:layout_constraintTop_toTopOf="parent" />--> | ||
| 152 | + | ||
| 153 | + <!-- <androidx.recyclerview.widget.RecyclerView--> | ||
| 154 | + <!-- android:id="@+id/rv_coupons"--> | ||
| 155 | + <!-- android:layout_width="match_parent"--> | ||
| 156 | + <!-- android:layout_height="wrap_content"--> | ||
| 157 | + <!-- android:layout_marginTop="24dp"--> | ||
| 158 | + <!-- android:clipToPadding="false"--> | ||
| 159 | + <!-- android:orientation="horizontal"--> | ||
| 160 | + <!-- android:paddingEnd="24dp"--> | ||
| 161 | + <!-- app:layout_constraintBottom_toBottomOf="parent"--> | ||
| 162 | + <!-- app:layout_constraintLeft_toLeftOf="parent"--> | ||
| 163 | + <!-- app:layout_constraintRight_toRightOf="parent"--> | ||
| 164 | + <!-- app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />--> | ||
| 165 | + <!-- </androidx.constraintlayout.widget.ConstraintLayout>--> | ||
| 166 | + </RelativeLayout> | ||
| 167 | +</LinearLayout> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
| ... | @@ -66,7 +66,7 @@ | ... | @@ -66,7 +66,7 @@ |
| 66 | android:layout_height="wrap_content" | 66 | android:layout_height="wrap_content" |
| 67 | android:layout_gravity="center" | 67 | android:layout_gravity="center" |
| 68 | android:scaleType="centerInside" | 68 | android:scaleType="centerInside" |
| 69 | - android:src="@drawable/ic_gifts_for_you_white" /> | 69 | + android:src="@drawable/ic_more_for_you_new" /> |
| 70 | 70 | ||
| 71 | <TextView | 71 | <TextView |
| 72 | android:layout_width="wrap_content" | 72 | android:layout_width="wrap_content" | ... | ... |
| ... | @@ -46,4 +46,6 @@ | ... | @@ -46,4 +46,6 @@ |
| 46 | <color name="cos_light_grey">#F4F4F4</color> | 46 | <color name="cos_light_grey">#F4F4F4</color> |
| 47 | <color name="cos_green9">#86C15F</color> | 47 | <color name="cos_green9">#86C15F</color> |
| 48 | <color name="cos_skyblue">#13ACD4</color> | 48 | <color name="cos_skyblue">#13ACD4</color> |
| 49 | + <color name="cos_grey6">#536C79</color> | ||
| 50 | + <color name="cos_grey_tr">#00000029</color> | ||
| 49 | </resources> | 51 | </resources> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -46,7 +46,7 @@ | ... | @@ -46,7 +46,7 @@ |
| 46 | <string name="cos_loyalty_rewards">My rewards</string> | 46 | <string name="cos_loyalty_rewards">My rewards</string> |
| 47 | <string name="cos_loyalty_old_rewards">Παλαιότερα δώρα</string> | 47 | <string name="cos_loyalty_old_rewards">Παλαιότερα δώρα</string> |
| 48 | <string name="cos_see_all">Δες τα όλα -></string> | 48 | <string name="cos_see_all">Δες τα όλα -></string> |
| 49 | - <string name="cos_active_rewards">Έχεις %1$s ενεργά\nδώρα</string> | 49 | + <string name="cos_active_rewards">Έχεις %1$s ενεργά δώρα</string> |
| 50 | <string name="cos_analysis">Ανάλυση</string> | 50 | <string name="cos_analysis">Ανάλυση</string> |
| 51 | <string name="cos_active_deals">Ενεργός κωδικός:</string> | 51 | <string name="cos_active_deals">Ενεργός κωδικός:</string> |
| 52 | <string name="cos_monthly">Μηνιαία</string> | 52 | <string name="cos_monthly">Μηνιαία</string> |
| ... | @@ -67,6 +67,11 @@ | ... | @@ -67,6 +67,11 @@ |
| 67 | <string name="cos_gift_it">Κάντο δώρο!</string> | 67 | <string name="cos_gift_it">Κάντο δώρο!</string> |
| 68 | <string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string> | 68 | <string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string> |
| 69 | <string name="cos_popup_more_subtitle">Εδώ μπορείς να βρεις διαγωνισμούς και\nνα σε επιβραβεύσουμε για τις αθλητικές σου\nδραστηριότητες!</string> | 69 | <string name="cos_popup_more_subtitle">Εδώ μπορείς να βρεις διαγωνισμούς και\nνα σε επιβραβεύσουμε για τις αθλητικές σου\nδραστηριότητες!</string> |
| 70 | + <string name="cos_deals_win_title">Μέχρι τώρα έχεις κερδίσει 30 κουπόνια\nκαι 20,00€ σε προσφορές!</string> | ||
| 71 | + <string name="cos_mygifts">Τα δώρα μου</string> | ||
| 72 | + <string name="cos_gifts_banner_title">Δώρα:</string> | ||
| 73 | + <string name="cos_see_more">Δες περισσότερα</string> | ||
| 74 | + <string name="cos_active_gifts_title">Ενεργά δώρα</string> | ||
| 70 | 75 | ||
| 71 | <string-array name="coupons_array"> | 76 | <string-array name="coupons_array"> |
| 72 | <item>Κουπόνια</item> | 77 | <item>Κουπόνια</item> | ... | ... |
-
Please register or login to post a comment