Skip to content

Commit

Permalink
feat: TabLayout 시간대 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
HI-JIN2 committed Aug 21, 2024
1 parent 87a5ea2 commit f22de7e
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ class ViewPager2Adapter(fragmentActivity: FragmentActivity) :
// 예를 들어, 첫 번째 Fragment를 디폴트로 설정하려면 0을 반환합니다.

val time = LocalTime.now()
var selectedIndex: Int

when (time.hour) {
in 0..10 -> selectedIndex = 0
in 10..16 -> selectedIndex = 1
in 16..24 -> selectedIndex = 2
else -> selectedIndex = 1
val selectedIndex: Int = when (time.hour) {
in 0..10 -> 0 //아침
in 10..16 -> 1 //점심
in 16..24 -> 2 //저녁
else -> 1
}
return selectedIndex
}
Expand Down

0 comments on commit f22de7e

Please sign in to comment.