Panagiotis Triantafyllou

deh requests, new models, dynamic couponsets in home activity

...@@ -5,6 +5,7 @@ import android.os.Bundle; ...@@ -5,6 +5,7 @@ import android.os.Bundle;
5 import android.view.LayoutInflater; 5 import android.view.LayoutInflater;
6 import android.view.View; 6 import android.view.View;
7 import android.view.ViewGroup; 7 import android.view.ViewGroup;
8 +import android.widget.EditText;
8 import android.widget.LinearLayout; 9 import android.widget.LinearLayout;
9 import android.widget.RelativeLayout; 10 import android.widget.RelativeLayout;
10 import android.widget.Toast; 11 import android.widget.Toast;
...@@ -17,12 +18,15 @@ import org.json.JSONObject; ...@@ -17,12 +18,15 @@ import org.json.JSONObject;
17 import ly.warp.sdk.R; 18 import ly.warp.sdk.R;
18 import ly.warp.sdk.activities.HomeActivity; 19 import ly.warp.sdk.activities.HomeActivity;
19 import ly.warp.sdk.io.callbacks.CallbackReceiver; 20 import ly.warp.sdk.io.callbacks.CallbackReceiver;
21 +import ly.warp.sdk.io.models.User;
20 import ly.warp.sdk.utils.WarpUtils; 22 import ly.warp.sdk.utils.WarpUtils;
21 import ly.warp.sdk.utils.managers.WarplyManager; 23 import ly.warp.sdk.utils.managers.WarplyManager;
22 24
23 public class HomeFragment extends Fragment implements View.OnClickListener { 25 public class HomeFragment extends Fragment implements View.OnClickListener {
24 private RelativeLayout mPbLoading; 26 private RelativeLayout mPbLoading;
25 private LinearLayout mRlSmFlow; 27 private LinearLayout mRlSmFlow;
28 + private EditText mEtLogin;
29 + private LinearLayout mLlLogin;
26 30
27 @Override 31 @Override
28 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 32 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
...@@ -36,15 +40,13 @@ public class HomeFragment extends Fragment implements View.OnClickListener { ...@@ -36,15 +40,13 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
36 mPbLoading.setOnTouchListener((v, event) -> true); 40 mPbLoading.setOnTouchListener((v, event) -> true);
37 mRlSmFlow = view.findViewById(R.id.ll_sm_flow); 41 mRlSmFlow = view.findViewById(R.id.ll_sm_flow);
38 mRlSmFlow.setOnClickListener(this); 42 mRlSmFlow.setOnClickListener(this);
43 + mEtLogin = view.findViewById(R.id.et_login);
44 + mLlLogin = view.findViewById(R.id.ll_login);
45 + mLlLogin.setOnClickListener(this);
39 46
40 WarpUtils.applyEdgeToEdge(getActivity(), 47 WarpUtils.applyEdgeToEdge(getActivity(),
41 view.findViewById(R.id.rl_header), 48 view.findViewById(R.id.rl_header),
42 null); 49 null);
43 -
44 - // 6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826
45 - // prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179
46 -// mPbLoading.setVisibility(View.VISIBLE);
47 -// WarplyManager.getDehUser("aggeliki@warp.ly", mLoginReceiver);
48 } 50 }
49 51
50 @Override 52 @Override
...@@ -59,6 +61,11 @@ public class HomeFragment extends Fragment implements View.OnClickListener { ...@@ -59,6 +61,11 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
59 // WarplyManager.logout(mLogoutReceiver); 61 // WarplyManager.logout(mLogoutReceiver);
60 // return; 62 // return;
61 // } 63 // }
64 + if (view.getId() == R.id.ll_login) {
65 + mPbLoading.setVisibility(View.VISIBLE);
66 + WarplyManager.login(mEtLogin.getText().toString(), mLoginReceiver);
67 + return;
68 + }
62 if (view.getId() == R.id.ll_sm_flow) { 69 if (view.getId() == R.id.ll_sm_flow) {
63 Intent myIntent = new Intent(getContext(), HomeActivity.class); 70 Intent myIntent = new Intent(getContext(), HomeActivity.class);
64 startActivity(myIntent); 71 startActivity(myIntent);
...@@ -87,8 +94,9 @@ public class HomeFragment extends Fragment implements View.OnClickListener { ...@@ -87,8 +94,9 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
87 private final CallbackReceiver<JSONObject> mLoginReceiver = new CallbackReceiver<JSONObject>() { 94 private final CallbackReceiver<JSONObject> mLoginReceiver = new CallbackReceiver<JSONObject>() {
88 @Override 95 @Override
89 public void onSuccess(JSONObject result) { 96 public void onSuccess(JSONObject result) {
90 - mPbLoading.setVisibility(View.GONE); 97 +// mPbLoading.setVisibility(View.GONE);
91 Toast.makeText(getActivity(), "LOGIN SUCCESS", Toast.LENGTH_SHORT).show(); 98 Toast.makeText(getActivity(), "LOGIN SUCCESS", Toast.LENGTH_SHORT).show();
99 + WarplyManager.getUser(mUserReceiver);
92 } 100 }
93 101
94 @Override 102 @Override
...@@ -97,4 +105,20 @@ public class HomeFragment extends Fragment implements View.OnClickListener { ...@@ -97,4 +105,20 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
97 Toast.makeText(getActivity(), "LOGIN ERROR", Toast.LENGTH_SHORT).show(); 105 Toast.makeText(getActivity(), "LOGIN ERROR", Toast.LENGTH_SHORT).show();
98 } 106 }
99 }; 107 };
108 +
109 + private final CallbackReceiver<User> mUserReceiver = new CallbackReceiver<User>() {
110 + @Override
111 + public void onSuccess(User user) {
112 + mPbLoading.setVisibility(View.GONE);
113 + Toast.makeText(getActivity(), "USER SUCCESS", Toast.LENGTH_SHORT).show();
114 + Intent myIntent = new Intent(getContext(), HomeActivity.class);
115 + startActivity(myIntent);
116 + }
117 +
118 + @Override
119 + public void onFailure(int errorCode) {
120 + mPbLoading.setVisibility(View.GONE);
121 + Toast.makeText(getActivity(), "USER ERROR", Toast.LENGTH_SHORT).show();
122 + }
123 + };
100 } 124 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -47,6 +47,24 @@ public class BannerAdapter extends RecyclerView.Adapter<BannerAdapter.BannerView ...@@ -47,6 +47,24 @@ public class BannerAdapter extends RecyclerView.Adapter<BannerAdapter.BannerView
47 this.mListenerContent = listener; 47 this.mListenerContent = listener;
48 } 48 }
49 49
50 + private String getCampaignImage(BannerItem item) {
51 + if (item.getCampaign().getExtraFields() != null) {
52 + if (!item.getCampaign().getExtraFields().isNull("banner_img_mobile")) {
53 + return item.getCampaign().getExtraFields().optString("banner_img_mobile", "");
54 + }
55 + }
56 +
57 + return item.getCampaign().getLogoUrl();
58 + }
59 +
60 + private String getContentImage(BannerItem item) {
61 + if (!item.getContent().getImg().isEmpty()) {
62 + return item.getContent().getImg().get(0);
63 + }
64 +
65 + return item.getContent().getImgPreview();
66 + }
67 +
50 @NonNull 68 @NonNull
51 @Override 69 @Override
52 public BannerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 70 public BannerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
...@@ -64,7 +82,7 @@ public class BannerAdapter extends RecyclerView.Adapter<BannerAdapter.BannerView ...@@ -64,7 +82,7 @@ public class BannerAdapter extends RecyclerView.Adapter<BannerAdapter.BannerView
64 // RequestOptions 82 // RequestOptions
65 // .placeholderOf(R.drawable.demo_logo) 83 // .placeholderOf(R.drawable.demo_logo)
66 // .error(R.drawable.demo_logo)) 84 // .error(R.drawable.demo_logo))
67 - .load(bannerItem.getCampaign().getLogoUrl()) 85 + .load(getCampaignImage(bannerItem))
68 .diskCacheStrategy(DiskCacheStrategy.DATA) 86 .diskCacheStrategy(DiskCacheStrategy.DATA)
69 .into(holder.imageView); 87 .into(holder.imageView);
70 88
...@@ -79,7 +97,7 @@ public class BannerAdapter extends RecyclerView.Adapter<BannerAdapter.BannerView ...@@ -79,7 +97,7 @@ public class BannerAdapter extends RecyclerView.Adapter<BannerAdapter.BannerView
79 // RequestOptions 97 // RequestOptions
80 // .placeholderOf(R.drawable.demo_logo) 98 // .placeholderOf(R.drawable.demo_logo)
81 // .error(R.drawable.demo_logo)) 99 // .error(R.drawable.demo_logo))
82 - .load(bannerItem.getContent().getImgPreview()) 100 + .load(getContentImage(bannerItem))
83 .diskCacheStrategy(DiskCacheStrategy.DATA) 101 .diskCacheStrategy(DiskCacheStrategy.DATA)
84 .into(holder.imageView); 102 .into(holder.imageView);
85 103
......
1 +package ly.warp.sdk.io.adapters;
2 +
3 +import android.content.Context;
4 +import android.util.TypedValue;
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.annotation.NonNull;
12 +import androidx.recyclerview.widget.RecyclerView;
13 +
14 +import com.bumptech.glide.Glide;
15 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
16 +import com.bumptech.glide.load.resource.bitmap.CenterCrop;
17 +
18 +import java.text.ParseException;
19 +import java.text.SimpleDateFormat;
20 +import java.util.Date;
21 +import java.util.List;
22 +import java.util.Locale;
23 +
24 +import ly.warp.sdk.R;
25 +import ly.warp.sdk.io.models.Couponset;
26 +import ly.warp.sdk.utils.TopRoundedCornersTransformation;
27 +import ly.warp.sdk.utils.WarpUtils;
28 +
29 +
30 +public class CouponsetAdapter extends RecyclerView.Adapter<CouponsetAdapter.CouponsetViewHolder> {
31 +
32 + private final List<Couponset> couponsets;
33 + private final Context context;
34 + private OnCouponsetClickListener listener;
35 +
36 + public interface OnCouponsetClickListener {
37 + void onCouponsetClick(Couponset couponset, int position);
38 + }
39 +
40 + public CouponsetAdapter(Context context, List<Couponset> couponsets) {
41 + this.context = context;
42 + this.couponsets = couponsets;
43 + }
44 +
45 + public void setOnCouponsetClickListener(OnCouponsetClickListener listener) {
46 + this.listener = listener;
47 + }
48 +
49 + @NonNull
50 + @Override
51 + public CouponsetViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
52 + View view = LayoutInflater.from(context).inflate(R.layout.demo_item_offer, parent, false);
53 + return new CouponsetViewHolder(view);
54 + }
55 +
56 + @Override
57 + public void onBindViewHolder(@NonNull CouponsetViewHolder holder, int position) {
58 + Couponset couponset = couponsets.get(position);
59 + holder.bind(couponset, position);
60 + }
61 +
62 + @Override
63 + public int getItemCount() {
64 + return couponsets.size();
65 + }
66 +
67 + public class CouponsetViewHolder extends RecyclerView.ViewHolder {
68 + private final ImageView ivOfferImage;
69 + private final ImageView ivFavorite;
70 + private final ImageView ivLogo;
71 + private final TextView tvPrice;
72 + private final TextView tvTitle;
73 + private final TextView tvDescription;
74 + private final TextView tvValidity;
75 +
76 + CouponsetViewHolder(@NonNull View itemView) {
77 + super(itemView);
78 + ivOfferImage = itemView.findViewById(R.id.iv_offer_image);
79 + ivFavorite = itemView.findViewById(R.id.iv_favorite);
80 + ivLogo = itemView.findViewById(R.id.iv_logo);
81 + tvPrice = itemView.findViewById(R.id.tv_price);
82 + tvTitle = itemView.findViewById(R.id.tv_title);
83 + tvDescription = itemView.findViewById(R.id.tv_description);
84 + tvValidity = itemView.findViewById(R.id.tv_validity);
85 +
86 + WarpUtils.renderCustomFont(context, R.font.ping_lcg_bold, tvPrice, tvTitle);
87 + WarpUtils.renderCustomFont(context, R.font.ping_lcg_regular, tvDescription, tvValidity);
88 +
89 + itemView.setOnClickListener(v -> {
90 + int position = getAdapterPosition();
91 + if (listener != null && position != RecyclerView.NO_POSITION) {
92 + listener.onCouponsetClick(couponsets.get(position), position);
93 + }
94 + });
95 + }
96 +
97 + private void bind(Couponset couponset, int position) {
98 + tvTitle.setText(couponset.getName() != null ? couponset.getName() : "");
99 + tvDescription.setText(couponset.getShortDescription() != null ? couponset.getShortDescription() : "");
100 + tvPrice.setText(couponset.getDiscount() != null ? couponset.getDiscount() : "");
101 +
102 + if (couponset.getEndDate() != null && !couponset.getEndDate().isEmpty()) {
103 + tvValidity.setText(formatValidityDate(couponset.getEndDate()));
104 + tvValidity.setVisibility(View.VISIBLE);
105 + } else {
106 + tvValidity.setVisibility(View.GONE);
107 + }
108 +
109 + ivFavorite.setImageResource(R.drawable.demo_heart);
110 +
111 + loadCouponsetImage(couponset.getImgPreview());
112 +
113 + if (couponset.getMerchant() != null && couponset.getMerchant().getImgPreview() != null) {
114 + loadMerchantLogo(couponset.getMerchant().getImgPreview());
115 + } else {
116 + ivLogo.setVisibility(View.GONE);
117 + }
118 + }
119 +
120 + private String formatValidityDate(String endDate) {
121 + try {
122 + SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
123 + Date date = inputFormat.parse(endDate);
124 + SimpleDateFormat outputFormat = new SimpleDateFormat("dd-MM", Locale.getDefault());
125 + return "έως " + outputFormat.format(date);
126 + } catch (ParseException e) {
127 + try {
128 + SimpleDateFormat inputFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
129 + Date date = inputFormat2.parse(endDate);
130 + SimpleDateFormat outputFormat = new SimpleDateFormat("dd-MM", Locale.getDefault());
131 + return "έως " + outputFormat.format(date);
132 + } catch (ParseException e2) {
133 + return endDate;
134 + }
135 + }
136 + }
137 +
138 + private void loadCouponsetImage(String imageUrl) {
139 + if (imageUrl != null && !imageUrl.isEmpty()) {
140 + int radiusInPixels = (int) TypedValue.applyDimension(
141 + TypedValue.COMPLEX_UNIT_DIP, 9,
142 + context.getResources().getDisplayMetrics());
143 +
144 + Glide.with(context)
145 + .load(imageUrl)
146 + .diskCacheStrategy(DiskCacheStrategy.DATA)
147 + .transform(new CenterCrop(), new TopRoundedCornersTransformation(radiusInPixels))
148 + .into(ivOfferImage);
149 + }
150 + }
151 +
152 + private void loadMerchantLogo(String logoUrl) {
153 + if (logoUrl != null && !logoUrl.isEmpty()) {
154 + ivLogo.setVisibility(View.VISIBLE);
155 + Glide.with(context)
156 + .load(logoUrl)
157 + .diskCacheStrategy(DiskCacheStrategy.DATA)
158 + .into(ivLogo);
159 + } else {
160 + ivLogo.setVisibility(View.GONE);
161 + }
162 + }
163 + }
164 +}
This diff is collapsed. Click to expand it.
...@@ -5,6 +5,7 @@ import java.util.concurrent.TimeUnit; ...@@ -5,6 +5,7 @@ import java.util.concurrent.TimeUnit;
5 import ly.warp.sdk.Warply; 5 import ly.warp.sdk.Warply;
6 import ly.warp.sdk.utils.WarplyProperty; 6 import ly.warp.sdk.utils.WarplyProperty;
7 import okhttp3.OkHttpClient; 7 import okhttp3.OkHttpClient;
8 +import okhttp3.logging.HttpLoggingInterceptor;
8 import retrofit2.Retrofit; 9 import retrofit2.Retrofit;
9 import retrofit2.converter.gson.GsonConverterFactory; 10 import retrofit2.converter.gson.GsonConverterFactory;
10 11
...@@ -48,11 +49,11 @@ public class ApiClient { ...@@ -48,11 +49,11 @@ public class ApiClient {
48 49
49 private static OkHttpClient getClient() { 50 private static OkHttpClient getClient() {
50 /* Logs Enabled */ 51 /* Logs Enabled */
51 -// HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); 52 + HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
52 -// interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); 53 + interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
53 54
54 return new OkHttpClient.Builder() 55 return new OkHttpClient.Builder()
55 -// .addInterceptor(interceptor) // Logs Enabled 56 + .addInterceptor(interceptor) // Logs Enabled
56 .connectTimeout(30, TimeUnit.SECONDS) 57 .connectTimeout(30, TimeUnit.SECONDS)
57 .writeTimeout(30, TimeUnit.SECONDS) 58 .writeTimeout(30, TimeUnit.SECONDS)
58 .readTimeout(30, TimeUnit.SECONDS) 59 .readTimeout(30, TimeUnit.SECONDS)
......
...@@ -32,7 +32,7 @@ public interface ApiService { ...@@ -32,7 +32,7 @@ public interface ApiService {
32 32
33 @Headers("Content-Type: application/json") 33 @Headers("Content-Type: application/json")
34 @POST("/partners/dei/app_login") 34 @POST("/partners/dei/app_login")
35 - Call<ResponseBody> dehUser(@Body RequestBody request, 35 + Call<ResponseBody> loginUser(@Body RequestBody request,
36 @Header(WarpConstants.HEADER_DATE) String timeStamp, 36 @Header(WarpConstants.HEADER_DATE) String timeStamp,
37 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 37 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
38 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, 38 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
...@@ -41,14 +41,16 @@ public interface ApiService { ...@@ -41,14 +41,16 @@ public interface ApiService {
41 @Header(WarpConstants.HEADER_SIGNATURE) String signature); 41 @Header(WarpConstants.HEADER_SIGNATURE) String signature);
42 42
43 @Headers("Content-Type: application/json") 43 @Headers("Content-Type: application/json")
44 - @POST("/partners/dei/verify") 44 + @POST("/oauth/{appUuid}/context")
45 - Call<ResponseBody> verifyUser(@Body RequestBody request, 45 + Call<ResponseBody> getUser(@Path("appUuid") String appUuid,
46 + @Body RequestBody request,
46 @Header(WarpConstants.HEADER_DATE) String timeStamp, 47 @Header(WarpConstants.HEADER_DATE) String timeStamp,
47 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 48 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
48 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, 49 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
49 @Header(WarpConstants.HEADER_CHANNEL) String channel, 50 @Header(WarpConstants.HEADER_CHANNEL) String channel,
50 @Header(WarpConstants.HEADER_WEB_ID) String webId, 51 @Header(WarpConstants.HEADER_WEB_ID) String webId,
51 - @Header(WarpConstants.HEADER_SIGNATURE) String signature); 52 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
53 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
52 54
53 @Headers("Content-Type: application/json") 55 @Headers("Content-Type: application/json")
54 @POST("/oauth/{appUuid}/logout") 56 @POST("/oauth/{appUuid}/logout")
...@@ -59,7 +61,8 @@ public interface ApiService { ...@@ -59,7 +61,8 @@ public interface ApiService {
59 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, 61 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
60 @Header(WarpConstants.HEADER_CHANNEL) String channel, 62 @Header(WarpConstants.HEADER_CHANNEL) String channel,
61 @Header(WarpConstants.HEADER_WEB_ID) String webId, 63 @Header(WarpConstants.HEADER_WEB_ID) String webId,
62 - @Header(WarpConstants.HEADER_SIGNATURE) String signature); 64 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
65 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
63 66
64 @Headers("Content-Type: application/json") 67 @Headers("Content-Type: application/json")
65 @POST("/user/v5/{appUuid}/logout") 68 @POST("/user/v5/{appUuid}/logout")
...@@ -70,7 +73,8 @@ public interface ApiService { ...@@ -70,7 +73,8 @@ public interface ApiService {
70 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, 73 @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
71 @Header(WarpConstants.HEADER_CHANNEL) String channel, 74 @Header(WarpConstants.HEADER_CHANNEL) String channel,
72 @Header(WarpConstants.HEADER_WEB_ID) String webId, 75 @Header(WarpConstants.HEADER_WEB_ID) String webId,
73 - @Header(WarpConstants.HEADER_SIGNATURE) String signature); 76 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
77 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
74 78
75 @Headers("Content-Type: application/json") 79 @Headers("Content-Type: application/json")
76 @POST("/oauth/{appUuid}/context") 80 @POST("/oauth/{appUuid}/context")
......
...@@ -29,12 +29,14 @@ import org.json.JSONException; ...@@ -29,12 +29,14 @@ import org.json.JSONException;
29 import org.json.JSONObject; 29 import org.json.JSONObject;
30 30
31 import java.util.ArrayList; 31 import java.util.ArrayList;
32 +import java.util.LinkedHashMap;
32 33
33 import ly.warp.sdk.Warply; 34 import ly.warp.sdk.Warply;
34 import ly.warp.sdk.db.WarplyDBHelper; 35 import ly.warp.sdk.db.WarplyDBHelper;
35 import ly.warp.sdk.io.models.BannerItem; 36 import ly.warp.sdk.io.models.BannerItem;
36 import ly.warp.sdk.io.models.Campaign; 37 import ly.warp.sdk.io.models.Campaign;
37 import ly.warp.sdk.io.models.CouponList; 38 import ly.warp.sdk.io.models.CouponList;
39 +import ly.warp.sdk.io.models.Couponset;
38 import ly.warp.sdk.utils.managers.WarplyManager; 40 import ly.warp.sdk.utils.managers.WarplyManager;
39 41
40 /** 42 /**
...@@ -54,6 +56,7 @@ public class WarplyManagerHelper { ...@@ -54,6 +56,7 @@ public class WarplyManagerHelper {
54 private static CouponList mCouponRedeemedList = new CouponList(); 56 private static CouponList mCouponRedeemedList = new CouponList();
55 private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>(); 57 private static ArrayList<Campaign> mCampaignListAll = new ArrayList<Campaign>();
56 private static ArrayList<BannerItem> mBannerListAll = new ArrayList<BannerItem>(); 58 private static ArrayList<BannerItem> mBannerListAll = new ArrayList<BannerItem>();
59 + private static LinkedHashMap<String, ArrayList<Couponset>> mCouponsetCategorizedMap = new LinkedHashMap<>();
57 60
58 // =========================================================== 61 // ===========================================================
59 // Methods for/from SuperClass/Interfaces 62 // Methods for/from SuperClass/Interfaces
...@@ -81,6 +84,15 @@ public class WarplyManagerHelper { ...@@ -81,6 +84,15 @@ public class WarplyManagerHelper {
81 return mBannerListAll; 84 return mBannerListAll;
82 } 85 }
83 86
87 + public static void setCouponsetCategorizedMap(LinkedHashMap<String, ArrayList<Couponset>> couponsetMap) {
88 + mCouponsetCategorizedMap.clear();
89 + mCouponsetCategorizedMap.putAll(couponsetMap);
90 + }
91 +
92 + public static LinkedHashMap<String, ArrayList<Couponset>> getCouponsetCategorizedMap() {
93 + return mCouponsetCategorizedMap;
94 + }
95 +
84 public static void setCouponRedeemedList(CouponList couponRedeemedList) { 96 public static void setCouponRedeemedList(CouponList couponRedeemedList) {
85 mCouponRedeemedList.clear(); 97 mCouponRedeemedList.clear();
86 mCouponRedeemedList.addAll(couponRedeemedList); 98 mCouponRedeemedList.addAll(couponRedeemedList);
......
...@@ -6,15 +6,12 @@ ...@@ -6,15 +6,12 @@
6 android:layout_height="260dp" 6 android:layout_height="260dp"
7 android:background="@drawable/demo_shape_white_border_grey"> 7 android:background="@drawable/demo_shape_white_border_grey">
8 8
9 - <!-- Main Offer Image -->
10 <ImageView 9 <ImageView
11 android:id="@+id/iv_offer_image" 10 android:id="@+id/iv_offer_image"
12 android:layout_width="match_parent" 11 android:layout_width="match_parent"
13 android:layout_height="140dp" 12 android:layout_height="140dp"
14 - android:scaleType="centerCrop" 13 + android:scaleType="centerCrop" />
15 - tools:src="@drawable/demo_home_banner1" />
16 14
17 - <!-- Heart Icon (Favorite) -->
18 <ImageView 15 <ImageView
19 android:id="@+id/iv_favorite" 16 android:id="@+id/iv_favorite"
20 android:layout_width="32dp" 17 android:layout_width="32dp"
...@@ -22,7 +19,6 @@ ...@@ -22,7 +19,6 @@
22 android:layout_margin="8dp" 19 android:layout_margin="8dp"
23 android:src="@drawable/demo_heart" /> 20 android:src="@drawable/demo_heart" />
24 21
25 - <!-- Price Badge -->
26 <TextView 22 <TextView
27 android:id="@+id/tv_price" 23 android:id="@+id/tv_price"
28 android:layout_width="68dp" 24 android:layout_width="68dp"
...@@ -35,7 +31,6 @@ ...@@ -35,7 +31,6 @@
35 android:textSize="16sp" 31 android:textSize="16sp"
36 tools:text="17,95€" /> 32 tools:text="17,95€" />
37 33
38 - <!-- Content Section -->
39 <androidx.constraintlayout.widget.ConstraintLayout 34 <androidx.constraintlayout.widget.ConstraintLayout
40 android:layout_width="match_parent" 35 android:layout_width="match_parent"
41 android:layout_height="match_parent" 36 android:layout_height="match_parent"
...@@ -50,7 +45,6 @@ ...@@ -50,7 +45,6 @@
50 android:orientation="vertical" 45 android:orientation="vertical"
51 app:layout_constraintGuide_percent="0.7" /> 46 app:layout_constraintGuide_percent="0.7" />
52 47
53 - <!-- Title -->
54 <TextView 48 <TextView
55 android:id="@+id/tv_title" 49 android:id="@+id/tv_title"
56 android:layout_width="0dp" 50 android:layout_width="0dp"
...@@ -63,7 +57,6 @@ ...@@ -63,7 +57,6 @@
63 app:layout_constraintTop_toTopOf="parent" 57 app:layout_constraintTop_toTopOf="parent"
64 tools:text="Móvo 17,95" /> 58 tools:text="Móvo 17,95" />
65 59
66 - <!-- Description -->
67 <TextView 60 <TextView
68 android:id="@+id/tv_description" 61 android:id="@+id/tv_description"
69 android:layout_width="0dp" 62 android:layout_width="0dp"
...@@ -77,7 +70,6 @@ ...@@ -77,7 +70,6 @@
77 app:layout_constraintTop_toBottomOf="@+id/tv_title" 70 app:layout_constraintTop_toBottomOf="@+id/tv_title"
78 tools:text="2 πίτσες &amp; Coca-COLA 1,5lt" /> 71 tools:text="2 πίτσες &amp; Coca-COLA 1,5lt" />
79 72
80 - <!-- Validity Date -->
81 <TextView 73 <TextView
82 android:id="@+id/tv_validity" 74 android:id="@+id/tv_validity"
83 android:layout_width="wrap_content" 75 android:layout_width="wrap_content"
...@@ -92,7 +84,6 @@ ...@@ -92,7 +84,6 @@
92 app:layout_constraintBottom_toBottomOf="parent" 84 app:layout_constraintBottom_toBottomOf="parent"
93 tools:text="έως 30-09" /> 85 tools:text="έως 30-09" />
94 86
95 - <!-- Brand Logo -->
96 <ImageView 87 <ImageView
97 android:id="@+id/iv_logo" 88 android:id="@+id/iv_logo"
98 android:layout_width="60dp" 89 android:layout_width="60dp"
...@@ -100,7 +91,6 @@ ...@@ -100,7 +91,6 @@
100 android:layout_alignParentEnd="true" 91 android:layout_alignParentEnd="true"
101 android:layout_centerVertical="true" 92 android:layout_centerVertical="true"
102 android:scaleType="centerInside" 93 android:scaleType="centerInside"
103 - app:layout_constraintBottom_toBottomOf="parent"
104 app:layout_constraintEnd_toEndOf="parent" 94 app:layout_constraintEnd_toEndOf="parent"
105 app:layout_constraintTop_toTopOf="parent" 95 app:layout_constraintTop_toTopOf="parent"
106 tools:src="@drawable/demo_avis" /> 96 tools:src="@drawable/demo_avis" />
......
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
43 android:layout_marginBottom="8dp" 43 android:layout_marginBottom="8dp"
44 android:maxLines="1" 44 android:maxLines="1"
45 android:scrollHorizontally="true" 45 android:scrollHorizontally="true"
46 - android:textColor="@color/custom_black2" 46 + android:text="@string/welcome_user"
47 - android:text="@string/welcome_user" /> 47 + android:textColor="@color/custom_black2" />
48 </RelativeLayout> 48 </RelativeLayout>
49 49
50 <ImageView 50 <ImageView
...@@ -83,7 +83,8 @@ ...@@ -83,7 +83,8 @@
83 android:layout_marginHorizontal="8dp" 83 android:layout_marginHorizontal="8dp"
84 android:layout_marginTop="24dp" 84 android:layout_marginTop="24dp"
85 android:layout_marginBottom="16dp" 85 android:layout_marginBottom="16dp"
86 - android:background="@drawable/shape_rectangle_rounded_white"> 86 + android:background="@drawable/shape_rectangle_rounded_white"
87 + android:visibility="gone">
87 88
88 <LinearLayout 89 <LinearLayout
89 android:id="@+id/ll_sm_flow" 90 android:id="@+id/ll_sm_flow"
...@@ -94,7 +95,8 @@ ...@@ -94,7 +95,8 @@
94 android:layout_marginStart="16dp" 95 android:layout_marginStart="16dp"
95 android:background="@drawable/selector_button_light_blue" 96 android:background="@drawable/selector_button_light_blue"
96 android:gravity="center" 97 android:gravity="center"
97 - android:orientation="horizontal"> 98 + android:orientation="horizontal"
99 + android:visibility="gone">
98 100
99 <TextView 101 <TextView
100 android:layout_width="wrap_content" 102 android:layout_width="wrap_content"
...@@ -107,5 +109,40 @@ ...@@ -107,5 +109,40 @@
107 </LinearLayout> 109 </LinearLayout>
108 </RelativeLayout> 110 </RelativeLayout>
109 111
112 + <LinearLayout
113 + android:id="@+id/ll_login_view"
114 + android:layout_width="match_parent"
115 + android:layout_height="wrap_content"
116 + android:layout_below="@+id/rl_header"
117 + android:layout_marginTop="24dp"
118 + android:paddingHorizontal="24dp"
119 + android:orientation="vertical">
120 +
121 + <EditText
122 + android:id="@+id/et_login"
123 + android:layout_width="match_parent"
124 + android:layout_height="wrap_content"
125 + android:inputType="textEmailAddress"
126 + android:text="p.anagnostou+1201@dei.gr"/>
127 +
128 + <LinearLayout
129 + android:id="@+id/ll_login"
130 + android:layout_width="match_parent"
131 + android:layout_height="45dp"
132 + android:layout_marginTop="16dp"
133 + android:background="@drawable/selector_button_light_blue"
134 + android:gravity="center"
135 + android:orientation="horizontal">
136 +
137 + <TextView
138 + android:layout_width="wrap_content"
139 + android:layout_height="wrap_content"
140 + android:gravity="center"
141 + android:includeFontPadding="false"
142 + android:text="@string/demo_login"
143 + android:textColor="@color/white"
144 + android:textSize="16sp" />
145 + </LinearLayout>
146 + </LinearLayout>
110 </RelativeLayout> 147 </RelativeLayout>
111 </ScrollView> 148 </ScrollView>
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:layout_width="match_parent"
5 + android:layout_height="wrap_content"
6 + android:layout_marginTop="48dp">
7 +
8 + <LinearLayout
9 + android:id="@+id/ll_section_header"
10 + android:layout_width="match_parent"
11 + android:layout_height="wrap_content"
12 + android:layout_gravity="center"
13 + android:orientation="horizontal"
14 + android:paddingHorizontal="16dp">
15 +
16 + <TextView
17 + android:id="@+id/tv_section_title"
18 + android:layout_width="0dp"
19 + android:layout_height="wrap_content"
20 + android:layout_weight="1"
21 + android:textColor="@color/custom_black2"
22 + android:textSize="16sp"
23 + tools:text="Top Offers (10)" />
24 +
25 + <TextView
26 + android:id="@+id/tv_section_all"
27 + android:layout_width="wrap_content"
28 + android:layout_height="wrap_content"
29 + android:background="@drawable/demo_shape_transparent_border_black"
30 + android:paddingHorizontal="16dp"
31 + android:paddingVertical="5dp"
32 + android:text="@string/demo_all"
33 + android:textColor="@color/custom_black3"
34 + android:textSize="14sp" />
35 + </LinearLayout>
36 +
37 + <androidx.recyclerview.widget.RecyclerView
38 + android:id="@+id/rv_section_list"
39 + android:layout_width="match_parent"
40 + android:layout_height="wrap_content"
41 + android:layout_below="@+id/ll_section_header"
42 + android:layout_marginTop="16dp"
43 + android:clipToPadding="false"
44 + android:orientation="horizontal"
45 + android:paddingHorizontal="16dp" />
46 +</RelativeLayout>
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
6 <string name="welcome_user">User</string> 6 <string name="welcome_user">User</string>
7 <string name="menu_home">Αρχική</string> 7 <string name="menu_home">Αρχική</string>
8 <string name="demo_home">Αρχική οθόνη</string> 8 <string name="demo_home">Αρχική οθόνη</string>
9 + <string name="demo_login">Σύνδεση</string>
9 <string name="demo_all">Όλα</string> 10 <string name="demo_all">Όλα</string>
10 <string name="demo_offer">Προσφορά</string> 11 <string name="demo_offer">Προσφορά</string>
11 <string name="demo_more">Περισσότερα</string> 12 <string name="demo_more">Περισσότερα</string>
......