Skip to content

Commit

Permalink
Fix NPE when trying to dismiss search bar when it wasn't created
Browse files Browse the repository at this point in the history
  • Loading branch information
Reco1I committed Nov 21, 2024
1 parent 9755e05 commit a5d0ace
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions src/com/edlplan/ui/fragment/SearchBarFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -253,31 +253,35 @@ class SearchBarFragment : BaseFragment(), IUpdateHandler, IFilterMenu {

private fun playEndAnim(action: () -> Unit) {

val options = findViewById<View>(R.id.options)!!
options.animate().cancel()
options.animate()
.alpha(0f)
.translationY(-400f)
.setInterpolator(EasingHelper.asInterpolator(Easing.InOutQuad))
.setDuration(300)
.start()

val body = findViewById<View>(R.id.frg_body)!!
body.animate().cancel()
body.animate()
.alpha(0f)
.translationY(-400f)
.setInterpolator(EasingHelper.asInterpolator(Easing.InOutQuad))
.setDuration(300)
.setListener(
object : BaseAnimationListener() {
override fun onAnimationEnd(animation: Animator) {
action()
if (isCreated) {
val options = findViewById<View>(R.id.options)!!
options.animate().cancel()
options.animate()
.alpha(0f)
.translationY(-400f)
.setInterpolator(EasingHelper.asInterpolator(Easing.InOutQuad))
.setDuration(300)
.start()

val body = findViewById<View>(R.id.frg_body)!!
body.animate().cancel()
body.animate()
.alpha(0f)
.translationY(-400f)
.setInterpolator(EasingHelper.asInterpolator(Easing.InOutQuad))
.setDuration(300)
.setListener(
object : BaseAnimationListener() {
override fun onAnimationEnd(animation: Animator) {
action()
}
}
}
)
.start()
playBackgroundHideOutAnim(150)
)
.start()
playBackgroundHideOutAnim(150)
} else {
action()
}
}

private fun updateOrderButton() {
Expand Down

0 comments on commit a5d0ace

Please sign in to comment.