Skip to content

Commit

Permalink
#45 [feat] 상세 화면 API 연결 - 2
Browse files Browse the repository at this point in the history
#45 [feat] 상세 화면 API 연결
  • Loading branch information
NaZe0320 authored Feb 8, 2024
2 parents 4effb9a + df6b88c commit 66cd4d2
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class CoumoRepositoryImpl @Inject constructor(
stampCount = response.coupon.cnt,
color = response.coupon.color,
stampMax = 10,
stampImage = Uri.parse(response.coupon.stampType)
stampImage = imageNullCheck(response.coupon.stampType)
),
menuList = response.menus?.map {
MenuModel(
name = it.name,
description = it.description,
image = Uri.parse(it.image),
image = imageNullCheck(it.image),
isNew = it.isNew
)
}
Expand All @@ -79,7 +79,7 @@ class CoumoRepositoryImpl @Inject constructor(
return responseList?.map { response ->
StoreCouponCountModel(
id = response.storeId,
image = Uri.parse(response.storeImage),
image = imageNullCheck(response.storeImage),
name = response.name,
coupon = response.couponCnt
)
Expand All @@ -90,12 +90,19 @@ class CoumoRepositoryImpl @Inject constructor(
return responseList?.map { response ->
StoreInfoItemModel(
id = response.storeId,
image = Uri.parse(response.storeImage),
image = imageNullCheck(response.storeImage),
name = response.name,
address = response.location,
description = response.description,
)
}
}

private fun imageNullCheck(uri: String?): Uri? {
return if (uri != null) {
Uri.parse(uri)
} else {
null
}
}
}
214 changes: 109 additions & 105 deletions app/src/main/res/layout/fragment_home_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,132 +9,136 @@
type="com.umc.coumo.domain.viewmodel.HomeViewModel" />
</data>


<androidx.constraintlayout.widget.ConstraintLayout
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/section_tool_bar"
android:layout_width="match_parent"
style="@style/TabBarDefaultStyle"
app:layout_constraintTop_toTopOf="parent">

<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/btn_toolbar_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/icon_chevron_left"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>

<TextView
android:id="@+id/tv_toolBar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{viewModel.category.title}"
android:textColor="@color/main"
android:textSize="18sp"
android:fontFamily="@font/pretendard_600"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
android:layout_height="match_parent">

</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/section_tool_bar"
android:layout_width="match_parent"
style="@style/TabBarDefaultStyle"
app:layout_constraintTop_toTopOf="parent">

<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/btn_toolbar_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/icon_chevron_left"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>

<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/section_tool_bar">
<TextView
android:id="@+id/tv_toolBar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{viewModel.category.title}"
android:textColor="@color/main"
android:textSize="18sp"
android:fontFamily="@font/pretendard_600"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>

<androidx.constraintlayout.widget.ConstraintLayout
</androidx.constraintlayout.widget.ConstraintLayout>

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

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/section_locate_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="27dp"
android:paddingHorizontal="@dimen/horizontal_padding"
app:layout_constraintTop_toTopOf="parent">
android:layout_height="match_parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_marginEnd="18dp"
android:background="@drawable/shape_rect_round_6"
android:backgroundTint="#EDEDED"
android:paddingHorizontal="8dp"
android:paddingVertical="6dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/btn_refresh">
android:id="@+id/section_locate_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="27dp"
android:paddingHorizontal="@dimen/horizontal_padding"
app:layout_constraintTop_toTopOf="parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_marginEnd="18dp"
android:background="@drawable/shape_rect_round_6"
android:backgroundTint="#EDEDED"
android:paddingHorizontal="8dp"
android:paddingVertical="6dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/btn_refresh">

<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/iv_locate"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/icon_locate_color"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/shape_rect_round_6"
android:backgroundTint="#EDEDED"
android:text="반경 500m 이내의 검색결과입니다!"
android:textSize="12sp"
android:textColor="@color/main"
android:fontFamily="@font/pretendard_600"
android:layout_marginStart="2dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_locate"
app:layout_constraintBottom_toBottomOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>


<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/iv_locate"
android:id="@+id/btn_refresh"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/icon_locate_color"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/shape_rect_round_6"
android:backgroundTint="#EDEDED"
android:text="반경 500m 이내의 검색결과입니다!"
android:textSize="12sp"
android:textColor="@color/main"
android:fontFamily="@font/pretendard_600"
android:layout_marginStart="2dp"
android:src="@drawable/icon_refresh"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_locate"
app:layout_constraintBottom_toBottomOf="parent"/>
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>


<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/btn_refresh"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/icon_refresh"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView
android:id="@+id/tv_list_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="다빈님 근처 카페/디저트 매장"
android:fontFamily="@font/pretendard_700"
android:textSize="20sp"
android:textColor="@color/font_text"
android:layout_marginStart="@dimen/horizontal_padding"
android:layout_marginTop="30dp"
app:layout_constraintTop_toBottomOf="@id/section_locate_section"
app:layout_constraintStart_toStartOf="parent"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_store"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/horizontal_padding"
android:layout_marginTop="22dp"
android:paddingBottom="@dimen/bottom_above"
android:nestedScrollingEnabled="false"
app:layout_constraintTop_toBottomOf="@id/tv_list_title"/>

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

<TextView
android:id="@+id/tv_list_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="다빈님 근처 카페/디저트 매장"
android:fontFamily="@font/pretendard_700"
android:textSize="20sp"
android:textColor="@color/font_text"
android:layout_marginStart="@dimen/horizontal_padding"
android:layout_marginTop="30dp"
app:layout_constraintTop_toBottomOf="@id/section_locate_section"
app:layout_constraintStart_toStartOf="parent"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_store"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/horizontal_padding"
android:layout_marginTop="22dp"
android:paddingBottom="@dimen/bottom_above"
android:nestedScrollingEnabled="false"
app:layout_constraintTop_toBottomOf="@id/tv_list_title"/>

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

0 comments on commit 66cd4d2

Please sign in to comment.