Panagiotis Triantafyllou

deh part5

1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <resources> 2 <resources>
3 3
4 - <string name="app_name">Cosmote demo</string> 4 + <string name="app_name">ΔΕΗ demo</string>
5 <string name="hello_world">Hello world!</string> 5 <string name="hello_world">Hello world!</string>
6 <string name="action_settings">Settings</string> 6 <string name="action_settings">Settings</string>
7 <string name="title_activity_main">MainActivity</string> 7 <string name="title_activity_main">MainActivity</string>
......
...@@ -45,6 +45,12 @@ ...@@ -45,6 +45,12 @@
45 android:theme="@style/SDKAppTheme" /> 45 android:theme="@style/SDKAppTheme" />
46 46
47 <activity 47 <activity
48 + android:name=".activities.ProfileActivity"
49 + android:exported="false"
50 + android:screenOrientation="portrait"
51 + android:theme="@style/SDKAppTheme" />
52 +
53 + <activity
48 android:name=".dexter.PermissionsActivity" 54 android:name=".dexter.PermissionsActivity"
49 android:exported="false" 55 android:exported="false"
50 android:launchMode="singleInstance" 56 android:launchMode="singleInstance"
......
...@@ -76,6 +76,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -76,6 +76,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
76 76
77 private TextView mTvAllOffers, mTvAllFavorites, mTvAllViability, mTvAllFamily, 77 private TextView mTvAllOffers, mTvAllFavorites, mTvAllViability, mTvAllFamily,
78 mTvAllCoffee, mTvAllTravelling, mTvAllKids, mTvAllPurchases; 78 mTvAllCoffee, mTvAllTravelling, mTvAllKids, mTvAllPurchases;
79 + private ImageView mIvProfile;
79 80
80 // =========================================================== 81 // ===========================================================
81 // Methods for/from SuperClass/Interfaces 82 // Methods for/from SuperClass/Interfaces
...@@ -106,7 +107,10 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -106,7 +107,10 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
106 107
107 @Override 108 @Override
108 public void onClick(View v) { 109 public void onClick(View v) {
109 - // No longer needed as banner clicks are handled by the adapter 110 + if (v.getId() == R.id.profile_icon) {
111 + Intent myIntent = new Intent(HomeActivity.this, ProfileActivity.class);
112 + startActivity(myIntent);
113 + }
110 } 114 }
111 115
112 @Override 116 @Override
...@@ -129,6 +133,9 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -129,6 +133,9 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
129 // Initialize banner carousel 133 // Initialize banner carousel
130 setupBannerCarousel(); 134 setupBannerCarousel();
131 135
136 + mIvProfile = findViewById(R.id.profile_icon);
137 + mIvProfile.setOnClickListener(this);
138 +
132 // Initialize Top Offers section 139 // Initialize Top Offers section
133 mTvCategoryTopOffers = findViewById(R.id.tv_recycler_category1); 140 mTvCategoryTopOffers = findViewById(R.id.tv_recycler_category1);
134 mRvTopOffers = findViewById(R.id.rl_recycler1); 141 mRvTopOffers = findViewById(R.id.rl_recycler1);
...@@ -191,6 +198,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -191,6 +198,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
191 // Set up RecyclerView 198 // Set up RecyclerView
192 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); 199 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
193 mRvTopOffers.setLayoutManager(layoutManager); 200 mRvTopOffers.setLayoutManager(layoutManager);
201 + mRvTopOffers.setHasFixedSize(true);
194 202
195 // Add spacing between items 203 // Add spacing between items
196 int spacingInPixels = (int) TypedValue.applyDimension( 204 int spacingInPixels = (int) TypedValue.applyDimension(
...@@ -217,6 +225,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -217,6 +225,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
217 // Set up RecyclerView 225 // Set up RecyclerView
218 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); 226 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
219 mRvFavorites.setLayoutManager(layoutManager); 227 mRvFavorites.setLayoutManager(layoutManager);
228 + mRvFavorites.setHasFixedSize(true);
220 229
221 // Add spacing between items 230 // Add spacing between items
222 int spacingInPixels = (int) TypedValue.applyDimension( 231 int spacingInPixels = (int) TypedValue.applyDimension(
...@@ -243,6 +252,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -243,6 +252,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
243 // Set up RecyclerView 252 // Set up RecyclerView
244 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); 253 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
245 mRvViability.setLayoutManager(layoutManager); 254 mRvViability.setLayoutManager(layoutManager);
255 + mRvViability.setHasFixedSize(true);
246 256
247 // Add spacing between items 257 // Add spacing between items
248 int spacingInPixels = (int) TypedValue.applyDimension( 258 int spacingInPixels = (int) TypedValue.applyDimension(
...@@ -269,6 +279,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -269,6 +279,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
269 // Set up RecyclerView 279 // Set up RecyclerView
270 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); 280 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
271 mRvFamily.setLayoutManager(layoutManager); 281 mRvFamily.setLayoutManager(layoutManager);
282 + mRvFamily.setHasFixedSize(true);
272 283
273 // Add spacing between items 284 // Add spacing between items
274 int spacingInPixels = (int) TypedValue.applyDimension( 285 int spacingInPixels = (int) TypedValue.applyDimension(
...@@ -295,6 +306,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -295,6 +306,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
295 // Set up RecyclerView 306 // Set up RecyclerView
296 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); 307 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
297 mRvFoodCoffee.setLayoutManager(layoutManager); 308 mRvFoodCoffee.setLayoutManager(layoutManager);
309 + mRvFoodCoffee.setHasFixedSize(true);
298 310
299 // Add spacing between items 311 // Add spacing between items
300 int spacingInPixels = (int) TypedValue.applyDimension( 312 int spacingInPixels = (int) TypedValue.applyDimension(
...@@ -321,6 +333,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -321,6 +333,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
321 // Set up RecyclerView 333 // Set up RecyclerView
322 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); 334 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
323 mRvTravelling.setLayoutManager(layoutManager); 335 mRvTravelling.setLayoutManager(layoutManager);
336 + mRvTravelling.setHasFixedSize(true);
324 337
325 // Add spacing between items 338 // Add spacing between items
326 int spacingInPixels = (int) TypedValue.applyDimension( 339 int spacingInPixels = (int) TypedValue.applyDimension(
...@@ -347,6 +360,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -347,6 +360,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
347 // Set up RecyclerView 360 // Set up RecyclerView
348 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); 361 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
349 mRvKids.setLayoutManager(layoutManager); 362 mRvKids.setLayoutManager(layoutManager);
363 + mRvKids.setHasFixedSize(true);
350 364
351 // Add spacing between items 365 // Add spacing between items
352 int spacingInPixels = (int) TypedValue.applyDimension( 366 int spacingInPixels = (int) TypedValue.applyDimension(
...@@ -373,6 +387,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -373,6 +387,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
373 // Set up RecyclerView 387 // Set up RecyclerView
374 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); 388 LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
375 mRvPurchases.setLayoutManager(layoutManager); 389 mRvPurchases.setLayoutManager(layoutManager);
390 + mRvPurchases.setHasFixedSize(true);
376 391
377 // Add spacing between items 392 // Add spacing between items
378 int spacingInPixels = (int) TypedValue.applyDimension( 393 int spacingInPixels = (int) TypedValue.applyDimension(
...@@ -433,6 +448,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -433,6 +448,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
433 448
434 /** 449 /**
435 * Sets up the pagination dots 450 * Sets up the pagination dots
451 + *
436 * @param count Number of dots to display 452 * @param count Number of dots to display
437 */ 453 */
438 private void setupPaginationDots(int count) { 454 private void setupPaginationDots(int count) {
...@@ -464,6 +480,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe ...@@ -464,6 +480,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
464 480
465 /** 481 /**
466 * Updates the dots to reflect the current page 482 * Updates the dots to reflect the current page
483 + *
467 * @param position Current page position 484 * @param position Current page position
468 */ 485 */
469 private void updateDots(int position) { 486 private void updateDots(int position) {
......
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.resource.bitmap.CenterCrop;
16 +
17 +import java.text.ParseException;
18 +import java.text.SimpleDateFormat;
19 +import java.util.ArrayList;
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.CouponItem;
26 +import ly.warp.sdk.utils.TopRoundedCornersTransformation;
27 +import ly.warp.sdk.utils.WarpUtils;
28 +
29 +/**
30 + * Adapter for displaying coupon items in a vertical RecyclerView
31 + */
32 +public class CouponAdapter extends RecyclerView.Adapter<CouponAdapter.CouponViewHolder> {
33 +
34 + private final List<CouponItem> allCouponItems;
35 + private List<CouponItem> filteredCouponItems;
36 + private final Context context;
37 + private OnCouponClickListener listener;
38 + private String currentFilter = null;
39 +
40 + /**
41 + * Interface for handling coupon item clicks
42 + */
43 + public interface OnCouponClickListener {
44 + void onCouponClick(CouponItem couponItem, int position);
45 + void onFavoriteClick(CouponItem couponItem, int position);
46 + }
47 +
48 + /**
49 + * Constructor
50 + *
51 + * @param context The context
52 + * @param couponItems List of coupon items to display
53 + */
54 + public CouponAdapter(Context context, List<CouponItem> couponItems) {
55 + this.context = context;
56 + this.allCouponItems = couponItems;
57 + this.filteredCouponItems = new ArrayList<>(couponItems);
58 + }
59 +
60 + /**
61 + * Set click listener for coupon items
62 + *
63 + * @param listener The listener
64 + */
65 + public void setOnCouponClickListener(OnCouponClickListener listener) {
66 + this.listener = listener;
67 + }
68 +
69 + /**
70 + * Filter coupons by status
71 + *
72 + * @param status The status to filter by (active, favorite, redeemed) or null for all
73 + */
74 + public void filterByStatus(String status) {
75 + currentFilter = status;
76 + filteredCouponItems.clear();
77 +
78 + if (status == null) {
79 + // Show all coupons
80 + filteredCouponItems.addAll(allCouponItems);
81 + } else {
82 + // Filter by status
83 + for (CouponItem coupon : allCouponItems) {
84 + if (status.equals(coupon.getStatus())) {
85 + filteredCouponItems.add(coupon);
86 + }
87 + }
88 + }
89 +
90 + notifyDataSetChanged();
91 + }
92 +
93 + @NonNull
94 + @Override
95 + public CouponViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
96 + View view = LayoutInflater.from(context).inflate(R.layout.demo_item_coupon, parent, false);
97 + return new CouponViewHolder(view);
98 + }
99 +
100 + @Override
101 + public void onBindViewHolder(@NonNull CouponViewHolder holder, int position) {
102 + CouponItem couponItem = filteredCouponItems.get(position);
103 + holder.bind(couponItem, position);
104 + }
105 +
106 + @Override
107 + public int getItemCount() {
108 + return filteredCouponItems.size();
109 + }
110 +
111 + /**
112 + * ViewHolder for coupon items
113 + */
114 + class CouponViewHolder extends RecyclerView.ViewHolder {
115 + private final ImageView ivOfferImage;
116 + private final ImageView ivFavorite;
117 + private final ImageView ivLogo;
118 + private final TextView tvPrice;
119 + private final TextView tvTitle;
120 + private final TextView tvDescription;
121 + private final TextView tvValidity;
122 +
123 + CouponViewHolder(@NonNull View itemView) {
124 + super(itemView);
125 + ivOfferImage = itemView.findViewById(R.id.iv_offer_image);
126 + ivFavorite = itemView.findViewById(R.id.iv_favorite);
127 + ivLogo = itemView.findViewById(R.id.iv_logo);
128 + tvPrice = itemView.findViewById(R.id.tv_price);
129 + tvTitle = itemView.findViewById(R.id.tv_title);
130 + tvDescription = itemView.findViewById(R.id.tv_description);
131 + tvValidity = itemView.findViewById(R.id.tv_validity);
132 +
133 + WarpUtils.renderCustomFont(context, R.font.ping_lcg_bold, tvPrice, tvTitle);
134 + WarpUtils.renderCustomFont(context, R.font.ping_lcg_regular, tvDescription, tvValidity);
135 +
136 + // Set click listeners
137 + itemView.setOnClickListener(v -> {
138 + int position = getAdapterPosition();
139 + if (listener != null && position != RecyclerView.NO_POSITION) {
140 + listener.onCouponClick(filteredCouponItems.get(position), position);
141 + }
142 + });
143 +
144 + ivFavorite.setOnClickListener(v -> {
145 + int position = getAdapterPosition();
146 + if (listener != null && position != RecyclerView.NO_POSITION) {
147 + listener.onFavoriteClick(filteredCouponItems.get(position), position);
148 + }
149 + });
150 + }
151 +
152 + void bind(CouponItem couponItem, int position) {
153 + // Set coupon data to views
154 + tvTitle.setText(couponItem.getTitle());
155 + tvDescription.setText(couponItem.getDescription());
156 + tvPrice.setText(couponItem.getValue());
157 + tvValidity.setText(formatValidityDate(couponItem.getEndDate()));
158 +
159 + // Set heart icon based on favorite status
160 + if (couponItem.isFavorite()) {
161 + // Use pressed/filled heart for Favorites
162 + ivFavorite.setImageResource(R.drawable.demo_heart_pressed);
163 + } else {
164 + // Use default/empty heart for other statuses
165 + ivFavorite.setImageResource(R.drawable.demo_heart);
166 + }
167 +
168 + // Load images from resources
169 + loadOfferImage(couponItem.getImageUrl());
170 + loadLogoImage(couponItem.getLogoUrl());
171 + }
172 +
173 + /**
174 + * Format the end date to "έως dd-MM" format
175 + *
176 + * @param endDate The end date in "dd/MM/yyyy" format
177 + * @return Formatted date string
178 + */
179 + private String formatValidityDate(String endDate) {
180 + try {
181 + SimpleDateFormat inputFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
182 + Date date = inputFormat.parse(endDate);
183 +
184 + SimpleDateFormat outputFormat = new SimpleDateFormat("dd-MM", Locale.getDefault());
185 + return "έως " + outputFormat.format(date);
186 +
187 + } catch (ParseException e) {
188 + // Fallback to original if parsing fails
189 + return endDate;
190 + }
191 + }
192 +
193 + /**
194 + * Load offer image with rounded top corners using Glide
195 + *
196 + * @param imageName The image resource name
197 + */
198 + private void loadOfferImage(String imageName) {
199 + try {
200 + // Remove file extension if present
201 + if (imageName.contains(".")) {
202 + imageName = imageName.substring(0, imageName.lastIndexOf('.'));
203 + }
204 +
205 + // Get resource ID by name
206 + int resourceId = context.getResources().getIdentifier(
207 + imageName, "drawable", context.getPackageName());
208 +
209 + if (resourceId != 0) {
210 + // Convert 9dp to pixels
211 + int radiusInPixels = (int) TypedValue.applyDimension(
212 + TypedValue.COMPLEX_UNIT_DIP, 9,
213 + context.getResources().getDisplayMetrics());
214 +
215 + // Load with Glide and apply transformations
216 + Glide.with(context)
217 + .load(resourceId)
218 + .transform(new CenterCrop(), new TopRoundedCornersTransformation(radiusInPixels))
219 + .into(ivOfferImage);
220 + }
221 + } catch (Exception e) {
222 + e.printStackTrace();
223 + }
224 + }
225 +
226 + /**
227 + * Load logo image without transformations
228 + *
229 + * @param imageName The image resource name
230 + */
231 + private void loadLogoImage(String imageName) {
232 + try {
233 + // Remove file extension if present
234 + if (imageName.contains(".")) {
235 + imageName = imageName.substring(0, imageName.lastIndexOf('.'));
236 + }
237 +
238 + // Get resource ID by name
239 + int resourceId = context.getResources().getIdentifier(
240 + imageName, "drawable", context.getPackageName());
241 +
242 + if (resourceId != 0) {
243 + // Load logo normally without transformations
244 + ivLogo.setImageResource(resourceId);
245 + }
246 + } catch (Exception e) {
247 + e.printStackTrace();
248 + }
249 + }
250 + }
251 +}
1 +package ly.warp.sdk.io.models;
2 +
3 +/**
4 + * Model class representing a coupon item to be displayed in the profile screen.
5 + * Extends OfferItem with additional status field.
6 + */
7 +public class CouponItem extends OfferItem {
8 +
9 + // Coupon status constants
10 + public static final String STATUS_ACTIVE = "active";
11 + public static final String STATUS_FAVORITE = "favorite";
12 + public static final String STATUS_REDEEMED = "redeemed";
13 +
14 + private String status;
15 +
16 + /**
17 + * Default constructor
18 + */
19 + public CouponItem() {
20 + super();
21 + }
22 +
23 + /**
24 + * Full constructor for creating a coupon item
25 + *
26 + * @param id Unique identifier for the coupon
27 + * @param title Title of the coupon
28 + * @param description Short description of the coupon
29 + * @param fullDescription Detailed description of the coupon
30 + * @param endDate End date of the coupon (formatted as string)
31 + * @param value Value of the coupon (formatted as string, e.g., "50%", "€20")
32 + * @param imageUrl URL or resource name for the coupon image
33 + * @param logoUrl URL or resource name for the merchant logo
34 + * @param category Category this coupon belongs to
35 + * @param status Status of the coupon (active, favorite, redeemed)
36 + */
37 + public CouponItem(String id, String title, String description, String fullDescription, String endDate,
38 + String value, String imageUrl, String logoUrl, String category, String status) {
39 + super(id, title, description, fullDescription, endDate, value, imageUrl, logoUrl, category);
40 + this.status = status;
41 + }
42 +
43 + /**
44 + * Constructor for backward compatibility
45 + *
46 + * @param id Unique identifier for the coupon
47 + * @param title Title of the coupon
48 + * @param description Description of the coupon
49 + * @param endDate End date of the coupon (formatted as string)
50 + * @param value Value of the coupon (formatted as string, e.g., "50%", "€20")
51 + * @param imageUrl URL or resource name for the coupon image
52 + * @param logoUrl URL or resource name for the merchant logo
53 + * @param category Category this coupon belongs to
54 + * @param status Status of the coupon (active, favorite, redeemed)
55 + */
56 + public CouponItem(String id, String title, String description, String endDate,
57 + String value, String imageUrl, String logoUrl, String category, String status) {
58 + super(id, title, description, endDate, value, imageUrl, logoUrl, category);
59 + this.status = status;
60 + }
61 +
62 + /**
63 + * Constructor from an existing OfferItem with added status
64 + *
65 + * @param offerItem The offer item to convert
66 + * @param status Status of the coupon (active, favorite, redeemed)
67 + */
68 + public CouponItem(OfferItem offerItem, String status) {
69 + super(offerItem.getId(), offerItem.getTitle(), offerItem.getDescription(),
70 + offerItem.getFullDescription(), offerItem.getEndDate(), offerItem.getValue(),
71 + offerItem.getImageUrl(), offerItem.getLogoUrl(), offerItem.getCategory());
72 + this.status = status;
73 + }
74 +
75 + // Getters and Setters
76 +
77 + public String getStatus() {
78 + return status;
79 + }
80 +
81 + public void setStatus(String status) {
82 + this.status = status;
83 + }
84 +
85 + /**
86 + * Check if the coupon is active
87 + * @return true if active, false otherwise
88 + */
89 + public boolean isActive() {
90 + return STATUS_ACTIVE.equals(status);
91 + }
92 +
93 + /**
94 + * Check if the coupon is a favorite
95 + * @return true if favorite, false otherwise
96 + */
97 + public boolean isFavorite() {
98 + return STATUS_FAVORITE.equals(status);
99 + }
100 +
101 + /**
102 + * Check if the coupon is redeemed
103 + * @return true if redeemed, false otherwise
104 + */
105 + public boolean isRedeemed() {
106 + return STATUS_REDEEMED.equals(status);
107 + }
108 +}
...@@ -179,7 +179,6 @@ public class WarplyManagerHelper { ...@@ -179,7 +179,6 @@ public class WarplyManagerHelper {
179 params.putOpt("refresh_token", WarplyDBHelper.getInstance(context).getAuthValue("refresh_token")); 179 params.putOpt("refresh_token", WarplyDBHelper.getInstance(context).getAuthValue("refresh_token"));
180 params.putOpt("client_id", WarplyDBHelper.getInstance(context).getClientValue("client_id")); 180 params.putOpt("client_id", WarplyDBHelper.getInstance(context).getClientValue("client_id"));
181 params.putOpt("client_secret", WarplyDBHelper.getInstance(context).getClientValue("client_secret")); 181 params.putOpt("client_secret", WarplyDBHelper.getInstance(context).getClientValue("client_secret"));
182 - params.putOpt("map", "true");
183 params.putOpt("lan", WarpUtils.getApplicationLocale(context)); 182 params.putOpt("lan", WarpUtils.getApplicationLocale(context));
184 params.putOpt("dark", String.valueOf(WarpUtils.getIsDarkModeEnabled(context))); 183 params.putOpt("dark", String.valueOf(WarpUtils.getIsDarkModeEnabled(context)));
185 } catch (JSONException e) { 184 } catch (JSONException e) {
......
1 +package ly.warp.sdk.views;
2 +
3 +import android.graphics.Rect;
4 +import android.view.View;
5 +
6 +import androidx.annotation.NonNull;
7 +import androidx.recyclerview.widget.RecyclerView;
8 +
9 +/**
10 + * ItemDecoration for adding vertical spacing between RecyclerView items.
11 + * Adds spacing to the bottom of each item except the last one.
12 + */
13 +public class VerticalSpaceItemDecoration extends RecyclerView.ItemDecoration {
14 + private final int spaceHeight;
15 +
16 + /**
17 + * Constructor
18 + *
19 + * @param spaceHeight Space height in pixels
20 + */
21 + public VerticalSpaceItemDecoration(int spaceHeight) {
22 + this.spaceHeight = spaceHeight;
23 + }
24 +
25 + @Override
26 + public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
27 + // Add spacing to the bottom of each item except the last one
28 + int position = parent.getChildAdapterPosition(view);
29 + if (position != RecyclerView.NO_POSITION && position != parent.getAdapter().getItemCount() - 1) {
30 + outRect.bottom = spaceHeight;
31 + }
32 + }
33 +}
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
84 <RelativeLayout 84 <RelativeLayout
85 android:layout_width="match_parent" 85 android:layout_width="match_parent"
86 android:layout_height="wrap_content" 86 android:layout_height="wrap_content"
87 - android:layout_marginTop="48dp"> 87 + android:layout_marginTop="24dp">
88 88
89 <LinearLayout 89 <LinearLayout
90 android:id="@+id/ll_recycler1" 90 android:id="@+id/ll_recycler1"
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
109 android:layout_height="wrap_content" 109 android:layout_height="wrap_content"
110 android:background="@drawable/demo_shape_transparent_border_black" 110 android:background="@drawable/demo_shape_transparent_border_black"
111 android:paddingHorizontal="16dp" 111 android:paddingHorizontal="16dp"
112 - android:paddingVertical="6dp" 112 + android:paddingVertical="5dp"
113 android:text="@string/demo_all" 113 android:text="@string/demo_all"
114 android:textColor="@color/black3" 114 android:textColor="@color/black3"
115 android:textSize="14sp" /> 115 android:textSize="14sp" />
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
155 android:layout_height="wrap_content" 155 android:layout_height="wrap_content"
156 android:background="@drawable/demo_shape_transparent_border_black" 156 android:background="@drawable/demo_shape_transparent_border_black"
157 android:paddingHorizontal="16dp" 157 android:paddingHorizontal="16dp"
158 - android:paddingVertical="6dp" 158 + android:paddingVertical="5dp"
159 android:text="@string/demo_all" 159 android:text="@string/demo_all"
160 android:textColor="@color/black3" 160 android:textColor="@color/black3"
161 android:textSize="14sp" /> 161 android:textSize="14sp" />
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
201 android:layout_height="wrap_content" 201 android:layout_height="wrap_content"
202 android:background="@drawable/demo_shape_transparent_border_black" 202 android:background="@drawable/demo_shape_transparent_border_black"
203 android:paddingHorizontal="16dp" 203 android:paddingHorizontal="16dp"
204 - android:paddingVertical="6dp" 204 + android:paddingVertical="5dp"
205 android:text="@string/demo_all" 205 android:text="@string/demo_all"
206 android:textColor="@color/black3" 206 android:textColor="@color/black3"
207 android:textSize="14sp" /> 207 android:textSize="14sp" />
...@@ -247,7 +247,7 @@ ...@@ -247,7 +247,7 @@
247 android:layout_height="wrap_content" 247 android:layout_height="wrap_content"
248 android:background="@drawable/demo_shape_transparent_border_black" 248 android:background="@drawable/demo_shape_transparent_border_black"
249 android:paddingHorizontal="16dp" 249 android:paddingHorizontal="16dp"
250 - android:paddingVertical="6dp" 250 + android:paddingVertical="5dp"
251 android:text="@string/demo_all" 251 android:text="@string/demo_all"
252 android:textColor="@color/black3" 252 android:textColor="@color/black3"
253 android:textSize="14sp" /> 253 android:textSize="14sp" />
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
293 android:layout_height="wrap_content" 293 android:layout_height="wrap_content"
294 android:background="@drawable/demo_shape_transparent_border_black" 294 android:background="@drawable/demo_shape_transparent_border_black"
295 android:paddingHorizontal="16dp" 295 android:paddingHorizontal="16dp"
296 - android:paddingVertical="6dp" 296 + android:paddingVertical="5dp"
297 android:text="@string/demo_all" 297 android:text="@string/demo_all"
298 android:textColor="@color/black3" 298 android:textColor="@color/black3"
299 android:textSize="14sp" /> 299 android:textSize="14sp" />
...@@ -339,7 +339,7 @@ ...@@ -339,7 +339,7 @@
339 android:layout_height="wrap_content" 339 android:layout_height="wrap_content"
340 android:background="@drawable/demo_shape_transparent_border_black" 340 android:background="@drawable/demo_shape_transparent_border_black"
341 android:paddingHorizontal="16dp" 341 android:paddingHorizontal="16dp"
342 - android:paddingVertical="6dp" 342 + android:paddingVertical="5dp"
343 android:text="@string/demo_all" 343 android:text="@string/demo_all"
344 android:textColor="@color/black3" 344 android:textColor="@color/black3"
345 android:textSize="14sp" /> 345 android:textSize="14sp" />
...@@ -385,7 +385,7 @@ ...@@ -385,7 +385,7 @@
385 android:layout_height="wrap_content" 385 android:layout_height="wrap_content"
386 android:background="@drawable/demo_shape_transparent_border_black" 386 android:background="@drawable/demo_shape_transparent_border_black"
387 android:paddingHorizontal="16dp" 387 android:paddingHorizontal="16dp"
388 - android:paddingVertical="6dp" 388 + android:paddingVertical="5dp"
389 android:text="@string/demo_all" 389 android:text="@string/demo_all"
390 android:textColor="@color/black3" 390 android:textColor="@color/black3"
391 android:textSize="14sp" /> 391 android:textSize="14sp" />
...@@ -432,7 +432,7 @@ ...@@ -432,7 +432,7 @@
432 android:layout_height="wrap_content" 432 android:layout_height="wrap_content"
433 android:background="@drawable/demo_shape_transparent_border_black" 433 android:background="@drawable/demo_shape_transparent_border_black"
434 android:paddingHorizontal="16dp" 434 android:paddingHorizontal="16dp"
435 - android:paddingVertical="6dp" 435 + android:paddingVertical="5dp"
436 android:text="@string/demo_all" 436 android:text="@string/demo_all"
437 android:textColor="@color/black3" 437 android:textColor="@color/black3"
438 android:textSize="14sp" /> 438 android:textSize="14sp" />
......
This diff is collapsed. Click to expand it.
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
29 <LinearLayout 29 <LinearLayout
30 android:layout_width="0dp" 30 android:layout_width="0dp"
31 android:layout_height="wrap_content" 31 android:layout_height="wrap_content"
32 - android:layout_gravity="center" 32 + android:gravity="center_vertical"
33 android:layout_weight="1" 33 android:layout_weight="1"
34 android:orientation="horizontal"> 34 android:orientation="horizontal">
35 35
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout 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="280dp"
7 + android:background="@drawable/demo_shape_white_border_grey">
8 +
9 + <ImageView
10 + android:id="@+id/iv_offer_image"
11 + android:layout_width="match_parent"
12 + android:layout_height="160dp"
13 + android:scaleType="centerCrop"
14 + tools:src="@drawable/demo_home_banner1" />
15 +
16 + <ImageView
17 + android:id="@+id/iv_favorite"
18 + android:layout_width="46dp"
19 + android:layout_height="46dp"
20 + android:layout_margin="8dp"
21 + android:src="@drawable/demo_heart" />
22 +
23 + <TextView
24 + android:id="@+id/tv_price"
25 + android:layout_width="84dp"
26 + android:layout_height="84dp"
27 + android:layout_alignParentEnd="true"
28 + android:layout_margin="8dp"
29 + android:background="@drawable/demo_shape_pink"
30 + android:gravity="center"
31 + android:textColor="@android:color/white"
32 + android:textSize="23sp"
33 + tools:text="17,95€" />
34 +
35 + <androidx.constraintlayout.widget.ConstraintLayout
36 + android:layout_width="match_parent"
37 + android:layout_height="match_parent"
38 + android:layout_below="@id/iv_offer_image"
39 + android:orientation="vertical"
40 + android:padding="12dp">
41 +
42 + <androidx.constraintlayout.widget.Guideline
43 + android:id="@+id/gl_vertical_70"
44 + android:layout_width="wrap_content"
45 + android:layout_height="wrap_content"
46 + android:orientation="vertical"
47 + app:layout_constraintGuide_percent="0.7" />
48 +
49 + <!-- Title -->
50 + <TextView
51 + android:id="@+id/tv_title"
52 + android:layout_width="0dp"
53 + android:layout_height="wrap_content"
54 + android:maxLines="1"
55 + android:textColor="@color/black2"
56 + android:textSize="21sp"
57 + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_70"
58 + app:layout_constraintStart_toStartOf="parent"
59 + app:layout_constraintTop_toTopOf="parent"
60 + tools:text="Móvo 17,95" />
61 +
62 + <!-- Description -->
63 + <TextView
64 + android:id="@+id/tv_description"
65 + android:layout_width="0dp"
66 + android:layout_height="wrap_content"
67 + android:maxLines="2"
68 + android:textColor="@color/black3"
69 + android:textSize="15sp"
70 + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_70"
71 + app:layout_constraintStart_toStartOf="parent"
72 + app:layout_constraintTop_toBottomOf="@+id/tv_title"
73 + tools:text="2 πίτσες &amp; Coca-COLA 1,5lt" />
74 +
75 + <!-- Validity Date -->
76 + <TextView
77 + android:id="@+id/tv_validity"
78 + android:layout_width="wrap_content"
79 + android:layout_height="wrap_content"
80 + android:layout_alignParentStart="true"
81 + android:layout_centerVertical="true"
82 + android:layout_marginTop="24dp"
83 + android:maxLines="1"
84 + android:textColor="@color/black3"
85 + android:textSize="12sp"
86 + app:layout_constraintStart_toStartOf="parent"
87 + app:layout_constraintBottom_toBottomOf="parent"
88 + tools:text="έως 30-09" />
89 +
90 + <!-- Brand Logo -->
91 + <ImageView
92 + android:id="@+id/iv_logo"
93 + android:layout_width="80dp"
94 + android:layout_height="80dp"
95 + android:layout_alignParentEnd="true"
96 + android:layout_centerVertical="true"
97 + android:scaleType="centerInside"
98 + app:layout_constraintBottom_toBottomOf="parent"
99 + app:layout_constraintEnd_toEndOf="parent"
100 + app:layout_constraintTop_toTopOf="parent"
101 + tools:src="@drawable/demo_avis" />
102 + </androidx.constraintlayout.widget.ConstraintLayout>
103 +</RelativeLayout>
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools" 4 xmlns:tools="http://schemas.android.com/tools"
5 - android:layout_width="260dp" 5 + android:layout_width="270dp"
6 - android:layout_height="250dp" 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 --> 9 <!-- Main Offer Image -->
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
12 android:layout_width="match_parent" 12 android:layout_width="match_parent"
13 android:layout_height="140dp" 13 android:layout_height="140dp"
14 android:scaleType="centerCrop" 14 android:scaleType="centerCrop"
15 - tools:src="@drawable/demo_home_banner" /> 15 + tools:src="@drawable/demo_home_banner1" />
16 16
17 <!-- Heart Icon (Favorite) --> 17 <!-- Heart Icon (Favorite) -->
18 <ImageView 18 <ImageView
...@@ -86,10 +86,10 @@ ...@@ -86,10 +86,10 @@
86 android:layout_centerVertical="true" 86 android:layout_centerVertical="true"
87 android:layout_marginTop="12dp" 87 android:layout_marginTop="12dp"
88 android:maxLines="1" 88 android:maxLines="1"
89 - android:textColor="#757575" 89 + android:textColor="@color/black3"
90 android:textSize="12sp" 90 android:textSize="12sp"
91 app:layout_constraintStart_toStartOf="parent" 91 app:layout_constraintStart_toStartOf="parent"
92 - app:layout_constraintTop_toBottomOf="@+id/tv_description" 92 + app:layout_constraintBottom_toBottomOf="parent"
93 tools:text="έως 30-09" /> 93 tools:text="έως 30-09" />
94 94
95 <!-- Brand Logo --> 95 <!-- Brand Logo -->
......
...@@ -23,4 +23,9 @@ ...@@ -23,4 +23,9 @@
23 <string name="demo_lorem_ipsum">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</string> 23 <string name="demo_lorem_ipsum">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</string>
24 <string name="demo_shops">Καταστήματα κοντά μου</string> 24 <string name="demo_shops">Καταστήματα κοντά μου</string>
25 <string name="demo_website">Δες το website</string> 25 <string name="demo_website">Δες το website</string>
26 + <string name="demo_profile">Το προφίλ μου</string>
27 + <string name="demo_my_coupons">Τα κουπόνια μου</string>
28 + <string name="demo_active">Ενεργά</string>
29 + <string name="demo_redeemed">Εξαργυρωμένα</string>
30 + <string name="demo_favorites">Αγαπημένα</string>
26 </resources> 31 </resources>
......