Skip to content

Commit

Permalink
feat(dashspend): show discount in merchant list
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering committed Aug 14, 2024
1 parent f73c3f4 commit 42c06b4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ class MerchantViewHolder(val binding: MerchantRowBinding) : ExploreViewHolder(bi
binding.title.text = merchant?.name
binding.subtitle.text = getDistanceText(resources, merchant)
binding.subtitle.isVisible = merchant?.type != MerchantType.ONLINE && binding.subtitle.text.isNotEmpty()
if (merchant != null) {
if (merchant.savingsPercentageAsDouble != 0.00) {
binding.discountValue.isVisible = true
binding.discountValue.text = binding.root.context.getString(R.string.explore_discount, merchant.savingsPercentageAsDouble * 100)
} else {
binding.discountValue.isVisible = false
}
}

binding.logoImg.load(merchant?.logoLocation) {
crossfade(200)
Expand Down
19 changes: 15 additions & 4 deletions features/exploredash/src/main/res/layout/merchant_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginEnd="16dp"
android:layout_marginEnd="3dp"
app:layout_constraintStart_toEndOf="@id/logo_img"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/subtitle"
app:layout_constraintEnd_toStartOf="@id/method_img"
app:layout_constraintEnd_toStartOf="@id/discount_value"
tools:text="Bark Box" />

<TextView
Expand All @@ -54,13 +54,24 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginEnd="16dp"
android:layout_marginEnd="3dp"
app:layout_constraintStart_toEndOf="@id/logo_img"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/method_img"
app:layout_constraintEnd_toStartOf="@id/discount_value"
tools:text="10 miles" />

<TextView
android:id="@+id/discount_value"
style="@style/Overline.Medium.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/method_img"
tools:text="1.25%" />

<ImageView
android:id="@+id/method_img"
android:layout_width="wrap_content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<string name="explore_no_atms">No ATMs</string>
<string name="distance_miles">%s miles</string>
<string name="distance_kilometers">%s kilometers</string>
<string name="explore_discount" translatable="false">~%.0f%%</string>

<plurals name="explore_merchant_amount">
<item quantity="one">%d merchant</item>
Expand Down

0 comments on commit 42c06b4

Please sign in to comment.