Showing
6 changed files
with
81 additions
and
8 deletions
| ... | @@ -27,6 +27,7 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener | ... | @@ -27,6 +27,7 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener |
| 27 | // Constants | 27 | // Constants |
| 28 | // =========================================================== | 28 | // =========================================================== |
| 29 | public static final String EXTRA_CATEGORY = "category"; | 29 | public static final String EXTRA_CATEGORY = "category"; |
| 30 | + public static final String EXTRA_SUBCATEGORY = "subcategory"; | ||
| 30 | 31 | ||
| 31 | // =========================================================== | 32 | // =========================================================== |
| 32 | // Fields | 33 | // Fields |
| ... | @@ -37,6 +38,7 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener | ... | @@ -37,6 +38,7 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener |
| 37 | private CouponsetAdapter mCouponsetsAdapter; | 38 | private CouponsetAdapter mCouponsetsAdapter; |
| 38 | private TextView mTvHeaderTitle, mTvSearchTitle; | 39 | private TextView mTvHeaderTitle, mTvSearchTitle; |
| 39 | private String mCouponsetsCategory = ""; | 40 | private String mCouponsetsCategory = ""; |
| 41 | + private String mCouponsetsSubcategory = ""; | ||
| 40 | 42 | ||
| 41 | // =========================================================== | 43 | // =========================================================== |
| 42 | // Methods for/from SuperClass/Interfaces | 44 | // Methods for/from SuperClass/Interfaces |
| ... | @@ -51,6 +53,9 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener | ... | @@ -51,6 +53,9 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener |
| 51 | if (intent != null && intent.hasExtra(EXTRA_CATEGORY)) { | 53 | if (intent != null && intent.hasExtra(EXTRA_CATEGORY)) { |
| 52 | mCouponsetsCategory = intent.getStringExtra(EXTRA_CATEGORY); | 54 | mCouponsetsCategory = intent.getStringExtra(EXTRA_CATEGORY); |
| 53 | } | 55 | } |
| 56 | + if (intent != null && intent.hasExtra(EXTRA_SUBCATEGORY)) { | ||
| 57 | + mCouponsetsSubcategory = intent.getStringExtra(EXTRA_SUBCATEGORY); | ||
| 58 | + } | ||
| 54 | 59 | ||
| 55 | initViews(); | 60 | initViews(); |
| 56 | 61 | ||
| ... | @@ -81,7 +86,7 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener | ... | @@ -81,7 +86,7 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener |
| 81 | 86 | ||
| 82 | mRvCouponsets = findViewById(R.id.rv_couponsets); | 87 | mRvCouponsets = findViewById(R.id.rv_couponsets); |
| 83 | mTvHeaderTitle = findViewById(R.id.tv_header_title); | 88 | mTvHeaderTitle = findViewById(R.id.tv_header_title); |
| 84 | - mTvHeaderTitle.setText(mCouponsetsCategory); | 89 | + mTvHeaderTitle.setText(!mCouponsetsSubcategory.isEmpty() ? mCouponsetsSubcategory : mCouponsetsCategory); |
| 85 | mTvSearchTitle = findViewById(R.id.tv_search_title); | 90 | mTvSearchTitle = findViewById(R.id.tv_search_title); |
| 86 | 91 | ||
| 87 | WarpUtils.renderCustomFont(this, R.font.ping_lcg_bold, mTvHeaderTitle); | 92 | WarpUtils.renderCustomFont(this, R.font.ping_lcg_bold, mTvHeaderTitle); |
| ... | @@ -97,6 +102,17 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener | ... | @@ -97,6 +102,17 @@ public class CouponsetsActivity extends Activity implements View.OnClickListener |
| 97 | ArrayList<Couponset> couponsets = categorizedMap.get(mCouponsetsCategory); | 102 | ArrayList<Couponset> couponsets = categorizedMap.get(mCouponsetsCategory); |
| 98 | if (couponsets == null || couponsets.isEmpty()) return; | 103 | if (couponsets == null || couponsets.isEmpty()) return; |
| 99 | 104 | ||
| 105 | + if (!mCouponsetsSubcategory.isEmpty()) { | ||
| 106 | + ArrayList<Couponset> filtered = new ArrayList<>(); | ||
| 107 | + for (Couponset c : couponsets) { | ||
| 108 | + if (mCouponsetsSubcategory.equals(c.getOfferCategory())) { | ||
| 109 | + filtered.add(c); | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + couponsets = filtered; | ||
| 113 | + } | ||
| 114 | + if (couponsets.isEmpty()) return; | ||
| 115 | + | ||
| 100 | GridLayoutManager layoutManager = new GridLayoutManager(this, 2); | 116 | GridLayoutManager layoutManager = new GridLayoutManager(this, 2); |
| 101 | mRvCouponsets.setLayoutManager(layoutManager); | 117 | mRvCouponsets.setLayoutManager(layoutManager); |
| 102 | mRvCouponsets.setHasFixedSize(true); | 118 | mRvCouponsets.setHasFixedSize(true); | ... | ... |
| ... | @@ -376,15 +376,25 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup | ... | @@ -376,15 +376,25 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup |
| 376 | 376 | ||
| 377 | LinearLayout llFilterContainer = dialogView.findViewById(R.id.ll_filter_container); | 377 | LinearLayout llFilterContainer = dialogView.findViewById(R.id.ll_filter_container); |
| 378 | 378 | ||
| 379 | + LinearLayout llFilterHeader = dialogView.findViewById(R.id.header_layout); | ||
| 380 | + TextView headerTitle = llFilterHeader.findViewById(R.id.tv_header_title); | ||
| 381 | + WarpUtils.renderCustomFont(this, R.font.ping_lcg_bold, headerTitle); | ||
| 382 | + ImageView headerClose = llFilterHeader.findViewById(R.id.dlg_close_icon); | ||
| 383 | + headerClose.setOnClickListener(v -> { | ||
| 384 | + bottomSheetDialog.dismiss(); | ||
| 385 | + }); | ||
| 386 | + | ||
| 379 | // Static "Top Offers" row | 387 | // Static "Top Offers" row |
| 380 | View topOffersRow = LayoutInflater.from(this).inflate(R.layout.item_filter_category, llFilterContainer, false); | 388 | View topOffersRow = LayoutInflater.from(this).inflate(R.layout.item_filter_category, llFilterContainer, false); |
| 381 | TextView tvTopOffers = topOffersRow.findViewById(R.id.tv_category_name); | 389 | TextView tvTopOffers = topOffersRow.findViewById(R.id.tv_category_name); |
| 382 | tvTopOffers.setText(getString(R.string.lbl_top_offers)); | 390 | tvTopOffers.setText(getString(R.string.lbl_top_offers)); |
| 383 | WarpUtils.renderCustomFont(this, R.font.ping_lcg_regular, tvTopOffers); | 391 | WarpUtils.renderCustomFont(this, R.font.ping_lcg_regular, tvTopOffers); |
| 384 | - topOffersRow.setTag(R.string.lbl_top_offers); | 392 | + topOffersRow.setTag(getString(R.string.lbl_top_offers)); |
| 385 | topOffersRow.setOnClickListener(v -> { | 393 | topOffersRow.setOnClickListener(v -> { |
| 386 | - // TODO: filter action | ||
| 387 | bottomSheetDialog.dismiss(); | 394 | bottomSheetDialog.dismiss(); |
| 395 | + Intent filterIntent = new Intent(HomeActivity.this, CouponsetsActivity.class); | ||
| 396 | + filterIntent.putExtra(CouponsetsActivity.EXTRA_CATEGORY, (String) v.getTag()); | ||
| 397 | + startActivity(filterIntent); | ||
| 388 | }); | 398 | }); |
| 389 | llFilterContainer.addView(topOffersRow); | 399 | llFilterContainer.addView(topOffersRow); |
| 390 | 400 | ||
| ... | @@ -417,8 +427,10 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup | ... | @@ -417,8 +427,10 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup |
| 417 | ivArrow.setVisibility(View.GONE); | 427 | ivArrow.setVisibility(View.GONE); |
| 418 | categoryRow.setTag(parent.getAdminName()); | 428 | categoryRow.setTag(parent.getAdminName()); |
| 419 | categoryRow.setOnClickListener(v -> { | 429 | categoryRow.setOnClickListener(v -> { |
| 420 | - // TODO: filter action | ||
| 421 | bottomSheetDialog.dismiss(); | 430 | bottomSheetDialog.dismiss(); |
| 431 | + Intent filterIntent = new Intent(HomeActivity.this, CouponsetsActivity.class); | ||
| 432 | + filterIntent.putExtra(CouponsetsActivity.EXTRA_CATEGORY, (String) v.getTag()); | ||
| 433 | + startActivity(filterIntent); | ||
| 422 | }); | 434 | }); |
| 423 | llFilterContainer.addView(categoryRow); | 435 | llFilterContainer.addView(categoryRow); |
| 424 | } else { | 436 | } else { |
| ... | @@ -440,8 +452,11 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup | ... | @@ -440,8 +452,11 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup |
| 440 | WarpUtils.renderCustomFont(this, R.font.ping_lcg_regular, tvSubcategoryName); | 452 | WarpUtils.renderCustomFont(this, R.font.ping_lcg_regular, tvSubcategoryName); |
| 441 | childRow.setTag(child.getAdminName()); | 453 | childRow.setTag(child.getAdminName()); |
| 442 | childRow.setOnClickListener(v -> { | 454 | childRow.setOnClickListener(v -> { |
| 443 | - // TODO: filter action | ||
| 444 | bottomSheetDialog.dismiss(); | 455 | bottomSheetDialog.dismiss(); |
| 456 | + Intent filterIntent = new Intent(HomeActivity.this, CouponsetsActivity.class); | ||
| 457 | + filterIntent.putExtra(CouponsetsActivity.EXTRA_CATEGORY, parent.getAdminName()); | ||
| 458 | + filterIntent.putExtra(CouponsetsActivity.EXTRA_SUBCATEGORY, (String) v.getTag()); | ||
| 459 | + startActivity(filterIntent); | ||
| 445 | }); | 460 | }); |
| 446 | childContainer.addView(childRow); | 461 | childContainer.addView(childRow); |
| 447 | } | 462 | } | ... | ... |
| 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="1000dp" /> | ||
| 5 | + | ||
| 6 | + <solid | ||
| 7 | + android:width="2dp" | ||
| 8 | + android:color="@color/white" /> | ||
| 9 | +</shape> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -5,6 +5,41 @@ | ... | @@ -5,6 +5,41 @@ |
| 5 | android:background="@color/custom_black7" | 5 | android:background="@color/custom_black7" |
| 6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 7 | 7 | ||
| 8 | + <LinearLayout | ||
| 9 | + android:id="@+id/header_layout" | ||
| 10 | + android:layout_width="match_parent" | ||
| 11 | + android:layout_height="wrap_content" | ||
| 12 | + android:background="@color/custom_black7" | ||
| 13 | + android:gravity="center" | ||
| 14 | + android:orientation="horizontal" | ||
| 15 | + android:paddingVertical="16dp" | ||
| 16 | + android:paddingHorizontal="16dp"> | ||
| 17 | + | ||
| 18 | + <LinearLayout | ||
| 19 | + android:layout_width="0dp" | ||
| 20 | + android:layout_height="wrap_content" | ||
| 21 | + android:layout_weight="1" | ||
| 22 | + android:orientation="vertical"> | ||
| 23 | + | ||
| 24 | + <TextView | ||
| 25 | + android:id="@+id/tv_header_title" | ||
| 26 | + android:layout_width="wrap_content" | ||
| 27 | + android:layout_height="wrap_content" | ||
| 28 | + android:includeFontPadding="false" | ||
| 29 | + android:text="@string/demo_search_title" | ||
| 30 | + android:textColor="@color/white" | ||
| 31 | + android:textSize="28sp" /> | ||
| 32 | + </LinearLayout> | ||
| 33 | + | ||
| 34 | + <ImageView | ||
| 35 | + android:id="@+id/dlg_close_icon" | ||
| 36 | + android:layout_width="46dp" | ||
| 37 | + android:layout_height="46dp" | ||
| 38 | + android:background="@drawable/shape_rectangle_rounded_white3" | ||
| 39 | + android:padding="16dp" | ||
| 40 | + android:src="@drawable/demo_close" /> | ||
| 41 | + </LinearLayout> | ||
| 42 | + | ||
| 8 | <androidx.core.widget.NestedScrollView | 43 | <androidx.core.widget.NestedScrollView |
| 9 | android:layout_width="match_parent" | 44 | android:layout_width="match_parent" |
| 10 | android:layout_height="match_parent"> | 45 | android:layout_height="match_parent"> | ... | ... |
| ... | @@ -42,5 +42,5 @@ | ... | @@ -42,5 +42,5 @@ |
| 42 | <string name="demo_partners_title">Partner businesses</string> | 42 | <string name="demo_partners_title">Partner businesses</string> |
| 43 | <string name="demo_search_title">Αναζήτηση</string> | 43 | <string name="demo_search_title">Αναζήτηση</string> |
| 44 | <string name="lbl_directions">Οδηγίες</string> | 44 | <string name="lbl_directions">Οδηγίες</string> |
| 45 | - <string name="lbl_top_offers">Top Offers</string> | 45 | + <string name="lbl_top_offers">Top offers</string> |
| 46 | </resources> | 46 | </resources> | ... | ... |
| ... | @@ -50,8 +50,6 @@ | ... | @@ -50,8 +50,6 @@ |
| 50 | 50 | ||
| 51 | <style name="FullScreenBottomSheetDialog" parent="Theme.MaterialComponents.Light.BottomSheetDialog"> | 51 | <style name="FullScreenBottomSheetDialog" parent="Theme.MaterialComponents.Light.BottomSheetDialog"> |
| 52 | <item name="android:windowIsFloating">false</item> | 52 | <item name="android:windowIsFloating">false</item> |
| 53 | - <item name="android:windowFullscreen">true</item> | ||
| 54 | - <item name="android:windowContentOverlay">@null</item> | ||
| 55 | <item name="bottomSheetStyle">@style/FullScreenBottomSheetStyle</item> | 53 | <item name="bottomSheetStyle">@style/FullScreenBottomSheetStyle</item> |
| 56 | </style> | 54 | </style> |
| 57 | 55 | ... | ... |
-
Please register or login to post a comment