Skip to content

Commit

Permalink
Merge pull request #104 from POLZZAK/feat/bottom_sheet_modify
Browse files Browse the repository at this point in the history
Feat/bottom sheet modify
  • Loading branch information
HS0204 authored Sep 6, 2023
2 parents 2a3f86d + 47b21cb commit 41f6631
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class CommonBottomSheetHelper(
)
})
}

BottomSheetType.COUPON -> {
binding.bottomSheetPositiveButton.isEnabled = true
binding.giftDay.text = data.contentList.first().toString()
}
}

this.adapter.updateItem(item = items)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.polzzak_android.presentation.component.bottomsheet

import android.text.Spannable
import com.polzzak_android.presentation.common.model.CommonButtonModel

data class CommonBottomSheetModel(
val type: BottomSheetType,
val title: String,
val subTitle: String? = null,
val title: Spannable,
val subTitle: Spannable? = null,
val contentList: List<*>,
val button: CommonButtonModel
)
Expand All @@ -14,7 +15,8 @@ data class CommonBottomSheetModel(
* MISSION : 미션
* PROFILE_IMAGE : 프로필 이미지형
* SELECT_STAMP_BOARD : 도장판 조회
* COUPON : 쿠폰
*/
enum class BottomSheetType {
MISSION, PROFILE_IMAGE, SELECT_STAMP_BOARD
MISSION, PROFILE_IMAGE, SELECT_STAMP_BOARD, COUPON
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View
import android.widget.TextView
import android.widget.Toast
import androidx.core.text.toSpannable
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
Expand Down Expand Up @@ -123,7 +124,7 @@ class CouponContentFragment : BaseFragment<FragmentCouponContentBinding>(), Coup
CommonBottomSheetHelper.getInstance(
data = CommonBottomSheetModel(
type = BottomSheetType.SELECT_STAMP_BOARD,
title = "누구에게 선물한 쿠폰을 볼까요?",
title = "누구에게 선물한 쿠폰을 볼까요?".toSpannable(),
contentList = userList.map { it.toSelectUserStampBoardModel() },
button = CommonButtonModel(
buttonCount = ButtonCount.ZERO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.polzzak_android.presentation.feature.stamp.detail.protector

import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.core.text.toSpannable
import androidx.fragment.app.viewModels
import com.polzzak_android.R
import com.polzzak_android.databinding.FragmentKidStampBoardDetailBinding
Expand Down Expand Up @@ -60,7 +61,7 @@ class ProtectorStampBoardDetailFragment : BaseFragment<FragmentKidStampBoardDeta
content = CommonDialogModel(
type = DialogStyleType.MISSION,
content = CommonDialogContent(
title = "미션 완료",
title = "미션 완료".toSpannable(),
mission = CommonDialogMissionData(
img = "",
missionTitle = stamp.missionContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.polzzak_android.presentation.feature.stamp.main.progress
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.core.text.toSpannable
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
Expand Down Expand Up @@ -153,7 +154,7 @@ class ProtectorProgressFragment : BaseFragment<FragmentProgressBinding>(), MainP
CommonBottomSheetHelper.getInstance(
data = CommonBottomSheetModel(
type = BottomSheetType.SELECT_STAMP_BOARD,
title = "누구의 도장판을 볼까요?",
title = "누구의 도장판을 볼까요?".toSpannable(),
contentList = userList.map { it.toSelectUserStampBoardModel() },
button = CommonButtonModel(
buttonCount = ButtonCount.ZERO
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/bg_gray_stroke_light_gray_bg_r8.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/gray_100" />
<stroke
android:width="1dp"
android:color="@color/gray_200" />
<corners android:radius="8dp" />
</shape>
109 changes: 100 additions & 9 deletions app/src/main/res/layout/common_bottom_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
name="buttonCount"
type="com.polzzak_android.presentation.common.model.ButtonCount" />

<variable
name="type"
type="com.polzzak_android.presentation.component.bottomsheet.BottomSheetType" />

<variable
name="bottomSheet"
type="com.polzzak_android.presentation.component.bottomsheet.CommonBottomSheetHelper" />
Expand Down Expand Up @@ -63,35 +67,122 @@
android:gravity="center"
android:text="@{data.subTitle}"
android:textColor="@color/gray_500"
app:layout_constraintBottom_toTopOf="@id/bottom_sheet_recycler_view"
app:layout_constraintBottom_toTopOf="@id/bottom_sheet_content_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottom_sheet_title"
tools:text="서브 제목" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/bottom_sheet_recycler_view"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bottom_sheet_content_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:clipToPadding="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@id/bottom_sheet_button_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottom_sheet_subtitle"
tools:itemCount="3"
tools:listitem="@layout/item_select_user_filter" />
app:layout_constraintTop_toBottomOf="@id/bottom_sheet_subtitle">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/bottom_sheet_recycler_view"
setVisibility="@{data.type != type.COUPON}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:itemCount="3"
tools:listitem="@layout/item_select_user_filter" />

<!-- 쿠폰 -->
<androidx.constraintlayout.widget.ConstraintLayout
setVisibility="@{data.type == type.COUPON}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/coupon_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher_background"
app:layout_constraintBottom_toTopOf="@id/coupon_alert_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/coupon_alert_text"
style="@style/caption.12.500"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center"
android:text="언제까지 선물을 주실 예정인가요?\n선물 예정일은 수정이 불가하니 신중하게 정해주세요."
android:textColor="@color/gray_500"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/coupon_d_day_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/coupon_img" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/coupon_d_day_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="47dp"
android:background="@drawable/bg_gray_stroke_light_gray_bg_r8"
android:paddingHorizontal="16dp"
android:paddingVertical="14dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/coupon_alert_text">

<TextView
android:id="@+id/gift_title"
style="@style/body.14.500"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="선물 예정일"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/gift_day"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/gift_day"
style="@style/body.14.500"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/gift_title"
app:layout_constraintTop_toTopOf="parent"
tools:text="2023.03.30" />

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

<LinearLayout
android:id="@+id/bottom_sheet_button_container"
setVisibility="@{data.button.buttonCount != buttonCount.ZERO}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottom_sheet_recycler_view">
app:layout_constraintTop_toBottomOf="@id/bottom_sheet_content_container">

<Button
android:id="@+id/bottom_sheet_negative_button"
Expand Down

0 comments on commit 41f6631

Please sign in to comment.