Remaining input bar animation

This commit is contained in:
Niels Andriesse 2021-06-18 09:51:44 +10:00
parent f4621a4fee
commit a5bf1a3c66
2 changed files with 7 additions and 1 deletions

View file

@ -159,11 +159,13 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
override fun toggleAttachmentOptions() { override fun toggleAttachmentOptions() {
val targetAlpha = if (isShowingAttachmentOptions) 0.0f else 1.0f val targetAlpha = if (isShowingAttachmentOptions) 0.0f else 1.0f
val allButtons = listOf( cameraButtonContainer, libraryButtonContainer, documentButtonContainer, gifButtonContainer) val allButtons = listOf( cameraButtonContainer, libraryButtonContainer, documentButtonContainer, gifButtonContainer)
val isReversed = isShowingAttachmentOptions // Run the animation in reverse
val count = allButtons.size
allButtons.indices.forEach { index -> allButtons.indices.forEach { index ->
val view = allButtons[index] val view = allButtons[index]
val animation = ValueAnimator.ofObject(FloatEvaluator(), view.alpha, targetAlpha) val animation = ValueAnimator.ofObject(FloatEvaluator(), view.alpha, targetAlpha)
animation.duration = 250L animation.duration = 250L
animation.startDelay = 50L * index.toLong() animation.startDelay = if (isReversed) 50L * (count - index.toLong()) else 50L * index.toLong()
animation.addUpdateListener { animator -> animation.addUpdateListener { animator ->
view.alpha = animator.animatedValue as Float view.alpha = animator.animatedValue as Float
} }
@ -321,6 +323,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
} }
animation.start() animation.start()
} }
inputBarRecordingView.hide()
} }
// endregion // endregion
} }

View file

@ -41,6 +41,9 @@ class InputBarRecordingView : RelativeLayout {
fun show() { fun show() {
startTimestamp = Date().time startTimestamp = Date().time
recordButtonOverlayImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ic_microphone, context.theme)) recordButtonOverlayImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ic_microphone, context.theme))
inputBarCancelButton.alpha = 0.0f
inputBarMiddleContentContainer.alpha = 1.0f
lockView.alpha = 1.0f
isVisible = true isVisible = true
alpha = 0.0f alpha = 0.0f
val animation = ValueAnimator.ofObject(FloatEvaluator(), 0.0f, 1.0f) val animation = ValueAnimator.ofObject(FloatEvaluator(), 0.0f, 1.0f)