From d5062f4da10d319f58d4401dd47f6028c6428939 Mon Sep 17 00:00:00 2001 From: DOGDDUDDY Date: Sun, 27 Aug 2023 22:46:45 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[fix/home=5Fui]:=20=EB=B0=94=ED=85=80=20?= =?UTF-8?q?=EB=82=B4=EB=B9=84=EA=B2=8C=EC=9D=B4=EC=85=98=20=EB=A7=8C?= =?UTF-8?q?=ED=81=BC=20Layout=20=EB=9C=A8=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 바텀 내비게이션 애니메이션만 있고, View 영역은 존재해서 Layout이 뜨는 문제 -> Visibility Gone 처리 - Gone 처리 시 애니메이션 없이 사라지는 문제 -> 애니메이션 종료 후 Gone 처리 --- .../presentation/utils/animationExtensions.kt | 5 +++-- .../gdsc/presentation/view/MainActivity.kt | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/java/org/gdsc/presentation/utils/animationExtensions.kt b/presentation/src/main/java/org/gdsc/presentation/utils/animationExtensions.kt index fc2b65b6..40f8d155 100644 --- a/presentation/src/main/java/org/gdsc/presentation/utils/animationExtensions.kt +++ b/presentation/src/main/java/org/gdsc/presentation/utils/animationExtensions.kt @@ -1,5 +1,6 @@ package org.gdsc.presentation.utils +import android.animation.Animator import android.animation.ObjectAnimator import android.view.View import android.view.animation.AlphaAnimation @@ -47,12 +48,12 @@ fun View.slideUp(duration: Long = 200) { } } -fun View.slideDown(duration: Long = 200) { +fun View.slideDown(duration: Long = 200, endListener: Animator.AnimatorListener) { val self = this ObjectAnimator .ofFloat(self, "translationY", self.height.toFloat()) .apply { setDuration(duration) start() - } + }.addListener(endListener) } \ No newline at end of file diff --git a/presentation/src/main/java/org/gdsc/presentation/view/MainActivity.kt b/presentation/src/main/java/org/gdsc/presentation/view/MainActivity.kt index 96458eb1..3eecf1a1 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/MainActivity.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/MainActivity.kt @@ -1,6 +1,7 @@ package org.gdsc.presentation.view import android.Manifest +import android.animation.Animator import android.annotation.SuppressLint import android.content.Intent import android.content.pm.PackageManager @@ -10,6 +11,7 @@ import android.os.Bundle import android.provider.Settings import android.view.MenuItem import android.view.View +import android.view.animation.Animation import android.widget.Toast import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels @@ -26,8 +28,9 @@ import org.gdsc.presentation.databinding.ActivityMainBinding import org.gdsc.presentation.utils.slideDown import org.gdsc.presentation.utils.slideUp import org.gdsc.presentation.utils.toPx -import org.gdsc.presentation.view.mypage.viewmodel.MyPageViewModel import org.gdsc.presentation.view.home.HomeFragmentDirections +import org.gdsc.presentation.view.mypage.viewmodel.MyPageViewModel + @AndroidEntryPoint class MainActivity : BaseActivity() { @@ -172,10 +175,22 @@ class MainActivity : BaseActivity() { } fun slideDownBottomNavigationView() { - binding.bottomNavigationView.slideDown() + val myAnimationListener: Animator.AnimatorListener = + object : Animator.AnimatorListener { + override fun onAnimationStart(p0: Animator) {} + override fun onAnimationEnd(p0: Animator) { + + binding.bottomNavigationView.visibility = View.GONE + } + + override fun onAnimationCancel(p0: Animator) {} + override fun onAnimationRepeat(p0: Animator) {} + } + binding.bottomNavigationView.slideDown(endListener = myAnimationListener) } fun slideUpBottomNavigationView() { + binding.bottomNavigationView.visibility = View.VISIBLE binding.bottomNavigationView.slideUp() } From 3c5ac978dd22729de85f02643e107e042d68ef2c Mon Sep 17 00:00:00 2001 From: DOGDDUDDY Date: Sun, 27 Aug 2023 22:48:26 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[fix/home=5Fui]:=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20nickName=20=ED=81=AC=EB=9E=98?= =?UTF-8?q?=EC=8B=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gdsc/presentation/view/mypage/MyPageFragment.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/MyPageFragment.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/MyPageFragment.kt index 9a3f168d..796ef068 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/MyPageFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/MyPageFragment.kt @@ -12,6 +12,8 @@ import androidx.navigation.fragment.findNavController import com.bumptech.glide.Glide import com.google.android.material.tabs.TabLayoutMediator import dagger.hilt.android.AndroidEntryPoint +import kotlinx.coroutines.flow.collect +import kotlinx.coroutines.flow.collectLatest import org.gdsc.domain.Empty import org.gdsc.presentation.R import org.gdsc.presentation.databinding.FragmentMyPageBinding @@ -105,8 +107,11 @@ class MyPageFragment : Fragment() { private fun setCollapsingToolbarOffChangedCallback() { binding.appBarLayout.addOnOffsetChangedListener { _, verticalOffset -> if (verticalOffset == -binding.collapsingToolbar.height) { - // TODO: User Nickname From ViewModel - setToolbarTitle(viewModel.nicknameState.value) + repeatWhenUiStarted { + viewModel.nicknameState.collectLatest { + setToolbarTitle(it) + } + } } else { setToolbarTitle() } From 44ad4ce2849a3ee88fdbac491b9be945f4bfb6a3 Mon Sep 17 00:00:00 2001 From: DOGDDUDDY Date: Sun, 27 Aug 2023 22:49:05 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[fix/home=5Fui]:=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20Scope=20=EC=BD=94=EB=93=9C=20Exte?= =?UTF-8?q?nsion=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/mypage/RegisteredRestaurantFragment.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/RegisteredRestaurantFragment.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/RegisteredRestaurantFragment.kt index cdaa34aa..cae7297e 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/RegisteredRestaurantFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/RegisteredRestaurantFragment.kt @@ -66,7 +66,7 @@ class RegisteredRestaurantFragment : Fragment() { private fun observeState() { - lifecycleScope.launch { + repeatWhenUiStarted { viewModel.idState.collectLatest { id -> id?.let { notNullId -> @@ -77,19 +77,19 @@ class RegisteredRestaurantFragment : Fragment() { } } - lifecycleScope.launch { + repeatWhenUiStarted { viewModel.sortTypeState.collectLatest { binding.sortSpinner.setMenuTitle(it.text) } } - lifecycleScope.launch { + repeatWhenUiStarted { viewModel.foodCategoryState.collectLatest { binding.foodCategorySpinner.setMenuTitle(it.text) } } - lifecycleScope.launch { + repeatWhenUiStarted { viewModel.drinkPossibilityState.collectLatest { binding.drinkPossibilitySpinner.setMenuTitle(it.text) }