Skip to content

Commit

Permalink
ADS: Dismiss dialog when action button is tapped in BottomSheet compo…
Browse files Browse the repository at this point in the history
…nents (#3944)

Task/Issue URL: https://app.asana.com/0/488551667048375/1206057713910059/f

### Description
Hide bottom sheet dialog when an action button is tapped. This will affect to ADS components:

- ActionBottomSheetDialog
- PromoBottomSheetDialog

### Steps to test this PR

- Install from branch
- Go to Settings > ADS preview
- Go to DIALOGS Tab
- [ ] Check all action buttons in bottomSheet components hide the dialog

### No UI changes
  • Loading branch information
nalcalag authored Nov 30, 2023
1 parent bafa3c0 commit a4de895
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ class ActionBottomSheetDialog(builder: Builder) : BottomSheetDialog(builder.cont

setOnDismissListener { builder.listener.onBottomSheetDismissed() }
setOnShowListener { builder.listener.onBottomSheetShown() }
binding.actionBottomSheetDialogPrimaryItem.setOnClickListener { builder.listener.onPrimaryItemClicked() }
binding.actionBottomSheetDialogSecondaryItem.setOnClickListener { builder.listener.onSecondaryItemClicked() }
binding.actionBottomSheetDialogPrimaryItem.setOnClickListener {
builder.listener.onPrimaryItemClicked()
hide()
}
binding.actionBottomSheetDialogSecondaryItem.setOnClickListener {
builder.listener.onSecondaryItemClicked()
hide()
}

builder.titleText?.let {
binding.actionBottomSheetDialogTitle.text = it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ class PromoBottomSheetDialog(builder: Builder) : BottomSheetDialog(builder.conte

setOnDismissListener { builder.listener.onBottomSheetDismissed() }
setOnShowListener { builder.listener.onBottomSheetShown() }
binding.bottomSheetPromoPrimaryButton.setOnClickListener { builder.listener.onPrimaryButtonClicked() }
binding.bottomSheetPromoSecondaryButton.setOnClickListener { builder.listener.onSecondaryButtonClicked() }
binding.bottomSheetPromoPrimaryButton.setOnClickListener {
builder.listener.onPrimaryButtonClicked()
hide()
}
binding.bottomSheetPromoSecondaryButton.setOnClickListener {
builder.listener.onSecondaryButtonClicked()
hide()
}

builder.icon?.let {
binding.bottomSheetPromoIcon.setImageResource(it)
Expand Down

0 comments on commit a4de895

Please sign in to comment.