-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
.../app/src/main/java/com/woowacourse/friendogly/presentation/ui/chatlist/WoofBottomSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<View>(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<TextView>(R.id.tv_woof_dog_name)?.text = info.name | ||
dlg.findViewById<TextView>(R.id.tv_woof_dog_age)?.text = "${info.age} 살" | ||
dlg.findViewById<TextView>(R.id.tv_woof_dog_gender)?.text = info.name | ||
dlg.findViewById<TextView>(R.id.tv_woof_dog_size)?.text = info.size | ||
dlg.findViewById<TextView>(R.id.tv_woof_dog_desc)?.text = info.description | ||
|
||
Glide.with(requireContext()) | ||
.load(info.imageUrl) | ||
.into(dlg.findViewById<ImageView>(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) } | ||
} | ||
} | ||
|
||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...d/app/src/main/java/com/woowacourse/friendogly/presentation/ui/chatlist/WoofDogUiModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/layout_woof_walk" | ||
style="@style/Widget.Material3.BottomSheet" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@color/white" | ||
android:paddingBottom="30dp" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<com.google.android.material.bottomsheet.BottomSheetDragHandleView | ||
android:id="@+id/drag_handle_woof_walk" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
|
||
<com.google.android.material.imageview.ShapeableImageView | ||
android:id="@+id/iv_woof_dog" | ||
android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
android:layout_marginHorizontal="90dp" | ||
android:layout_marginTop="7dp" | ||
android:src="@drawable/img_woof_bottom_sheet_dog" | ||
app:layout_constraintDimensionRatio="1:1" | ||
app:layout_constraintTop_toBottomOf="@id/drag_handle_woof_walk" | ||
app:shapeAppearanceOverlay="@style/RoundBig" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_woof_dog_name" | ||
style="@style/Theme.AppCompat.TextView.SemiBold.Gray10.Size18" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="30dp" | ||
android:gravity="center" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/iv_woof_dog" | ||
tools:text="땡이가 여기서 산책하고 있어요!" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_woof_dog_age" | ||
style="@style/Theme.AppCompat.TextView.Regular.White.Size14" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
android:background="@drawable/rect_orange700_fill_12" | ||
android:paddingHorizontal="25dp" | ||
android:paddingVertical="7dp" | ||
app:layout_constraintEnd_toStartOf="@id/tv_woof_dog_size" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/tv_woof_dog_name" | ||
tools:text="11살" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_woof_dog_size" | ||
style="@style/Theme.AppCompat.TextView.Regular.White.Size14" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
android:background="@drawable/rect_orange700_fill_12" | ||
android:paddingHorizontal="25dp" | ||
android:paddingVertical="7dp" | ||
app:layout_constraintEnd_toStartOf="@id/tv_woof_dog_gender" | ||
app:layout_constraintStart_toEndOf="@id/tv_woof_dog_age" | ||
app:layout_constraintTop_toBottomOf="@id/tv_woof_dog_name" | ||
tools:text="소형견" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_woof_dog_gender" | ||
style="@style/Theme.AppCompat.TextView.Regular.White.Size14" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
android:background="@drawable/rect_orange700_fill_12" | ||
android:paddingHorizontal="25dp" | ||
android:paddingVertical="7dp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/tv_woof_dog_size" | ||
app:layout_constraintTop_toBottomOf="@id/tv_woof_dog_name" | ||
tools:text="암컷" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_woof_dog_introduce" | ||
style="@style/Theme.AppCompat.TextView.SemiBold.Black.Size16" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="20dp" | ||
android:layout_marginTop="30dp" | ||
android:text="소개" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/tv_woof_dog_age" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_woof_dog_desc" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="15dp" | ||
android:layout_marginTop="10dp" | ||
android:padding="15dp" | ||
style="@style/Theme.AppCompat.TextView.Regular.Black.Size14" | ||
tools:text="dfdsfsdfsdfdsfds" | ||
android:background="@drawable/rect_orange100_fill_12" | ||
android:minHeight="80dp" | ||
app:layout_constraintTop_toBottomOf="@id/tv_woof_dog_introduce" /> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |