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

fix: 페이지를 새로고침이나 검색할 때마다 데이터가 없음을 보여주는 문구 오류 수정 #532

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
Expand Up @@ -16,7 +16,7 @@ import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class SearchFragment : BaseFragment<FragmentSearchBinding, SearchViewModel>(
{ FragmentSearchBinding.inflate(it) }
{ FragmentSearchBinding.inflate(it) },
) {
override val viewModel: SearchViewModel by viewModels()
override val inflater: LayoutInflater by lazy { LayoutInflater.from(context) }
Expand All @@ -41,10 +41,8 @@ class SearchFragment : BaseFragment<FragmentSearchBinding, SearchViewModel>(

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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import com.app.edonymyeon.presentation.ui.postdetail.PostDetailActivity
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MyPostActivity : BaseActivity<ActivityMyPostBinding, MyPostViewModel>(
{ ActivityMyPostBinding.inflate(it) }
), MyPostClickListener {
class MyPostActivity :
BaseActivity<ActivityMyPostBinding, MyPostViewModel>(
{ ActivityMyPostBinding.inflate(it) },
),
MyPostClickListener {
private val notificationId by lazy {
intent.getLongExtra(KEY_NOTIFICATION_ID, -1)
}
Expand Down Expand Up @@ -88,10 +90,8 @@ class MyPostActivity : BaseActivity<ActivityMyPostBinding, MyPostViewModel>(

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
}
}

Expand Down
Loading