Skip to content

Commit

Permalink
[simba/#33] feat:: Bottom Sheet Dialog 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
BAEK0111 committed May 28, 2024
1 parent 9902ae3 commit a095a39
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.example.umc_6th

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import com.example.umc_6th.databinding.FragmentBottomSheetBinding
import com.google.android.material.bottomsheet.BottomSheetDialogFragment

class BottomSheetFragment : BottomSheetDialogFragment() {

lateinit var binding: FragmentBottomSheetBinding

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentBottomSheetBinding.inflate(inflater,container,false)
return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

binding.bottomSheetIv1.setOnClickListener {
Toast.makeText(requireActivity(),"듣기 버튼 클릭",Toast.LENGTH_SHORT).show()
}
binding.bottomSheetIv2.setOnClickListener {
Toast.makeText(requireActivity(),"재생목록 버튼 클릭",Toast.LENGTH_SHORT).show()
}
binding.bottomSheetIv3.setOnClickListener {
Toast.makeText(requireActivity(),"내 리스트 버튼 클릭",Toast.LENGTH_SHORT).show()
}
binding.bottomSheetIv4.setOnClickListener {
Toast.makeText(requireActivity(),"삭제 버튼 클릭",Toast.LENGTH_SHORT).show()
}
}
}
11 changes: 11 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/LockerFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class LockerFragment : Fragment() {

lateinit var binding: FragmentLockerBinding
private var information = arrayListOf("저장한곡", "음악파일", "저장앨범")
val bottomSheetFragment = BottomSheetFragment()


override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand All @@ -26,6 +29,14 @@ class LockerFragment : Fragment() {
tab.text = information[position]
}.attach()

binding.lockerSelectAllImgIv.setOnClickListener {
bottomSheetFragment.show(requireFragmentManager(),"BottomSheetDialog")
}

binding.lockerSelectAllTv.setOnClickListener{
bottomSheetFragment.show(requireFragmentManager(),"BottomSheetDialog")
}

return binding.root
}
}
108 changes: 108 additions & 0 deletions UMC_6th/app/src/main/res/layout/fragment_bottom_sheet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?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"
android:gravity="center_horizontal"
tools:context=".BottomSheetFragment"
android:background="@color/colorPrimary">

<TextView
android:id="@+id/bottom_sheet_tv1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:gravity="center"
android:text="듣기"
android:background="@color/transparent"
android:textSize="15sp"
android:textColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/bottom_sheet_tv2"
app:layout_constraintTop_toTopOf="parent"/>

<ImageView
android:id="@+id/bottom_sheet_iv1"
android:layout_width="0dp"
android:layout_height="50dp"
android:src="@drawable/btn_miniplayer_play"
app:layout_constraintBottom_toTopOf="@+id/bottom_sheet_tv1"
app:layout_constraintEnd_toStartOf="@+id/bottom_sheet_iv2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/bottom_sheet_tv2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:background="@color/transparent"
android:gravity="center"
android:text="재생목록"
android:textColor="@color/white"
android:textSize="15sp"
app:layout_constraintEnd_toStartOf="@+id/bottom_sheet_tv3"
app:layout_constraintStart_toEndOf="@+id/bottom_sheet_tv1"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/bottom_sheet_iv2"
android:layout_width="0dp"
android:layout_height="50dp"
android:src="@drawable/btn_miniplayer_play"
app:layout_constraintBottom_toTopOf="@+id/bottom_sheet_tv2"
app:layout_constraintStart_toEndOf="@+id/bottom_sheet_iv1"
app:layout_constraintEnd_toStartOf="@+id/bottom_sheet_iv3"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/bottom_sheet_tv3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:background="@color/transparent"
android:gravity="center"
android:text="내 리스트"
android:textColor="@color/white"
android:textSize="15sp"
app:layout_constraintEnd_toStartOf="@+id/bottom_sheet_tv4"
app:layout_constraintStart_toEndOf="@+id/bottom_sheet_tv2"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/bottom_sheet_iv3"
android:layout_width="0dp"
android:layout_height="50dp"
android:src="@drawable/btn_miniplayer_play"
app:layout_constraintBottom_toTopOf="@+id/bottom_sheet_tv2"
app:layout_constraintStart_toEndOf="@+id/bottom_sheet_iv2"
app:layout_constraintEnd_toStartOf="@id/bottom_sheet_iv4"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/bottom_sheet_tv4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:background="@color/transparent"
android:gravity="center"
android:text="삭제"
android:textColor="@color/white"
android:textSize="15sp"
app:layout_constraintStart_toEndOf="@+id/bottom_sheet_tv3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/bottom_sheet_iv4"
android:layout_width="0dp"
android:layout_height="50dp"
android:src="@drawable/btn_miniplayer_play"
app:layout_constraintBottom_toTopOf="@+id/bottom_sheet_tv2"
app:layout_constraintStart_toEndOf="@+id/bottom_sheet_iv3"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit a095a39

Please # to comment.