-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT/#374] Event / 점심시간 이벤트 구현 #378
Merged
Merged
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
0643e78
[UI/#374] 점심시간 이벤트 xml 구현
6c0fd24
[MERGE] : develop -> #374
c4c520f
[UI/#374] strings.xml 충돌 해결 및 보상 동적으로 동작하도록 xml 수정
73fd3d8
[UI/#374] Reward Dialog 파일 생성 및 xml 구현
5bbf9c6
[FEAT/#374] 이벤트 조회 서버통신 기본 설정
931ba9d
[FEAT/#374] 이벤트 조회 기본 동작 구현
37e8e56
[FEAT/#374] RewardAdapter 구현
cba4318
[FEAT/#374] 이벤트 상태 조회 서버통신 기본 설정
ca55a37
[FEAT/#374] 이벤트 상태 조회 동작 구현
cf8189c
[FEAT/#374] 이벤트 조회 로직 Main 뷰로 이동
df1dac7
[CHORE/#374] idempotencyKey intent에 extra로 전달
e07f736
[CHORE/#374] 이벤트 참여 서버통신 기본 설정
eb0e6ea
[FEAT/#374] 이벤트 참여 서버통신 연결
ee56bd6
[FIX/#374] 이벤트 보상 다이얼로그 로직 보완
4050ca2
[FIX/#374] adapter 설정 후 observe 순서 배치
0bdb1e1
[MERGE] : develop -> #374
0c71547
[CHORE/#374] 완료된 TODO 제거
ebc737e
[CHORE/#374] 투표 딜레이 시간 조정 및 flow job cancel 시점 변경
f6efcf5
Merge branch 'develop' of https://github.com/team-yello/YELLO-Android…
d9eef2b
[FIX/#374] 이벤트 상태 조회 onFailure 분기 제거
6cff21a
[UI/#374] 로티 이미지 변경 시 깜빡이지 않도록 보완
49247a1
[CHORE/#374] 함수 호출 순서 정렬
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
app/src/main/java/com/el/yello/presentation/event/EventActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package com.el.yello.presentation.event | ||
|
||
import android.animation.Animator | ||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import com.el.yello.R | ||
import com.el.yello.databinding.ActivityEventBinding | ||
import com.el.yello.presentation.event.reward.RewardDialog | ||
import com.el.yello.presentation.main.MainActivity.Companion.EXTRA_EVENT | ||
import com.el.yello.presentation.main.MainActivity.Companion.EXTRA_IDEMPOTENCY_KEY | ||
import com.el.yello.presentation.main.MainActivity.Companion.EXTRA_REWARD_LIST | ||
import com.el.yello.presentation.main.ParcelableEvent | ||
import com.el.yello.presentation.main.ParcelableReward | ||
import com.example.ui.base.BindingActivity | ||
import com.example.ui.intent.getCompatibleParcelableExtra | ||
import com.example.ui.view.setOnSingleClickListener | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class EventActivity : BindingActivity<ActivityEventBinding>(R.layout.activity_event) { | ||
private val viewModel by viewModels<EventViewModel>() | ||
|
||
private var rewardAdapter: RewardAdapter? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
initRewardAdapter() | ||
getEventExtra() | ||
} | ||
|
||
private fun getEventExtra() { | ||
val event = intent.getCompatibleParcelableExtra<ParcelableEvent>(EXTRA_EVENT) ?: return | ||
with(event) { | ||
binding.tvEventTitle.text = title | ||
binding.tvEventSubtitle.text = subTitle | ||
|
||
initEventLottieClickListener() | ||
} | ||
|
||
rewardAdapter?.submitList( | ||
intent.getParcelableArrayListExtra<ParcelableReward>( | ||
EXTRA_REWARD_LIST, | ||
)?.toList(), | ||
) | ||
|
||
viewModel.setIdempotencyKey(intent.getStringExtra(EXTRA_IDEMPOTENCY_KEY) ?: return) | ||
} | ||
|
||
private fun initRewardAdapter() { | ||
rewardAdapter = RewardAdapter() | ||
binding.rvEventRewardItem.adapter = rewardAdapter | ||
} | ||
|
||
private fun initEventLottieClickListener() { | ||
// TODO: 필요하면 터치 영역 조정 | ||
with(binding.lottieEvent) { | ||
setOnSingleClickListener { | ||
setOnClickListener(null) | ||
setAnimation(R.raw.lottie_event_open) | ||
loop(false) | ||
playAnimation() | ||
addAnimatorListener(object : Animator.AnimatorListener { | ||
override fun onAnimationStart(animation: Animator, isReverse: Boolean) { | ||
super.onAnimationStart(animation, isReverse) | ||
} | ||
|
||
override fun onAnimationStart(p0: Animator) {} | ||
|
||
override fun onAnimationEnd(animation: Animator, isReverse: Boolean) { | ||
super.onAnimationEnd(animation, isReverse) | ||
} | ||
|
||
override fun onAnimationEnd(p0: Animator) { | ||
startRewardDialog() | ||
} | ||
|
||
override fun onAnimationCancel(p0: Animator) {} | ||
|
||
override fun onAnimationRepeat(p0: Animator) {} | ||
}) | ||
} | ||
} | ||
} | ||
|
||
private fun startRewardDialog() { | ||
RewardDialog.newInstance().show(supportFragmentManager, TAG_DIALOG_REWARD) | ||
} | ||
|
||
companion object { | ||
private const val TAG_DIALOG_REWARD = "DIALOG_REWARD" | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/com/el/yello/presentation/event/EventViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.el.yello.presentation.event | ||
|
||
import androidx.lifecycle.ViewModel | ||
import com.example.domain.repository.EventRepository | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class EventViewModel @Inject constructor( | ||
private val eventRepository: EventRepository, | ||
) : ViewModel() { | ||
private var idempotencyKey = "" | ||
|
||
fun setIdempotencyKey(key: String) { | ||
idempotencyKey = key | ||
} | ||
|
||
fun getIdempotencyKey() = idempotencyKey | ||
} |
40 changes: 40 additions & 0 deletions
40
app/src/main/java/com/el/yello/presentation/event/RewardAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.el.yello.presentation.event | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.ListAdapter | ||
import androidx.recyclerview.widget.RecyclerView | ||
import coil.load | ||
import com.el.yello.databinding.ItemEventRewardBinding | ||
import com.el.yello.presentation.main.ParcelableReward | ||
import com.example.ui.diff.DiffCallback | ||
|
||
class RewardAdapter : ListAdapter<ParcelableReward, RewardAdapter.RewardViewHolder>(diffUtil) { | ||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RewardViewHolder = | ||
RewardViewHolder( | ||
ItemEventRewardBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, | ||
false, | ||
), | ||
) | ||
|
||
override fun onBindViewHolder(holder: RewardViewHolder, position: Int) { | ||
holder.setReward(getItem(position)) | ||
} | ||
|
||
class RewardViewHolder(private val binding: ItemEventRewardBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
fun setReward(reward: ParcelableReward) { | ||
binding.ivEventReward.load(reward.imageUrl) | ||
binding.tvEventRewardDescription.text = reward.name | ||
} | ||
} | ||
|
||
companion object { | ||
private val diffUtil = DiffCallback<ParcelableReward>( | ||
onItemsTheSame = { old, new -> old.name == new.name }, | ||
onContentsTheSame = { old, new -> old == new }, | ||
) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
깜빡임 이슈 제 견해로는 클릭 이벤트 처리가 애니메이션 시작 전에 발생돼서 클릭 시 깜빡일 수도 있을 것 같아욥 ..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한번 액티비티 onCreate 최상단에서 initEventLottieClickListener()를 호출하게 해봤는데 요거 말씀하신 게 맞을까요..? 계속 깜빡이네요ㅠ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 그렇군요 ,, 혹시 그럼 onAnimationEnd 시에 다이얼로그 호출하며 잠시 깜빡이는 건 아닐까욧 ..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제 생각에는 그 애니메이션 로티 이미지를 새로 그리면서 잠깐 깜빡였던 것 같은데 밑에 상호가 말해준 대로 해결했습니다!!!