Showing
34 changed files
with
2034 additions
and
8 deletions
| ... | @@ -2,12 +2,25 @@ package ly.warp.sdk.activities; | ... | @@ -2,12 +2,25 @@ package ly.warp.sdk.activities; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | +import android.util.TypedValue; | ||
| 5 | import android.view.View; | 6 | import android.view.View; |
| 6 | import android.widget.ImageView; | 7 | import android.widget.ImageView; |
| 8 | +import android.widget.TextView; | ||
| 9 | +import android.widget.Toast; | ||
| 10 | + | ||
| 11 | +import androidx.recyclerview.widget.LinearLayoutManager; | ||
| 12 | +import androidx.recyclerview.widget.RecyclerView; | ||
| 7 | 13 | ||
| 8 | import ly.warp.sdk.R; | 14 | import ly.warp.sdk.R; |
| 15 | +import ly.warp.sdk.io.adapters.OfferAdapter; | ||
| 16 | +import ly.warp.sdk.io.models.DummyDataProvider; | ||
| 17 | +import ly.warp.sdk.io.models.OfferCategory; | ||
| 18 | +import ly.warp.sdk.io.models.OfferItem; | ||
| 19 | +import ly.warp.sdk.utils.WarplyManagerHelper; | ||
| 20 | +import ly.warp.sdk.utils.managers.WarplyManager; | ||
| 21 | +import ly.warp.sdk.views.HorizontalSpaceItemDecoration; | ||
| 9 | 22 | ||
| 10 | -public class HomeActivity extends Activity implements View.OnClickListener { | 23 | +public class HomeActivity extends Activity implements View.OnClickListener, OfferAdapter.OnOfferClickListener { |
| 11 | // =========================================================== | 24 | // =========================================================== |
| 12 | // Constants | 25 | // Constants |
| 13 | // =========================================================== | 26 | // =========================================================== |
| ... | @@ -17,6 +30,39 @@ public class HomeActivity extends Activity implements View.OnClickListener { | ... | @@ -17,6 +30,39 @@ public class HomeActivity extends Activity implements View.OnClickListener { |
| 17 | // =========================================================== | 30 | // =========================================================== |
| 18 | private ImageView mIvBanner; | 31 | private ImageView mIvBanner; |
| 19 | 32 | ||
| 33 | + // Category sections | ||
| 34 | + private TextView mTvCategoryTopOffers; | ||
| 35 | + private RecyclerView mRvTopOffers; | ||
| 36 | + private OfferAdapter mTopOffersAdapter; | ||
| 37 | + | ||
| 38 | + private TextView mTvCategoryFavorites; | ||
| 39 | + private RecyclerView mRvFavorites; | ||
| 40 | + private OfferAdapter mFavoritesAdapter; | ||
| 41 | + | ||
| 42 | + private TextView mTvCategoryViability; | ||
| 43 | + private RecyclerView mRvViability; | ||
| 44 | + private OfferAdapter mViabilityAdapter; | ||
| 45 | + | ||
| 46 | + private TextView mTvCategoryFamily; | ||
| 47 | + private RecyclerView mRvFamily; | ||
| 48 | + private OfferAdapter mFamilyAdapter; | ||
| 49 | + | ||
| 50 | + private TextView mTvCategoryFoodCoffee; | ||
| 51 | + private RecyclerView mRvFoodCoffee; | ||
| 52 | + private OfferAdapter mFoodCoffeeAdapter; | ||
| 53 | + | ||
| 54 | + private TextView mTvCategoryTravelling; | ||
| 55 | + private RecyclerView mRvTravelling; | ||
| 56 | + private OfferAdapter mTravellingAdapter; | ||
| 57 | + | ||
| 58 | + private TextView mTvCategoryKids; | ||
| 59 | + private RecyclerView mRvKids; | ||
| 60 | + private OfferAdapter mKidsAdapter; | ||
| 61 | + | ||
| 62 | + private TextView mTvCategoryPurchases; | ||
| 63 | + private RecyclerView mRvPurchases; | ||
| 64 | + private OfferAdapter mPurchasesAdapter; | ||
| 65 | + | ||
| 20 | // =========================================================== | 66 | // =========================================================== |
| 21 | // Methods for/from SuperClass/Interfaces | 67 | // Methods for/from SuperClass/Interfaces |
| 22 | // =========================================================== | 68 | // =========================================================== |
| ... | @@ -29,6 +75,16 @@ public class HomeActivity extends Activity implements View.OnClickListener { | ... | @@ -29,6 +75,16 @@ public class HomeActivity extends Activity implements View.OnClickListener { |
| 29 | mIvBanner = findViewById(R.id.banner_icon); | 75 | mIvBanner = findViewById(R.id.banner_icon); |
| 30 | 76 | ||
| 31 | initViews(); | 77 | initViews(); |
| 78 | + | ||
| 79 | + // Setup all category sections | ||
| 80 | + setupTopOffersSection(); | ||
| 81 | + setupFavoritesSection(); | ||
| 82 | + setupViabilitySection(); | ||
| 83 | + setupFamilySection(); | ||
| 84 | + setupFoodCoffeeSection(); | ||
| 85 | + setupTravellingSection(); | ||
| 86 | + setupKidsSection(); | ||
| 87 | + setupPurchasesSection(); | ||
| 32 | } | 88 | } |
| 33 | 89 | ||
| 34 | @Override | 90 | @Override |
| ... | @@ -41,14 +97,265 @@ public class HomeActivity extends Activity implements View.OnClickListener { | ... | @@ -41,14 +97,265 @@ public class HomeActivity extends Activity implements View.OnClickListener { |
| 41 | // =========================================================== | 97 | // =========================================================== |
| 42 | 98 | ||
| 43 | private void initViews() { | 99 | private void initViews() { |
| 100 | + // Initialize banner | ||
| 44 | mIvBanner.setOnClickListener(this); | 101 | mIvBanner.setOnClickListener(this); |
| 102 | + | ||
| 103 | + // Initialize Top Offers section | ||
| 104 | + mTvCategoryTopOffers = findViewById(R.id.tv_recycler_category1); | ||
| 105 | + mRvTopOffers = findViewById(R.id.rl_recycler1); | ||
| 106 | + | ||
| 107 | + // Initialize Favorites section | ||
| 108 | + mTvCategoryFavorites = findViewById(R.id.tv_recycler_category2); | ||
| 109 | + mRvFavorites = findViewById(R.id.rl_recycler2); | ||
| 110 | + | ||
| 111 | + // Initialize Viability section | ||
| 112 | + mTvCategoryViability = findViewById(R.id.tv_recycler_category3); | ||
| 113 | + mRvViability = findViewById(R.id.rl_recycler3); | ||
| 114 | + | ||
| 115 | + // Initialize Family section | ||
| 116 | + mTvCategoryFamily = findViewById(R.id.tv_recycler_category4); | ||
| 117 | + mRvFamily = findViewById(R.id.rl_recycler4); | ||
| 118 | + | ||
| 119 | + // Initialize Food & Coffee section | ||
| 120 | + mTvCategoryFoodCoffee = findViewById(R.id.tv_recycler_category5); | ||
| 121 | + mRvFoodCoffee = findViewById(R.id.rl_recycler5); | ||
| 122 | + | ||
| 123 | + // Initialize Travelling section | ||
| 124 | + mTvCategoryTravelling = findViewById(R.id.tv_recycler_category6); | ||
| 125 | + mRvTravelling = findViewById(R.id.rl_recycler6); | ||
| 126 | + | ||
| 127 | + // Initialize Kids section | ||
| 128 | + mTvCategoryKids = findViewById(R.id.tv_recycler_category7); | ||
| 129 | + mRvKids = findViewById(R.id.rl_recycler7); | ||
| 130 | + | ||
| 131 | + // Initialize Purchases section | ||
| 132 | + mTvCategoryPurchases = findViewById(R.id.tv_recycler_category8); | ||
| 133 | + mRvPurchases = findViewById(R.id.rl_recycler8); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * Set up the Top Offers section with dummy data | ||
| 138 | + */ | ||
| 139 | + private void setupTopOffersSection() { | ||
| 140 | + // Get Top Offers data | ||
| 141 | + OfferCategory topOffersCategory = DummyDataProvider.getTopOffers(); | ||
| 142 | + | ||
| 143 | + // Set category title with item count | ||
| 144 | + String categoryTitle = topOffersCategory.getName() + " (" + topOffersCategory.getItems().size() + ")"; | ||
| 145 | + mTvCategoryTopOffers.setText(categoryTitle); | ||
| 146 | + | ||
| 147 | + // Set up RecyclerView | ||
| 148 | + LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | ||
| 149 | + mRvTopOffers.setLayoutManager(layoutManager); | ||
| 150 | + | ||
| 151 | + // Add spacing between items | ||
| 152 | + int spacingInPixels = (int) TypedValue.applyDimension( | ||
| 153 | + TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); | ||
| 154 | + mRvTopOffers.addItemDecoration(new HorizontalSpaceItemDecoration(spacingInPixels)); | ||
| 155 | + | ||
| 156 | + // Create and set adapter | ||
| 157 | + mTopOffersAdapter = new OfferAdapter(this, topOffersCategory.getItems()); | ||
| 158 | + mTopOffersAdapter.setOnOfferClickListener(this); | ||
| 159 | + mRvTopOffers.setAdapter(mTopOffersAdapter); | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + /** | ||
| 163 | + * Set up the Favorites section with dummy data | ||
| 164 | + */ | ||
| 165 | + private void setupFavoritesSection() { | ||
| 166 | + // Get Favorites data | ||
| 167 | + OfferCategory favoritesCategory = DummyDataProvider.getFavorites(); | ||
| 168 | + | ||
| 169 | + // Set category title with item count | ||
| 170 | + String categoryTitle = favoritesCategory.getName() + " (" + favoritesCategory.getItems().size() + ")"; | ||
| 171 | + mTvCategoryFavorites.setText(categoryTitle); | ||
| 172 | + | ||
| 173 | + // Set up RecyclerView | ||
| 174 | + LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | ||
| 175 | + mRvFavorites.setLayoutManager(layoutManager); | ||
| 176 | + | ||
| 177 | + // Add spacing between items | ||
| 178 | + int spacingInPixels = (int) TypedValue.applyDimension( | ||
| 179 | + TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); | ||
| 180 | + mRvFavorites.addItemDecoration(new HorizontalSpaceItemDecoration(spacingInPixels)); | ||
| 181 | + | ||
| 182 | + // Create and set adapter | ||
| 183 | + mFavoritesAdapter = new OfferAdapter(this, favoritesCategory.getItems()); | ||
| 184 | + mFavoritesAdapter.setOnOfferClickListener(this); | ||
| 185 | + mRvFavorites.setAdapter(mFavoritesAdapter); | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + /** | ||
| 189 | + * Set up the Viability section with dummy data | ||
| 190 | + */ | ||
| 191 | + private void setupViabilitySection() { | ||
| 192 | + // Get Viability data | ||
| 193 | + OfferCategory viabilityCategory = DummyDataProvider.getViability(); | ||
| 194 | + | ||
| 195 | + // Set category title with item count | ||
| 196 | + String categoryTitle = viabilityCategory.getName() + " (" + viabilityCategory.getItems().size() + ")"; | ||
| 197 | + mTvCategoryViability.setText(categoryTitle); | ||
| 198 | + | ||
| 199 | + // Set up RecyclerView | ||
| 200 | + LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | ||
| 201 | + mRvViability.setLayoutManager(layoutManager); | ||
| 202 | + | ||
| 203 | + // Add spacing between items | ||
| 204 | + int spacingInPixels = (int) TypedValue.applyDimension( | ||
| 205 | + TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); | ||
| 206 | + mRvViability.addItemDecoration(new HorizontalSpaceItemDecoration(spacingInPixels)); | ||
| 207 | + | ||
| 208 | + // Create and set adapter | ||
| 209 | + mViabilityAdapter = new OfferAdapter(this, viabilityCategory.getItems()); | ||
| 210 | + mViabilityAdapter.setOnOfferClickListener(this); | ||
| 211 | + mRvViability.setAdapter(mViabilityAdapter); | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + /** | ||
| 215 | + * Set up the Family section with dummy data | ||
| 216 | + */ | ||
| 217 | + private void setupFamilySection() { | ||
| 218 | + // Get Family data | ||
| 219 | + OfferCategory familyCategory = DummyDataProvider.getFamily(); | ||
| 220 | + | ||
| 221 | + // Set category title with item count | ||
| 222 | + String categoryTitle = familyCategory.getName() + " (" + familyCategory.getItems().size() + ")"; | ||
| 223 | + mTvCategoryFamily.setText(categoryTitle); | ||
| 224 | + | ||
| 225 | + // Set up RecyclerView | ||
| 226 | + LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | ||
| 227 | + mRvFamily.setLayoutManager(layoutManager); | ||
| 228 | + | ||
| 229 | + // Add spacing between items | ||
| 230 | + int spacingInPixels = (int) TypedValue.applyDimension( | ||
| 231 | + TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); | ||
| 232 | + mRvFamily.addItemDecoration(new HorizontalSpaceItemDecoration(spacingInPixels)); | ||
| 233 | + | ||
| 234 | + // Create and set adapter | ||
| 235 | + mFamilyAdapter = new OfferAdapter(this, familyCategory.getItems()); | ||
| 236 | + mFamilyAdapter.setOnOfferClickListener(this); | ||
| 237 | + mRvFamily.setAdapter(mFamilyAdapter); | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + /** | ||
| 241 | + * Set up the Food & Coffee section with dummy data | ||
| 242 | + */ | ||
| 243 | + private void setupFoodCoffeeSection() { | ||
| 244 | + // Get Food & Coffee data | ||
| 245 | + OfferCategory foodCoffeeCategory = DummyDataProvider.getFoodAndCoffee(); | ||
| 246 | + | ||
| 247 | + // Set category title with item count | ||
| 248 | + String categoryTitle = foodCoffeeCategory.getName() + " (" + foodCoffeeCategory.getItems().size() + ")"; | ||
| 249 | + mTvCategoryFoodCoffee.setText(categoryTitle); | ||
| 250 | + | ||
| 251 | + // Set up RecyclerView | ||
| 252 | + LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | ||
| 253 | + mRvFoodCoffee.setLayoutManager(layoutManager); | ||
| 254 | + | ||
| 255 | + // Add spacing between items | ||
| 256 | + int spacingInPixels = (int) TypedValue.applyDimension( | ||
| 257 | + TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); | ||
| 258 | + mRvFoodCoffee.addItemDecoration(new HorizontalSpaceItemDecoration(spacingInPixels)); | ||
| 259 | + | ||
| 260 | + // Create and set adapter | ||
| 261 | + mFoodCoffeeAdapter = new OfferAdapter(this, foodCoffeeCategory.getItems()); | ||
| 262 | + mFoodCoffeeAdapter.setOnOfferClickListener(this); | ||
| 263 | + mRvFoodCoffee.setAdapter(mFoodCoffeeAdapter); | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + /** | ||
| 267 | + * Set up the Travelling section with dummy data | ||
| 268 | + */ | ||
| 269 | + private void setupTravellingSection() { | ||
| 270 | + // Get Travelling data | ||
| 271 | + OfferCategory travellingCategory = DummyDataProvider.getTravelling(); | ||
| 272 | + | ||
| 273 | + // Set category title with item count | ||
| 274 | + String categoryTitle = travellingCategory.getName() + " (" + travellingCategory.getItems().size() + ")"; | ||
| 275 | + mTvCategoryTravelling.setText(categoryTitle); | ||
| 276 | + | ||
| 277 | + // Set up RecyclerView | ||
| 278 | + LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | ||
| 279 | + mRvTravelling.setLayoutManager(layoutManager); | ||
| 280 | + | ||
| 281 | + // Add spacing between items | ||
| 282 | + int spacingInPixels = (int) TypedValue.applyDimension( | ||
| 283 | + TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); | ||
| 284 | + mRvTravelling.addItemDecoration(new HorizontalSpaceItemDecoration(spacingInPixels)); | ||
| 285 | + | ||
| 286 | + // Create and set adapter | ||
| 287 | + mTravellingAdapter = new OfferAdapter(this, travellingCategory.getItems()); | ||
| 288 | + mTravellingAdapter.setOnOfferClickListener(this); | ||
| 289 | + mRvTravelling.setAdapter(mTravellingAdapter); | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + /** | ||
| 293 | + * Set up the Kids section with dummy data | ||
| 294 | + */ | ||
| 295 | + private void setupKidsSection() { | ||
| 296 | + // Get Kids data | ||
| 297 | + OfferCategory kidsCategory = DummyDataProvider.getKids(); | ||
| 298 | + | ||
| 299 | + // Set category title with item count | ||
| 300 | + String categoryTitle = kidsCategory.getName() + " (" + kidsCategory.getItems().size() + ")"; | ||
| 301 | + mTvCategoryKids.setText(categoryTitle); | ||
| 302 | + | ||
| 303 | + // Set up RecyclerView | ||
| 304 | + LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | ||
| 305 | + mRvKids.setLayoutManager(layoutManager); | ||
| 306 | + | ||
| 307 | + // Add spacing between items | ||
| 308 | + int spacingInPixels = (int) TypedValue.applyDimension( | ||
| 309 | + TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); | ||
| 310 | + mRvKids.addItemDecoration(new HorizontalSpaceItemDecoration(spacingInPixels)); | ||
| 311 | + | ||
| 312 | + // Create and set adapter | ||
| 313 | + mKidsAdapter = new OfferAdapter(this, kidsCategory.getItems()); | ||
| 314 | + mKidsAdapter.setOnOfferClickListener(this); | ||
| 315 | + mRvKids.setAdapter(mKidsAdapter); | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + /** | ||
| 319 | + * Set up the Purchases section with dummy data | ||
| 320 | + */ | ||
| 321 | + private void setupPurchasesSection() { | ||
| 322 | + // Get Purchases data | ||
| 323 | + OfferCategory purchasesCategory = DummyDataProvider.getPurchases(); | ||
| 324 | + | ||
| 325 | + // Set category title with item count | ||
| 326 | + String categoryTitle = purchasesCategory.getName() + " (" + purchasesCategory.getItems().size() + ")"; | ||
| 327 | + mTvCategoryPurchases.setText(categoryTitle); | ||
| 328 | + | ||
| 329 | + // Set up RecyclerView | ||
| 330 | + LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | ||
| 331 | + mRvPurchases.setLayoutManager(layoutManager); | ||
| 332 | + | ||
| 333 | + // Add spacing between items | ||
| 334 | + int spacingInPixels = (int) TypedValue.applyDimension( | ||
| 335 | + TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); | ||
| 336 | + mRvPurchases.addItemDecoration(new HorizontalSpaceItemDecoration(spacingInPixels)); | ||
| 337 | + | ||
| 338 | + // Create and set adapter | ||
| 339 | + mPurchasesAdapter = new OfferAdapter(this, purchasesCategory.getItems()); | ||
| 340 | + mPurchasesAdapter.setOnOfferClickListener(this); | ||
| 341 | + mRvPurchases.setAdapter(mPurchasesAdapter); | ||
| 45 | } | 342 | } |
| 46 | 343 | ||
| 47 | @Override | 344 | @Override |
| 48 | public void onClick(View v) { | 345 | public void onClick(View v) { |
| 49 | if (v.getId() == R.id.banner_icon) { | 346 | if (v.getId() == R.id.banner_icon) { |
| 347 | + WarplyManagerHelper.openContest(this); | ||
| 348 | + } | ||
| 349 | + } | ||
| 50 | 350 | ||
| 351 | + @Override | ||
| 352 | + public void onOfferClick(OfferItem offerItem, int position) { | ||
| 353 | +// Toast.makeText(this, "Offer clicked: " + offerItem.getTitle(), Toast.LENGTH_SHORT).show(); | ||
| 51 | } | 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(); | ||
| 52 | } | 359 | } |
| 53 | 360 | ||
| 54 | // =========================================================== | 361 | // =========================================================== | ... | ... |
| 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.util.List; | ||
| 18 | + | ||
| 19 | +import ly.warp.sdk.R; | ||
| 20 | +import ly.warp.sdk.io.models.DummyDataProvider; | ||
| 21 | +import ly.warp.sdk.io.models.OfferItem; | ||
| 22 | +import ly.warp.sdk.utils.TopRoundedCornersTransformation; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Adapter for displaying offer items in a RecyclerView | ||
| 26 | + */ | ||
| 27 | +public class OfferAdapter extends RecyclerView.Adapter<OfferAdapter.OfferViewHolder> { | ||
| 28 | + | ||
| 29 | + private final List<OfferItem> offerItems; | ||
| 30 | + private final Context context; | ||
| 31 | + private OnOfferClickListener listener; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * Interface for handling offer item clicks | ||
| 35 | + */ | ||
| 36 | + public interface OnOfferClickListener { | ||
| 37 | + void onOfferClick(OfferItem offerItem, int position); | ||
| 38 | + void onFavoriteClick(OfferItem offerItem, int position); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * Constructor | ||
| 43 | + * | ||
| 44 | + * @param context The context | ||
| 45 | + * @param offerItems List of offer items to display | ||
| 46 | + */ | ||
| 47 | + public OfferAdapter(Context context, List<OfferItem> offerItems) { | ||
| 48 | + this.context = context; | ||
| 49 | + this.offerItems = offerItems; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * Set click listener for offer items | ||
| 54 | + * | ||
| 55 | + * @param listener The listener | ||
| 56 | + */ | ||
| 57 | + public void setOnOfferClickListener(OnOfferClickListener listener) { | ||
| 58 | + this.listener = listener; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @NonNull | ||
| 62 | + @Override | ||
| 63 | + public OfferViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
| 64 | + View view = LayoutInflater.from(context).inflate(R.layout.demo_item_offer, parent, false); | ||
| 65 | + return new OfferViewHolder(view); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public void onBindViewHolder(@NonNull OfferViewHolder holder, int position) { | ||
| 70 | + OfferItem offerItem = offerItems.get(position); | ||
| 71 | + holder.bind(offerItem, position); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public int getItemCount() { | ||
| 76 | + return offerItems.size(); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * ViewHolder for offer items | ||
| 81 | + */ | ||
| 82 | + class OfferViewHolder extends RecyclerView.ViewHolder { | ||
| 83 | + private final ImageView ivOfferImage; | ||
| 84 | + private final ImageView ivFavorite; | ||
| 85 | + private final ImageView ivLogo; | ||
| 86 | + private final TextView tvPrice; | ||
| 87 | + private final TextView tvTitle; | ||
| 88 | + private final TextView tvDescription; | ||
| 89 | + private final TextView tvValidity; | ||
| 90 | + | ||
| 91 | + OfferViewHolder(@NonNull View itemView) { | ||
| 92 | + super(itemView); | ||
| 93 | + ivOfferImage = itemView.findViewById(R.id.iv_offer_image); | ||
| 94 | + ivFavorite = itemView.findViewById(R.id.iv_favorite); | ||
| 95 | + ivLogo = itemView.findViewById(R.id.iv_logo); | ||
| 96 | + tvPrice = itemView.findViewById(R.id.tv_price); | ||
| 97 | + tvTitle = itemView.findViewById(R.id.tv_title); | ||
| 98 | + tvDescription = itemView.findViewById(R.id.tv_description); | ||
| 99 | + tvValidity = itemView.findViewById(R.id.tv_validity); | ||
| 100 | + | ||
| 101 | + // Set click listeners | ||
| 102 | +// itemView.setOnClickListener(v -> { | ||
| 103 | +// int position = getAdapterPosition(); | ||
| 104 | +// if (listener != null && position != RecyclerView.NO_POSITION) { | ||
| 105 | +// listener.onOfferClick(offerItems.get(position), position); | ||
| 106 | +// } | ||
| 107 | +// }); | ||
| 108 | + | ||
| 109 | +// ivFavorite.setOnClickListener(v -> { | ||
| 110 | +// int position = getAdapterPosition(); | ||
| 111 | +// if (listener != null && position != RecyclerView.NO_POSITION) { | ||
| 112 | +// listener.onFavoriteClick(offerItems.get(position), position); | ||
| 113 | +// } | ||
| 114 | +// }); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + void bind(OfferItem offerItem, int position) { | ||
| 118 | + // Set offer data to views | ||
| 119 | + tvTitle.setText(offerItem.getTitle()); | ||
| 120 | + tvDescription.setText(offerItem.getDescription()); | ||
| 121 | + tvPrice.setText(offerItem.getValue()); | ||
| 122 | + tvValidity.setText(offerItem.getEndDate()); | ||
| 123 | + | ||
| 124 | + // Set heart icon based on category | ||
| 125 | + if (DummyDataProvider.CATEGORY_FAVORITES.equals(offerItem.getCategory())) { | ||
| 126 | + // Use pressed/filled heart for Favorites category | ||
| 127 | + ivFavorite.setImageResource(R.drawable.demo_heart_pressed); | ||
| 128 | + } else { | ||
| 129 | + // Use default/empty heart for other categories | ||
| 130 | + ivFavorite.setImageResource(R.drawable.demo_heart); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + // Load images from resources | ||
| 134 | + loadOfferImage(offerItem.getImageUrl()); | ||
| 135 | + loadLogoImage(offerItem.getLogoUrl()); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + /** | ||
| 139 | + * Load offer image with rounded top corners using Glide | ||
| 140 | + * | ||
| 141 | + * @param imageName The image resource name | ||
| 142 | + */ | ||
| 143 | + private void loadOfferImage(String imageName) { | ||
| 144 | + try { | ||
| 145 | + // Remove file extension if present | ||
| 146 | + if (imageName.contains(".")) { | ||
| 147 | + imageName = imageName.substring(0, imageName.lastIndexOf('.')); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + // Get resource ID by name | ||
| 151 | + int resourceId = context.getResources().getIdentifier( | ||
| 152 | + imageName, "drawable", context.getPackageName()); | ||
| 153 | + | ||
| 154 | + if (resourceId != 0) { | ||
| 155 | + // Convert 9dp to pixels | ||
| 156 | + int radiusInPixels = (int) TypedValue.applyDimension( | ||
| 157 | + TypedValue.COMPLEX_UNIT_DIP, 9, | ||
| 158 | + context.getResources().getDisplayMetrics()); | ||
| 159 | + | ||
| 160 | + // Load with Glide and apply transformations | ||
| 161 | + Glide.with(context) | ||
| 162 | + .load(resourceId) | ||
| 163 | + .transform(new CenterCrop(), new TopRoundedCornersTransformation(radiusInPixels)) | ||
| 164 | + .into(ivOfferImage); | ||
| 165 | + } | ||
| 166 | + } catch (Exception e) { | ||
| 167 | + e.printStackTrace(); | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + /** | ||
| 172 | + * Load logo image without transformations | ||
| 173 | + * | ||
| 174 | + * @param imageName The image resource name | ||
| 175 | + */ | ||
| 176 | + private void loadLogoImage(String imageName) { | ||
| 177 | + try { | ||
| 178 | + // Remove file extension if present | ||
| 179 | + if (imageName.contains(".")) { | ||
| 180 | + imageName = imageName.substring(0, imageName.lastIndexOf('.')); | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + // Get resource ID by name | ||
| 184 | + int resourceId = context.getResources().getIdentifier( | ||
| 185 | + imageName, "drawable", context.getPackageName()); | ||
| 186 | + | ||
| 187 | + if (resourceId != 0) { | ||
| 188 | + // Load logo normally without transformations | ||
| 189 | + ivLogo.setImageResource(resourceId); | ||
| 190 | + } | ||
| 191 | + } catch (Exception e) { | ||
| 192 | + e.printStackTrace(); | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | +} |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import java.util.ArrayList; | ||
| 4 | +import java.util.Arrays; | ||
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.List; | ||
| 7 | +import java.util.Map; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Provider class for dummy data to be used in the home screen. | ||
| 11 | + * Contains methods to generate sample data for different offer categories. | ||
| 12 | + */ | ||
| 13 | +public class DummyDataProvider { | ||
| 14 | + | ||
| 15 | + // Category IDs | ||
| 16 | + public static final String CATEGORY_TOP_OFFERS = "top_offers"; | ||
| 17 | + public static final String CATEGORY_FAVORITES = "favorites"; | ||
| 18 | + public static final String CATEGORY_VIABILITY = "viability"; | ||
| 19 | + public static final String CATEGORY_FAMILY = "family"; | ||
| 20 | + public static final String CATEGORY_FOOD_COFFEE = "food_coffee"; | ||
| 21 | + public static final String CATEGORY_TRAVELLING = "travelling"; | ||
| 22 | + public static final String CATEGORY_KIDS = "kids"; | ||
| 23 | + public static final String CATEGORY_PURCHASES = "purchases"; | ||
| 24 | + | ||
| 25 | + // Cache for categories | ||
| 26 | + private static Map<String, OfferCategory> categoryCache = new HashMap<>(); | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * Get all categories with their items | ||
| 30 | + * | ||
| 31 | + * @return List of all offer categories with items | ||
| 32 | + */ | ||
| 33 | + public static List<OfferCategory> getAllCategories() { | ||
| 34 | + List<OfferCategory> categories = new ArrayList<>(); | ||
| 35 | + categories.add(getTopOffers()); | ||
| 36 | + categories.add(getFavorites()); | ||
| 37 | + categories.add(getViability()); | ||
| 38 | + categories.add(getFamily()); | ||
| 39 | + categories.add(getFoodAndCoffee()); | ||
| 40 | + categories.add(getTravelling()); | ||
| 41 | + categories.add(getKids()); | ||
| 42 | + categories.add(getPurchases()); | ||
| 43 | + return categories; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * Get a specific category by ID | ||
| 48 | + * | ||
| 49 | + * @param categoryId The category ID to retrieve | ||
| 50 | + * @return The requested category or null if not found | ||
| 51 | + */ | ||
| 52 | + public static OfferCategory getCategoryById(String categoryId) { | ||
| 53 | + if (categoryCache.containsKey(categoryId)) { | ||
| 54 | + return categoryCache.get(categoryId); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + OfferCategory category = null; | ||
| 58 | + switch (categoryId) { | ||
| 59 | + case CATEGORY_TOP_OFFERS: | ||
| 60 | + category = getTopOffers(); | ||
| 61 | + break; | ||
| 62 | + case CATEGORY_FAVORITES: | ||
| 63 | + category = getFavorites(); | ||
| 64 | + break; | ||
| 65 | + case CATEGORY_VIABILITY: | ||
| 66 | + category = getViability(); | ||
| 67 | + break; | ||
| 68 | + case CATEGORY_FAMILY: | ||
| 69 | + category = getFamily(); | ||
| 70 | + break; | ||
| 71 | + case CATEGORY_FOOD_COFFEE: | ||
| 72 | + category = getFoodAndCoffee(); | ||
| 73 | + break; | ||
| 74 | + case CATEGORY_TRAVELLING: | ||
| 75 | + category = getTravelling(); | ||
| 76 | + break; | ||
| 77 | + case CATEGORY_KIDS: | ||
| 78 | + category = getKids(); | ||
| 79 | + break; | ||
| 80 | + case CATEGORY_PURCHASES: | ||
| 81 | + category = getPurchases(); | ||
| 82 | + break; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + if (category != null) { | ||
| 86 | + categoryCache.put(categoryId, category); | ||
| 87 | + } | ||
| 88 | + return category; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * Get Top Offers category with items | ||
| 93 | + * | ||
| 94 | + * @return Top Offers category | ||
| 95 | + */ | ||
| 96 | + public static OfferCategory getTopOffers() { | ||
| 97 | + OfferCategory category = new OfferCategory(CATEGORY_TOP_OFFERS, "Top Offers"); | ||
| 98 | + | ||
| 99 | + category.addItem(new OfferItem("to1", "50% Έκπτωση σε Πακέτα Κινητής", | ||
| 100 | + "Πάρτε τα πακέτα κινητής στη μισή τιμή μόνο αυτό το μήνα", | ||
| 101 | + "30/06/2025", "50%", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 102 | + | ||
| 103 | + category.addItem(new OfferItem("to2", "Δωρεάν Εγκατάσταση Τηλεόρασης", | ||
| 104 | + "Επαγγελματική εγκατάσταση με κάθε αγορά νέας τηλεόρασης", | ||
| 105 | + "15/07/2025", "€0", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 106 | + | ||
| 107 | + category.addItem(new OfferItem("to3", "Αγοράζεις 1 Παίρνεις 1 Δώρο", | ||
| 108 | + "Σε όλα τα είδη ρουχισμού της καλοκαιρινής μας συλλογής", | ||
| 109 | + "31/08/2025", "100%", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 110 | + | ||
| 111 | + category.addItem(new OfferItem("to4", "30% Έκπτωση στα Τρόφιμα", | ||
| 112 | + "Έκπτωση στην πρώτη σας online παραγγελία τροφίμων", | ||
| 113 | + "10/06/2025", "30%", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 114 | + | ||
| 115 | + category.addItem(new OfferItem("to5", "Κουπόνι Εστιατορίου €20", | ||
| 116 | + "Με ελάχιστη κατανάλωση €50 σε συνεργαζόμενα εστιατόρια", | ||
| 117 | + "31/07/2025", "€20", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 118 | + | ||
| 119 | + category.addItem(new OfferItem("to6", "25% Έκπτωση σε Κρατήσεις Ξενοδοχείων", | ||
| 120 | + "Για διαμονές Σαββατοκύριακου κατά τους καλοκαιρινούς μήνες", | ||
| 121 | + "30/09/2025", "25%", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 122 | + | ||
| 123 | + category.addItem(new OfferItem("to7", "Δωρεάν Παράδοση", | ||
| 124 | + "Σε όλες τις online παραγγελίες άνω των €30", | ||
| 125 | + "Ongoing", "€0", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 126 | + | ||
| 127 | + category.addItem(new OfferItem("to8", "40% Έκπτωση σε Συνδρομή Γυμναστηρίου", | ||
| 128 | + "Πρώτοι 3 μήνες με μειωμένη τιμή για νέα μέλη", | ||
| 129 | + "31/08/2025", "40%", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 130 | + | ||
| 131 | + category.addItem(new OfferItem("to9", "Εισιτήρια Κινηματογράφου €10", | ||
| 132 | + "Ειδική τιμή για όλες τις προβολές Δευτέρα έως Πέμπτη", | ||
| 133 | + "31/12/2025", "€10", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 134 | + | ||
| 135 | + category.addItem(new OfferItem("to10", "75% Έκπτωση στο Δεύτερο Είδος", | ||
| 136 | + "Αγοράστε ένα είδος σε πλήρη τιμή, πάρτε το δεύτερο με 75% έκπτωση", | ||
| 137 | + "15/06/2025", "75%", "demo_image_dominos.png", "demo_dominos.png", CATEGORY_TOP_OFFERS)); | ||
| 138 | + | ||
| 139 | + return category; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + /** | ||
| 143 | + * Get Favorites category with items | ||
| 144 | + * | ||
| 145 | + * @return Favorites category | ||
| 146 | + */ | ||
| 147 | + public static OfferCategory getFavorites() { | ||
| 148 | + OfferCategory category = new OfferCategory(CATEGORY_FAVORITES, "Αγαπημένα"); | ||
| 149 | + | ||
| 150 | + category.addItem(new OfferItem("fav1", "Αγαπημένο Καφέ", | ||
| 151 | + "15% έκπτωση στον αγαπημένο σας καφέ κάθε μέρα", | ||
| 152 | + "Ongoing", "15%", "demo_image_avis.png", "demo_avis.png", CATEGORY_FAVORITES)); | ||
| 153 | + | ||
| 154 | + category.addItem(new OfferItem("fav2", "Εβδομαδιαία Έκπτωση Σούπερ Μάρκετ", | ||
| 155 | + "10% έκπτωση στα εβδομαδιαία ψώνια σας", | ||
| 156 | + "Recurring", "10%", "demo_image_avis.png", "demo_avis.png", CATEGORY_FAVORITES)); | ||
| 157 | + | ||
| 158 | + category.addItem(new OfferItem("fav3", "Αγαπημένο Εστιατόριο", | ||
| 159 | + "Δωρεάν επιδόρπιο με κάθε κυρίως πιάτο", | ||
| 160 | + "31/12/2025", "€0", "demo_image_avis.png", "demo_avis.png", CATEGORY_FAVORITES)); | ||
| 161 | + | ||
| 162 | + category.addItem(new OfferItem("fav4", "Συνδρομή Βιβλιοπωλείου", | ||
| 163 | + "20% έκπτωση σε όλες τις αγορές με την κάρτα μέλους", | ||
| 164 | + "Ongoing", "20%", "demo_image_avis.png", "demo_avis.png", CATEGORY_FAVORITES)); | ||
| 165 | + | ||
| 166 | + category.addItem(new OfferItem("fav5", "Συνδρομή Γυμναστηρίου", | ||
| 167 | + "€45 μηνιαίως για απεριόριστη πρόσβαση", | ||
| 168 | + "Auto-renews", "€45", "demo_image_avis.png", "demo_avis.png", CATEGORY_FAVORITES)); | ||
| 169 | + | ||
| 170 | + // Only keeping 5 items for Favorites category | ||
| 171 | + | ||
| 172 | + return category; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + /** | ||
| 176 | + * Get Viability category with items | ||
| 177 | + * | ||
| 178 | + * @return Viability category | ||
| 179 | + */ | ||
| 180 | + public static OfferCategory getViability() { | ||
| 181 | + OfferCategory category = new OfferCategory(CATEGORY_VIABILITY, "Βιωσιμότητα"); | ||
| 182 | + | ||
| 183 | + category.addItem(new OfferItem("via1", "Έκπτωση Ανανεώσιμης Ενέργειας", | ||
| 184 | + "20% έκπτωση όταν αλλάζετε σε πράσινα ενεργειακά προγράμματα", | ||
| 185 | + "31/12/2025", "20%", "demo_image_musa.png", "demo_musa.png", CATEGORY_VIABILITY)); | ||
| 186 | + | ||
| 187 | + category.addItem(new OfferItem("via2", "Φόρτιση Ηλεκτρικών Οχημάτων", | ||
| 188 | + "50% έκπτωση στη φόρτιση σε συνεργαζόμενους σταθμούς", | ||
| 189 | + "30/06/2026", "50%", "demo_image_musa.png", "demo_musa.png", CATEGORY_VIABILITY)); | ||
| 190 | + | ||
| 191 | + category.addItem(new OfferItem("via3", "Οικολογικά Προϊόντα", | ||
| 192 | + "Αγοράστε βιώσιμα προϊόντα και κερδίστε €10 έκπτωση", | ||
| 193 | + "Ongoing", "€10", "demo_image_musa.png", "demo_musa.png", CATEGORY_VIABILITY)); | ||
| 194 | + | ||
| 195 | + category.addItem(new OfferItem("via4", "Κάρτα Μέσων Μαζικής Μεταφοράς", | ||
| 196 | + "Μηνιαία κάρτα σε μειωμένη τιμή €30", | ||
| 197 | + "Monthly", "€30", "demo_image_musa.png", "demo_musa.png", CATEGORY_VIABILITY)); | ||
| 198 | + | ||
| 199 | + category.addItem(new OfferItem("via5", "Ανταμοιβές Ανακύκλωσης", | ||
| 200 | + "Κερδίστε πόντους για ανακύκλωση που μετατρέπονται σε εκπτώσεις", | ||
| 201 | + "Ongoing", "5%", "demo_image_musa.png", "demo_musa.png", CATEGORY_VIABILITY)); | ||
| 202 | + | ||
| 203 | + category.addItem(new OfferItem("via6", "Συνδρομή Κοινόχρηστων Ποδηλάτων", | ||
| 204 | + "Ετήσια συνδρομή με 40% έκπτωση", | ||
| 205 | + "31/08/2025", "40%", "demo_image_musa.png", "demo_musa.png", CATEGORY_VIABILITY)); | ||
| 206 | + | ||
| 207 | + category.addItem(new OfferItem("via7", "Ενεργειακά Αποδοτικές Συσκευές", | ||
| 208 | + "€50 επιστροφή χρημάτων σε συσκευές με βαθμολογία A+++", | ||
| 209 | + "31/07/2025", "€50", "demo_image_musa.png", "demo_musa.png", CATEGORY_VIABILITY)); | ||
| 210 | + | ||
| 211 | + // Only keeping 7 items for Viability category | ||
| 212 | + | ||
| 213 | + return category; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + /** | ||
| 217 | + * Get Family category with items | ||
| 218 | + * | ||
| 219 | + * @return Family category | ||
| 220 | + */ | ||
| 221 | + public static OfferCategory getFamily() { | ||
| 222 | + OfferCategory category = new OfferCategory(CATEGORY_FAMILY, "Family"); | ||
| 223 | + | ||
| 224 | + category.addItem(new OfferItem("fam1", "Οικογενειακό Πακέτο Κινητής", | ||
| 225 | + "Μοιραστείτε δεδομένα σε 4 γραμμές για €60/μήνα", | ||
| 226 | + "Ongoing", "€60", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 227 | + | ||
| 228 | + category.addItem(new OfferItem("fam2", "Εισιτήρια Οικογενειακού Πάρκου", | ||
| 229 | + "30% έκπτωση όταν αγοράζετε 4+ εισιτήρια", | ||
| 230 | + "31/08/2025", "30%", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 231 | + | ||
| 232 | + category.addItem(new OfferItem("fam3", "Παιδιά Τρώνε Δωρεάν", | ||
| 233 | + "Ένα δωρεάν παιδικό γεύμα με κάθε κυρίως πιάτο ενηλίκου", | ||
| 234 | + "Weekdays only", "€0", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 235 | + | ||
| 236 | + category.addItem(new OfferItem("fam4", "Οικογενειακό Πακέτο Σινεμά", | ||
| 237 | + "4 εισιτήρια + ποπκόρν + αναψυκτικά για €35", | ||
| 238 | + "Weekends", "€35", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 239 | + | ||
| 240 | + category.addItem(new OfferItem("fam5", "Οικογενειακή Συνδρομή Γυμναστηρίου", | ||
| 241 | + "50% έκπτωση για επιπλέον μέλη της οικογένειας", | ||
| 242 | + "Annual", "50%", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 243 | + | ||
| 244 | + category.addItem(new OfferItem("fam6", "Οικογενειακή Φωτογράφιση", | ||
| 245 | + "Επαγγελματική φωτογράφιση για €75", | ||
| 246 | + "31/07/2025", "€75", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 247 | + | ||
| 248 | + category.addItem(new OfferItem("fam7", "Οικογενειακό Πακέτο Ασφάλισης", | ||
| 249 | + "Εξοικονομήστε 25% συνδυάζοντας ασφάλεια σπιτιού και αυτοκινήτου", | ||
| 250 | + "31/12/2025", "25%", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 251 | + | ||
| 252 | + category.addItem(new OfferItem("fam8", "Οικογενειακό Πακέτο Διακοπών", | ||
| 253 | + "All-inclusive διαμονή με δωρεάν διαμονή για παιδιά", | ||
| 254 | + "30/09/2025", "€0", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 255 | + | ||
| 256 | + category.addItem(new OfferItem("fam9", "Οικογενειακό Πακέτο Streaming", | ||
| 257 | + "Πολλαπλές υπηρεσίες streaming για €20/μήνα", | ||
| 258 | + "12-month contract", "€20", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 259 | + | ||
| 260 | + category.addItem(new OfferItem("fam10", "Πακέτο Επιστροφής στο Σχολείο", | ||
| 261 | + "40% έκπτωση σε σχολικά είδη με αγορές άνω των €100", | ||
| 262 | + "31/08/2025", "40%", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 263 | + | ||
| 264 | + // Adding 2 more items for Family category (12 total) | ||
| 265 | + category.addItem(new OfferItem("fam11", "Οικογενειακό Οδοντιατρικό Πρόγραμμα", | ||
| 266 | + "Ετήσιοι έλεγχοι για όλη την οικογένεια με 30% έκπτωση", | ||
| 267 | + "31/12/2025", "30%", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 268 | + | ||
| 269 | + category.addItem(new OfferItem("fam12", "Οικογενειακή Βραδιά Παιχνιδιών", | ||
| 270 | + "Αγοράστε 2 επιτραπέζια παιχνίδια και πάρτε 1 δωρεάν", | ||
| 271 | + "Weekend offer", "100%", "demo_image_ranch.png", "demo_ranch.png", CATEGORY_FAMILY)); | ||
| 272 | + | ||
| 273 | + return category; | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + /** | ||
| 277 | + * Get Food and Coffee category with items | ||
| 278 | + * | ||
| 279 | + * @return Food and Coffee category | ||
| 280 | + */ | ||
| 281 | + public static OfferCategory getFoodAndCoffee() { | ||
| 282 | + OfferCategory category = new OfferCategory(CATEGORY_FOOD_COFFEE, "Φαγητό και καφές"); | ||
| 283 | + | ||
| 284 | + category.addItem(new OfferItem("fc1", "Συνδρομή Καφέ", | ||
| 285 | + "Καθημερινός καφές για €2 με μηνιαία συνδρομή", | ||
| 286 | + "Monthly", "€2", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 287 | + | ||
| 288 | + category.addItem(new OfferItem("fc2", "Προσφορά Μεσημεριανού", | ||
| 289 | + "25% έκπτωση στο μενού μεσημεριανού μεταξύ 12-3μμ", | ||
| 290 | + "Weekdays", "25%", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 291 | + | ||
| 292 | + category.addItem(new OfferItem("fc3", "Κάρτα Επιβράβευσης Φούρνου", | ||
| 293 | + "10ο γλυκό δωρεάν με την κάρτα επιβράβευσης", | ||
| 294 | + "Ongoing", "100%", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 295 | + | ||
| 296 | + category.addItem(new OfferItem("fc4", "Δείπνο για Δύο", | ||
| 297 | + "Γεύμα 3 πιάτων με κρασί για €60", | ||
| 298 | + "31/07/2025", "€60", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 299 | + | ||
| 300 | + category.addItem(new OfferItem("fc5", "Παράδοση Φαγητού", | ||
| 301 | + "Δωρεάν παράδοση για παραγγελίες άνω των €20", | ||
| 302 | + "Ongoing", "€0", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 303 | + | ||
| 304 | + category.addItem(new OfferItem("fc6", "Εκλεκτοί Κόκκοι Καφέ", | ||
| 305 | + "20% έκπτωση σε premium κόκκους καφέ", | ||
| 306 | + "30/06/2025", "20%", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 307 | + | ||
| 308 | + category.addItem(new OfferItem("fc7", "Προσφορά Πρωινού", | ||
| 309 | + "Καφές και γλυκό για €5", | ||
| 310 | + "Daily until 11am", "€5", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 311 | + | ||
| 312 | + category.addItem(new OfferItem("fc8", "Gourmet Burger Γεύμα", | ||
| 313 | + "Burger, πατάτες και αναψυκτικό για €12", | ||
| 314 | + "Ongoing", "€12", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 315 | + | ||
| 316 | + category.addItem(new OfferItem("fc9", "Γευσιγνωσία Κρασιού", | ||
| 317 | + "50% έκπτωση σε συνεδρίες γευσιγνωσίας κρασιού", | ||
| 318 | + "Thursdays", "50%", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 319 | + | ||
| 320 | + category.addItem(new OfferItem("fc10", "Πακέτο Παγωτού", | ||
| 321 | + "Αγοράστε 2 μπάλες και πάρτε 1 δωρεάν", | ||
| 322 | + "Summer offer", "100%", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 323 | + | ||
| 324 | + // Adding 14 more items for Food & Coffee category (24 total) | ||
| 325 | + category.addItem(new OfferItem("fc11", "Εστιατόριο Sushi", | ||
| 326 | + "Φάτε όσο sushi θέλετε για €25", | ||
| 327 | + "Tuesday & Thursday", "€25", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 328 | + | ||
| 329 | + category.addItem(new OfferItem("fc12", "Χειροποίητο Ψωμί", | ||
| 330 | + "Αγοράστε ένα καρβέλι και πάρτε το δεύτερο στη μισή τιμή", | ||
| 331 | + "Weekends", "50%", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 332 | + | ||
| 333 | + category.addItem(new OfferItem("fc13", "Κόκκοι Καφέ", | ||
| 334 | + "15% έκπτωση σε premium κόκκους μονής προέλευσης", | ||
| 335 | + "Limited stock", "15%", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 336 | + | ||
| 337 | + category.addItem(new OfferItem("fc14", "Βραδιά Πίτσας", | ||
| 338 | + "Οικογενειακή πίτσα με 2 υλικά για €12", | ||
| 339 | + "Every Wednesday", "€12", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 340 | + | ||
| 341 | + category.addItem(new OfferItem("fc15", "Μπαρ με Smoothies", | ||
| 342 | + "Αγοράστε ένα smoothie και πάρτε το δεύτερο στη μισή τιμή", | ||
| 343 | + "Morning hours", "50%", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 344 | + | ||
| 345 | + category.addItem(new OfferItem("fc16", "Προσφορά Ζυμαρικών", | ||
| 346 | + "Όλα τα πιάτα ζυμαρικών €10 με δωρεάν ψωμί", | ||
| 347 | + "Monday-Thursday", "€10", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 348 | + | ||
| 349 | + category.addItem(new OfferItem("fc17", "Πιατέλα Επιδορπίων", | ||
| 350 | + "Επιλογή από 5 επιδόρπια για μοίρασμα για €15", | ||
| 351 | + "After 8pm", "€15", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 352 | + | ||
| 353 | + category.addItem(new OfferItem("fc18", "Μπουφές Πρωινού", | ||
| 354 | + "Πρωινό όσο θέλετε για €12.99", | ||
| 355 | + "7am-10am daily", "€12.99", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 356 | + | ||
| 357 | + category.addItem(new OfferItem("fc19", "Εξειδικευμένα Τσάγια", | ||
| 358 | + "Αγοράστε οποιοδήποτε τσάι και πάρτε ένα γλυκό δωρεάν", | ||
| 359 | + "Afternoon tea time", "€0", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 360 | + | ||
| 361 | + category.addItem(new OfferItem("fc20", "Χορτοφαγικό Μενού", | ||
| 362 | + "20% έκπτωση σε όλα τα χορτοφαγικά κυρίως πιάτα", | ||
| 363 | + "All week", "20%", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 364 | + | ||
| 365 | + category.addItem(new OfferItem("fc21", "Γευσιγνωσία Μπύρας", | ||
| 366 | + "Δοκιμή 4 χειροποίητων μπυρών για €8", | ||
| 367 | + "Happy hour", "€8", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 368 | + | ||
| 369 | + category.addItem(new OfferItem("fc22", "Πιατέλα Θαλασσινών", | ||
| 370 | + "Πιατέλα θαλασσινών για δύο με κρασί €45", | ||
| 371 | + "Friday & Saturday", "€45", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 372 | + | ||
| 373 | + category.addItem(new OfferItem("fc23", "Προσφορά Brunch", | ||
| 374 | + "Brunch με mimosa για €18", | ||
| 375 | + "Weekends 11am-3pm", "€18", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 376 | + | ||
| 377 | + category.addItem(new OfferItem("fc24", "Gourmet Σάντουιτς", | ||
| 378 | + "Gourmet σάντουιτς με συνδυασμό σούπας €9.50", | ||
| 379 | + "Lunch special", "€9.50", "demo_image_coffee.png", "demo_coffee.png", CATEGORY_FOOD_COFFEE)); | ||
| 380 | + | ||
| 381 | + return category; | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + /** | ||
| 385 | + * Get Travelling category with items | ||
| 386 | + * | ||
| 387 | + * @return Travelling category | ||
| 388 | + */ | ||
| 389 | + public static OfferCategory getTravelling() { | ||
| 390 | + OfferCategory category = new OfferCategory(CATEGORY_TRAVELLING, "Απόδραση"); | ||
| 391 | + | ||
| 392 | + category.addItem(new OfferItem("tr1", "Έκπτωση Αεροπορικών", | ||
| 393 | + "15% έκπτωση σε διεθνείς πτήσεις", | ||
| 394 | + "31/08/2025", "15%", "demo_image_ninemia.png", "demo_ninemia.png", CATEGORY_TRAVELLING)); | ||
| 395 | + | ||
| 396 | + category.addItem(new OfferItem("tr2", "Διαμονή σε Ξενοδοχείο", | ||
| 397 | + "3 νύχτες στην τιμή των 2 σε συνεργαζόμενα ξενοδοχεία", | ||
| 398 | + "30/09/2025", "33%", "demo_image_ninemia.png", "demo_ninemia.png", CATEGORY_TRAVELLING)); | ||
| 399 | + | ||
| 400 | + category.addItem(new OfferItem("tr3", "Ενοικίαση Αυτοκινήτου", | ||
| 401 | + "€25 έκπτωση σε εβδομαδιαίες ενοικιάσεις αυτοκινήτων", | ||
| 402 | + "31/12/2025", "€25", "demo_image_ninemia.png", "demo_ninemia.png", CATEGORY_TRAVELLING)); | ||
| 403 | + | ||
| 404 | + category.addItem(new OfferItem("tr4", "Ταξιδιωτική Ασφάλεια", | ||
| 405 | + "20% έκπτωση σε ετήσια ταξιδιωτική ασφάλεια", | ||
| 406 | + "30/06/2025", "20%", "demo_image_ninemia.png", "demo_ninemia.png", CATEGORY_TRAVELLING)); | ||
| 407 | + | ||
| 408 | + category.addItem(new OfferItem("tr5", "Ξενάγηση Πόλης", | ||
| 409 | + "Αγοράστε ένα εισιτήριο και πάρτε ένα δωρεάν", | ||
| 410 | + "31/07/2025", "100%", "demo_image_ninemia.png", "demo_ninemia.png", CATEGORY_TRAVELLING)); | ||
| 411 | + | ||
| 412 | + category.addItem(new OfferItem("tr6", "Πρόσβαση σε Lounge Αεροδρομίου", | ||
| 413 | + "€15 για πρόσβαση σε lounge ανεξαρτήτως κατηγορίας εισιτηρίου", | ||
| 414 | + "Ongoing", "€15", "demo_image_ninemia.png", "demo_ninemia.png", CATEGORY_TRAVELLING)); | ||
| 415 | + | ||
| 416 | + category.addItem(new OfferItem("tr7", "Έκπτωση Κρουαζιέρας", | ||
| 417 | + "30% έκπτωση σε επιλεγμένα πακέτα κρουαζιέρας", | ||
| 418 | + "31/08/2025", "30%", "demo_image_ninemia.png", "demo_ninemia.png", CATEGORY_TRAVELLING)); | ||
| 419 | + | ||
| 420 | + category.addItem(new OfferItem("tr8", "Αξεσουάρ Ταξιδιού", | ||
| 421 | + "Αγοράστε 2 και πάρτε 1 δωρεάν σε είδη ταξιδιού", | ||
| 422 | + "While stocks last", "100%", "demo_image_ninemia.png", "demo_ninemia.png", CATEGORY_TRAVELLING)); | ||
| 423 | + | ||
| 424 | + category.addItem(new OfferItem("tr9", "Μεταφορά από/προς Αεροδρόμιο", | ||
| 425 | + "€10 έκπτωση σε ιδιωτικές μεταφορές από/προς αεροδρόμιο", | ||
| 426 | + "31/12/2025", "€10", "demo_image_ninemia.png", "demo_ninemia.png", CATEGORY_TRAVELLING)); | ||
| 427 | + | ||
| 428 | + // Only keeping 9 items for Travelling category | ||
| 429 | + | ||
| 430 | + return category; | ||
| 431 | + } | ||
| 432 | + | ||
| 433 | + /** | ||
| 434 | + * Get Kids category with items | ||
| 435 | + * | ||
| 436 | + * @return Kids category | ||
| 437 | + */ | ||
| 438 | + public static OfferCategory getKids() { | ||
| 439 | + OfferCategory category = new OfferCategory(CATEGORY_KIDS, "Παιδί"); | ||
| 440 | + | ||
| 441 | + category.addItem(new OfferItem("kid1", "Έκπτωση σε Κατάστημα Παιχνιδιών", | ||
| 442 | + "25% έκπτωση σε όλα τα παιχνίδια αυτό το Σαββατοκύριακο", | ||
| 443 | + "Sunday", "25%", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 444 | + | ||
| 445 | + category.addItem(new OfferItem("kid2", "Παιδικά Ρούχα", | ||
| 446 | + "Αγοράστε 2 και πάρτε 1 δωρεάν σε παιδικά ρούχα", | ||
| 447 | + "31/07/2025", "100%", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 448 | + | ||
| 449 | + category.addItem(new OfferItem("kid3", "Εσωτερική Παιδική Χαρά", | ||
| 450 | + "€5 είσοδος για απεριόριστο παιχνίδι", | ||
| 451 | + "Weekdays", "€5", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 452 | + | ||
| 453 | + category.addItem(new OfferItem("kid4", "Παιδικά Βιβλία", | ||
| 454 | + "30% έκπτωση σε εκπαιδευτικά βιβλία", | ||
| 455 | + "30/06/2025", "30%", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 456 | + | ||
| 457 | + category.addItem(new OfferItem("kid5", "Μαθήματα Κολύμβησης", | ||
| 458 | + "Πρώτο μάθημα δωρεάν, μετά €10 ανά μάθημα", | ||
| 459 | + "Summer offer", "€0", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 460 | + | ||
| 461 | + category.addItem(new OfferItem("kid6", "Παιδικό Κούρεμα", | ||
| 462 | + "Ειδική τιμή €8 για παιδιά κάτω των 12 ετών", | ||
| 463 | + "Ongoing", "€8", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 464 | + | ||
| 465 | + category.addItem(new OfferItem("kid7", "Παιδικό Μουσείο", | ||
| 466 | + "Οικογενειακό εισιτήριο για €25 (έως 4 άτομα)", | ||
| 467 | + "31/12/2025", "€25", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 468 | + | ||
| 469 | + category.addItem(new OfferItem("kid8", "Παιδικό Κουτί Γεύματος", | ||
| 470 | + "20% έκπτωση σε συνδρομή υγιεινών γευμάτων", | ||
| 471 | + "First 3 months", "20%", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 472 | + | ||
| 473 | + category.addItem(new OfferItem("kid9", "Είδη Ζωγραφικής", | ||
| 474 | + "40% έκπτωση σε είδη τέχνης και χειροτεχνίας", | ||
| 475 | + "Back to school offer", "40%", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 476 | + | ||
| 477 | + category.addItem(new OfferItem("kid10", "Παιδικός Αθλητικός Εξοπλισμός", | ||
| 478 | + "Αγοράστε πλήρες σετ και εξοικονομήστε €15", | ||
| 479 | + "31/08/2025", "€15", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 480 | + | ||
| 481 | + // Adding 1 more item for Kids category (11 total) | ||
| 482 | + category.addItem(new OfferItem("kid11", "Μαθήματα Προγραμματισμού για Παιδιά", | ||
| 483 | + "Πρώτο μάθημα δωρεάν για παιδιά 8-12 ετών", | ||
| 484 | + "New enrollments", "€0", "demo_image_moustakas.png", "demo_moustakas.png", CATEGORY_KIDS)); | ||
| 485 | + | ||
| 486 | + return category; | ||
| 487 | + } | ||
| 488 | + | ||
| 489 | + /** | ||
| 490 | + * Get Purchases category with items | ||
| 491 | + * | ||
| 492 | + * @return Purchases category | ||
| 493 | + */ | ||
| 494 | + public static OfferCategory getPurchases() { | ||
| 495 | + OfferCategory category = new OfferCategory(CATEGORY_PURCHASES, "Αγορές"); | ||
| 496 | + | ||
| 497 | + category.addItem(new OfferItem("pur1", "Κατάστημα Ηλεκτρονικών", | ||
| 498 | + "€50 έκπτωση σε αγορές άνω των €300", | ||
| 499 | + "30/06/2025", "€50", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 500 | + | ||
| 501 | + category.addItem(new OfferItem("pur2", "Προσφορά Επίπλων", | ||
| 502 | + "Έως και 40% έκπτωση σε επιλεγμένα έπιπλα", | ||
| 503 | + "While stocks last", "40%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 504 | + | ||
| 505 | + category.addItem(new OfferItem("pur3", "Online Αγορές", | ||
| 506 | + "15% έκπτωση στην πρώτη σας αγορά με κωδικό", | ||
| 507 | + "New customers", "15%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 508 | + | ||
| 509 | + category.addItem(new OfferItem("pur4", "Αναβάθμιση Smartphone", | ||
| 510 | + "Ανταλλάξτε το παλιό σας τηλέφωνο και πάρτε €100 επιπλέον αξία", | ||
| 511 | + "31/07/2025", "€100", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 512 | + | ||
| 513 | + category.addItem(new OfferItem("pur5", "Οικιακές Συσκευές", | ||
| 514 | + "Δωρεάν παράδοση και εγκατάσταση", | ||
| 515 | + "On purchases over €500", "€0", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 516 | + | ||
| 517 | + category.addItem(new OfferItem("pur6", "Αθλητικά Ρούχα", | ||
| 518 | + "30% έκπτωση σε παπούτσια για τρέξιμο και ρούχα", | ||
| 519 | + "31/08/2025", "30%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 520 | + | ||
| 521 | + category.addItem(new OfferItem("pur7", "Προϊόντα Ομορφιάς", | ||
| 522 | + "Αγοράστε 3 και πάρτε 1 δωρεάν στη σειρά περιποίησης δέρματος", | ||
| 523 | + "30/09/2025", "100%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 524 | + | ||
| 525 | + category.addItem(new OfferItem("pur8", "Συσκευές Κουζίνας", | ||
| 526 | + "25% έκπτωση σε συσκευές κουζίνας", | ||
| 527 | + "Weekend sale", "25%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 528 | + | ||
| 529 | + category.addItem(new OfferItem("pur9", "Έπιπλα Κήπου", | ||
| 530 | + "Εκκαθάριση τέλους σεζόν - 50% έκπτωση", | ||
| 531 | + "Until sold out", "50%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 532 | + | ||
| 533 | + category.addItem(new OfferItem("pur10", "Αξεσουάρ Τεχνολογίας", | ||
| 534 | + "Αγοράστε 2 αξεσουάρ και εξοικονομήστε €10", | ||
| 535 | + "31/12/2025", "€10", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 536 | + | ||
| 537 | + // Adding 22 more items for Purchases category (32 total) | ||
| 538 | + category.addItem(new OfferItem("pur11", "Γυαλιά Ηλίου Επώνυμων Οίκων", | ||
| 539 | + "30% έκπτωση σε γυαλιά ηλίου επώνυμων οίκων", | ||
| 540 | + "Summer sale", "30%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 541 | + | ||
| 542 | + category.addItem(new OfferItem("pur12", "Αναβάθμιση Laptop", | ||
| 543 | + "Ανταλλάξτε το παλιό σας laptop και πάρτε €150 έκπτωση", | ||
| 544 | + "Back to school", "€150", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 545 | + | ||
| 546 | + category.addItem(new OfferItem("pur13", "Σετ Κλινοσκεπασμάτων", | ||
| 547 | + "Αγοράστε ένα σετ κλινοσκεπασμάτων και πάρτε το δεύτερο στη μισή τιμή", | ||
| 548 | + "Home sale", "50%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 549 | + | ||
| 550 | + category.addItem(new OfferItem("pur14", "Συσκευές Έξυπνου Σπιτιού", | ||
| 551 | + "20% έκπτωση σε όλα τα προϊόντα έξυπνου σπιτιού", | ||
| 552 | + "Tech week", "20%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 553 | + | ||
| 554 | + category.addItem(new OfferItem("pur15", "Έπιπλα Εξωτερικού Χώρου", | ||
| 555 | + "Έως και 40% έκπτωση σε σετ επίπλων εξωτερικού χώρου", | ||
| 556 | + "Garden sale", "40%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 557 | + | ||
| 558 | + category.addItem(new OfferItem("pur16", "Ρολόγια Επώνυμων Οίκων", | ||
| 559 | + "15% έκπτωση σε πολυτελή ρολόγια", | ||
| 560 | + "Limited time", "15%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 561 | + | ||
| 562 | + category.addItem(new OfferItem("pur17", "Συσκευές Κουζίνας", | ||
| 563 | + "Αγοράστε 2 μικρές συσκευές και πάρτε 1 δωρεάν", | ||
| 564 | + "Kitchen sale", "100%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 565 | + | ||
| 566 | + category.addItem(new OfferItem("pur18", "Εξοπλισμός Γυμναστικής", | ||
| 567 | + "25% έκπτωση σε εξοπλισμό γυμναστικής για το σπίτι", | ||
| 568 | + "Fitness sale", "25%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 569 | + | ||
| 570 | + category.addItem(new OfferItem("pur19", "Πολυτελή Κλινοσκεπάσματα", | ||
| 571 | + "Σεντόνια από αιγυπτιακό βαμβάκι με 30% έκπτωση", | ||
| 572 | + "Bedroom essentials", "30%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 573 | + | ||
| 574 | + category.addItem(new OfferItem("pur20", "Τσάντες Επώνυμων Οίκων", | ||
| 575 | + "Έως και 25% έκπτωση σε επιλεγμένες επώνυμες τσάντες", | ||
| 576 | + "Accessory sale", "25%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 577 | + | ||
| 578 | + category.addItem(new OfferItem("pur21", "Έξυπνες Τηλεοράσεις", | ||
| 579 | + "€100 έκπτωση σε τηλεοράσεις 55\" και μεγαλύτερες", | ||
| 580 | + "Entertainment sale", "€100", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 581 | + | ||
| 582 | + category.addItem(new OfferItem("pur22", "Χειμερινά Ρούχα", | ||
| 583 | + "Αγοράστε 3 χειμερινά είδη και πάρτε 1 δωρεάν", | ||
| 584 | + "Winter collection", "100%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 585 | + | ||
| 586 | + category.addItem(new OfferItem("pur23", "Σετ Μαγειρικών Σκευών", | ||
| 587 | + "Επαγγελματικά σετ μαγειρικών σκευών με 40% έκπτωση", | ||
| 588 | + "Kitchen essentials", "40%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 589 | + | ||
| 590 | + category.addItem(new OfferItem("pur24", "Ασύρματα Ακουστικά", | ||
| 591 | + "Premium ασύρματα ακουστικά με €30 έκπτωση", | ||
| 592 | + "Audio sale", "€30", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 593 | + | ||
| 594 | + category.addItem(new OfferItem("pur25", "Πολυτελή Αρώματα", | ||
| 595 | + "25% έκπτωση σε αρώματα επώνυμων οίκων", | ||
| 596 | + "Beauty sale", "25%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 597 | + | ||
| 598 | + category.addItem(new OfferItem("pur26", "Κονσόλες Παιχνιδιών", | ||
| 599 | + "Δωρεάν παιχνίδι με την αγορά κονσόλας", | ||
| 600 | + "Gaming sale", "€60", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 601 | + | ||
| 602 | + category.addItem(new OfferItem("pur27", "Είδη Μπάνιου", | ||
| 603 | + "30% έκπτωση σε είδη ανακαίνισης μπάνιου", | ||
| 604 | + "Home improvement", "30%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 605 | + | ||
| 606 | + category.addItem(new OfferItem("pur28", "Εξοπλισμός Κάμπινγκ", | ||
| 607 | + "Αγοράστε σκηνή και πάρτε υπνόσακο στη μισή τιμή", | ||
| 608 | + "Outdoor sale", "50%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 609 | + | ||
| 610 | + category.addItem(new OfferItem("pur29", "Έπιπλα Γραφείου", | ||
| 611 | + "Εργονομικές καρέκλες γραφείου με 20% έκπτωση", | ||
| 612 | + "Work from home", "20%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 613 | + | ||
| 614 | + category.addItem(new OfferItem("pur30", "Προσφορά Κοσμημάτων", | ||
| 615 | + "40% έκπτωση σε συλλογή ασημένιων κοσμημάτων", | ||
| 616 | + "Accessory sale", "40%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 617 | + | ||
| 618 | + category.addItem(new OfferItem("pur31", "Έξυπνα Ρολόγια", | ||
| 619 | + "Τελευταία μοντέλα έξυπνων ρολογιών με €50 έκπτωση", | ||
| 620 | + "Tech sale", "€50", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 621 | + | ||
| 622 | + category.addItem(new OfferItem("pur32", "Σετ Αποσκευών", | ||
| 623 | + "Premium σετ αποσκευών με 35% έκπτωση", | ||
| 624 | + "Travel essentials", "35%", "demo_image_migato.png", "demo_migato.png", CATEGORY_PURCHASES)); | ||
| 625 | + | ||
| 626 | + return category; | ||
| 627 | + } | ||
| 628 | +} |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import java.io.Serializable; | ||
| 4 | +import java.util.ArrayList; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Model class representing a category of offers with its associated items. | ||
| 9 | + */ | ||
| 10 | +public class OfferCategory implements Serializable { | ||
| 11 | + private String id; | ||
| 12 | + private String name; | ||
| 13 | + private List<OfferItem> items; | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * Default constructor | ||
| 17 | + */ | ||
| 18 | + public OfferCategory() { | ||
| 19 | + this.items = new ArrayList<>(); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * Constructor with id and name | ||
| 24 | + * | ||
| 25 | + * @param id Unique identifier for the category | ||
| 26 | + * @param name Display name of the category | ||
| 27 | + */ | ||
| 28 | + public OfferCategory(String id, String name) { | ||
| 29 | + this.id = id; | ||
| 30 | + this.name = name; | ||
| 31 | + this.items = new ArrayList<>(); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * Full constructor | ||
| 36 | + * | ||
| 37 | + * @param id Unique identifier for the category | ||
| 38 | + * @param name Display name of the category | ||
| 39 | + * @param items List of offer items in this category | ||
| 40 | + */ | ||
| 41 | + public OfferCategory(String id, String name, List<OfferItem> items) { | ||
| 42 | + this.id = id; | ||
| 43 | + this.name = name; | ||
| 44 | + this.items = items != null ? items : new ArrayList<>(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + // Getters and Setters | ||
| 48 | + | ||
| 49 | + public String getId() { | ||
| 50 | + return id; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public void setId(String id) { | ||
| 54 | + this.id = id; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public String getName() { | ||
| 58 | + return name; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public void setName(String name) { | ||
| 62 | + this.name = name; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public List<OfferItem> getItems() { | ||
| 66 | + return items; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public void setItems(List<OfferItem> items) { | ||
| 70 | + this.items = items != null ? items : new ArrayList<>(); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * Add a single item to the category | ||
| 75 | + * | ||
| 76 | + * @param item The offer item to add | ||
| 77 | + */ | ||
| 78 | + public void addItem(OfferItem item) { | ||
| 79 | + if (items == null) { | ||
| 80 | + items = new ArrayList<>(); | ||
| 81 | + } | ||
| 82 | + items.add(item); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * Get the number of items in this category | ||
| 87 | + * | ||
| 88 | + * @return The count of items | ||
| 89 | + */ | ||
| 90 | + public int getItemCount() { | ||
| 91 | + return items != null ? items.size() : 0; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * Get the formatted name with item count | ||
| 96 | + * | ||
| 97 | + * @return Category name with item count in parentheses | ||
| 98 | + */ | ||
| 99 | + public String getFormattedName() { | ||
| 100 | + return name + " (" + getItemCount() + ")"; | ||
| 101 | + } | ||
| 102 | +} |
| 1 | +package ly.warp.sdk.io.models; | ||
| 2 | + | ||
| 3 | +import java.io.Serializable; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Model class representing an offer item to be displayed in the home screen. | ||
| 7 | + */ | ||
| 8 | +public class OfferItem implements Serializable { | ||
| 9 | + private String id; | ||
| 10 | + private String title; | ||
| 11 | + private String description; | ||
| 12 | + private String endDate; | ||
| 13 | + private String value; | ||
| 14 | + private String imageUrl; | ||
| 15 | + private String logoUrl; | ||
| 16 | + private String category; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * Default constructor | ||
| 20 | + */ | ||
| 21 | + public OfferItem() { | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * Full constructor for creating an offer item | ||
| 26 | + * | ||
| 27 | + * @param id Unique identifier for the offer | ||
| 28 | + * @param title Title of the offer | ||
| 29 | + * @param description Description of the offer | ||
| 30 | + * @param endDate End date of the offer (formatted as string) | ||
| 31 | + * @param value Value of the offer (formatted as string, e.g., "50%", "€20") | ||
| 32 | + * @param imageUrl URL or resource name for the offer image | ||
| 33 | + * @param logoUrl URL or resource name for the merchant logo | ||
| 34 | + * @param category Category this offer belongs to | ||
| 35 | + */ | ||
| 36 | + public OfferItem(String id, String title, String description, String endDate, | ||
| 37 | + String value, String imageUrl, String logoUrl, String category) { | ||
| 38 | + this.id = id; | ||
| 39 | + this.title = title; | ||
| 40 | + this.description = description; | ||
| 41 | + this.endDate = endDate; | ||
| 42 | + this.value = value; | ||
| 43 | + this.imageUrl = imageUrl; | ||
| 44 | + this.logoUrl = logoUrl; | ||
| 45 | + this.category = category; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + // Getters and Setters | ||
| 49 | + | ||
| 50 | + public String getId() { | ||
| 51 | + return id; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public void setId(String id) { | ||
| 55 | + this.id = id; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public String getTitle() { | ||
| 59 | + return title; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setTitle(String title) { | ||
| 63 | + this.title = title; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public String getDescription() { | ||
| 67 | + return description; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + public void setDescription(String description) { | ||
| 71 | + this.description = description; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + public String getEndDate() { | ||
| 75 | + return endDate; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public void setEndDate(String endDate) { | ||
| 79 | + this.endDate = endDate; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public String getValue() { | ||
| 83 | + return value; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public void setValue(String value) { | ||
| 87 | + this.value = value; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + public String getImageUrl() { | ||
| 91 | + return imageUrl; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + public void setImageUrl(String imageUrl) { | ||
| 95 | + this.imageUrl = imageUrl; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public String getLogoUrl() { | ||
| 99 | + return logoUrl; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + public void setLogoUrl(String logoUrl) { | ||
| 103 | + this.logoUrl = logoUrl; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public String getCategory() { | ||
| 107 | + return category; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public void setCategory(String category) { | ||
| 111 | + this.category = category; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * Returns the value (already formatted with % or € symbol) | ||
| 116 | + * @return Value string | ||
| 117 | + */ | ||
| 118 | + public String getFormattedValue() { | ||
| 119 | + return value; | ||
| 120 | + } | ||
| 121 | +} |
| 1 | +package ly.warp.sdk.utils; | ||
| 2 | + | ||
| 3 | +import android.graphics.Bitmap; | ||
| 4 | +import android.graphics.BitmapShader; | ||
| 5 | +import android.graphics.Canvas; | ||
| 6 | +import android.graphics.Paint; | ||
| 7 | +import android.graphics.Path; | ||
| 8 | +import android.graphics.RectF; | ||
| 9 | +import android.graphics.Shader; | ||
| 10 | + | ||
| 11 | +import androidx.annotation.NonNull; | ||
| 12 | + | ||
| 13 | +import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; | ||
| 14 | +import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; | ||
| 15 | + | ||
| 16 | +import java.security.MessageDigest; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Glide transformation to round only the top corners of an image | ||
| 20 | + */ | ||
| 21 | +public class TopRoundedCornersTransformation extends BitmapTransformation { | ||
| 22 | + private static final String ID = "ly.warp.sdk.utils.TopRoundedCornersTransformation"; | ||
| 23 | + private final int radius; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * Constructor | ||
| 27 | + * | ||
| 28 | + * @param radius Corner radius in pixels | ||
| 29 | + */ | ||
| 30 | + public TopRoundedCornersTransformation(int radius) { | ||
| 31 | + this.radius = radius; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) { | ||
| 36 | + return roundTopCorners(pool, toTransform); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + private Bitmap roundTopCorners(BitmapPool pool, Bitmap source) { | ||
| 40 | + if (source == null) return null; | ||
| 41 | + | ||
| 42 | + Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888); | ||
| 43 | + if (result == null) { | ||
| 44 | + result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + Canvas canvas = new Canvas(result); | ||
| 48 | + Paint paint = new Paint(); | ||
| 49 | + paint.setAntiAlias(true); | ||
| 50 | + paint.setShader(new BitmapShader(source, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP)); | ||
| 51 | + | ||
| 52 | + // Create path with rounded top corners | ||
| 53 | + Path path = new Path(); | ||
| 54 | + RectF rectF = new RectF(0, 0, source.getWidth(), source.getHeight()); | ||
| 55 | + float[] radii = new float[]{ | ||
| 56 | + radius, radius, // top-left | ||
| 57 | + radius, radius, // top-right | ||
| 58 | + 0, 0, // bottom-right | ||
| 59 | + 0, 0 // bottom-left | ||
| 60 | + }; | ||
| 61 | + path.addRoundRect(rectF, radii, Path.Direction.CW); | ||
| 62 | + | ||
| 63 | + // Draw rounded rectangle | ||
| 64 | + canvas.drawPath(path, paint); | ||
| 65 | + | ||
| 66 | + return result; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { | ||
| 71 | + messageDigest.update((ID + radius).getBytes()); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public boolean equals(Object o) { | ||
| 76 | + if (this == o) return true; | ||
| 77 | + if (o == null || getClass() != o.getClass()) return false; | ||
| 78 | + TopRoundedCornersTransformation that = (TopRoundedCornersTransformation) o; | ||
| 79 | + return radius == that.radius; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public int hashCode() { | ||
| 84 | + return ID.hashCode() + radius; | ||
| 85 | + } | ||
| 86 | +} |
| ... | @@ -167,6 +167,30 @@ public class WarplyManagerHelper { | ... | @@ -167,6 +167,30 @@ public class WarplyManagerHelper { |
| 167 | context.startActivity(WarpViewActivity.createIntentFromURL(context, (WarplyProperty.getSupermarketsUrl(context) + WarpConstants.SUPERMARKETS_MAP))); | 167 | context.startActivity(WarpViewActivity.createIntentFromURL(context, (WarplyProperty.getSupermarketsUrl(context) + WarpConstants.SUPERMARKETS_MAP))); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | + public static void openContest(Context context) { | ||
| 171 | + final String mContestUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html"; | ||
| 172 | + JSONObject params = new JSONObject(); | ||
| 173 | + try { | ||
| 174 | + params.putOpt("web_id", WarpUtils.getWebId(context)); | ||
| 175 | + params.putOpt("app_uuid", WarplyProperty.getAppUuid(context)); | ||
| 176 | + params.putOpt("api_key", WarpUtils.getApiKey(context)); | ||
| 177 | + params.putOpt("session_uuid", ""); | ||
| 178 | + params.putOpt("access_token", WarplyDBHelper.getInstance(context).getAuthValue("access_token")); | ||
| 179 | + params.putOpt("refresh_token", WarplyDBHelper.getInstance(context).getAuthValue("refresh_token")); | ||
| 180 | + params.putOpt("client_id", WarplyDBHelper.getInstance(context).getClientValue("client_id")); | ||
| 181 | + params.putOpt("client_secret", WarplyDBHelper.getInstance(context).getClientValue("client_secret")); | ||
| 182 | + params.putOpt("map", "true"); | ||
| 183 | + params.putOpt("lan", WarpUtils.getApplicationLocale(context)); | ||
| 184 | + params.putOpt("dark", String.valueOf(WarpUtils.getIsDarkModeEnabled(context))); | ||
| 185 | + } catch (JSONException e) { | ||
| 186 | + e.printStackTrace(); | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + WarpUtils.setWebviewParams(context, params); | ||
| 190 | + | ||
| 191 | + context.startActivity(WarpViewActivity.createIntentFromURL(context, mContestUrl)); | ||
| 192 | + } | ||
| 193 | + | ||
| 170 | // =========================================================== | 194 | // =========================================================== |
| 171 | // Inner and Anonymous Classes | 195 | // Inner and Anonymous Classes |
| 172 | // =========================================================== | 196 | // =========================================================== | ... | ... |
| 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 horizontal spacing between RecyclerView items. | ||
| 11 | + * Adds spacing to the right of each item except the last one. | ||
| 12 | + */ | ||
| 13 | +public class HorizontalSpaceItemDecoration extends RecyclerView.ItemDecoration { | ||
| 14 | + private final int spaceWidth; | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * Constructor | ||
| 18 | + * | ||
| 19 | + * @param spaceWidth Space width in pixels | ||
| 20 | + */ | ||
| 21 | + public HorizontalSpaceItemDecoration(int spaceWidth) { | ||
| 22 | + this.spaceWidth = spaceWidth; | ||
| 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 right 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.right = spaceWidth; | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | +} |
3.59 KB
10.3 KB
6.15 KB
1.68 KB
1.47 KB
317 KB
114 KB
170 KB
154 KB
70.3 KB
115 KB
170 KB
160 KB
8.51 KB
21 KB
3.94 KB
6.53 KB
10.2 KB
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + android:shape="rectangle"> | ||
| 4 | + <corners | ||
| 5 | + android:bottomLeftRadius="0dp" | ||
| 6 | + android:bottomRightRadius="0dp" | ||
| 7 | + android:topLeftRadius="9dp" | ||
| 8 | + android:topRightRadius="9dp" /> | ||
| 9 | + | ||
| 10 | + <solid android:color="@android:color/transparent" /> | ||
| 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 | + <stroke | ||
| 8 | + android:width="1dp" | ||
| 9 | + android:color="@color/black2" /> | ||
| 10 | +</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="9dp" /> | ||
| 5 | + | ||
| 6 | + <solid android:color="@color/white" /> | ||
| 7 | + <stroke | ||
| 8 | + android:width="1dp" | ||
| 9 | + android:color="@color/grey" /> | ||
| 10 | +</shape> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 1 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 2 | + xmlns:tools="http://schemas.android.com/tools" | ||
| 2 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
| 3 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
| 4 | android:background="@color/cos_grey_light"> | 5 | android:background="@color/cos_grey_light"> |
| ... | @@ -33,15 +34,15 @@ | ... | @@ -33,15 +34,15 @@ |
| 33 | 34 | ||
| 34 | <ImageView | 35 | <ImageView |
| 35 | android:id="@+id/green_icon" | 36 | android:id="@+id/green_icon" |
| 36 | - android:layout_width="52dp" | 37 | + android:layout_width="58dp" |
| 37 | - android:layout_height="20dp" | 38 | + android:layout_height="22dp" |
| 38 | android:layout_marginEnd="8dp" | 39 | android:layout_marginEnd="8dp" |
| 39 | android:src="@drawable/demo_green" /> | 40 | android:src="@drawable/demo_green" /> |
| 40 | 41 | ||
| 41 | <ImageView | 42 | <ImageView |
| 42 | android:id="@+id/family_icon" | 43 | android:id="@+id/family_icon" |
| 43 | - android:layout_width="52dp" | 44 | + android:layout_width="58dp" |
| 44 | - android:layout_height="20dp" | 45 | + android:layout_height="22dp" |
| 45 | android:src="@drawable/demo_family" /> | 46 | android:src="@drawable/demo_family" /> |
| 46 | </LinearLayout> | 47 | </LinearLayout> |
| 47 | 48 | ||
| ... | @@ -49,7 +50,6 @@ | ... | @@ -49,7 +50,6 @@ |
| 49 | android:id="@+id/profile_icon" | 50 | android:id="@+id/profile_icon" |
| 50 | android:layout_width="40dp" | 51 | android:layout_width="40dp" |
| 51 | android:layout_height="40dp" | 52 | android:layout_height="40dp" |
| 52 | - android:layout_gravity="center_vertical|end" | ||
| 53 | android:src="@drawable/demo_profile" /> | 53 | android:src="@drawable/demo_profile" /> |
| 54 | </LinearLayout> | 54 | </LinearLayout> |
| 55 | 55 | ||
| ... | @@ -60,6 +60,382 @@ | ... | @@ -60,6 +60,382 @@ |
| 60 | android:scaleType="fitXY" | 60 | android:scaleType="fitXY" |
| 61 | android:src="@drawable/demo_home_banner" /> | 61 | android:src="@drawable/demo_home_banner" /> |
| 62 | 62 | ||
| 63 | + <!-- Top Offers Section --> | ||
| 64 | + <RelativeLayout | ||
| 65 | + android:layout_width="match_parent" | ||
| 66 | + android:layout_height="wrap_content" | ||
| 67 | + android:layout_marginTop="48dp"> | ||
| 68 | + | ||
| 69 | + <LinearLayout | ||
| 70 | + android:id="@+id/ll_recycler1" | ||
| 71 | + android:layout_width="match_parent" | ||
| 72 | + android:layout_height="wrap_content" | ||
| 73 | + android:layout_gravity="center" | ||
| 74 | + android:paddingHorizontal="16dp" | ||
| 75 | + android:orientation="horizontal"> | ||
| 76 | + | ||
| 77 | + <TextView | ||
| 78 | + android:id="@+id/tv_recycler_category1" | ||
| 79 | + android:layout_width="0dp" | ||
| 80 | + android:layout_height="wrap_content" | ||
| 81 | + android:layout_weight="1" | ||
| 82 | + android:textColor="@color/black2" | ||
| 83 | + android:textStyle="bold" | ||
| 84 | + android:textSize="16sp" | ||
| 85 | + tools:text="Top Offers (10)" /> | ||
| 86 | + | ||
| 87 | + <TextView | ||
| 88 | + android:id="@+id/tv_recycler_all1" | ||
| 89 | + android:layout_width="wrap_content" | ||
| 90 | + android:layout_height="wrap_content" | ||
| 91 | + android:background="@drawable/demo_shape_transparent_border_black" | ||
| 92 | + android:paddingHorizontal="16dp" | ||
| 93 | + android:paddingVertical="6dp" | ||
| 94 | + android:text="@string/demo_all" | ||
| 95 | + android:textColor="@color/black3" | ||
| 96 | + android:textSize="14sp" /> | ||
| 97 | + </LinearLayout> | ||
| 98 | + | ||
| 99 | + <androidx.recyclerview.widget.RecyclerView | ||
| 100 | + android:id="@+id/rl_recycler1" | ||
| 101 | + android:layout_width="match_parent" | ||
| 102 | + android:layout_height="wrap_content" | ||
| 103 | + android:layout_below="@+id/ll_recycler1" | ||
| 104 | + android:layout_marginTop="16dp" | ||
| 105 | + android:orientation="horizontal" | ||
| 106 | + android:paddingHorizontal="16dp" | ||
| 107 | + android:clipToPadding="false" /> | ||
| 108 | + </RelativeLayout> | ||
| 109 | + | ||
| 110 | + <!-- Favorites Section --> | ||
| 111 | + <RelativeLayout | ||
| 112 | + android:layout_width="match_parent" | ||
| 113 | + android:layout_height="wrap_content" | ||
| 114 | + android:layout_marginTop="48dp"> | ||
| 115 | + | ||
| 116 | + <LinearLayout | ||
| 117 | + android:id="@+id/ll_recycler2" | ||
| 118 | + android:layout_width="match_parent" | ||
| 119 | + android:layout_height="wrap_content" | ||
| 120 | + android:layout_gravity="center" | ||
| 121 | + android:paddingHorizontal="16dp" | ||
| 122 | + android:orientation="horizontal"> | ||
| 123 | + | ||
| 124 | + <TextView | ||
| 125 | + android:id="@+id/tv_recycler_category2" | ||
| 126 | + android:layout_width="0dp" | ||
| 127 | + android:layout_height="wrap_content" | ||
| 128 | + android:layout_weight="1" | ||
| 129 | + android:textColor="@color/black2" | ||
| 130 | + android:textStyle="bold" | ||
| 131 | + android:textSize="16sp" | ||
| 132 | + tools:text="Favorites (10)" /> | ||
| 133 | + | ||
| 134 | + <TextView | ||
| 135 | + android:id="@+id/tv_recycler_all2" | ||
| 136 | + android:layout_width="wrap_content" | ||
| 137 | + android:layout_height="wrap_content" | ||
| 138 | + android:background="@drawable/demo_shape_transparent_border_black" | ||
| 139 | + android:paddingHorizontal="16dp" | ||
| 140 | + android:paddingVertical="6dp" | ||
| 141 | + android:text="@string/demo_all" | ||
| 142 | + android:textColor="@color/black3" | ||
| 143 | + android:textSize="14sp" /> | ||
| 144 | + </LinearLayout> | ||
| 145 | + | ||
| 146 | + <androidx.recyclerview.widget.RecyclerView | ||
| 147 | + android:id="@+id/rl_recycler2" | ||
| 148 | + android:layout_width="match_parent" | ||
| 149 | + android:layout_height="wrap_content" | ||
| 150 | + android:layout_below="@+id/ll_recycler2" | ||
| 151 | + android:layout_marginTop="16dp" | ||
| 152 | + android:orientation="horizontal" | ||
| 153 | + android:paddingHorizontal="16dp" | ||
| 154 | + android:clipToPadding="false" /> | ||
| 155 | + </RelativeLayout> | ||
| 156 | + | ||
| 157 | + <!-- Viability Section --> | ||
| 158 | + <RelativeLayout | ||
| 159 | + android:layout_width="match_parent" | ||
| 160 | + android:layout_height="wrap_content" | ||
| 161 | + android:layout_marginTop="48dp"> | ||
| 162 | + | ||
| 163 | + <LinearLayout | ||
| 164 | + android:id="@+id/ll_recycler3" | ||
| 165 | + android:layout_width="match_parent" | ||
| 166 | + android:layout_height="wrap_content" | ||
| 167 | + android:layout_gravity="center" | ||
| 168 | + android:paddingHorizontal="16dp" | ||
| 169 | + android:orientation="horizontal"> | ||
| 170 | + | ||
| 171 | + <TextView | ||
| 172 | + android:id="@+id/tv_recycler_category3" | ||
| 173 | + android:layout_width="0dp" | ||
| 174 | + android:layout_height="wrap_content" | ||
| 175 | + android:layout_weight="1" | ||
| 176 | + android:textColor="@color/black2" | ||
| 177 | + android:textStyle="bold" | ||
| 178 | + android:textSize="16sp" | ||
| 179 | + tools:text="Viability (10)" /> | ||
| 180 | + | ||
| 181 | + <TextView | ||
| 182 | + android:id="@+id/tv_recycler_all3" | ||
| 183 | + android:layout_width="wrap_content" | ||
| 184 | + android:layout_height="wrap_content" | ||
| 185 | + android:background="@drawable/demo_shape_transparent_border_black" | ||
| 186 | + android:paddingHorizontal="16dp" | ||
| 187 | + android:paddingVertical="6dp" | ||
| 188 | + android:text="@string/demo_all" | ||
| 189 | + android:textColor="@color/black3" | ||
| 190 | + android:textSize="14sp" /> | ||
| 191 | + </LinearLayout> | ||
| 192 | + | ||
| 193 | + <androidx.recyclerview.widget.RecyclerView | ||
| 194 | + android:id="@+id/rl_recycler3" | ||
| 195 | + android:layout_width="match_parent" | ||
| 196 | + android:layout_height="wrap_content" | ||
| 197 | + android:layout_below="@+id/ll_recycler3" | ||
| 198 | + android:layout_marginTop="16dp" | ||
| 199 | + android:orientation="horizontal" | ||
| 200 | + android:paddingHorizontal="16dp" | ||
| 201 | + android:clipToPadding="false" /> | ||
| 202 | + </RelativeLayout> | ||
| 203 | + | ||
| 204 | + <!-- Family Section --> | ||
| 205 | + <RelativeLayout | ||
| 206 | + android:layout_width="match_parent" | ||
| 207 | + android:layout_height="wrap_content" | ||
| 208 | + android:layout_marginTop="48dp"> | ||
| 209 | + | ||
| 210 | + <LinearLayout | ||
| 211 | + android:id="@+id/ll_recycler4" | ||
| 212 | + android:layout_width="match_parent" | ||
| 213 | + android:layout_height="wrap_content" | ||
| 214 | + android:layout_gravity="center" | ||
| 215 | + android:paddingHorizontal="16dp" | ||
| 216 | + android:orientation="horizontal"> | ||
| 217 | + | ||
| 218 | + <TextView | ||
| 219 | + android:id="@+id/tv_recycler_category4" | ||
| 220 | + android:layout_width="0dp" | ||
| 221 | + android:layout_height="wrap_content" | ||
| 222 | + android:layout_weight="1" | ||
| 223 | + android:textColor="@color/black2" | ||
| 224 | + android:textStyle="bold" | ||
| 225 | + android:textSize="16sp" | ||
| 226 | + tools:text="Family (10)" /> | ||
| 227 | + | ||
| 228 | + <TextView | ||
| 229 | + android:id="@+id/tv_recycler_all4" | ||
| 230 | + android:layout_width="wrap_content" | ||
| 231 | + android:layout_height="wrap_content" | ||
| 232 | + android:background="@drawable/demo_shape_transparent_border_black" | ||
| 233 | + android:paddingHorizontal="16dp" | ||
| 234 | + android:paddingVertical="6dp" | ||
| 235 | + android:text="@string/demo_all" | ||
| 236 | + android:textColor="@color/black3" | ||
| 237 | + android:textSize="14sp" /> | ||
| 238 | + </LinearLayout> | ||
| 239 | + | ||
| 240 | + <androidx.recyclerview.widget.RecyclerView | ||
| 241 | + android:id="@+id/rl_recycler4" | ||
| 242 | + android:layout_width="match_parent" | ||
| 243 | + android:layout_height="wrap_content" | ||
| 244 | + android:layout_below="@+id/ll_recycler4" | ||
| 245 | + android:layout_marginTop="16dp" | ||
| 246 | + android:orientation="horizontal" | ||
| 247 | + android:paddingHorizontal="16dp" | ||
| 248 | + android:clipToPadding="false" /> | ||
| 249 | + </RelativeLayout> | ||
| 250 | + | ||
| 251 | + <!-- Food and Coffee Section --> | ||
| 252 | + <RelativeLayout | ||
| 253 | + android:layout_width="match_parent" | ||
| 254 | + android:layout_height="wrap_content" | ||
| 255 | + android:layout_marginTop="48dp"> | ||
| 256 | + | ||
| 257 | + <LinearLayout | ||
| 258 | + android:id="@+id/ll_recycler5" | ||
| 259 | + android:layout_width="match_parent" | ||
| 260 | + android:layout_height="wrap_content" | ||
| 261 | + android:layout_gravity="center" | ||
| 262 | + android:paddingHorizontal="16dp" | ||
| 263 | + android:orientation="horizontal"> | ||
| 264 | + | ||
| 265 | + <TextView | ||
| 266 | + android:id="@+id/tv_recycler_category5" | ||
| 267 | + android:layout_width="0dp" | ||
| 268 | + android:layout_height="wrap_content" | ||
| 269 | + android:layout_weight="1" | ||
| 270 | + android:textColor="@color/black2" | ||
| 271 | + android:textStyle="bold" | ||
| 272 | + android:textSize="16sp" | ||
| 273 | + tools:text="Food and Coffee (10)" /> | ||
| 274 | + | ||
| 275 | + <TextView | ||
| 276 | + android:id="@+id/tv_recycler_all5" | ||
| 277 | + android:layout_width="wrap_content" | ||
| 278 | + android:layout_height="wrap_content" | ||
| 279 | + android:background="@drawable/demo_shape_transparent_border_black" | ||
| 280 | + android:paddingHorizontal="16dp" | ||
| 281 | + android:paddingVertical="6dp" | ||
| 282 | + android:text="@string/demo_all" | ||
| 283 | + android:textColor="@color/black3" | ||
| 284 | + android:textSize="14sp" /> | ||
| 285 | + </LinearLayout> | ||
| 286 | + | ||
| 287 | + <androidx.recyclerview.widget.RecyclerView | ||
| 288 | + android:id="@+id/rl_recycler5" | ||
| 289 | + android:layout_width="match_parent" | ||
| 290 | + android:layout_height="wrap_content" | ||
| 291 | + android:layout_below="@+id/ll_recycler5" | ||
| 292 | + android:layout_marginTop="16dp" | ||
| 293 | + android:orientation="horizontal" | ||
| 294 | + android:paddingHorizontal="16dp" | ||
| 295 | + android:clipToPadding="false" /> | ||
| 296 | + </RelativeLayout> | ||
| 297 | + | ||
| 298 | + <!-- Travelling Section --> | ||
| 299 | + <RelativeLayout | ||
| 300 | + android:layout_width="match_parent" | ||
| 301 | + android:layout_height="wrap_content" | ||
| 302 | + android:layout_marginTop="48dp"> | ||
| 303 | + | ||
| 304 | + <LinearLayout | ||
| 305 | + android:id="@+id/ll_recycler6" | ||
| 306 | + android:layout_width="match_parent" | ||
| 307 | + android:layout_height="wrap_content" | ||
| 308 | + android:layout_gravity="center" | ||
| 309 | + android:paddingHorizontal="16dp" | ||
| 310 | + android:orientation="horizontal"> | ||
| 311 | + | ||
| 312 | + <TextView | ||
| 313 | + android:id="@+id/tv_recycler_category6" | ||
| 314 | + android:layout_width="0dp" | ||
| 315 | + android:layout_height="wrap_content" | ||
| 316 | + android:layout_weight="1" | ||
| 317 | + android:textColor="@color/black2" | ||
| 318 | + android:textStyle="bold" | ||
| 319 | + android:textSize="16sp" | ||
| 320 | + tools:text="Travelling (10)" /> | ||
| 321 | + | ||
| 322 | + <TextView | ||
| 323 | + android:id="@+id/tv_recycler_all6" | ||
| 324 | + android:layout_width="wrap_content" | ||
| 325 | + android:layout_height="wrap_content" | ||
| 326 | + android:background="@drawable/demo_shape_transparent_border_black" | ||
| 327 | + android:paddingHorizontal="16dp" | ||
| 328 | + android:paddingVertical="6dp" | ||
| 329 | + android:text="@string/demo_all" | ||
| 330 | + android:textColor="@color/black3" | ||
| 331 | + android:textSize="14sp" /> | ||
| 332 | + </LinearLayout> | ||
| 333 | + | ||
| 334 | + <androidx.recyclerview.widget.RecyclerView | ||
| 335 | + android:id="@+id/rl_recycler6" | ||
| 336 | + android:layout_width="match_parent" | ||
| 337 | + android:layout_height="wrap_content" | ||
| 338 | + android:layout_below="@+id/ll_recycler6" | ||
| 339 | + android:layout_marginTop="16dp" | ||
| 340 | + android:orientation="horizontal" | ||
| 341 | + android:paddingHorizontal="16dp" | ||
| 342 | + android:clipToPadding="false" /> | ||
| 343 | + </RelativeLayout> | ||
| 344 | + | ||
| 345 | + <!-- Kids Section --> | ||
| 346 | + <RelativeLayout | ||
| 347 | + android:layout_width="match_parent" | ||
| 348 | + android:layout_height="wrap_content" | ||
| 349 | + android:layout_marginTop="48dp"> | ||
| 350 | + | ||
| 351 | + <LinearLayout | ||
| 352 | + android:id="@+id/ll_recycler7" | ||
| 353 | + android:layout_width="match_parent" | ||
| 354 | + android:layout_height="wrap_content" | ||
| 355 | + android:layout_gravity="center" | ||
| 356 | + android:paddingHorizontal="16dp" | ||
| 357 | + android:orientation="horizontal"> | ||
| 358 | + | ||
| 359 | + <TextView | ||
| 360 | + android:id="@+id/tv_recycler_category7" | ||
| 361 | + android:layout_width="0dp" | ||
| 362 | + android:layout_height="wrap_content" | ||
| 363 | + android:layout_weight="1" | ||
| 364 | + android:textColor="@color/black2" | ||
| 365 | + android:textStyle="bold" | ||
| 366 | + android:textSize="16sp" | ||
| 367 | + tools:text="Kids (10)" /> | ||
| 368 | + | ||
| 369 | + <TextView | ||
| 370 | + android:id="@+id/tv_recycler_all7" | ||
| 371 | + android:layout_width="wrap_content" | ||
| 372 | + android:layout_height="wrap_content" | ||
| 373 | + android:background="@drawable/demo_shape_transparent_border_black" | ||
| 374 | + android:paddingHorizontal="16dp" | ||
| 375 | + android:paddingVertical="6dp" | ||
| 376 | + android:text="@string/demo_all" | ||
| 377 | + android:textColor="@color/black3" | ||
| 378 | + android:textSize="14sp" /> | ||
| 379 | + </LinearLayout> | ||
| 380 | + | ||
| 381 | + <androidx.recyclerview.widget.RecyclerView | ||
| 382 | + android:id="@+id/rl_recycler7" | ||
| 383 | + android:layout_width="match_parent" | ||
| 384 | + android:layout_height="wrap_content" | ||
| 385 | + android:layout_below="@+id/ll_recycler7" | ||
| 386 | + android:layout_marginTop="16dp" | ||
| 387 | + android:orientation="horizontal" | ||
| 388 | + android:paddingHorizontal="16dp" | ||
| 389 | + android:clipToPadding="false" /> | ||
| 390 | + </RelativeLayout> | ||
| 391 | + | ||
| 392 | + <!-- Purchases Section --> | ||
| 393 | + <RelativeLayout | ||
| 394 | + android:layout_width="match_parent" | ||
| 395 | + android:layout_height="wrap_content" | ||
| 396 | + android:layout_marginTop="48dp" | ||
| 397 | + android:layout_marginBottom="48dp"> | ||
| 398 | + | ||
| 399 | + <LinearLayout | ||
| 400 | + android:id="@+id/ll_recycler8" | ||
| 401 | + android:layout_width="match_parent" | ||
| 402 | + android:layout_height="wrap_content" | ||
| 403 | + android:layout_gravity="center" | ||
| 404 | + android:paddingHorizontal="16dp" | ||
| 405 | + android:orientation="horizontal"> | ||
| 406 | + | ||
| 407 | + <TextView | ||
| 408 | + android:id="@+id/tv_recycler_category8" | ||
| 409 | + android:layout_width="0dp" | ||
| 410 | + android:layout_height="wrap_content" | ||
| 411 | + android:layout_weight="1" | ||
| 412 | + android:textColor="@color/black2" | ||
| 413 | + android:textStyle="bold" | ||
| 414 | + android:textSize="16sp" | ||
| 415 | + tools:text="Purchases (10)" /> | ||
| 416 | + | ||
| 417 | + <TextView | ||
| 418 | + android:id="@+id/tv_recycler_all8" | ||
| 419 | + android:layout_width="wrap_content" | ||
| 420 | + android:layout_height="wrap_content" | ||
| 421 | + android:background="@drawable/demo_shape_transparent_border_black" | ||
| 422 | + android:paddingHorizontal="16dp" | ||
| 423 | + android:paddingVertical="6dp" | ||
| 424 | + android:text="@string/demo_all" | ||
| 425 | + android:textColor="@color/black3" | ||
| 426 | + android:textSize="14sp" /> | ||
| 427 | + </LinearLayout> | ||
| 428 | + | ||
| 429 | + <androidx.recyclerview.widget.RecyclerView | ||
| 430 | + android:id="@+id/rl_recycler8" | ||
| 431 | + android:layout_width="match_parent" | ||
| 432 | + android:layout_height="wrap_content" | ||
| 433 | + android:layout_below="@+id/ll_recycler8" | ||
| 434 | + android:layout_marginTop="16dp" | ||
| 435 | + android:orientation="horizontal" | ||
| 436 | + android:paddingHorizontal="16dp" | ||
| 437 | + android:clipToPadding="false" /> | ||
| 438 | + </RelativeLayout> | ||
| 63 | </LinearLayout> | 439 | </LinearLayout> |
| 64 | </androidx.core.widget.NestedScrollView> | 440 | </androidx.core.widget.NestedScrollView> |
| 65 | </RelativeLayout> | 441 | </RelativeLayout> | ... | ... |
| 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="260dp" | ||
| 6 | + android:layout_height="250dp" | ||
| 7 | + android:background="@drawable/demo_shape_white_border_grey"> | ||
| 8 | + | ||
| 9 | + <!-- Main Offer Image --> | ||
| 10 | + <ImageView | ||
| 11 | + android:id="@+id/iv_offer_image" | ||
| 12 | + android:layout_width="match_parent" | ||
| 13 | + android:layout_height="140dp" | ||
| 14 | + android:scaleType="centerCrop" | ||
| 15 | + tools:src="@drawable/demo_home_banner" /> | ||
| 16 | + | ||
| 17 | + <!-- Heart Icon (Favorite) --> | ||
| 18 | + <ImageView | ||
| 19 | + android:id="@+id/iv_favorite" | ||
| 20 | + android:layout_width="32dp" | ||
| 21 | + android:layout_height="32dp" | ||
| 22 | + android:layout_margin="8dp" | ||
| 23 | + android:src="@drawable/demo_heart" /> | ||
| 24 | + | ||
| 25 | + <!-- Price Badge --> | ||
| 26 | + <TextView | ||
| 27 | + android:id="@+id/tv_price" | ||
| 28 | + android:layout_width="68dp" | ||
| 29 | + android:layout_height="68dp" | ||
| 30 | + android:layout_alignParentEnd="true" | ||
| 31 | + android:layout_margin="8dp" | ||
| 32 | + android:background="@drawable/demo_shape_pink" | ||
| 33 | + android:gravity="center" | ||
| 34 | + android:textColor="@android:color/white" | ||
| 35 | + android:textSize="16sp" | ||
| 36 | + android:textStyle="bold" | ||
| 37 | + tools:text="17,95€" /> | ||
| 38 | + | ||
| 39 | + <!-- Content Section --> | ||
| 40 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
| 41 | + android:layout_width="match_parent" | ||
| 42 | + android:layout_height="match_parent" | ||
| 43 | + android:layout_below="@id/iv_offer_image" | ||
| 44 | + android:orientation="vertical" | ||
| 45 | + android:padding="12dp"> | ||
| 46 | + | ||
| 47 | + <androidx.constraintlayout.widget.Guideline | ||
| 48 | + android:id="@+id/gl_vertical_70" | ||
| 49 | + android:layout_width="wrap_content" | ||
| 50 | + android:layout_height="wrap_content" | ||
| 51 | + android:orientation="vertical" | ||
| 52 | + app:layout_constraintGuide_percent="0.7" /> | ||
| 53 | + | ||
| 54 | + <!-- Title --> | ||
| 55 | + <TextView | ||
| 56 | + android:id="@+id/tv_title" | ||
| 57 | + android:layout_width="0dp" | ||
| 58 | + android:layout_height="wrap_content" | ||
| 59 | + android:maxLines="1" | ||
| 60 | + android:textColor="@color/black2" | ||
| 61 | + android:textSize="16sp" | ||
| 62 | + android:textStyle="bold" | ||
| 63 | + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_70" | ||
| 64 | + app:layout_constraintStart_toStartOf="parent" | ||
| 65 | + app:layout_constraintTop_toTopOf="parent" | ||
| 66 | + tools:text="Móvo 17,95" /> | ||
| 67 | + | ||
| 68 | + <!-- Description --> | ||
| 69 | + <TextView | ||
| 70 | + android:id="@+id/tv_description" | ||
| 71 | + android:layout_width="0dp" | ||
| 72 | + android:layout_height="wrap_content" | ||
| 73 | + android:layout_marginTop="2dp" | ||
| 74 | + android:maxLines="2" | ||
| 75 | + android:textColor="@color/black3" | ||
| 76 | + android:textSize="13sp" | ||
| 77 | + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_70" | ||
| 78 | + app:layout_constraintStart_toStartOf="parent" | ||
| 79 | + app:layout_constraintTop_toBottomOf="@+id/tv_title" | ||
| 80 | + tools:text="2 πίτσες & Coca-COLA 1,5lt" /> | ||
| 81 | + | ||
| 82 | + <!-- Validity Date --> | ||
| 83 | + <TextView | ||
| 84 | + android:id="@+id/tv_validity" | ||
| 85 | + android:layout_width="wrap_content" | ||
| 86 | + android:layout_height="wrap_content" | ||
| 87 | + android:layout_alignParentStart="true" | ||
| 88 | + android:layout_centerVertical="true" | ||
| 89 | + android:layout_marginTop="12dp" | ||
| 90 | + android:maxLines="1" | ||
| 91 | + android:textColor="#757575" | ||
| 92 | + android:textSize="12sp" | ||
| 93 | + app:layout_constraintStart_toStartOf="parent" | ||
| 94 | + app:layout_constraintTop_toBottomOf="@+id/tv_description" | ||
| 95 | + tools:text="έως 30-09" /> | ||
| 96 | + | ||
| 97 | + <!-- Brand Logo --> | ||
| 98 | + <ImageView | ||
| 99 | + android:id="@+id/iv_logo" | ||
| 100 | + android:layout_width="60dp" | ||
| 101 | + android:layout_height="60dp" | ||
| 102 | + android:layout_alignParentEnd="true" | ||
| 103 | + android:layout_centerVertical="true" | ||
| 104 | + android:scaleType="centerInside" | ||
| 105 | + app:layout_constraintBottom_toBottomOf="parent" | ||
| 106 | + app:layout_constraintEnd_toEndOf="parent" | ||
| 107 | + app:layout_constraintTop_toTopOf="parent" | ||
| 108 | + tools:src="@drawable/demo_avis" /> | ||
| 109 | + </androidx.constraintlayout.widget.ConstraintLayout> | ||
| 110 | +</RelativeLayout> |
| ... | @@ -13,6 +13,10 @@ | ... | @@ -13,6 +13,10 @@ |
| 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="cos_green5">#79BF14</color> | 15 | <color name="cos_green5">#79BF14</color> |
| 16 | + <color name="black2">#000F1E</color> | ||
| 17 | + <color name="black3">#00111B</color> | ||
| 18 | + <color name="grey">#CCCCCC</color> | ||
| 19 | + <color name="pink">#EE417D</color> | ||
| 16 | 20 | ||
| 17 | <!-- Used in styles --> | 21 | <!-- Used in styles --> |
| 18 | <color name="cos_light_blue">#00A5E3</color> | 22 | <color name="cos_light_blue">#00A5E3</color> | ... | ... |
| 1 | <resources> | 1 | <resources> |
| 2 | - <string name="lbl_cosmote_webview_permission_title">COSMOTE</string> | 2 | + <string name="lbl_cosmote_webview_permission_title">Demo App</string> |
| 3 | - <string name="lbl_cosmote_webview_permission_message">Το COSMOTE ζητάει πρόσβαση στην τοποθεσία σας.</string> | 3 | + <string name="lbl_cosmote_webview_permission_message">Το Demo App ζητάει πρόσβαση στην τοποθεσία σας.</string> |
| 4 | <string name="lbl_take_photo_accept">Οκ</string> | 4 | <string name="lbl_take_photo_accept">Οκ</string> |
| 5 | <string name="lbl_take_photo_decline">Άκυρο</string> | 5 | <string name="lbl_take_photo_decline">Άκυρο</string> |
| 6 | <string name="welcome_user">Γεια σου %1$s !</string> | 6 | <string name="welcome_user">Γεια σου %1$s !</string> |
| ... | @@ -10,4 +10,5 @@ | ... | @@ -10,4 +10,5 @@ |
| 10 | <string name="menu_home">Αρχική</string> | 10 | <string name="menu_home">Αρχική</string> |
| 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 | </resources> | 14 | </resources> | ... | ... |
-
Please register or login to post a comment