Skip to content
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

UI 개선, 바텀 내비게이션 애니메이션 적용 #282

Merged
merged 8 commits into from
Dec 6, 2023

Conversation

HamBP
Copy link
Member

@HamBP HamBP commented Dec 5, 2023

Issue

Overview

  • 이미지 centerCrop 적용
  • 바텀 내비게이션 애니메이션 적용
  • 어쩌다 보니 media change 이벤트 수정

Screenshot

KakaoTalk_20231206_004707408.mp4

@HamBP HamBP added 🤹 enhance 성능 개선 🤖 android android labels Dec 5, 2023
@HamBP HamBP self-assigned this Dec 5, 2023
@HamBP HamBP linked an issue Dec 5, 2023 that may be closed by this pull request
Copy link
Collaborator

@2taezeat 2taezeat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~

Copy link

github-actions bot commented Dec 5, 2023

Test Results

6 tests   6 ✔️  1s ⏱️
2 suites  0 💤
2 files    0

Results for commit ee265d7.

♻️ This comment has been updated with latest results.


private fun raiseBottomNav() {
ObjectAnimator.ofFloat(binding.bottomNav, "translationY", 0f).apply {
duration = 700
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

700이 여러군데에서 쓰이는 것 같은데 상수화 하는 것 어떤가용??

Comment on lines 112 to 138
private fun hideBottomNav() {
binding.bottomNav.visibility = View.GONE
val period = 700L
takeDownBottomNav(period)

lifecycleScope.launch {
delay(period)
binding.bottomNav.visibility = View.GONE
}
}

private fun showBottomNav() {
raiseBottomNav()

binding.bottomNav.visibility = View.VISIBLE
}

private fun takeDownBottomNav(period: Long) {
val height = binding.bottomNav.height.toFloat()
ObjectAnimator.ofFloat(binding.bottomNav, "translationY", height).apply {
duration = period
start()
}
}

private fun raiseBottomNav() {
ObjectAnimator.ofFloat(binding.bottomNav, "translationY", 0f).apply {
duration = 700
Copy link
Member

@youlalala youlalala Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showBottomNav() - raiseBottomNav() 가 함수명이 둘다 비슷한 의미 여서 함수가 어떤의미를 뜻하는지 정확하게 알기 어려운 것 같아요! raiseBottomNav 를 애니메이션 관련된 함수명으로 바꾸는 방법도 있을 것 같고, 두 함수를 합치는 것도 좋을 것 같아요. (hideBottomNav() - takeDownBottomNav 도 마찬가지입니다!) 그리고 scope 함수 apply를 적절하게 활용해보는 것도 좋을 것 같습니당
ex)

private fun showBottomNav() {
        val slideUpAnimation = ObjectAnimator.ofFloat(binding.bottomNav, "translationY", 0f).apply {
            duration = BOTTOM_NAV_ANIMATION_DURATION
        }
        slideUpAnimation.start()
        binding.bottomNav.visibility = View.VISIBLE
    }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

하나로 합칠게용

Comment on lines 116 to 119
lifecycleScope.launch {
delay(period)
binding.bottomNav.visibility = View.GONE
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delay 를 하드 코딩하는 것보다는 animator 에 doOnEnd 함수를 이용해보는 것도 좋을 것 같아용!

ex)

val slideDown = ObjectAnimator.ofFloat(binding.bottomNav, "translationY", binding.bottomNav.height.toFloat()).apply {
            duration = BOTTOM_NAV_ANIMATION_DURATION
            doOnEnd { binding.bottomNav.visibility = View.GONE }
        }
        slideDown.start()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오호 저런 함수가 있었군요!

Comment on lines 5 to 8
fun Context.fromDpToPx(dp: Float): Float {
val density = resources.displayMetrics.density
return dp * density
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 언제 쓰는 함수인지 궁금하네요!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dp를 px로 변환하려고 만들었는데, view에서 사이즈를 얻을 수 있어서 안 쓰게 됐네요. 없애버리겠습니다!

Copy link
Member

@youlalala youlalala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨어용~~~덕분에 네비게이션 보는 재미가 생겼군요 🙂

@HamBP HamBP merged commit df582de into develop Dec 6, 2023
1 check passed
@HamBP HamBP deleted the android/feature/281 branch December 6, 2023 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android android 🤹 enhance 성능 개선
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI 개선, 바텀 네비게이션 애니메이션
3 participants