Skip to content

Commit

Permalink
[ui/#32]: 카테고리 구현, 인기 매장 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
NaZe0320 committed Jan 29, 2024
1 parent 40742d7 commit 83e2ca7
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ package com.umc.coumo.presentation.fragment
import android.os.Bundle
import android.view.View
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.viewpager2.widget.ViewPager2
import com.umc.coumo.R
import com.umc.coumo.databinding.FragmentHomeMainBinding
import com.umc.coumo.domain.model.BannerCardModel
import com.umc.coumo.domain.model.StoreInfoModel
import com.umc.coumo.presentation.adapter.BannerPagerAdapter
import com.umc.coumo.presentation.adapter.StoreInfoAdapter
import com.umc.coumo.utils.ItemSpacingDecoration
import com.umc.coumo.utils.binding.BindingFragment

class HomeMainFragment: BindingFragment<FragmentHomeMainBinding>(R.layout.fragment_home_main) {
Expand All @@ -16,10 +20,42 @@ class HomeMainFragment: BindingFragment<FragmentHomeMainBinding>(R.layout.fragme
super.onViewCreated(view, savedInstanceState)

setBanner()
setRecyclerView()
setButton()
}

private fun setButton() {
binding.ivCafe.setOnClickListener {
val bundle = Bundle().apply {
putString("type","cafe")
}
findNavController().navigate(
R.id.action_homeMainFragment_to_homeSubFragment, bundle
)
}
}

private fun setRecyclerView() {
val storeInfoAdapter = StoreInfoAdapter()

binding.btnTest.setOnClickListener {
findNavController().navigate(R.id.action_homeMainFragment_to_homeSubFragment)
binding.rvPopular.apply {
adapter = storeInfoAdapter
addItemDecoration(ItemSpacingDecoration(requireContext(),resources.getDimensionPixelSize(R.dimen.item_between_horizontal)))
layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}

val list = listOf<StoreInfoModel>(
StoreInfoModel(1, null,"앙떼띠 로스터리(강남점)", "강남구 테헤란로 43-7", "양떼띠 로스터리는 2017년에 오픈한 강남의 유명 카페입니다. 강남역 직장인들을 위해 평일 오전 7시~9시에\n" +
"아메리카노 2000원 이벤트를 진행 중입니다."),
StoreInfoModel(2, null,"앙떼띠 로스터리(강남점)", "강남구 테헤란로 43-7", "양떼띠 로스터리는 2017년에 오픈한 강남의 유명 카페입니다. 강남역 직장인들을 위해 평일 오전 7시~9시에\n" +
"아메리카노 2000원 이벤트를 진행 중입니다."),
StoreInfoModel(3, null,"앙떼띠 로스터리(강남점)", "강남구 테헤란로 43-7", "양떼띠 로스터리는 2017년에 오픈한 강남의 유명 카페입니다. 강남역 직장인들을 위해 평일 오전 7시~9시에\n" +
"아메리카노 2000원 이벤트를 진행 중입니다."),
StoreInfoModel(4, null,"앙떼띠 로스터리(강남점)", "강남구 테헤란로 43-7", "양떼띠 로스터리는 2017년에 오픈한 강남의 유명 카페입니다. 강남역 직장인들을 위해 평일 오전 7시~9시에\n" +
"아메리카노 2000원 이벤트를 진행 중입니다."),
)

storeInfoAdapter.submitList(list)
}

private fun setBanner() {
Expand Down
Binary file added app/src/main/res/drawable/image_beauty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/image_cafe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/image_class.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/image_food.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/image_retail_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/image_retail_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
172 changes: 135 additions & 37 deletions app/src/main/res/layout/fragment_home_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,50 +66,148 @@
app:layout_constraintEnd_toEndOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/section_tab_bar">

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/banner_home"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_marginTop="27dp"
android:background="@drawable/shape_rect_round_4"
android:clipToOutline="true"
android:layout_marginHorizontal="@dimen/horizontal_padding"
app:layout_constraintTop_toTopOf="parent"/>

<TextView
android:id="@+id/tv_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="54dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_rect_side_round"
android:backgroundTint="#80000000"
android:paddingHorizontal="4dp"
android:paddingVertical="4dp"
android:text="6/10"
android:fontFamily="@font/pretendard_regular"
android:textColor="#FFFFFF"
android:textSize="12sp"
android:gravity="center"
app:layout_constraintTop_toTopOf="@+id/banner_home"
app:layout_constraintEnd_toEndOf="@id/banner_home"/>
</androidx.constraintlayout.widget.ConstraintLayout>
android:paddingBottom="84dp">

<Button
android:id="@+id/btn_test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/section_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/banner_home"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_marginTop="27dp"
android:background="@drawable/shape_rect_round_4"
android:clipToOutline="true"
android:layout_marginHorizontal="@dimen/horizontal_padding"
app:layout_constraintTop_toTopOf="parent"/>

<TextView
android:id="@+id/tv_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="54dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_rect_side_round"
android:backgroundTint="#80000000"
android:paddingHorizontal="4dp"
android:paddingVertical="4dp"
android:text="6/10"
android:fontFamily="@font/pretendard_regular"
android:textColor="#FFFFFF"
android:textSize="12sp"
android:gravity="center"
app:layout_constraintTop_toTopOf="@+id/banner_home"
app:layout_constraintEnd_toEndOf="@id/banner_home"/>
</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/section_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="34dp"
android:paddingHorizontal="@dimen/horizontal_padding"
app:layout_constraintTop_toBottomOf="@id/section_banner">

<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/iv_cafe"
android:layout_width="68dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/image_cafe"
app:layout_constraintEnd_toStartOf="@id/iv_retail_1"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/iv_retail_1"
android:layout_width="68dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/image_retail_1"
app:layout_constraintEnd_toStartOf="@id/iv_food"
app:layout_constraintStart_toEndOf="@id/iv_cafe"
app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/iv_food"
android:layout_width="68dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/image_food"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_retail_1"
app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/iv_retail_2"
android:layout_width="68dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/image_retail_2"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toStartOf="@id/iv_beauty"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_cafe" />

<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/iv_beauty"
android:layout_width="68dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/image_beauty"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toStartOf="@id/iv_class"
app:layout_constraintStart_toEndOf="@id/iv_retail_2"
app:layout_constraintTop_toBottomOf="@id/iv_retail_1" />

<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/iv_class"
android:layout_width="68dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/image_class"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_beauty"
app:layout_constraintTop_toBottomOf="@id/iv_food" />


</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/tv_popular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="다빈님 주변 인기 매장은?"
android:layout_marginTop="36dp"
android:fontFamily="@font/pretendard_700"
android:textSize="22sp"
android:textColor="@color/font_text"
android:layout_marginStart="@dimen/horizontal_padding"
app:layout_constraintTop_toBottomOf="@id/section_category"
app:layout_constraintStart_toStartOf="parent"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_popular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/tv_popular"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

0 comments on commit 83e2ca7

Please sign in to comment.