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 이슈 수정 #64

Merged
merged 3 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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() {
Expand Down Expand Up @@ -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)
Comment on lines +178 to +189
Copy link
Member

Choose a reason for hiding this comment

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

view 자체가 gone 이 안돼서 생겼던 문제군요!

}

fun slideUpBottomNavigationView() {
binding.bottomNavigationView.visibility = View.VISIBLE
binding.bottomNavigationView.slideUp()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
Comment on lines +110 to +114
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

Choose a reason for hiding this comment

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

로직 자체가 달라지긴 했는데

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nickName 없어도 적용하려다가 크래시 나는 부분이에욥.

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
Collaborator Author

Choose a reason for hiding this comment

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

Info API로 받아온 닉네임을 표현해주는 부분이라 타이틀이 보여지는 시간차가 생길 순 있어도, API 자체가 실패한 게 아니면 Title에 적용 되지 않을까 합니당.
그리고 커멘트 달았는데 Bitmap 사용하고 recycle 안 해도 괜ㅊ낳나요?

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
Collaborator Author

Choose a reason for hiding this comment

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

사실 이름이 없는게 문제 상황인거죠
그리고 그렇다해도 info api 핸들링으로 처리하면 문제가 없을 것 같습니다.
title은 null이 문제지 미입력이 문제는 아닌 것 같아서요

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
Collaborator Author

Choose a reason for hiding this comment

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

그 뷰분은 info쪽에서 크래시 나는지 백엔드에 요청드려서 테스트해볼게용

Copy link
Member

Choose a reason for hiding this comment

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

네넵..!! 감사합니당

} else {
setToolbarTitle()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class RegisteredRestaurantFragment : Fragment() {

private fun observeState() {

lifecycleScope.launch {
repeatWhenUiStarted {
viewModel.idState.collectLatest { id ->

id?.let { notNullId ->
Expand All @@ -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)
}
Expand Down
Loading