Skip to content

Commit

Permalink
[maro/#28] feat :: 보관함 개발
Browse files Browse the repository at this point in the history
  • Loading branch information
leesumin0526 committed May 20, 2024
1 parent c6ad832 commit 45d95cd
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 43 deletions.
35 changes: 28 additions & 7 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 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 @@ -10,21 +10,21 @@ import com.google.android.material.tabs.TabLayoutMediator

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

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

val lockerAdapter = LockerVPAdapter(this)
binding.lockerContentVp.adapter = lockerAdapter

TabLayoutMediator(binding.lockerContentTb, binding.lockerContentVp){
tab, position ->
TabLayoutMediator(binding.lockerContentTb, binding.lockerContentVp) { tab, position ->
tab.text = information[position]
}.attach()

return binding.root
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.myfirstapp.SavedAlbumFragment

class LockerVPAdapter (fragment: Fragment) : FragmentStateAdapter(fragment){
override fun getItemCount(): Int = 3
override fun getItemCount(): Int = 2

override fun createFragment(position: Int): Fragment {
return when(position){
0 -> SavedSongFragment()
1 -> SavedAlbumFragment()
else -> SavedAlbumFragment()
else -> MusicFileFragment()
}
}

Expand Down
34 changes: 27 additions & 7 deletions UMC_6th/app/src/main/java/com/example/umc_6th/SavedSongFragment.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
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 com.example.umc_6th.databinding.FragmentSongBinding
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.umc_6th.databinding.FragmentSavedSongBinding

class SavedSongFragment : Fragment(){
class SavedSongFragment : Fragment() {

lateinit var binding: FragmentSongBinding
private var albumDatas = ArrayList<Album>()
lateinit var binding : FragmentSavedSongBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}

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

binding = FragmentSavedSongBinding.inflate(inflater, container, false)

albumDatas.apply {
add(Album("Butter", "방탄소년단 (BTS)", R.drawable.img_album_exp))
add(Album("Lilac", "아이유 (IU)", R.drawable.img_album_exp2))
add(Album("Next Level", "에스파 (AESPA)", R.drawable.img_album_exp3))
add(Album("Boy with Luv", "방탄소년단 (BTS)", R.drawable.img_album_exp4))
add(Album("BBoom BBoom", "모모랜드 (MOMOLAND)", R.drawable.img_album_exp5))
add(Album("Weekend", "태연 (Tae Yeon)", R.drawable.img_album_exp6))
}

val lockerAlbumRVAdapter = LockerAlbumRVAdapter(albumDatas)
binding.lockerMusicAlbumRv.adapter = lockerAlbumRVAdapter
binding.lockerMusicAlbumRv.layoutManager = LinearLayoutManager(requireActivity())

return binding.root
}
}
72 changes: 60 additions & 12 deletions UMC_6th/app/src/main/res/layout/fragment_locker.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?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"
android:id="@+id/fragment_locker"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand All @@ -10,9 +9,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="보관함"
android:textSize="23sp"
android:textSize="25dp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_marginTop="50dp"
android:layout_marginTop="55dp"
android:layout_marginStart="20dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
Expand All @@ -31,28 +31,76 @@

<com.google.android.material.tabs.TabLayout
android:id="@+id/locker_content_tb"
android:layout_width="250dp"
android:layout_height="0dp"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:tabIndicatorFullWidth="false"
app:tabSelectedTextColor="#3f3fff"
app:tabIndicatorFullWidth="false"
app:tabIndicatorColor="#3f3fff"
app:tabRippleColor="#00ff0000"
android:layout_marginLeft="5dp"
app:layout_constraintTop_toBottomOf="@id/locker_title_tv"
app:layout_constraintStart_toStartOf="parent"/>

<ImageView
android:id="@+id/locker_select_all_img_iv"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:src="@drawable/btn_playlist_select_off"
app:layout_constraintTop_toBottomOf="@id/locker_content_tb"
app:layout_constraintStart_toStartOf="@id/locker_content_tb"/>

<TextView
android:id="@+id/locker_select_all_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="전체선택"
android:textColor="@color/colorPrimaryGrey"
app:layout_constraintStart_toEndOf="@id/locker_select_all_img_iv"
app:layout_constraintTop_toTopOf="@id/locker_select_all_img_iv"
app:layout_constraintBottom_toBottomOf="@id/locker_select_all_img_iv"/>

<ImageView
android:id="@+id/locker_play_all_img_iv"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/icon_browse_arrow_right"
android:layout_marginStart="20dp"
app:layout_constraintTop_toTopOf="@id/locker_select_all_img_iv"
app:layout_constraintBottom_toBottomOf="@id/locker_select_all_img_iv"
app:layout_constraintStart_toEndOf="@id/locker_select_all_tv"/>

<TextView
android:id="@+id/locker_play_all_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="전체듣기"
android:textColor="@color/colorPrimaryGrey"
app:layout_constraintTop_toTopOf="@id/locker_select_all_img_iv"
app:layout_constraintBottom_toBottomOf="@id/locker_select_all_img_iv"
app:layout_constraintStart_toEndOf="@id/locker_play_all_img_iv"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="편집"
android:layout_marginEnd="20dp"
android:textColor="@color/colorPrimaryGrey"
app:layout_constraintTop_toTopOf="@id/locker_select_all_img_iv"
app:layout_constraintBottom_toBottomOf="@id/locker_select_all_img_iv"
app:layout_constraintEnd_toEndOf="parent"/>

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/locker_content_vp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
app:layout_constraintVertical_bias="1.0"
app:layout_constraintTop_toBottomOf="@id/locker_content_tb"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="10dp"/>


app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/locker_select_all_img_iv" />

</androidx.constraintlayout.widget.ConstraintLayout>
22 changes: 13 additions & 9 deletions UMC_6th/app/src/main/res/layout/fragment_saved_song.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="저장된 곡이 없습니다"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/locker_music_album_rv"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
tools:listitem="@layout/item_locker_album" />

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 45d95cd

Please sign in to comment.