From af78a7bb2750ac9d64af0511bb7e60431c25deef Mon Sep 17 00:00:00 2001 From: soopeach Date: Wed, 13 Mar 2024 22:50:24 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[fix/restaurant=5Fdetail=5Fscroll]:=20?= =?UTF-8?q?=ED=83=AD=20=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20=EB=B0=8F=20?= =?UTF-8?q?=EC=83=81=EB=8B=A8=20=EB=B6=80=EB=B6=84=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A1=A4=EB=90=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD(?= =?UTF-8?q?=EB=B7=B0=20=ED=81=AC=EA=B8=B0=20=EA=B3=A0=EC=A0=95=20=EC=9D=B4?= =?UTF-8?q?=EC=8A=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RestaurantDetailFragment.kt | 1 + .../res/layout/fragment_restaurant_detail.xml | 150 +++++----- .../res/layout/fragment_restaurant_info.xml | 259 +++++++++--------- .../res/layout/fragment_restaurant_photo.xml | 16 +- .../res/layout/fragment_restaurant_review.xml | 4 +- 5 files changed, 204 insertions(+), 226 deletions(-) diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantDetailFragment.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantDetailFragment.kt index a9750e84..07eaadfb 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantDetailFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantDetailFragment.kt @@ -167,6 +167,7 @@ class RestaurantDetailFragment : Fragment() { binding.restaurantDetailPager.adapter = RestaurantDetailPagerAdapter(this) binding.restaurantDetailPager.isUserInputEnabled = false + binding.restaurantDetailPager.offscreenPageLimit = 1 TabLayoutMediator(binding.tabLayout, binding.restaurantDetailPager) { tab, position -> when (position) { diff --git a/presentation/src/main/res/layout/fragment_restaurant_detail.xml b/presentation/src/main/res/layout/fragment_restaurant_detail.xml index edac825c..ab0875d3 100644 --- a/presentation/src/main/res/layout/fragment_restaurant_detail.xml +++ b/presentation/src/main/res/layout/fragment_restaurant_detail.xml @@ -1,59 +1,55 @@ + android:layout_height="match_parent"> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + tools:text="용용선생 노원점" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_restaurant_name"> @@ -61,17 +57,16 @@ android:layout_width="1dp" android:layout_height="12dp" android:layout_gravity="center_vertical" - android:background="@color/grey200" android:layout_marginHorizontal="12dp" - /> + android:background="@color/grey200" /> + tools:text="중식" /> @@ -79,82 +74,80 @@ android:id="@+id/ct_address" android:layout_width="0dp" android:layout_height="wrap_content" - app:layout_constraintStart_toStartOf="parent" + android:layout_marginTop="4dp" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/ct_distance_and_category" - android:layout_marginTop="4dp"> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/ct_distance_and_category"> + android:text="주소복사" + android:textColor="@color/main300" /> + android:contentDescription="profile" + android:src="@drawable/mock_profile" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/ct_address" /> + app:layout_constraintBottom_toBottomOf="@id/iv_profile" + app:layout_constraintStart_toEndOf="@id/iv_profile" + app:layout_constraintTop_toTopOf="@id/iv_profile" + tools:text="Blaire" /> + app:tabTextColor="@color/grey400"> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tab_layout" /> @@ -165,70 +158,69 @@ android:layout_width="0dp" android:layout_height="1dp" android:background="@color/grey100" - app:layout_constraintStart_toStartOf="parent" + app:layout_constraintBottom_toTopOf="@id/ct_review_foam" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintBottom_toTopOf="@id/ct_review_foam"/> + app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintStart_toStartOf="parent"> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@id/et_review" /> + app:layout_constraintEnd_toEndOf="parent" /> + app:layout_constraintEnd_toStartOf="@id/btn_register" + app:layout_constraintStart_toEndOf="@id/add_image_icon" /> diff --git a/presentation/src/main/res/layout/fragment_restaurant_info.xml b/presentation/src/main/res/layout/fragment_restaurant_info.xml index 4c23d6c8..2a55b23a 100644 --- a/presentation/src/main/res/layout/fragment_restaurant_info.xml +++ b/presentation/src/main/res/layout/fragment_restaurant_info.xml @@ -1,143 +1,128 @@ + android:layout_height="wrap_content"> + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/presentation/src/main/res/layout/fragment_restaurant_photo.xml b/presentation/src/main/res/layout/fragment_restaurant_photo.xml index ba010b73..c8e756c0 100644 --- a/presentation/src/main/res/layout/fragment_restaurant_photo.xml +++ b/presentation/src/main/res/layout/fragment_restaurant_photo.xml @@ -2,8 +2,9 @@ + app:layout_constraintTop_toTopOf="parent" + /> + app:layout_constraintTop_toBottomOf="@id/tv_photos"/> \ No newline at end of file diff --git a/presentation/src/main/res/layout/fragment_restaurant_review.xml b/presentation/src/main/res/layout/fragment_restaurant_review.xml index 1a655fdd..9c4120ed 100644 --- a/presentation/src/main/res/layout/fragment_restaurant_review.xml +++ b/presentation/src/main/res/layout/fragment_restaurant_review.xml @@ -2,7 +2,7 @@ @@ -20,7 +20,7 @@ Date: Thu, 14 Mar 2024 02:07:34 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[fix/restaurant=5Fdetail=5Fscroll]:=20?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20=EC=9D=BC=EB=B6=80=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 --- .../src/main/res/layout/fragment_restaurant_photo.xml | 2 ++ .../src/main/res/layout/fragment_restaurant_review.xml | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/presentation/src/main/res/layout/fragment_restaurant_photo.xml b/presentation/src/main/res/layout/fragment_restaurant_photo.xml index c8e756c0..d5825b69 100644 --- a/presentation/src/main/res/layout/fragment_restaurant_photo.xml +++ b/presentation/src/main/res/layout/fragment_restaurant_photo.xml @@ -12,6 +12,8 @@ android:text="맛집 사진" android:layout_width="wrap_content" android:layout_height="wrap_content" + style="@style/text_medium_medium" + android:textColor="@color/grey700" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/presentation/src/main/res/layout/fragment_restaurant_review.xml b/presentation/src/main/res/layout/fragment_restaurant_review.xml index 9c4120ed..5064164b 100644 --- a/presentation/src/main/res/layout/fragment_restaurant_review.xml +++ b/presentation/src/main/res/layout/fragment_restaurant_review.xml @@ -14,7 +14,6 @@ style="@style/text_medium_medium" android:textColor="@color/grey700" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"/> + app:layout_constraintTop_toBottomOf="@id/tv_reviews" /> \ No newline at end of file From 70df2d7b671612d18d09aa7e30694b6980823684 Mon Sep 17 00:00:00 2001 From: soopeach Date: Thu, 14 Mar 2024 02:16:02 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[fix/restaurant=5Fdetail=5Fscroll]:=20?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=EA=B4=80=EB=A0=A8=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/mypage/adapter/ImageSlider.kt | 8 +++- .../RestaurantInfoFragment.kt | 13 +++-- .../RestaurantPhotoDetailFragment.kt | 47 ++++++++----------- .../RestaurantPhotoFragment.kt | 42 +++++++---------- .../src/main/res/layout/item_image_slide.xml | 9 ++-- 5 files changed, 54 insertions(+), 65 deletions(-) diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/ImageSlider.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/ImageSlider.kt index 57cdd826..8180b45c 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/ImageSlider.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/ImageSlider.kt @@ -6,14 +6,17 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide +import org.gdsc.domain.model.Review import org.gdsc.presentation.databinding.ItemImageSlideBinding data class ImageSliderItem( - val imageUrl: String + val imageUrl: String, + val review: Review ) class ImageSlider( - private val onItemSelected: () -> Unit = {} + private val onItemSelected: () -> Unit = {}, + private val onReviewRefreshed: (Review) -> Unit = {} ) : ListAdapter( diffUtil @@ -27,6 +30,7 @@ class ImageSlider( .load(item.imageUrl) .into(imageView) } + onReviewRefreshed(item.review) } } diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt index 8a987e8e..bb13e086 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt @@ -98,13 +98,12 @@ class RestaurantInfoFragment : Fragment() { } viewLifecycleOwner.lifecycleScope.launch { - viewModel.restaurantInfo.collect { - it?.let { notNullRestaurantInfo -> - restaurantPhotoAdapter.submitList( - notNullRestaurantInfo.pictures.map { imageUrl -> - (RestaurantPhotoItem(imageUrl)) - }) - } + + viewModel.reviews.collect { reviews -> + restaurantPhotoAdapter.submitList( + reviews.map { it.reviewImages }.flatten().take(8).map { imageUrl -> + (RestaurantPhotoItem(imageUrl)) + }) } } } diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantPhotoDetailFragment.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantPhotoDetailFragment.kt index db5054ce..de0738f5 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantPhotoDetailFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantPhotoDetailFragment.kt @@ -28,7 +28,16 @@ class RestaurantPhotoDetailFragment : Fragment() { private val imageSlider = ImageSlider( - ) + ) { + with(binding.reviewItem) { + Glide.with(root) + .load(it.reviewerImageUrl) + .into(ivProfile) + + tvNickname.text = it.userName + tvContent.text = it.reviewContent + } + } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -40,48 +49,30 @@ class RestaurantPhotoDetailFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - setAdapter() - observeData() - - } - private fun observeData() { - viewLifecycleOwner.lifecycleScope.launch { - viewModel.reviews.collect { reviewList -> - if (reviewList.isNotEmpty()) { - - // TODO: to be dynamic - val firstReview = reviewList.first() - with(binding.reviewItem) { - Glide.with(root) - .load(firstReview.reviewerImageUrl) - .into(ivProfile) - - tvNickname.text = firstReview.userName - tvContent.text = firstReview.reviewContent - } - } - } - } } private fun setAdapter() { binding.imageSlider.adapter = imageSlider - viewModel.restaurantInfo.value?.let { restaurantInfo -> + viewModel.reviews.value.let { reviews -> + + val imageSliderItems = reviews.map { review -> + review.reviewImages.map { imageUrl -> + ImageSliderItem(imageUrl, review) + } + }.flatten() binding.imageSlider.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() { override fun onPageSelected(position: Int) { super.onPageSelected(position) - parentActivity.changeToolbarTitle("${position + 1} / ${restaurantInfo.pictures.size}") + parentActivity.changeToolbarTitle("${position + 1} / ${imageSliderItems.size}") } }) - imageSlider.submitList(restaurantInfo.pictures.map { - ImageSliderItem(it) - }) + imageSlider.submitList(imageSliderItems) } } diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantPhotoFragment.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantPhotoFragment.kt index 37a09bc1..d0bf5187 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantPhotoFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantPhotoFragment.kt @@ -6,12 +6,16 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.ViewTreeObserver +import androidx.fragment.app.activityViewModels +import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.GridLayoutManager import dagger.hilt.android.AndroidEntryPoint +import kotlinx.coroutines.launch import org.gdsc.presentation.databinding.FragmentRestaurantPhotoBinding import org.gdsc.presentation.model.RestaurantPhotoItem import org.gdsc.presentation.view.mypage.adapter.RestaurantPhotoAdapter +import org.gdsc.presentation.view.mypage.viewmodel.RestaurantDetailViewModel @AndroidEntryPoint class RestaurantPhotoFragment : Fragment() { @@ -19,6 +23,12 @@ class RestaurantPhotoFragment : Fragment() { private var _binding: FragmentRestaurantPhotoBinding? = null private val binding get() = _binding!! + private val viewModel by activityViewModels() + + private val restaurantPhotoAdapter = RestaurantPhotoAdapter { + findNavController().navigate(RestaurantDetailFragmentDirections.actionRestaurantDetailFragmentToRestaurantPhotoDetailFragment()) + } + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -33,9 +43,6 @@ class RestaurantPhotoFragment : Fragment() { } private fun setAdapter() { - val restaurantPhotoAdapter = RestaurantPhotoAdapter { - findNavController().navigate(RestaurantDetailFragmentDirections.actionRestaurantDetailFragmentToRestaurantPhotoDetailFragment()) - } val spanCount = 3 @@ -51,28 +58,15 @@ class RestaurantPhotoFragment : Fragment() { } }) + viewLifecycleOwner.lifecycleScope.launch { + viewModel.reviews.collect { reviews -> + restaurantPhotoAdapter.submitList( + reviews.map { it.reviewImages }.flatten().map { imageUrl -> + (RestaurantPhotoItem(imageUrl)) + }) + } + } - // TODO: supposed to be real data - restaurantPhotoAdapter.submitList( - listOf( - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - RestaurantPhotoItem("https://gdsc-jmt.s3.ap-northeast-2.amazonaws.com/profileImg/defaultImg/Default+image.png"), - ) - ) } } \ No newline at end of file diff --git a/presentation/src/main/res/layout/item_image_slide.xml b/presentation/src/main/res/layout/item_image_slide.xml index 5784aa5e..b7642049 100644 --- a/presentation/src/main/res/layout/item_image_slide.xml +++ b/presentation/src/main/res/layout/item_image_slide.xml @@ -1,12 +1,13 @@ - + app:all_corner_radius="5dp"> - \ No newline at end of file + \ No newline at end of file From c479fe3498ed7248beab49dbcff0e38540e0965d Mon Sep 17 00:00:00 2001 From: soopeach Date: Thu, 14 Mar 2024 02:29:00 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[fix/restaurant=5Fdetail=5Fscroll]:=20?= =?UTF-8?q?=EC=82=AC=EC=A7=84=20=EB=8D=94=20=EB=B3=B4=EA=B8=B0=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mypage/adapter/RestaurantPhotoAdapter.kt | 19 ++++++++---- .../RestaurantInfoFragment.kt | 4 +-- .../src/main/res/drawable/ic_plus.png | Bin 0 -> 361 bytes .../main/res/layout/item_photo_restaurant.xml | 27 ++++++++++++++++++ 4 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 presentation/src/main/res/drawable/ic_plus.png diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/RestaurantPhotoAdapter.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/RestaurantPhotoAdapter.kt index 94301d9e..00f2e8b6 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/RestaurantPhotoAdapter.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/RestaurantPhotoAdapter.kt @@ -16,16 +16,25 @@ class RestaurantPhotoAdapter( diffUtil ) { - private var width = 0 - private var height = 0 + private var width = 0 + private var height = 0 inner class RestaurantPhotoViewHolder(private val binding: ItemPhotoRestaurantBinding) : RecyclerView.ViewHolder(binding.root) { fun bind(item: RestaurantPhotoItem) { with(binding) { - Glide.with(root) - .load(item.photoUrl) - .into(ivPhoto) + + if (item.photoUrl != "BUTTON") { + Glide.with(root) + .load(item.photoUrl) + .into(ivPhoto) + } else { + morePhotoButton.visibility = ViewGroup.VISIBLE + morePhotoButton.setOnClickListener { + onItemSelected() + } + } + } } } diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt index bb13e086..a0fbf583 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt @@ -44,7 +44,7 @@ class RestaurantInfoFragment : Fragment() { } private val restaurantPhotoAdapter = RestaurantPhotoAdapter { - + (parentFragment as RestaurantDetailFragment).changeCategory(RestaurantDetailPagerAdapter.PHOTO) } override fun onCreateView( @@ -103,7 +103,7 @@ class RestaurantInfoFragment : Fragment() { restaurantPhotoAdapter.submitList( reviews.map { it.reviewImages }.flatten().take(8).map { imageUrl -> (RestaurantPhotoItem(imageUrl)) - }) + } + RestaurantPhotoItem("BUTTON")) } } } diff --git a/presentation/src/main/res/drawable/ic_plus.png b/presentation/src/main/res/drawable/ic_plus.png new file mode 100644 index 0000000000000000000000000000000000000000..7297719c9add3ccb692c7d08be06b4f74644ebed GIT binary patch literal 361 zcmeAS@N?(olHy`uVBq!ia0vp^h9Jzr1|*B;ILZJi&H|6fVg?2=RS;(M3{v?36l5$8 za(7}_cTVOdki(Mh=8*6)sK?c)o& zWT~z&r{|8sJB`M^zST=U?~2g9#};%WC}>ZH$l2>hrgguVu6kOTSxKpfr;ktG{?LZsxsdPS4)^^WX77H-!K0dQhR zXUEaN5cacM82RR{zcAgv+5XA1(mbGbof1LEg#xbTUTP^cFV8hR6mU%;dFPpPw~uxx zZm%|eeelqSnF7CmdiUMizwh+RpPwH$pZ@<+@U)Ylj>tg-amYOB7DIje + + + + + + + + \ No newline at end of file From 049a586562ba2506bc05611b884680b080452150 Mon Sep 17 00:00:00 2001 From: soopeach Date: Thu, 14 Mar 2024 15:19:25 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[fix/restaurant=5Fdetail=5Fscroll]:=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EC=8B=9C=20=ED=88=B4=20=EB=B0=94?= =?UTF-8?q?=EC=97=90=20=EB=A7=9B=EC=A7=91=EC=9D=B4=EB=A6=84=EC=9D=B4=20?= =?UTF-8?q?=EB=B3=B4=EC=9D=B4=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../restaurantdetail/RestaurantDetailFragment.kt | 14 ++++++++++++++ .../main/res/layout/fragment_restaurant_detail.xml | 1 + 2 files changed, 15 insertions(+) diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantDetailFragment.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantDetailFragment.kt index 07eaadfb..ee66e82e 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantDetailFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantDetailFragment.kt @@ -10,6 +10,7 @@ import android.view.View import android.view.ViewGroup import android.widget.Toast import androidx.core.net.toUri +import androidx.core.widget.NestedScrollView import androidx.fragment.app.activityViewModels import androidx.fragment.app.setFragmentResultListener import androidx.lifecycle.lifecycleScope @@ -21,12 +22,14 @@ import kotlinx.coroutines.launch import okhttp3.MediaType import okhttp3.MultipartBody import okhttp3.RequestBody +import org.gdsc.domain.Empty import org.gdsc.presentation.R import org.gdsc.presentation.databinding.FragmentRestaurantDetailBinding import org.gdsc.presentation.utils.BitmapUtils.getCompressedBitmapFromUri import org.gdsc.presentation.utils.BitmapUtils.saveBitmapToFile import org.gdsc.presentation.utils.CalculatorUtils import org.gdsc.presentation.utils.repeatWhenUiStarted +import org.gdsc.presentation.view.MainActivity import org.gdsc.presentation.view.mypage.adapter.PhotoWillBeUploadedAdapter import org.gdsc.presentation.view.mypage.adapter.RestaurantDetailPagerAdapter import org.gdsc.presentation.view.mypage.viewmodel.RestaurantDetailViewModel @@ -39,6 +42,8 @@ class RestaurantDetailFragment : Fragment() { private val viewModel: RestaurantDetailViewModel by activityViewModels() + private val parentActivity by lazy { activity as MainActivity } + private val adapter = PhotoWillBeUploadedAdapter { viewModel.deletePhotoForReviewState(it) } @@ -63,6 +68,15 @@ class RestaurantDetailFragment : Fragment() { } } + binding.topScrollView.setOnScrollChangeListener( + NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY -> + if (scrollY > binding.tvRestaurantName.height) { + parentActivity.changeToolbarTitle(binding.tvRestaurantName.text.toString()) + } else { + parentActivity.changeToolbarTitle(String.Empty) + } + }) + binding.rvImageListWillBeUploaded.adapter = adapter binding.addImageIcon.setOnClickListener { diff --git a/presentation/src/main/res/layout/fragment_restaurant_detail.xml b/presentation/src/main/res/layout/fragment_restaurant_detail.xml index ab0875d3..48afbcd4 100644 --- a/presentation/src/main/res/layout/fragment_restaurant_detail.xml +++ b/presentation/src/main/res/layout/fragment_restaurant_detail.xml @@ -6,6 +6,7 @@ android:layout_height="match_parent"> Date: Thu, 14 Mar 2024 15:23:20 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[fix/restaurant=5Fdetail=5Fscroll]:=20?= =?UTF-8?q?=EB=A7=9B=EC=A7=91=20=EC=82=AC=EC=A7=84=20=EC=8A=AC=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=8D=94=20=EB=8D=94=EB=AF=B8=20=EA=B0=92=20=EB=8C=80?= =?UTF-8?q?=EC=8B=A0=20=EC=8B=A4=EC=A0=9C=20=EA=B0=92=EC=9D=B4=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EB=90=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../restaurantdetail/RestaurantInfoFragment.kt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt index a0fbf583..70e5e369 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/restaurantdetail/RestaurantInfoFragment.kt @@ -86,6 +86,10 @@ class RestaurantInfoFragment : Fragment() { binding.cgRecommendDrink.addView(newChip(it)) } } + + photoAdapter.submitList(pictures.map { + ImagePagerItem(it) + }) } } } @@ -112,17 +116,6 @@ class RestaurantInfoFragment : Fragment() { binding.pagerPhotos.adapter = photoAdapter - photoAdapter.submitList( - listOf( - ImagePagerItem("https://picsum.photos/200/200"), - ImagePagerItem("https://picsum.photos/200/200"), - ImagePagerItem("https://picsum.photos/200/200"), - ImagePagerItem("https://picsum.photos/200/200"), - ImagePagerItem("https://picsum.photos/200/200"), - ImagePagerItem("https://picsum.photos/200/200"), - ) - ) - binding.rvReviews.adapter = restaurantReviewAdapter binding.rvReviews.layoutManager = LinearLayoutManager(context)