Skip to content

Commit

Permalink
Merge pull request #277 from wealthfront/circular-fallback
Browse files Browse the repository at this point in the history
Provide fallback for CircularRevealTransition
  • Loading branch information
cmathew authored Jun 22, 2023
2 parents 8a16398 + 7f95179 commit 98b7ea1
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ private class CircularRevealTransition(@IdRes private val clickedViewId: Int) :
private fun getCenterClickedView(clickedViewContainer: ViewGroup): IntArray {
val clickedView = clickedViewContainer.findViewById<View>(clickedViewId)
val clickedViewRect = Rect()
clickedView.getDrawingRect(clickedViewRect)
clickedViewContainer.offsetDescendantRectToMyCoords(clickedView, clickedViewRect)
return intArrayOf(
clickedViewRect.exactCenterX().toInt(),
clickedViewRect.exactCenterY().toInt()
)
return if (clickedView != null) {
clickedView.getDrawingRect(clickedViewRect)
clickedViewContainer.offsetDescendantRectToMyCoords(clickedView, clickedViewRect)
intArrayOf(
clickedViewRect.exactCenterX().toInt(),
clickedViewRect.exactCenterY().toInt()
)
} else {
intArrayOf(clickedViewContainer.width / 2, clickedViewContainer.height / 2)
}
}
}

0 comments on commit 98b7ea1

Please sign in to comment.