diff --git a/android/app/src/main/java/com/woowacourse/friendogly/presentation/ui/chatlist/WoofBottomSheet.kt b/android/app/src/main/java/com/woowacourse/friendogly/presentation/ui/chatlist/WoofBottomSheet.kt new file mode 100644 index 000000000..74094947c --- /dev/null +++ b/android/app/src/main/java/com/woowacourse/friendogly/presentation/ui/chatlist/WoofBottomSheet.kt @@ -0,0 +1,80 @@ +package com.woowacourse.friendogly.presentation.ui.chatlist + +import android.app.Dialog +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.FrameLayout +import android.widget.ImageView +import android.widget.TextView +import com.bumptech.glide.Glide +import com.bumptech.glide.load.resource.bitmap.CenterCrop +import com.bumptech.glide.load.resource.bitmap.RoundedCorners +import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialog +import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.woowacourse.friendogly.R +import com.woowacourse.friendogly.presentation.utils.bindGlide1000 +import com.woowacourse.friendogly.presentation.utils.bundleParcelable + +class WoofBottomSheet : BottomSheetDialogFragment() { + + private lateinit var dlg: BottomSheetDialog + + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + dlg = super.onCreateDialog(savedInstanceState) as BottomSheetDialog + dlg.setOnShowListener { + val bottomSheet = + dlg.findViewById(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout + + val behavior = BottomSheetBehavior.from(bottomSheet) + behavior.isDraggable = false + behavior.state = BottomSheetBehavior.STATE_EXPANDED + } + return dlg + } + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return inflater.inflate(R.layout.bottom_sheet_woof, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + //setBackgroundTransparent() + + val info = this.arguments?.bundleParcelable(EXTRA_DOG_INFO_ID, WoofDogUiModel::class.java) + ?: error("dog info가 잘못 들어옴") + + dlg.findViewById(R.id.tv_woof_dog_name)?.text = info.name + dlg.findViewById(R.id.tv_woof_dog_age)?.text = "${info.age} 살" + dlg.findViewById(R.id.tv_woof_dog_gender)?.text = info.name + dlg.findViewById(R.id.tv_woof_dog_size)?.text = info.size + dlg.findViewById(R.id.tv_woof_dog_desc)?.text = info.description + + Glide.with(requireContext()) + .load(info.imageUrl) + .into(dlg.findViewById(R.id.iv_woof_dog)!!) + + } + + private fun setBackgroundTransparent() { + dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + } + + companion object { + private const val EXTRA_DOG_INFO_ID = "dogInfo" + + fun getBundle(dog: WoofDogUiModel): Bundle { + return Bundle().apply { this.putParcelable(EXTRA_DOG_INFO_ID, dog) } + } + } + + +} diff --git a/android/app/src/main/java/com/woowacourse/friendogly/presentation/ui/chatlist/WoofDogUiModel.kt b/android/app/src/main/java/com/woowacourse/friendogly/presentation/ui/chatlist/WoofDogUiModel.kt new file mode 100644 index 000000000..1b541f77e --- /dev/null +++ b/android/app/src/main/java/com/woowacourse/friendogly/presentation/ui/chatlist/WoofDogUiModel.kt @@ -0,0 +1,14 @@ +package com.woowacourse.friendogly.presentation.ui.chatlist + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + + +@Parcelize +data class WoofDogUiModel( + val imageUrl: String, + val name: String, + val size: String, + val age: Int, + val description: String, +): Parcelable diff --git a/android/app/src/main/res/layout/bottom_sheet_woof.xml b/android/app/src/main/res/layout/bottom_sheet_woof.xml new file mode 100644 index 000000000..0d14ea780 --- /dev/null +++ b/android/app/src/main/res/layout/bottom_sheet_woof.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +