Showing
54 changed files
with
156 additions
and
30 deletions

1.73 KB
No preview for this file type

3.47 KB
No preview for this file type

3.68 KB
No preview for this file type

1.1 KB
No preview for this file type

1.99 KB
No preview for this file type

2.19 KB
No preview for this file type

2.57 KB
No preview for this file type

5.42 KB
No preview for this file type

5.62 KB
No preview for this file type

4.53 KB
No preview for this file type

9.86 KB
No preview for this file type

9.57 KB
No preview for this file type

6.88 KB
No preview for this file type

16.3 KB
No preview for this file type

14.5 KB
No preview for this file type
... | @@ -39,6 +39,12 @@ | ... | @@ -39,6 +39,12 @@ |
39 | android:theme="@style/SDKAppTheme" /> | 39 | android:theme="@style/SDKAppTheme" /> |
40 | 40 | ||
41 | <activity | 41 | <activity |
42 | + android:name=".activities.SingleCouponActivity" | ||
43 | + android:exported="false" | ||
44 | + android:screenOrientation="portrait" | ||
45 | + android:theme="@style/SDKAppTheme" /> | ||
46 | + | ||
47 | + <activity | ||
42 | android:name=".dexter.PermissionsActivity" | 48 | android:name=".dexter.PermissionsActivity" |
43 | android:exported="false" | 49 | android:exported="false" |
44 | android:launchMode="singleInstance" | 50 | android:launchMode="singleInstance" | ... | ... |
1 | package ly.warp.sdk.activities; | 1 | package ly.warp.sdk.activities; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | +import android.content.Intent; | ||
4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
5 | import android.util.TypedValue; | 6 | import android.util.TypedValue; |
6 | import android.view.View; | 7 | import android.view.View; |
7 | import android.widget.ImageView; | 8 | import android.widget.ImageView; |
8 | import android.widget.TextView; | 9 | import android.widget.TextView; |
9 | -import android.widget.Toast; | ||
10 | 10 | ||
11 | import androidx.recyclerview.widget.LinearLayoutManager; | 11 | import androidx.recyclerview.widget.LinearLayoutManager; |
12 | import androidx.recyclerview.widget.RecyclerView; | 12 | import androidx.recyclerview.widget.RecyclerView; |
... | @@ -17,7 +17,6 @@ import ly.warp.sdk.io.models.DummyDataProvider; | ... | @@ -17,7 +17,6 @@ import ly.warp.sdk.io.models.DummyDataProvider; |
17 | import ly.warp.sdk.io.models.OfferCategory; | 17 | import ly.warp.sdk.io.models.OfferCategory; |
18 | import ly.warp.sdk.io.models.OfferItem; | 18 | import ly.warp.sdk.io.models.OfferItem; |
19 | import ly.warp.sdk.utils.WarplyManagerHelper; | 19 | import ly.warp.sdk.utils.WarplyManagerHelper; |
20 | -import ly.warp.sdk.utils.managers.WarplyManager; | ||
21 | import ly.warp.sdk.views.HorizontalSpaceItemDecoration; | 20 | import ly.warp.sdk.views.HorizontalSpaceItemDecoration; |
22 | 21 | ||
23 | public class HomeActivity extends Activity implements View.OnClickListener, OfferAdapter.OnOfferClickListener { | 22 | public class HomeActivity extends Activity implements View.OnClickListener, OfferAdapter.OnOfferClickListener { |
... | @@ -72,8 +71,6 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe | ... | @@ -72,8 +71,6 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe |
72 | super.onCreate(savedInstanceState); | 71 | super.onCreate(savedInstanceState); |
73 | setContentView(R.layout.activity_home); | 72 | setContentView(R.layout.activity_home); |
74 | 73 | ||
75 | - mIvBanner = findViewById(R.id.banner_icon); | ||
76 | - | ||
77 | initViews(); | 74 | initViews(); |
78 | 75 | ||
79 | // Setup all category sections | 76 | // Setup all category sections |
... | @@ -92,12 +89,32 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe | ... | @@ -92,12 +89,32 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe |
92 | super.onResume(); | 89 | super.onResume(); |
93 | } | 90 | } |
94 | 91 | ||
92 | + @Override | ||
93 | + public void onClick(View v) { | ||
94 | + if (v.getId() == R.id.banner_icon) { | ||
95 | + WarplyManagerHelper.openContest(this); | ||
96 | + } | ||
97 | + } | ||
98 | + | ||
99 | + @Override | ||
100 | + public void onOfferClick(OfferItem offerItem, int position) { | ||
101 | + Intent myIntent = new Intent(HomeActivity.this, SingleCouponActivity.class); | ||
102 | + myIntent.putExtra(SingleCouponActivity.EXTRA_OFFER_ITEM, offerItem); | ||
103 | + startActivity(myIntent); | ||
104 | + } | ||
105 | + | ||
106 | + @Override | ||
107 | + public void onFavoriteClick(OfferItem offerItem, int position) { | ||
108 | +// Toast.makeText(this, "Favorite clicked for: " + offerItem.getTitle(), Toast.LENGTH_SHORT).show(); | ||
109 | + } | ||
110 | + | ||
95 | // =========================================================== | 111 | // =========================================================== |
96 | // Methods | 112 | // Methods |
97 | // =========================================================== | 113 | // =========================================================== |
98 | 114 | ||
99 | private void initViews() { | 115 | private void initViews() { |
100 | // Initialize banner | 116 | // Initialize banner |
117 | + mIvBanner = findViewById(R.id.banner_icon); | ||
101 | mIvBanner.setOnClickListener(this); | 118 | mIvBanner.setOnClickListener(this); |
102 | 119 | ||
103 | // Initialize Top Offers section | 120 | // Initialize Top Offers section |
... | @@ -341,23 +358,6 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe | ... | @@ -341,23 +358,6 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe |
341 | mRvPurchases.setAdapter(mPurchasesAdapter); | 358 | mRvPurchases.setAdapter(mPurchasesAdapter); |
342 | } | 359 | } |
343 | 360 | ||
344 | - @Override | ||
345 | - public void onClick(View v) { | ||
346 | - if (v.getId() == R.id.banner_icon) { | ||
347 | - WarplyManagerHelper.openContest(this); | ||
348 | - } | ||
349 | - } | ||
350 | - | ||
351 | - @Override | ||
352 | - public void onOfferClick(OfferItem offerItem, int position) { | ||
353 | -// Toast.makeText(this, "Offer clicked: " + offerItem.getTitle(), Toast.LENGTH_SHORT).show(); | ||
354 | - } | ||
355 | - | ||
356 | - @Override | ||
357 | - public void onFavoriteClick(OfferItem offerItem, int position) { | ||
358 | -// Toast.makeText(this, "Favorite clicked for: " + offerItem.getTitle(), Toast.LENGTH_SHORT).show(); | ||
359 | - } | ||
360 | - | ||
361 | // =========================================================== | 361 | // =========================================================== |
362 | // Inner and Anonymous Classes | 362 | // Inner and Anonymous Classes |
363 | // =========================================================== | 363 | // =========================================================== | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -14,7 +14,11 @@ import androidx.recyclerview.widget.RecyclerView; | ... | @@ -14,7 +14,11 @@ import androidx.recyclerview.widget.RecyclerView; |
14 | import com.bumptech.glide.Glide; | 14 | import com.bumptech.glide.Glide; |
15 | import com.bumptech.glide.load.resource.bitmap.CenterCrop; | 15 | import com.bumptech.glide.load.resource.bitmap.CenterCrop; |
16 | 16 | ||
17 | +import java.text.ParseException; | ||
18 | +import java.text.SimpleDateFormat; | ||
19 | +import java.util.Date; | ||
17 | import java.util.List; | 20 | import java.util.List; |
21 | +import java.util.Locale; | ||
18 | 22 | ||
19 | import ly.warp.sdk.R; | 23 | import ly.warp.sdk.R; |
20 | import ly.warp.sdk.io.models.DummyDataProvider; | 24 | import ly.warp.sdk.io.models.DummyDataProvider; |
... | @@ -99,12 +103,12 @@ public class OfferAdapter extends RecyclerView.Adapter<OfferAdapter.OfferViewHol | ... | @@ -99,12 +103,12 @@ public class OfferAdapter extends RecyclerView.Adapter<OfferAdapter.OfferViewHol |
99 | tvValidity = itemView.findViewById(R.id.tv_validity); | 103 | tvValidity = itemView.findViewById(R.id.tv_validity); |
100 | 104 | ||
101 | // Set click listeners | 105 | // Set click listeners |
102 | -// itemView.setOnClickListener(v -> { | 106 | + itemView.setOnClickListener(v -> { |
103 | -// int position = getAdapterPosition(); | 107 | + int position = getAdapterPosition(); |
104 | -// if (listener != null && position != RecyclerView.NO_POSITION) { | 108 | + if (listener != null && position != RecyclerView.NO_POSITION) { |
105 | -// listener.onOfferClick(offerItems.get(position), position); | 109 | + listener.onOfferClick(offerItems.get(position), position); |
106 | -// } | 110 | + } |
107 | -// }); | 111 | + }); |
108 | 112 | ||
109 | // ivFavorite.setOnClickListener(v -> { | 113 | // ivFavorite.setOnClickListener(v -> { |
110 | // int position = getAdapterPosition(); | 114 | // int position = getAdapterPosition(); |
... | @@ -119,7 +123,7 @@ public class OfferAdapter extends RecyclerView.Adapter<OfferAdapter.OfferViewHol | ... | @@ -119,7 +123,7 @@ public class OfferAdapter extends RecyclerView.Adapter<OfferAdapter.OfferViewHol |
119 | tvTitle.setText(offerItem.getTitle()); | 123 | tvTitle.setText(offerItem.getTitle()); |
120 | tvDescription.setText(offerItem.getDescription()); | 124 | tvDescription.setText(offerItem.getDescription()); |
121 | tvPrice.setText(offerItem.getValue()); | 125 | tvPrice.setText(offerItem.getValue()); |
122 | - tvValidity.setText(offerItem.getEndDate()); | 126 | + tvValidity.setText(formatValidityDate(offerItem.getEndDate())); |
123 | 127 | ||
124 | // Set heart icon based on category | 128 | // Set heart icon based on category |
125 | if (DummyDataProvider.CATEGORY_FAVORITES.equals(offerItem.getCategory())) { | 129 | if (DummyDataProvider.CATEGORY_FAVORITES.equals(offerItem.getCategory())) { |
... | @@ -136,6 +140,26 @@ public class OfferAdapter extends RecyclerView.Adapter<OfferAdapter.OfferViewHol | ... | @@ -136,6 +140,26 @@ public class OfferAdapter extends RecyclerView.Adapter<OfferAdapter.OfferViewHol |
136 | } | 140 | } |
137 | 141 | ||
138 | /** | 142 | /** |
143 | + * Format the end date to "έως dd-MM" format | ||
144 | + * | ||
145 | + * @param endDate The end date in "dd/MM/yyyy" format | ||
146 | + * @return Formatted date string | ||
147 | + */ | ||
148 | + private String formatValidityDate(String endDate) { | ||
149 | + try { | ||
150 | + SimpleDateFormat inputFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault()); | ||
151 | + Date date = inputFormat.parse(endDate); | ||
152 | + | ||
153 | + SimpleDateFormat outputFormat = new SimpleDateFormat("dd-MM", Locale.getDefault()); | ||
154 | + return "έως " + outputFormat.format(date); | ||
155 | + | ||
156 | + } catch (ParseException e) { | ||
157 | + // Fallback to original if parsing fails | ||
158 | + return endDate; | ||
159 | + } | ||
160 | + } | ||
161 | + | ||
162 | + /** | ||
139 | * Load offer image with rounded top corners using Glide | 163 | * Load offer image with rounded top corners using Glide |
140 | * | 164 | * |
141 | * @param imageName The image resource name | 165 | * @param imageName The image resource name | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -9,6 +9,7 @@ public class OfferItem implements Serializable { | ... | @@ -9,6 +9,7 @@ public class OfferItem implements Serializable { |
9 | private String id; | 9 | private String id; |
10 | private String title; | 10 | private String title; |
11 | private String description; | 11 | private String description; |
12 | + private String fullDescription; | ||
12 | private String endDate; | 13 | private String endDate; |
13 | private String value; | 14 | private String value; |
14 | private String imageUrl; | 15 | private String imageUrl; |
... | @@ -26,18 +27,20 @@ public class OfferItem implements Serializable { | ... | @@ -26,18 +27,20 @@ public class OfferItem implements Serializable { |
26 | * | 27 | * |
27 | * @param id Unique identifier for the offer | 28 | * @param id Unique identifier for the offer |
28 | * @param title Title of the offer | 29 | * @param title Title of the offer |
29 | - * @param description Description of the offer | 30 | + * @param description Short description of the offer |
31 | + * @param fullDescription Detailed description of the offer (approximately 200 characters) | ||
30 | * @param endDate End date of the offer (formatted as string) | 32 | * @param endDate End date of the offer (formatted as string) |
31 | * @param value Value of the offer (formatted as string, e.g., "50%", "€20") | 33 | * @param value Value of the offer (formatted as string, e.g., "50%", "€20") |
32 | * @param imageUrl URL or resource name for the offer image | 34 | * @param imageUrl URL or resource name for the offer image |
33 | * @param logoUrl URL or resource name for the merchant logo | 35 | * @param logoUrl URL or resource name for the merchant logo |
34 | * @param category Category this offer belongs to | 36 | * @param category Category this offer belongs to |
35 | */ | 37 | */ |
36 | - public OfferItem(String id, String title, String description, String endDate, | 38 | + public OfferItem(String id, String title, String description, String fullDescription, String endDate, |
37 | String value, String imageUrl, String logoUrl, String category) { | 39 | String value, String imageUrl, String logoUrl, String category) { |
38 | this.id = id; | 40 | this.id = id; |
39 | this.title = title; | 41 | this.title = title; |
40 | this.description = description; | 42 | this.description = description; |
43 | + this.fullDescription = fullDescription; | ||
41 | this.endDate = endDate; | 44 | this.endDate = endDate; |
42 | this.value = value; | 45 | this.value = value; |
43 | this.imageUrl = imageUrl; | 46 | this.imageUrl = imageUrl; |
... | @@ -45,6 +48,23 @@ public class OfferItem implements Serializable { | ... | @@ -45,6 +48,23 @@ public class OfferItem implements Serializable { |
45 | this.category = category; | 48 | this.category = category; |
46 | } | 49 | } |
47 | 50 | ||
51 | + /** | ||
52 | + * Constructor for backward compatibility | ||
53 | + * | ||
54 | + * @param id Unique identifier for the offer | ||
55 | + * @param title Title of the offer | ||
56 | + * @param description Description of the offer | ||
57 | + * @param endDate End date of the offer (formatted as string) | ||
58 | + * @param value Value of the offer (formatted as string, e.g., "50%", "€20") | ||
59 | + * @param imageUrl URL or resource name for the offer image | ||
60 | + * @param logoUrl URL or resource name for the merchant logo | ||
61 | + * @param category Category this offer belongs to | ||
62 | + */ | ||
63 | + public OfferItem(String id, String title, String description, String endDate, | ||
64 | + String value, String imageUrl, String logoUrl, String category) { | ||
65 | + this(id, title, description, description, endDate, value, imageUrl, logoUrl, category); | ||
66 | + } | ||
67 | + | ||
48 | // Getters and Setters | 68 | // Getters and Setters |
49 | 69 | ||
50 | public String getId() { | 70 | public String getId() { |
... | @@ -71,6 +91,14 @@ public class OfferItem implements Serializable { | ... | @@ -71,6 +91,14 @@ public class OfferItem implements Serializable { |
71 | this.description = description; | 91 | this.description = description; |
72 | } | 92 | } |
73 | 93 | ||
94 | + public String getFullDescription() { | ||
95 | + return fullDescription; | ||
96 | + } | ||
97 | + | ||
98 | + public void setFullDescription(String fullDescription) { | ||
99 | + this.fullDescription = fullDescription; | ||
100 | + } | ||
101 | + | ||
74 | public String getEndDate() { | 102 | public String getEndDate() { |
75 | return endDate; | 103 | return endDate; |
76 | } | 104 | } | ... | ... |

2.02 KB

2.21 KB

2.34 KB

30.4 KB

249 Bytes

615 Bytes

384 Bytes

1.02 KB
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
3 | + <item android:drawable="@drawable/shape_cos_black_tr" android:state_pressed="true" /> | ||
4 | + <item android:drawable="@drawable/shape_cos_black" android:state_pressed="false" /> | ||
5 | +</selector> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
3 | + <item android:drawable="@drawable/shape_transparent_black_border_tr" android:state_pressed="true" /> | ||
4 | + <item android:drawable="@drawable/shape_transparent_black_border" android:state_pressed="false" /> | ||
5 | +</selector> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
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="4dp" /> | ||
5 | + | ||
6 | + <solid | ||
7 | + android:width="2dp" | ||
8 | + android:color="@color/black2" /> | ||
9 | +</shape> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
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="4dp" /> | ||
5 | + | ||
6 | + <solid | ||
7 | + android:width="2dp" | ||
8 | + android:color="@color/black2_tr" /> | ||
9 | +</shape> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
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="4dp" /> | ||
5 | + | ||
6 | + <solid android:color="@android:color/transparent" /> | ||
7 | + | ||
8 | + <stroke | ||
9 | + android:width="1dp" | ||
10 | + android:color="@color/black2" /> | ||
11 | +</shape> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
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="4dp" /> | ||
5 | + | ||
6 | + <solid android:color="@android:color/transparent" /> | ||
7 | + | ||
8 | + <stroke | ||
9 | + android:width="1dp" | ||
10 | + android:color="@color/black2_tr" /> | ||
11 | +</shape> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
... | @@ -12,11 +12,17 @@ | ... | @@ -12,11 +12,17 @@ |
12 | <color name="cos_skyblue2">#22A9B5</color> | 12 | <color name="cos_skyblue2">#22A9B5</color> |
13 | <color name="blue_dark">#3A5266</color> | 13 | <color name="blue_dark">#3A5266</color> |
14 | <color name="white">#FFFFFF</color> | 14 | <color name="white">#FFFFFF</color> |
15 | + <color name="white_tr">#66FFFFFF</color> | ||
15 | <color name="cos_green5">#79BF14</color> | 16 | <color name="cos_green5">#79BF14</color> |
16 | <color name="black2">#000F1E</color> | 17 | <color name="black2">#000F1E</color> |
18 | + <color name="black2_tr">#66000F1E</color> | ||
17 | <color name="black3">#00111B</color> | 19 | <color name="black3">#00111B</color> |
18 | <color name="grey">#CCCCCC</color> | 20 | <color name="grey">#CCCCCC</color> |
19 | <color name="pink">#EE417D</color> | 21 | <color name="pink">#EE417D</color> |
22 | + <color name="black4">#0D1B29</color> | ||
23 | + <color name="black5">#020E1C</color> | ||
24 | + <color name="pink2">#F2709D</color> | ||
25 | + <color name="skyblue">#00A3E0</color> | ||
20 | 26 | ||
21 | <!-- Used in styles --> | 27 | <!-- Used in styles --> |
22 | <color name="cos_light_blue">#00A5E3</color> | 28 | <color name="cos_light_blue">#00A5E3</color> | ... | ... |
... | @@ -11,4 +11,16 @@ | ... | @@ -11,4 +11,16 @@ |
11 | <string name="demo_sm_flow">Open SM Flow</string> | 11 | <string name="demo_sm_flow">Open SM Flow</string> |
12 | <string name="demo_sm_map">Open SM Map</string> | 12 | <string name="demo_sm_map">Open SM Map</string> |
13 | <string name="demo_all">Όλα</string> | 13 | <string name="demo_all">Όλα</string> |
14 | + <string name="demo_offer">Προσφορά</string> | ||
15 | + <string name="demo_more">Περισσότερα</string> | ||
16 | + <string name="demo_less">Λιγότερα</string> | ||
17 | + <string name="demo_purchases">για αγορές</string> | ||
18 | + <string name="demo_valid_until">Η προσφορά ισχύει έως %1$s</string> | ||
19 | + <string name="demo_coupon_code">Κωδικός Κουπονιού</string> | ||
20 | + <string name="demo_qr_code">QR Κουπονιού</string> | ||
21 | + <string name="demo_terms">Όροι Χρήσης</string> | ||
22 | + <string name="demo_copy_success">Ο κωδικός αντιγράφηκε στο πρόχειρο</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> | ||
25 | + <string name="demo_website">Δες το website</string> | ||
14 | </resources> | 26 | </resources> | ... | ... |
-
Please register or login to post a comment