Skip to content

Commit

Permalink
Reuse update arrow method inside the arrow initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Dec 27, 2023
1 parent 64c84bc commit a326ad8
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -273,40 +273,8 @@ public class Balloon private constructor(

adjustArrowOrientationByRules(anchor)

when (builder.arrowOrientation.getRTLSupportOrientation(builder.isRtlLayout)) {
ArrowOrientation.BOTTOM -> {
rotation = 180f
x = getArrowConstraintPositionX(anchor)
y = binding.balloonCard.y + binding.balloonCard.height - SIZE_ARROW_BOUNDARY
ViewCompat.setElevation(this, builder.arrowElevation)
runOnAfterSDK23 {
foreground = getArrowForeground(x, binding.balloonCard.height.toFloat())
}
}
updateArrow(anchor)

ArrowOrientation.TOP -> {
rotation = 0f
x = getArrowConstraintPositionX(anchor)
y = binding.balloonCard.y - builder.arrowSize + SIZE_ARROW_BOUNDARY
runOnAfterSDK23 { foreground = getArrowForeground(x, 0f) }
}

ArrowOrientation.START -> {
rotation = -90f
x = binding.balloonCard.x - builder.arrowSize + SIZE_ARROW_BOUNDARY
y = getArrowConstraintPositionY(anchor)
runOnAfterSDK23 { foreground = getArrowForeground(0f, y) }
}

ArrowOrientation.END -> {
rotation = 90f
x = binding.balloonCard.x + binding.balloonCard.width - SIZE_ARROW_BOUNDARY
y = getArrowConstraintPositionY(anchor)
runOnAfterSDK23 {
foreground = getArrowForeground(binding.balloonCard.width.toFloat(), y)
}
}
}
visible(builder.isVisibleArrow)
}
}
Expand Down

0 comments on commit a326ad8

Please sign in to comment.