Uh oh!
There was an error while loading. Please reload this page.
Fix/209 코스발견 상단 배너 스크롤 타이머 로직 수정2 - #210
Merged
Hidden character warning
The head ref may contain hidden characters: "fix/209-\ucf54\uc2a4\ubc1c\uacac-\uc0c1\ub2e8-\ubc30\ub108-\uc2a4\ud06c\ub864-\ud0c0\uc774\uba38-\ub85c\uc9c1-\uc218\uc8152"
Merged
Conversation
- 초기화 로직과 비즈니스 로직의 분리 - 메소드 명 변경 setPromotion -> setPromotionBanner
unam98
approved these changes
Aug 20, 2023
Comment on lines
-30
to
+35
| Toast.makeText(context,"장기간 미접속으로 인해 재로그인이 필요합니다.",Toast.LENGTH_LONG).show() | ||
| Handler(Looper.getMainLooper()).post{ | ||
| Toast.makeText(context,context.getString(R.string.alert_need_to_re_sign),Toast.LENGTH_LONG).show() | ||
| } |
Collaborator
There was a problem hiding this comment.
override fun authenticate()가 백그라운드에서 도는 함수인가요?
Comment on lines
-49
to
+48
| private lateinit var promotionAdapter: DiscoverPromotionAdapter | ||
| private val promotionAdapter: DiscoverPromotionAdapter by lazy { | ||
| DiscoverPromotionAdapter(requireContext(), this) | ||
| } |
Collaborator
There was a problem hiding this comment.
lateinit var가 아닌 by lazy를 쓰신 특별한 이유가 있을까요?
ContributorAuthor
There was a problem hiding this comment.
- 한 번 초기화된 promotionAdapter를 이후에도 재사용하는 것을 보장하기 위함입니다!
- adpater를 사용하는 과정에서 setBannerCount 등 순서에 민감한 로직들이 있기 때문에 리팩토링에 어려움을 겪었습니다. 그래서 promotionAdapter가 사용될 때에만 adapter를 초기화하도록 lazy를 사용하였습니다.
Collaborator
There was a problem hiding this comment.
초기화 여부를 확인하는 조건문을 넣어주는 것보다 이게 깔끔하긴 하겠네요. 좋네요!!
Comment on lines
-261
to
-267
| private fun autoScrollStart() { | ||
| private fun setTimerTask() { | ||
| timerTask = object : TimerTask() { | ||
| override fun run() { | ||
| scrollHandler.post(scrollPageRunnable) | ||
| } | ||
| } | ||
| timer.schedule(timerTask, INTERVAL_TIME, INTERVAL_TIME) |
Comment on lines
-208
to
+209
| private fun setPromotion(vp: ViewPager2, vpList: MutableList<DiscoverPromotionItemDTO>) { | ||
| setPromotionAdapter(vpList) | ||
| setPromotionIndicator(vp) | ||
| private fun setPromotionBanner(vp: ViewPager2) { | ||
| setPromotionViewPager(vp) | ||
| setScrollHandler(vp) | ||
| setScrollHandler() | ||
| setScrollPageRunnable(vp) | ||
| setTimerTask() |
Collaborator
There was a problem hiding this comment.
세부적으로 더 쪼개준만큼 어떤 구성요소들이 있는지 더 직관적으로 파악하기 쉽고 이번처럼 이슈가 생겼을 때 관리를 더 수월하게 해나갈 수 있을 것 같아서 좋네요
This file contains hidden or 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
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📌 개요
#209 코스발견 상단 배너 스크롤 타이머 로직 수정2
✨ 작업 내용
상단 배너 초기화 로직인 setPromotion 메소드가 비대해짐에 따라 발생한 비효율적인 로직 개선
배너 자동 스크롤에 사용되는 timer 및 timerTask의 초기화 관련 이슈 해결
번외 : Toast 메시지 표시가 UI Thread에서 이루어지도록 수정