-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
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.
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.
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 | ||
} | ||
} |
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() | ||
} | ||
} | ||
} |
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 | ||
} | ||
} |
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) | ||
} | ||
|
||
} |
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 | ||
} | ||
} |
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 | ||
} | ||
} |
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() | ||
} | ||
} | ||
|
||
|
||
} |
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) | ||
} | ||
} |
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 | ||
} | ||
} |
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 | ||
} | ||
} |
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 | ||
} | ||
} |
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) | ||
} | ||
} |