Flick dismiss all the things!
This release introduces a much simpler way for providing height of your flick-dismissible content:
val contentSizeProvider = ContentSizeProvider2 { imageView.zoomedImageHeight() }
The function names in the older interface were confusing to understand. To be honest, I don't even remember why I wrote them that way:
val contentSizeProvider = object : ContentSizeProvider {
override fun heightForDismissAnimation(): Int =
imageView.zoomedImageHeight()
override fun heightForCalculatingDismissThreshold(): Int =
// Zoomed in height minus the portion of image that has gone
// outside display bounds, because they are no longer visible.
imageView.visibleZoomedImageHeight()
}
Flick v1.7.0
gets rid of an extra function by automatically calculating if the content height exceeds the flickable View's bounds. The changes are fully backward compatible. In case you notice any differences, you can go back to using the old ContentSizeProvider
without downgrading Flick. Don't forget to file a bug report!
This release also brings in support for optionally providing flick callbacks using lambdas:
val callbacks = FlickCallbacks(
onMove = { moveRatio -> updateBackgroundDimming(moveRatio) },
onFlickDismiss = { flickAnimDuration -> finishActivityAfterMillis(flickAnimDuration) }
)
You can leverage lambda references to make the code super compact:
val callbacks = FlickCallbacks(
onMove = this::updateBackgroundDimming,
onFlickDismiss = this::finishActivityAfterMillis
)
The parameters have default values so you can also skip callbacks you're not interested in:
val callbacks = FlickCallbacks(onFlickDismiss = { ... })
Migrated to AndroidX, thanks to @ZacSweers (#10)
Small release that makes rotation of flick dismissible View optional (https://github.com/saket/Flick/issues/9), useful in cases like shared element Activity transitions that silently ignore rotations.
val gestureListener = FlickGestureListener(
context, contentSizeProvider, callbacks, rotationEnabled = false
)
This release brings in some breaking changes:
flick_
)First release \m/