Panagiotis Triantafyllou

new mfy ui

...@@ -31,17 +31,17 @@ package ly.warp.sdk.io.models; ...@@ -31,17 +31,17 @@ package ly.warp.sdk.io.models;
31 */ 31 */
32 32
33 public class HealthEventModel { 33 public class HealthEventModel {
34 - private double steps; 34 + private double meters;
35 35
36 public HealthEventModel() { 36 public HealthEventModel() {
37 - this.steps = 0.0d; 37 + this.meters = 0.0d;
38 } 38 }
39 39
40 - public double getSteps() { 40 + public double getMeters() {
41 - return steps; 41 + return meters;
42 } 42 }
43 43
44 - public void setSteps(double steps) { 44 + public void setMeters(double meters) {
45 - this.steps = steps; 45 + this.meters = meters;
46 } 46 }
47 } 47 }
......
...@@ -211,7 +211,7 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -211,7 +211,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
211 mSteps++; 211 mSteps++;
212 mStepsAll++; 212 mStepsAll++;
213 HealthEventModel healthSteps = new HealthEventModel(); 213 HealthEventModel healthSteps = new HealthEventModel();
214 - healthSteps.setSteps((mStepsAll * 0.762)); 214 + healthSteps.setMeters((mStepsAll * 0.762));
215 EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); 215 EventBus.getDefault().post(new WarplyEventBusManager(healthSteps));
216 WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762)); 216 WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762));
217 WarpUtils.setStepsCounter(this, mSteps); 217 WarpUtils.setStepsCounter(this, mSteps);
......
...@@ -745,7 +745,7 @@ public class WarplyManagerHelper { ...@@ -745,7 +745,7 @@ public class WarplyManagerHelper {
745 */ 745 */
746 public static void setSeasonalList(ArrayList<LoyaltyGiftsForYouPackage> seasonalCoupons) { 746 public static void setSeasonalList(ArrayList<LoyaltyGiftsForYouPackage> seasonalCoupons) {
747 mSeasonalList.clear(); 747 mSeasonalList.clear();
748 - mSeasonalList.addAll(seasonalCoupons); 748 + mSeasonalList = seasonalCoupons;
749 } 749 }
750 750
751 /** 751 /**
......
...@@ -22,8 +22,7 @@ import io.reactivex.subjects.PublishSubject; ...@@ -22,8 +22,7 @@ import io.reactivex.subjects.PublishSubject;
22 import ly.warp.sdk.R; 22 import ly.warp.sdk.R;
23 import ly.warp.sdk.io.models.Campaign; 23 import ly.warp.sdk.io.models.Campaign;
24 24
25 - 25 +public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapter.MoreCampaignViewHolder> {
26 -public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapter.ProfileCampaignViewHolder> {
27 26
28 private Context mContext; 27 private Context mContext;
29 private ArrayList<Campaign> mCampaigns; 28 private ArrayList<Campaign> mCampaigns;
...@@ -34,25 +33,17 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte ...@@ -34,25 +33,17 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte
34 this.mCampaigns = campaignList; 33 this.mCampaigns = campaignList;
35 } 34 }
36 35
37 - public class ProfileCampaignViewHolder extends RecyclerView.ViewHolder { 36 + public class MoreCampaignViewHolder extends RecyclerView.ViewHolder {
38 private ImageView ivCampaignTitle, ivIsNew; 37 private ImageView ivCampaignTitle, ivIsNew;
39 private TextView tvCampaignTitle, tvCampaignSubtitle, tvCampaignMessage; 38 private TextView tvCampaignTitle, tvCampaignSubtitle, tvCampaignMessage;
40 39
41 - public ProfileCampaignViewHolder(View view) { 40 + public MoreCampaignViewHolder(View view) {
42 - super(view);
43 - ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo);
44 - tvCampaignTitle = view.findViewById(R.id.tv_campaign_title);
45 - }
46 -
47 - public ProfileCampaignViewHolder(View view, boolean vertical) {
48 super(view); 41 super(view);
49 ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo); 42 ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo);
50 tvCampaignTitle = view.findViewById(R.id.tv_campaign_title); 43 tvCampaignTitle = view.findViewById(R.id.tv_campaign_title);
51 ivIsNew = view.findViewById(R.id.iv_campaign_new); 44 ivIsNew = view.findViewById(R.id.iv_campaign_new);
52 - if (vertical) { 45 + tvCampaignSubtitle = view.findViewById(R.id.tv_campaign_subtitle);
53 - tvCampaignSubtitle = view.findViewById(R.id.tv_campaign_subtitle); 46 + tvCampaignMessage = view.findViewById(R.id.tv_campaign_message);
54 - tvCampaignMessage = view.findViewById(R.id.tv_campaign_message);
55 - }
56 } 47 }
57 } 48 }
58 49
...@@ -76,15 +67,15 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte ...@@ -76,15 +67,15 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte
76 } 67 }
77 68
78 @Override 69 @Override
79 - public ProfileCampaignViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 70 + public MoreCampaignViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
80 View itemView; 71 View itemView;
81 72
82 itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler_vertical, parent, false); 73 itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler_vertical, parent, false);
83 - return new ProfileCampaignViewHolder(itemView, true); 74 + return new MoreCampaignViewHolder(itemView);
84 } 75 }
85 76
86 @Override 77 @Override
87 - public void onBindViewHolder(final ProfileCampaignViewHolder holder, int position) { 78 + public void onBindViewHolder(final MoreCampaignViewHolder holder, int position) {
88 Campaign campaignItem = mCampaigns.get(position); 79 Campaign campaignItem = mCampaigns.get(position);
89 80
90 if (campaignItem != null) { 81 if (campaignItem != null) {
......
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 +
20 +import io.reactivex.Observable;
21 +import io.reactivex.subjects.PublishSubject;
22 +import ly.warp.sdk.R;
23 +import ly.warp.sdk.io.models.Campaign;
24 +import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
25 +
26 +public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAdapter.MoreContextualViewHolder> {
27 +
28 + private Context mContext;
29 + private ArrayList<LoyaltyContextualOfferModel> mCampaigns;
30 + private final PublishSubject<LoyaltyContextualOfferModel> onClickSubject = PublishSubject.create();
31 +
32 + public MoreContextualAdapter(Context mContext, ArrayList<LoyaltyContextualOfferModel> campaignList) {
33 + this.mContext = mContext;
34 + this.mCampaigns = campaignList;
35 + }
36 +
37 + public class MoreContextualViewHolder extends RecyclerView.ViewHolder {
38 + private ImageView ivCampaignTitle, ivIsNew;
39 + private TextView tvCampaignTitle, tvCampaignSubtitle, tvCampaignMessage;
40 +
41 + public MoreContextualViewHolder(View view) {
42 + super(view);
43 + ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo);
44 + tvCampaignTitle = view.findViewById(R.id.tv_campaign_title);
45 + ivIsNew = view.findViewById(R.id.iv_campaign_new);
46 + tvCampaignSubtitle = view.findViewById(R.id.tv_campaign_subtitle);
47 + tvCampaignMessage = view.findViewById(R.id.tv_campaign_message);
48 + }
49 + }
50 +
51 + @Override
52 + public int getItemCount() {
53 + if (mCampaigns == null)
54 + return 0;
55 + else
56 + return mCampaigns.size();
57 + }
58 +
59 +
60 + public LoyaltyContextualOfferModel getItem(int id) {
61 + return mCampaigns.get(id);
62 + }
63 +
64 + public void updateData(ArrayList<LoyaltyContextualOfferModel> campaignList) {
65 + mCampaigns.clear();
66 + mCampaigns.addAll(campaignList);
67 + notifyDataSetChanged();
68 + }
69 +
70 + @Override
71 + public MoreContextualViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
72 + View itemView;
73 +
74 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler_vertical, parent, false);
75 + return new MoreContextualViewHolder(itemView);
76 + }
77 +
78 + @Override
79 + public void onBindViewHolder(final MoreContextualViewHolder holder, int position) {
80 + LoyaltyContextualOfferModel campaignItem = mCampaigns.get(position);
81 +
82 + if (campaignItem != null) {
83 + if (!TextUtils.isEmpty(campaignItem.getImageUrl())) {
84 + Glide.with(mContext)
85 + .load(campaignItem.getImageUrl())
86 + .transform(new CenterCrop(), new RoundedCorners(4))
87 + .diskCacheStrategy(DiskCacheStrategy.DATA)
88 + .into(holder.ivCampaignTitle);
89 + } else {
90 + Glide.with(mContext)
91 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
92 + .into(holder.ivCampaignTitle);
93 + }
94 +
95 + holder.tvCampaignTitle.setText(campaignItem.getTitle());
96 + holder.tvCampaignSubtitle.setText(campaignItem.getSubtitle());
97 + holder.tvCampaignMessage.setText(campaignItem.getMessage());
98 + holder.ivIsNew.setVisibility(View.GONE);
99 +
100 + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(campaignItem));
101 + }
102 + }
103 +
104 + public Observable<LoyaltyContextualOfferModel> getPositionClicks() {
105 + return onClickSubject.cache();
106 + }
107 +
108 +}
...@@ -132,6 +132,7 @@ ...@@ -132,6 +132,7 @@
132 <string name="cos_empty_shared_coupons">Δεν έχεις μοιραστεί ακόμη κουπόνια</string> 132 <string name="cos_empty_shared_coupons">Δεν έχεις μοιραστεί ακόμη κουπόνια</string>
133 <string name="cos_empty_expired_coupons">Δεν έχεις εξαργυρώσει ακόμη κουπόνια</string> 133 <string name="cos_empty_expired_coupons">Δεν έχεις εξαργυρώσει ακόμη κουπόνια</string>
134 <string name="cos_dlg_pacing_goal">Πέτυχες το στόχο του μήνα! Διάλεξε το δώρο που επιθυμείς να ενεργοποιήσεις!</string> 134 <string name="cos_dlg_pacing_goal">Πέτυχες το στόχο του μήνα! Διάλεξε το δώρο που επιθυμείς να ενεργοποιήσεις!</string>
135 + <string name="cos_mfy_other">ΆΛΛΕΣ</string>
135 136
136 <string-array name="coupons_array"> 137 <string-array name="coupons_array">
137 <item>Κουπόνια</item> 138 <item>Κουπόνια</item>
......