From 0ebec0828a902c31a3fcb71819937104698abec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A1=9C=ED=94=BC?= <50761690+Choisehyeon@users.noreply.github.com> Date: Tue, 17 Oct 2023 11:47:48 +0900 Subject: [PATCH] =?UTF-8?q?Feat/#485=20=EB=B9=88=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EB=AC=B8=EA=B5=AC=EC=B6=94=EA=B0=80=20(#492)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 내가 쓴 글 화면에 글이 없다면 문구가 보이도록 구현 * feat: 검색 페이지에 검색된 글이 없다면 문구가 보이도록 구현 - 키보드가 올라와도 텍스트 뷰 위치 동일하도록 함 * chore: 문구 수정 * refactor: 빈 검색어가 입력되었을 경우 문구가 보이도록 수정 --- android/app/src/main/AndroidManifest.xml | 3 ++- .../presentation/ui/main/search/SearchFragment.kt | 8 ++++++-- .../presentation/ui/mypost/MyPostActivity.kt | 6 +++++- .../app/src/main/res/layout/activity_my_post.xml | 14 +++++++++++++- .../app/src/main/res/layout/fragment_search.xml | 15 ++++++++++++++- android/app/src/main/res/values/strings.xml | 6 +++++- 6 files changed, 45 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 51e3a49c1..638c4b338 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -54,7 +54,8 @@ android:exported="true" /> + android:exported="true" + android:windowSoftInputMode="adjustPan"> 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 63426a946..61032e19d 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 @@ -5,6 +5,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.SearchView +import androidx.core.view.isVisible import androidx.fragment.app.viewModels import androidx.recyclerview.widget.RecyclerView import app.edonymyeon.databinding.FragmentSearchBinding @@ -19,7 +20,6 @@ class SearchFragment : BaseFragment({ }) { override val viewModel: SearchViewModel by viewModels() override val inflater: LayoutInflater by lazy { LayoutInflater.from(context) } - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -41,7 +41,10 @@ class SearchFragment : BaseFragment({ binding.rvSearchResult.adapter = searchAdapter viewModel.searchResult.observe(viewLifecycleOwner) { - searchAdapter.setPosts(it) + binding.tvEmptyPost.isVisible = it.isEmpty() + if (it.isNotEmpty()) { + searchAdapter.setPosts(it) + } } } @@ -62,6 +65,7 @@ class SearchFragment : BaseFragment({ } override fun onQueryTextChange(newText: String?): Boolean { + if (newText == "") binding.tvEmptyPost.isVisible = false return true } }) 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 1d3dcf34e..1aadc4d0f 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 @@ -6,6 +6,7 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.MenuItem import androidx.activity.viewModels +import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import app.edonymyeon.databinding.ActivityMyPostBinding import com.app.edonymyeon.presentation.common.activity.BaseActivity @@ -89,7 +90,10 @@ class MyPostActivity : private fun setMyPostsObserver() { viewModel.posts.observe(this) { - adapter.setMyPosts(it) + binding.tvEmptyPost.isVisible = it.isEmpty() + if (it.isNotEmpty()) { + adapter.setMyPosts(it) + } } } diff --git a/android/app/src/main/res/layout/activity_my_post.xml b/android/app/src/main/res/layout/activity_my_post.xml index c073ae9f8..1f6aef519 100644 --- a/android/app/src/main/res/layout/activity_my_post.xml +++ b/android/app/src/main/res/layout/activity_my_post.xml @@ -54,7 +54,19 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/space_my_post_list_top" tools:listitem="@layout/item_my_post"/> - + + diff --git a/android/app/src/main/res/layout/fragment_search.xml b/android/app/src/main/res/layout/fragment_search.xml index 99cc7e485..5ce24a741 100644 --- a/android/app/src/main/res/layout/fragment_search.xml +++ b/android/app/src/main/res/layout/fragment_search.xml @@ -69,5 +69,18 @@ app:layout_constraintTop_toBottomOf="@id/space_search_container_bottom" tools:listitem="@layout/item_post" /> + + - \ No newline at end of file + diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 253f70dec..0e3f26dd7 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -37,7 +37,7 @@ 이돈이면 HOT 게시물 전체 게시글 - 이번 주 핫 게시글이 없습니다 + 3일간 핫 게시글이 없습니다 수정 @@ -124,6 +124,7 @@ %s %,d원 구매확정 절약확정 + 내가 쓴 글이 없습니다 구매 금액과 날짜를 입력해주세요 @@ -164,4 +165,7 @@ 기본 이미지로 변경 닉네임 수정하기 + + + 검색된 게시글이 없습니다