Skip to content

Commit

Permalink
Closes mozilla-mobile#11411: Cancel downloads prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
mike a committed Dec 20, 2021
1 parent cdbc169 commit 16ccc87
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,20 @@ class DownloadCancelDialogFragment : AppCompatDialogFragment() {
acceptButton.backgroundTintList = backgroundTintList

// It appears there is not guaranteed way to get background color of a button,
// there are always nullable types, hence this code executes only if user
// provided positiveButtonBackgroundColor
}

positiveButtonRadius?.let {
val shape = GradientDrawable()
shape.shape = GradientDrawable.RECTANGLE
shape.setColor(
ContextCompat.getColor(
requireContext(),
positiveButtonBackgroundColor!!
// there are always nullable types, hence the code changing the positiveButtonRadius
// executes only if positiveButtonBackgroundColor is provided
positiveButtonRadius?.let {
val shape = GradientDrawable()
shape.shape = GradientDrawable.RECTANGLE
shape.setColor(
ContextCompat.getColor(
requireContext(),
positiveButtonBackgroundColor
)
)
)
shape.cornerRadius = positiveButtonRadius
acceptButton.background = shape
shape.cornerRadius = positiveButtonRadius
acceptButton.background = shape
}
}

positiveButtonTextColor?.let {
Expand Down

0 comments on commit 16ccc87

Please sign in to comment.