mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
Animate the mention candidates view
This commit is contained in:
parent
efc752e3a1
commit
be158eccc1
@ -44,6 +44,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
private var actionMode: ActionMode? = null
|
private var actionMode: ActionMode? = null
|
||||||
private var isLockViewExpanded = false
|
private var isLockViewExpanded = false
|
||||||
private var isShowingAttachmentOptions = false
|
private var isShowingAttachmentOptions = false
|
||||||
|
private var mentionCandidatesView: MentionCandidatesView? = null
|
||||||
|
|
||||||
// TODO: Selected message background color
|
// TODO: Selected message background color
|
||||||
// TODO: Overflow menu background + text color
|
// TODO: Overflow menu background + text color
|
||||||
@ -173,6 +174,8 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
// TODO: Work this out further
|
// TODO: Work this out further
|
||||||
if (newContent.contains("@")) {
|
if (newContent.contains("@")) {
|
||||||
showMentionCandidates()
|
showMentionCandidates()
|
||||||
|
} else {
|
||||||
|
hideMentionCandidates()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +185,26 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
mentionCandidatesView.glide = glide
|
mentionCandidatesView.glide = glide
|
||||||
inputBarAdditionalContentContainer.addView(mentionCandidatesView)
|
inputBarAdditionalContentContainer.addView(mentionCandidatesView)
|
||||||
val mentionCandidates = MentionsManager.getMentionCandidates("", threadID, thread.isOpenGroupRecipient)
|
val mentionCandidates = MentionsManager.getMentionCandidates("", threadID, thread.isOpenGroupRecipient)
|
||||||
|
this.mentionCandidatesView = mentionCandidatesView
|
||||||
mentionCandidatesView.show(mentionCandidates, threadID)
|
mentionCandidatesView.show(mentionCandidates, threadID)
|
||||||
|
mentionCandidatesView.alpha = 0.0f
|
||||||
|
val animation = ValueAnimator.ofObject(FloatEvaluator(), mentionCandidatesView.alpha, 1.0f)
|
||||||
|
animation.duration = 250L
|
||||||
|
animation.addUpdateListener { animator ->
|
||||||
|
mentionCandidatesView.alpha = animator.animatedValue as Float
|
||||||
|
}
|
||||||
|
animation.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun hideMentionCandidates() {
|
||||||
|
val mentionCandidatesView = mentionCandidatesView ?: return
|
||||||
|
val animation = ValueAnimator.ofObject(FloatEvaluator(), mentionCandidatesView.alpha, 0.0f)
|
||||||
|
animation.duration = 250L
|
||||||
|
animation.addUpdateListener { animator ->
|
||||||
|
mentionCandidatesView.alpha = animator.animatedValue as Float
|
||||||
|
if (animator.animatedFraction == 1.0f) { inputBarAdditionalContentContainer.removeAllViews() }
|
||||||
|
}
|
||||||
|
animation.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toggleAttachmentOptions() {
|
override fun toggleAttachmentOptions() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user