diff --git a/android/app/src/main/java/com/app/edonymyeon/presentation/ui/main/search/SearchFragment.kt b/android/app/src/main/java/com/app/edonymyeon/presentation/ui/main/search/SearchFragment.kt index 2745edc2b..4fe1a22e1 100644 --- a/android/app/src/main/java/com/app/edonymyeon/presentation/ui/main/search/SearchFragment.kt +++ b/android/app/src/main/java/com/app/edonymyeon/presentation/ui/main/search/SearchFragment.kt @@ -16,7 +16,7 @@ import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint class SearchFragment : BaseFragment( - { FragmentSearchBinding.inflate(it) } + { FragmentSearchBinding.inflate(it) }, ) { override val viewModel: SearchViewModel by viewModels() override val inflater: LayoutInflater by lazy { LayoutInflater.from(context) } @@ -41,10 +41,8 @@ class SearchFragment : BaseFragment( binding.rvSearchResult.adapter = searchAdapter viewModel.searchResult.observe(viewLifecycleOwner) { - binding.tvEmptyPost.isVisible = it.isEmpty() - if (it.isNotEmpty()) { - searchAdapter.setPosts(it) - } + searchAdapter.setPosts(it) + binding.tvEmptyPost.isVisible = it.isEmpty() && searchAdapter.itemCount == 0 } } diff --git a/android/app/src/main/java/com/app/edonymyeon/presentation/ui/mypost/MyPostActivity.kt b/android/app/src/main/java/com/app/edonymyeon/presentation/ui/mypost/MyPostActivity.kt index 70351ed39..15def165b 100644 --- a/android/app/src/main/java/com/app/edonymyeon/presentation/ui/mypost/MyPostActivity.kt +++ b/android/app/src/main/java/com/app/edonymyeon/presentation/ui/mypost/MyPostActivity.kt @@ -17,9 +17,11 @@ import com.app.edonymyeon.presentation.ui.postdetail.PostDetailActivity import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint -class MyPostActivity : BaseActivity( - { ActivityMyPostBinding.inflate(it) } -), MyPostClickListener { +class MyPostActivity : + BaseActivity( + { ActivityMyPostBinding.inflate(it) }, + ), + MyPostClickListener { private val notificationId by lazy { intent.getLongExtra(KEY_NOTIFICATION_ID, -1) } @@ -88,10 +90,8 @@ class MyPostActivity : BaseActivity( private fun setMyPostsObserver() { viewModel.posts.observe(this) { - binding.tvEmptyPost.isVisible = it.isEmpty() - if (it.isNotEmpty()) { - adapter.setMyPosts(it) - } + adapter.setMyPosts(it) + binding.tvEmptyPost.isVisible = it.isEmpty() && adapter.itemCount == 0 } }