-
Notifications
You must be signed in to change notification settings - Fork 2
Main 홈, 스크롤
yunso edited this page Jan 15, 2021
·
5 revisions
- 사용자가 현재 일자에 업로드한 일기가 없을 경우, 빈 홈 화면을 보여주고
현재 일자에 이미 일기를 업로드했을 경우 일기 정보를 보여줍니다.
HomeFragment.kt
private fun setDayNightStatus() {
val currentHourDay = Calendar.getInstance().get(Calendar.HOUR_OF_DAY) // 24시간 포맷
if (currentHourDay in 6..18) { // 06:00 ~ 18:59
setDayView()
isDay = true
} else {
setNightView()
isDay = false
}
setLoadingViewBackground()
}
- 홈 뷰에서 현재 시간을 받아와서 06:00 ~ 18:59 까지는 Day mode,
그 이외의 시간에는 Night mode의 UI를 보여줍니다.
HomeFragment.kt
private fun setDayNightStatus() {
val currentHourDay = Calendar.getInstance().get(Calendar.HOUR_OF_DAY) // 24시간 포맷
if (currentHourDay in 6..18) { // 06:00 ~ 18:59
setDayView()
isDay = true
} else {
setNightView()
isDay = false
}
setLoadingViewBackground()
}
- 다이어리 상세 뷰에서 수정을 한 후, 다시 홈 화면으로 돌아왔을 때
IS_EDITED
boolean 값을 이용해 데이터를 다시 로드합니다.
HomeFragment.kt
override fun onResume() {
super.onResume()
if(IS_EDITED) {
updateByServerData()
IS_EDITED = false
}
}