From 5ac7fec54d53fec2befc6aa3b464824b0da77020 Mon Sep 17 00:00:00 2001 From: HashEngineering Date: Wed, 14 Aug 2024 07:18:06 -0700 Subject: [PATCH] feat(dashspend): show discount in merchant details page --- .../dark_gray_button_background.xml | 34 +++++++++++++++++++ .../main/res/drawable/triangle_black_70.xml | 10 ++++++ .../exploredash/ui/explore/ItemDetails.kt | 7 ++++ .../src/main/res/layout/item_details_view.xml | 23 +++++++++++++ .../main/res/values/strings-explore-dash.xml | 1 + 5 files changed, 75 insertions(+) create mode 100644 common/src/main/res/drawable-v21/dark_gray_button_background.xml create mode 100644 common/src/main/res/drawable/triangle_black_70.xml diff --git a/common/src/main/res/drawable-v21/dark_gray_button_background.xml b/common/src/main/res/drawable-v21/dark_gray_button_background.xml new file mode 100644 index 0000000000..61c9f6aec4 --- /dev/null +++ b/common/src/main/res/drawable-v21/dark_gray_button_background.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/triangle_black_70.xml b/common/src/main/res/drawable/triangle_black_70.xml new file mode 100644 index 0000000000..b3deb6bd24 --- /dev/null +++ b/common/src/main/res/drawable/triangle_black_70.xml @@ -0,0 +1,10 @@ + + + diff --git a/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/explore/ItemDetails.kt b/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/explore/ItemDetails.kt index 8dbac80998..68addde6ae 100644 --- a/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/explore/ItemDetails.kt +++ b/features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/explore/ItemDetails.kt @@ -237,6 +237,13 @@ class ItemDetails(context: Context, attrs: AttributeSet) : LinearLayout(context, } bindCommonDetails(merchant, isOnline) + + if (merchant.savingsPercentageAsDouble != 0.0) { + binding.discountValue.isVisible = true + binding.discountValue.text = root.context.getString(R.string.explore_pay_with_dash_save, merchant.savingsPercentageAsDouble * 100) + } else { + binding.discountValue.isVisible = false + } } } diff --git a/features/exploredash/src/main/res/layout/item_details_view.xml b/features/exploredash/src/main/res/layout/item_details_view.xml index 476dfa6ec4..2487bc9f9b 100644 --- a/features/exploredash/src/main/res/layout/item_details_view.xml +++ b/features/exploredash/src/main/res/layout/item_details_view.xml @@ -249,6 +249,7 @@ app:layout_constraintEnd_toEndOf="parent" /> + + + + \ No newline at end of file diff --git a/features/exploredash/src/main/res/values/strings-explore-dash.xml b/features/exploredash/src/main/res/values/strings-explore-dash.xml index 9bb99f79f6..58855dd0a9 100644 --- a/features/exploredash/src/main/res/values/strings-explore-dash.xml +++ b/features/exploredash/src/main/res/values/strings-explore-dash.xml @@ -63,6 +63,7 @@ Back to nearest location Select location Pay with Dash + Save %.2f%% Buy a Gift Card Buy Dash Sell Dash