Skip to content

Commit

Permalink
[maro/#13] fix : AlbumFragment.kt 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
leesumin0526 committed Apr 20, 2024
1 parent ea4bb8b commit 1eb7aee
Show file tree
Hide file tree
Showing 145 changed files with 2,339 additions and 0 deletions.
1 change: 1 addition & 0 deletions .idea/.name

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

6 changes: 6 additions & 0 deletions .idea/compiler.xml

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

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

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

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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/AlbumFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.example.umc_6th

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.fragment.app.setFragmentResultListener
import com.example.umc_6th.databinding.FragmentAlbumBinding
import com.example.umc_6th.databinding.FragmentAlbumBinding.inflate
import com.example.umc_6th.databinding.FragmentSongBinding
import com.google.android.material.tabs.TabLayoutMediator

class AlbumFragment : Fragment() {
lateinit var binding: FragmentAlbumBinding

private val information = arrayListOf("수록곡","상세정보","영상")
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = inflate(inflater,container,false)
binding.albumBackIv.setOnClickListener{
(context as MainActivity).supportFragmentManager.beginTransaction().
replace(R.id.main_frm,HomeFragment()).
commitAllowingStateLoss()
}

val albumAdapter = AlbumVPAdapter(this)
binding.albumContentVp.adapter = albumAdapter


setFragmentResultListener("TitleInfo") { requestKey, bundle ->
binding.albumTitleTv.text = bundle.getString("title")
}
setFragmentResultListener("SingerInfo") { requestKey, bundle ->
binding.albumSingerTv.text = bundle.getString("singer")
}

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

return binding.root
}
}
16 changes: 16 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/AlbumVPAdpter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.umc_6th

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter

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

override fun createFragment(position: Int): Fragment {
return when(position) {
0 -> SongFragment()
1 -> DetailFragment()
else -> VideoFragment()
}
}
}
27 changes: 27 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/BannerFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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.FragmentBannerBinding

class BannerFragment(val imgRes : Int) : Fragment() {

lateinit var binding : FragmentBannerBinding

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

}

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentBannerBinding.inflate(inflater, container, false)
binding.bannerImageIv.setImageResource(imgRes)
return binding.root
}
}
22 changes: 22 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/BannerVPAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.umc_6th

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter

class BannerVPAdapter(fragment : Fragment) : FragmentStateAdapter(fragment) {
private val fragmentList : ArrayList<Fragment> = ArrayList()

override fun getItemCount(): Int {
return fragmentList.size
}

override fun createFragment(position: Int): Fragment {
return fragmentList[position]
}

fun addFragment(fragment: Fragment) {
fragmentList.add(fragment)
notifyItemInserted(fragmentList.size-1)
}

}
23 changes: 23 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/DetailFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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.FragmentDetailBinding

class DetailFragment : Fragment() {

lateinit var binding: FragmentDetailBinding

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

return binding.root
}
}
30 changes: 30 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
@@ -0,0 +1,30 @@
package com.example.umc_6th

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.example.umc_6th.databinding.FragmentLockerBinding
import com.google.android.material.tabs.TabLayoutMediator

class LockerFragment : Fragment() {
lateinit var binding: FragmentLockerBinding
private val information = arrayListOf("저장한 곡", "음악파일", "저장앨범")
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentLockerBinding.inflate(inflater, container, false)

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

TabLayoutMediator(binding.lockerContentTb, binding.lockerContentVp){
tab, position ->
tab.text = information[position]
}.attach()
return binding.root
}
}
19 changes: 19 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/LockerVPAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.example.umc_6th

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.myfirstapp.SavedAlbumFragment

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

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


}
22 changes: 22 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/LookFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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

class LookFragment : Fragment() {

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

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_look, container, false)
}
}
27 changes: 27 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/PannelFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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.FragmentPannelBinding

class PannelFragment(val imgRes : Int) : Fragment() {

lateinit var binding : FragmentPannelBinding

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

}

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentPannelBinding.inflate(inflater, container, false)
binding.pannelImageIv.setImageResource(imgRes)
return binding.root
}
}
22 changes: 22 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/PannelVPAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.umc_6th

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter

class PannelVpAdapter (fragment : Fragment) : FragmentStateAdapter(fragment) {

private val fragmentList : ArrayList<Fragment> = ArrayList()

override fun getItemCount(): Int {
return fragmentList.size
}

override fun createFragment(position: Int): Fragment {
return fragmentList[position]
}

fun addFragment(fragment: Fragment) {
fragmentList.add(fragment)
notifyItemInserted(fragmentList.size-1)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.myfirstapp

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.example.umc_6th.databinding.FragmentSavedAlbumBinding

class SavedAlbumFragment : Fragment(){

lateinit var binding: FragmentSavedAlbumBinding

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentSavedAlbumBinding.inflate(inflater,container,false)
return binding.root
}
}
22 changes: 22 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/SavedSongFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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

class SavedSongFragment : Fragment(){

lateinit var binding: FragmentSongBinding

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentSongBinding.inflate(inflater,container,false)
return binding.root
}
}
22 changes: 22 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/SearchFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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

class SearchFragment : Fragment() {

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

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_search, container, false)
}
}
Loading

0 comments on commit 1eb7aee

Please sign in to comment.