Skip to content

Diary 일기 상세보기

Jo Hyun Jin edited this page Jan 15, 2021 · 2 revisions

Diary 일기 상세보기

image

  • 서버에서 받아오는 일기의 깊이에 따라 Background Color와 배경별 오브제 다르게 지정
private fun setDepthBackground(depth: Int) {
    binding.objectDeep1.setGone()
    binding.objectDeep2.setGone()
    binding.objectDeep3.setGone()
    binding.objectDeep4.setGone()
    binding.objectDeep5.setGone()
    binding.objectDeep6.setGone()
    when (depth) {
        0 -> {
            binding.root.background = resources.getDrawable(R.drawable.bg_deep1, null)
            object_deep1.setVisible()
        }
        1 -> {
            binding.root.background = resources.getDrawable(R.drawable.bg_deep2, null)
            object_deep2.setVisible()
        }
        2 -> {
            binding.root.background = resources.getDrawable(R.drawable.bg_deep3, null)
            object_deep3.setVisible()
        }
        3 -> {
            binding.root.background = resources.getDrawable(R.drawable.bg_deep4, null)
            object_deep4.setVisible()
        }
        4 -> {
            binding.root.background = resources.getDrawable(R.drawable.bg_deep5, null)
            object_deep5.setVisible()
        }
        5 -> {
            binding.root.background = resources.getDrawable(R.drawable.bg_deep6, null)
            object_deep6.setVisible()
        }
        6 -> {
            binding.root.background = resources.getDrawable(R.drawable.bg_deep7, null)
        }
    }
}