Skip to content

Commit

Permalink
[UI/#374] 로티 이미지 변경 시 깜빡이지 않도록 보완
Browse files Browse the repository at this point in the history
  • Loading branch information
b1urrrr committed Feb 8, 2024
1 parent d9eef2b commit 6cff21a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.el.yello.presentation.event

import android.animation.Animator
import android.os.Bundle
import android.view.View
import androidx.activity.viewModels
import com.el.yello.R
import com.el.yello.databinding.ActivityEventBinding
Expand Down Expand Up @@ -54,13 +55,13 @@ class EventActivity : BindingActivity<ActivityEventBinding>(R.layout.activity_ev

private fun initEventLottieClickListener() {
// TODO: 필요하면 터치 영역 조정
with(binding.lottieEvent) {
setOnSingleClickListener {
setOnClickListener(null)
setAnimation(R.raw.lottie_event_open)
loop(false)
playAnimation()
addAnimatorListener(object : Animator.AnimatorListener {
with(binding) {
lottieEventDefault.setOnSingleClickListener {
lottieEventDefault.setOnClickListener(null)
lottieEventDefault.visibility = View.INVISIBLE
lottieEventOpen.visibility = View.VISIBLE
lottieEventOpen.playAnimation()
lottieEventOpen.addAnimatorListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator, isReverse: Boolean) {
super.onAnimationStart(animation, isReverse)
}
Expand Down
17 changes: 15 additions & 2 deletions app/src/main/res/layout/activity_event.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
app:layout_constraintTop_toTopOf="parent">

<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottie_event"
android:id="@+id/lottie_event_default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-146dp"
Expand All @@ -36,6 +36,19 @@
app:lottie_loop="true"
app:lottie_rawRes="@raw/lottie_event_default" />

<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottie_event_open"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@id/lottie_event_default"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/lottie_event_default"
app:lottie_autoPlay="false"
app:lottie_loop="false"
app:lottie_rawRes="@raw/lottie_event_open" />

<TextView
android:id="@+id/tv_event_tag"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -101,7 +114,7 @@
android:paddingVertical="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/lottie_event">
app:layout_constraintTop_toBottomOf="@id/lottie_event_default">

<TextView
android:id="@+id/tv_event_reward_title"
Expand Down

0 comments on commit 6cff21a

Please sign in to comment.