Fixed inconsistent animations in hide

This commit is contained in:
Viktor De Pasquale 2019-11-14 15:12:53 +01:00
parent e1bda4ee8b
commit eec5b37da1
2 changed files with 8 additions and 2 deletions

View File

@ -24,8 +24,8 @@ abstract class CompatFragment<ViewModel : CompatViewModel, Binding : ViewDataBin
binding.addOnRebindCallback(object : OnRebindCallback<Binding>() { binding.addOnRebindCallback(object : OnRebindCallback<Binding>() {
override fun onPreBind(binding: Binding): Boolean { override fun onPreBind(binding: Binding): Boolean {
(binding.root as? ViewGroup)?.startAnimations() this@CompatFragment.onPreBind(binding)
return super.onPreBind(binding) return true
} }
}) })
@ -42,6 +42,10 @@ abstract class CompatFragment<ViewModel : CompatViewModel, Binding : ViewDataBin
delegate.onEventExecute(event, this) delegate.onEventExecute(event, this)
} }
protected open fun onPreBind(binding: Binding) {
(binding.root as? ViewGroup)?.startAnimations()
}
protected fun ViewEvent.dispatchOnSelf() = delegate.onEventExecute(this, this@CompatFragment) protected fun ViewEvent.dispatchOnSelf() = delegate.onEventExecute(this, this@CompatFragment)
} }

View File

@ -65,6 +65,8 @@ class HideFragment : CompatFragment<HideViewModel, FragmentHideMd2Binding>() {
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
} }
override fun onPreBind(binding: FragmentHideMd2Binding) = Unit
} }
object MotionRevealHelper { object MotionRevealHelper {