Skip to content

Commit

Permalink
feat(dashspend): show discount in merchant details page
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering committed Aug 14, 2024
1 parent 42c06b4 commit 5ac7fec
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
34 changes: 34 additions & 0 deletions common/src/main/res/drawable-v21/dark_gray_button_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_dark">

<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/ripple_dark" />
<corners android:radius="6dp" />
</shape>
</item>

<item>
<selector>
<item android:state_enabled="false">
<shape android:shape="rectangle">
<corners android:radius="6dp" />
<solid android:color="@color/dash_black_0.7" />
</shape>
</item>
<item>
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/dash_black_0.7" />
<corners android:radius="6dp" />
</shape>
</item>
</layer-list>
</item>

</selector>
</item>

</ripple>
10 changes: 10 additions & 0 deletions common/src/main/res/drawable/triangle_black_70.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="6dp"
android:height="7dp"
android:viewportWidth="6"
android:viewportHeight="7">
<path
android:pathData="M6,0V7H0L6,0Z"
android:fillColor="#191C1F"
android:fillAlpha="0.7"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
23 changes: 23 additions & 0 deletions features/exploredash/src/main/res/layout/item_details_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
app:layout_constraintEnd_toEndOf="parent" />



<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:id="@+id/pay_btn"
Expand Down Expand Up @@ -280,5 +281,27 @@
android:layout_height="wrap_content" />
</androidx.appcompat.widget.LinearLayoutCompat>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/triangle_black_70"
app:layout_constraintEnd_toStartOf="@+id/discount_value"
app:layout_constraintBottom_toTopOf="@id/pay_btn"
/>
<TextView
android:id="@+id/discount_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Save 3.75%"
android:textColor="@color/white"
android:background="@drawable/dark_gray_button_background"
android:paddingHorizontal="5dp"
android:paddingVertical="1dp"
app:layout_constraintTop_toTopOf="@+id/pay_btn"
app:layout_constraintBottom_toTopOf="@+id/pay_btn"
app:layout_constraintEnd_toEndOf="@id/pay_btn"
android:layout_marginEnd="30dp"
/>

</androidx.constraintlayout.widget.ConstraintLayout>
</merge>
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string name="explore_back_to_nearest">Back to nearest location</string>
<string name="explore_select_location">Select location</string>
<string name="explore_pay_with_dash">Pay with Dash</string>
<string name="explore_pay_with_dash_save">Save %.2f%%</string>
<string name="explore_buy_gift_card">Buy a Gift Card</string>
<string name="explore_buy_dash">Buy Dash</string>
<string name="explore_sell_dash">Sell Dash</string>
Expand Down

0 comments on commit 5ac7fec

Please sign in to comment.