From dec21e5685331a3c96a9e6e2142a4c838f9fa2c9 Mon Sep 17 00:00:00 2001 From: hyowon0204 Date: Sat, 20 Apr 2024 18:39:46 +0900 Subject: [PATCH] =?UTF-8?q?[kara/#13]=20feat.3=EC=A3=BC=EC=B0=A8=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UMC_6th/app/build.gradle.kts | 1 + .../com/example/myfirstapp/AlbumFragment.kt | 28 +- .../com/example/myfirstapp/AlbumVpAdapter.kt | 17 + .../com/example/myfirstapp/BannerFragment.kt | 24 + .../com/example/myfirstapp/BannerVPAdapter.kt | 19 + .../com/example/myfirstapp/DetailFragment.kt | 22 + .../com/example/myfirstapp/HomeFragment.kt | 46 ++ .../com/example/myfirstapp/LockerFragment.kt | 18 +- .../com/example/myfirstapp/LockerVPAdapter.kt | 18 + .../example/myfirstapp/MusicFileFragment.kt | 23 + .../com/example/myfirstapp/PannelFragment.kt | 27 + .../com/example/myfirstapp/PannelVPAdapter.kt | 22 + .../example/myfirstapp/SavedAlbumFragment.kt | 24 + .../example/myfirstapp/SavedSongFragment.kt | 24 + .../com/example/myfirstapp/SongActivity.kt | 35 +- .../com/example/myfirstapp/SongFragment.kt | 61 ++ .../com/example/myfirstapp/VideoFragment.kt | 23 + .../app/src/main/res/drawable/blue_radius.xml | 6 + .../app/src/main/res/drawable/gray_radius.xml | 6 + .../app/src/main/res/layout/activity_song.xml | 8 +- .../src/main/res/layout/fragment_album.xml | 570 +----------------- .../src/main/res/layout/fragment_banner.xml | 18 + .../src/main/res/layout/fragment_detail.xml | 17 + .../app/src/main/res/layout/fragment_home.xml | 71 ++- .../src/main/res/layout/fragment_locker.xml | 51 ++ .../main/res/layout/fragment_musicfile.xml | 6 + .../src/main/res/layout/fragment_pannel.xml | 19 + .../main/res/layout/fragment_savedalbum.xml | 6 + .../main/res/layout/fragment_savedsong.xml | 15 + .../app/src/main/res/layout/fragment_song.xml | 526 ++++++++++++++++ .../src/main/res/layout/fragment_video.xml | 18 + 31 files changed, 1172 insertions(+), 597 deletions(-) create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumVpAdapter.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/BannerFragment.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/BannerVPAdapter.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/DetailFragment.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/LockerVPAdapter.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/MusicFileFragment.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/PannelFragment.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/PannelVPAdapter.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/SavedAlbumFragment.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/SavedSongFragment.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/SongFragment.kt create mode 100644 UMC_6th/app/src/main/java/com/example/myfirstapp/VideoFragment.kt create mode 100644 UMC_6th/app/src/main/res/drawable/blue_radius.xml create mode 100644 UMC_6th/app/src/main/res/drawable/gray_radius.xml create mode 100644 UMC_6th/app/src/main/res/layout/fragment_banner.xml create mode 100644 UMC_6th/app/src/main/res/layout/fragment_detail.xml create mode 100644 UMC_6th/app/src/main/res/layout/fragment_musicfile.xml create mode 100644 UMC_6th/app/src/main/res/layout/fragment_pannel.xml create mode 100644 UMC_6th/app/src/main/res/layout/fragment_savedalbum.xml create mode 100644 UMC_6th/app/src/main/res/layout/fragment_savedsong.xml create mode 100644 UMC_6th/app/src/main/res/layout/fragment_song.xml create mode 100644 UMC_6th/app/src/main/res/layout/fragment_video.xml diff --git a/UMC_6th/app/build.gradle.kts b/UMC_6th/app/build.gradle.kts index 4751c27..22bd893 100644 --- a/UMC_6th/app/build.gradle.kts +++ b/UMC_6th/app/build.gradle.kts @@ -48,6 +48,7 @@ dependencies { implementation(libs.androidx.activity) implementation(libs.androidx.constraintlayout) implementation ("androidx.fragment:fragment-ktx:1.6.2") + implementation ("me.relex:circleindicator:2.1.6") testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumFragment.kt index 4b98f5a..5f0e5ca 100644 --- a/UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumFragment.kt +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumFragment.kt @@ -7,11 +7,14 @@ import android.view.ViewGroup import android.widget.Toast import androidx.fragment.app.Fragment import com.example.myfirstapp.databinding.FragmentAlbumBinding +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?, @@ -26,24 +29,13 @@ class AlbumFragment : Fragment() { binding.albumBackIv.setOnClickListener{ (context as MainActivity).supportFragmentManager.beginTransaction().replace(R.id.main_container,HomeFragment()).commitAllowingStateLoss() } - binding.albumSongLalacCl.setOnClickListener{ - Toast.makeText(activity,"LILAC",Toast.LENGTH_SHORT).show() - } - binding.albumSongFluCl.setOnClickListener{ - Toast.makeText(activity,"FLU",Toast.LENGTH_SHORT).show() - } - binding.albumSongCoinCl.setOnClickListener{ - Toast.makeText(activity,"Coin",Toast.LENGTH_SHORT).show() - } - binding.albumSongSpringhelloCl.setOnClickListener{ - Toast.makeText(activity,"봄 안녕 봄",Toast.LENGTH_SHORT).show() - } - binding.albumSongCelebrityCl.setOnClickListener{ - Toast.makeText(activity,"Celebrity",Toast.LENGTH_SHORT).show() - } - binding.albumSongSingCl.setOnClickListener{ - Toast.makeText(activity,"돌림노래 (Feat.DEAN)",Toast.LENGTH_SHORT).show() - } + + val albumVpAdapter = AlbumVpAdapter(this) + binding.albumContentVp.adapter = albumVpAdapter + TabLayoutMediator(binding.albumContentTb,binding.albumContentVp){ + tab ,position -> + tab.text =information[position] + }.attach() return binding.root } diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumVpAdapter.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumVpAdapter.kt new file mode 100644 index 0000000..8052cc1 --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumVpAdapter.kt @@ -0,0 +1,17 @@ +package com.example.myfirstapp + +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() + } + } + +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/BannerFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/BannerFragment.kt new file mode 100644 index 0000000..d8067d9 --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/BannerFragment.kt @@ -0,0 +1,24 @@ +package com.example.myfirstapp + +import android.content.res.Configuration +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import com.example.myfirstapp.databinding.FragmentBannerBinding + +class BannerFragment(val imgRes : Int) : Fragment() { + lateinit var binding : FragmentBannerBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + binding = FragmentBannerBinding.inflate(inflater, container, false) + + binding.bannerImgIv.setImageResource(imgRes) + return binding.root + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/BannerVPAdapter.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/BannerVPAdapter.kt new file mode 100644 index 0000000..36ff8ba --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/BannerVPAdapter.kt @@ -0,0 +1,19 @@ +package com.example.myfirstapp + +import androidx.fragment.app.Fragment +import androidx.viewpager2.adapter.FragmentStateAdapter + +class BannerVPAdapter(fragment: Fragment) : FragmentStateAdapter(fragment){ + + private val fragmentList : ArrayList = ArrayList() + override fun getItemCount(): Int { + return fragmentList.size + } + + override fun createFragment(position: Int): Fragment = fragmentList[position] + + fun addFragment(fragment: Fragment){ + fragmentList.add(fragment) + notifyItemInserted(fragmentList.size-1) + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/DetailFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/DetailFragment.kt new file mode 100644 index 0000000..dbde467 --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/DetailFragment.kt @@ -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.myfirstapp.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 + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/HomeFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/HomeFragment.kt index a2a41bf..e2dca35 100644 --- a/UMC_6th/app/src/main/java/com/example/myfirstapp/HomeFragment.kt +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/HomeFragment.kt @@ -1,15 +1,24 @@ package com.example.myfirstapp import android.os.Bundle +import android.os.Handler +import android.os.Looper import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment +import androidx.viewpager2.widget.ViewPager2 import com.example.myfirstapp.databinding.FragmentHomeBinding +import java.util.Timer +import java.util.TimerTask class HomeFragment : Fragment() { lateinit var binding: FragmentHomeBinding + + + private val timer = Timer() + private val handler = Handler(Looper.getMainLooper()) override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -29,6 +38,43 @@ class HomeFragment : Fragment() { (context as MainActivity).supportFragmentManager.beginTransaction() .replace(R.id.main_container, albumFragment).commitAllowingStateLoss() } + val bannerAdapter = BannerVPAdapter(this) + bannerAdapter.addFragment(BannerFragment(R.drawable.img_home_viewpager_exp)) + bannerAdapter.addFragment(BannerFragment(R.drawable.img_home_viewpager_exp2)) + bannerAdapter.addFragment(BannerFragment(R.drawable.img_home_viewpager_exp)) + bannerAdapter.addFragment(BannerFragment(R.drawable.img_home_viewpager_exp2)) + bannerAdapter.addFragment(BannerFragment(R.drawable.img_home_viewpager_exp)) + bannerAdapter.addFragment(BannerFragment(R.drawable.img_home_viewpager_exp2)) + binding.homeBannerVp.adapter =bannerAdapter + binding.homeBannerVp.orientation = ViewPager2.ORIENTATION_HORIZONTAL + + binding.homeBannerIndicator.setViewPager(binding.homeBannerVp) + + autoSlide(bannerAdapter) + + val pannelAdpater = PannelVPAdapter(this) + pannelAdpater.addFragment(PannelFragment(R.drawable.img_first_album_default)) + pannelAdpater.addFragment(PannelFragment(R.drawable.img_first_album_default)) + binding.homePannelBackgroundVp.adapter = pannelAdpater + binding.homePannelBackgroundVp.orientation = ViewPager2.ORIENTATION_HORIZONTAL + + binding.homePannelIndicator.setViewPager(binding.homePannelBackgroundVp) + return binding.root } + + private fun autoSlide(adapter: BannerVPAdapter) { + timer.scheduleAtFixedRate(object : TimerTask() { + override fun run() { + handler.post { + val nextItem = binding.homeBannerVp.currentItem + 1 + if (nextItem < adapter.itemCount) { + binding.homeBannerVp.currentItem = nextItem + } else { + binding.homeBannerVp.currentItem = 0 // 순환 + } + } + } + }, 3000, 3000) + } } \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/LockerFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/LockerFragment.kt index 278ac71..837abe8 100644 --- a/UMC_6th/app/src/main/java/com/example/myfirstapp/LockerFragment.kt +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/LockerFragment.kt @@ -5,15 +5,27 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment +import com.example.myfirstapp.databinding.FragmentLockerBinding +import com.google.android.material.tabs.TabLayoutMediator class LockerFragment : Fragment() { - // 여기에 Fragment의 구현 내용을 작성합니다. + lateinit var binding: FragmentLockerBinding + private val information = arrayListOf("저장한 곡", "음악파일", "저장앨범") override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - // 여기에서 Fragment의 레이아웃을 인플레이트합니다. - return inflater.inflate(R.layout.fragment_locker, container, false) + 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 + } } \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/LockerVPAdapter.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/LockerVPAdapter.kt new file mode 100644 index 0000000..0778365 --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/LockerVPAdapter.kt @@ -0,0 +1,18 @@ +package com.example.myfirstapp + +import androidx.fragment.app.Fragment +import androidx.viewpager2.adapter.FragmentStateAdapter + +class LockerVPAdapter (fragment: Fragment) : FragmentStateAdapter(fragment){ + override fun getItemCount(): Int = 3 + + override fun createFragment(position: Int): Fragment { + return when(position){ + 0 -> SavedSongFragment() + 1 -> MusicFileFragment() + else -> SavedAlbumFragment() + } + } + + +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/MusicFileFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/MusicFileFragment.kt new file mode 100644 index 0000000..6beed45 --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/MusicFileFragment.kt @@ -0,0 +1,23 @@ +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.myfirstapp.databinding.FragmentDetailBinding +import com.example.myfirstapp.databinding.FragmentMusicfileBinding + +class MusicFileFragment : Fragment(){ + + lateinit var binding: FragmentMusicfileBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + binding = FragmentMusicfileBinding.inflate(inflater,container,false) + return binding.root + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/PannelFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/PannelFragment.kt new file mode 100644 index 0000000..9d43cae --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/PannelFragment.kt @@ -0,0 +1,27 @@ +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.myfirstapp.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 + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/PannelVPAdapter.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/PannelVPAdapter.kt new file mode 100644 index 0000000..23714ee --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/PannelVPAdapter.kt @@ -0,0 +1,22 @@ +package com.example.myfirstapp + +import androidx.fragment.app.Fragment +import androidx.viewpager2.adapter.FragmentStateAdapter + +class PannelVPAdapter (fragment : Fragment) : FragmentStateAdapter(fragment) { + + private val fragmentList : ArrayList = 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) + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/SavedAlbumFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/SavedAlbumFragment.kt new file mode 100644 index 0000000..b49af7e --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/SavedAlbumFragment.kt @@ -0,0 +1,24 @@ +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.myfirstapp.databinding.FragmentDetailBinding +import com.example.myfirstapp.databinding.FragmentMusicfileBinding +import com.example.myfirstapp.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 + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/SavedSongFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/SavedSongFragment.kt new file mode 100644 index 0000000..e0129a9 --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/SavedSongFragment.kt @@ -0,0 +1,24 @@ +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.myfirstapp.databinding.FragmentDetailBinding +import com.example.myfirstapp.databinding.FragmentMusicfileBinding +import com.example.myfirstapp.databinding.FragmentSavedsongBinding + +class SavedSongFragment : Fragment(){ + + lateinit var binding: FragmentSavedsongBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + binding = FragmentSavedsongBinding.inflate(inflater,container,false) + return binding.root + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/SongActivity.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/SongActivity.kt index 13d3f52..cfcb319 100644 --- a/UMC_6th/app/src/main/java/com/example/myfirstapp/SongActivity.kt +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/SongActivity.kt @@ -5,12 +5,14 @@ import android.os.Bundle import android.os.PersistableBundle import android.view.View import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat import com.example.myfirstapp.databinding.ActivityMainBinding import com.example.myfirstapp.databinding.ActivitySongBinding class SongActivity : AppCompatActivity() { lateinit var binding: ActivitySongBinding + private var isColorChanged = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -47,15 +49,36 @@ class SongActivity : AppCompatActivity() { binding.songMusicTitleTv.text = intent.getStringExtra("title") binding.songMusicSingerTv.text = intent.getStringExtra("singer") } - } - override fun onBackPressed() { - val intent = Intent(this, MainActivity::class.java) - intent.putExtra("message", "뒤로가기 버튼 클릭") - setResult(RESULT_OK, intent) - finish() + binding.songRepeatIv.setOnClickListener { + if (isColorChanged) { + // 변경된 색상을 다시 초기 색상으로 변경 + binding.songRepeatIv.setColorFilter(ContextCompat.getColor(this, R.color.black)) + } else { + binding.songRepeatIv.setColorFilter(ContextCompat.getColor(this, R.color.flo)) + } + isColorChanged = !isColorChanged + } + + binding.songRandomIv.setOnClickListener { + if (isColorChanged) { + // 변경된 색상을 다시 초기 색상으로 변경 + binding.songRandomIv.setColorFilter(ContextCompat.getColor(this, R.color.black)) + } else { + binding.songRandomIv.setColorFilter(ContextCompat.getColor(this, R.color.flo)) + } + isColorChanged = !isColorChanged + } } +// override fun onBackPressed() { +// super.onBackPressed() +// val intent = Intent(this, MainActivity::class.java) +// intent.putExtra("message", "뒤로가기 버튼 클릭") +// setResult(RESULT_OK, intent) +// finish() +// } + fun setPlayerStatus(isPlaying : Boolean){ if(isPlaying){ //재생중 binding.songMiniplayerPlayIv.visibility = View.VISIBLE diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/SongFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/SongFragment.kt new file mode 100644 index 0000000..264e92b --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/SongFragment.kt @@ -0,0 +1,61 @@ +package com.example.myfirstapp + +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 com.example.myfirstapp.databinding.FragmentDetailBinding +import com.example.myfirstapp.databinding.FragmentSongBinding + +class SongFragment : Fragment(){ + + lateinit var binding: FragmentSongBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + binding = FragmentSongBinding.inflate(inflater,container,false) + + binding.albumSongMixOffIv.setOnClickListener { + setPlayerStatus(false) + } + binding.albumSongMixOnIv.setOnClickListener { + setPlayerStatus(true) + } + + binding.albumSongLalacCl.setOnClickListener{ + Toast.makeText(activity,"LILAC", Toast.LENGTH_SHORT).show() + } + binding.albumSongFluCl.setOnClickListener{ + Toast.makeText(activity,"FLU", Toast.LENGTH_SHORT).show() + } + binding.albumSongCoinCl.setOnClickListener{ + Toast.makeText(activity,"Coin", Toast.LENGTH_SHORT).show() + } + binding.albumSongSpringhelloCl.setOnClickListener{ + Toast.makeText(activity,"봄 안녕 봄", Toast.LENGTH_SHORT).show() + } + binding.albumSongCelebrityCl.setOnClickListener{ + Toast.makeText(activity,"Celebrity", Toast.LENGTH_SHORT).show() + } + binding.albumSongSingCl.setOnClickListener{ + Toast.makeText(activity,"돌림노래 (Feat.DEAN)", Toast.LENGTH_SHORT).show() + } + return binding.root + } + + fun setPlayerStatus(isPlaying : Boolean){ + if(isPlaying){ //내 취향 off + binding.albumSongMixOffIv.visibility = View.VISIBLE + binding.albumSongMixOnIv.visibility = View.GONE + } + else{ //내 취향 on + binding.albumSongMixOffIv.visibility = View.GONE + binding.albumSongMixOnIv.visibility = View.VISIBLE + } + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/myfirstapp/VideoFragment.kt b/UMC_6th/app/src/main/java/com/example/myfirstapp/VideoFragment.kt new file mode 100644 index 0000000..dd264f2 --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/myfirstapp/VideoFragment.kt @@ -0,0 +1,23 @@ +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.myfirstapp.databinding.FragmentDetailBinding +import com.example.myfirstapp.databinding.FragmentVideoBinding + +class VideoFragment : Fragment(){ + + lateinit var binding: FragmentVideoBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + binding = FragmentVideoBinding.inflate(inflater,container,false) + return binding.root + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/drawable/blue_radius.xml b/UMC_6th/app/src/main/res/drawable/blue_radius.xml new file mode 100644 index 0000000..f2a12db --- /dev/null +++ b/UMC_6th/app/src/main/res/drawable/blue_radius.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/drawable/gray_radius.xml b/UMC_6th/app/src/main/res/drawable/gray_radius.xml new file mode 100644 index 0000000..5b9a17d --- /dev/null +++ b/UMC_6th/app/src/main/res/drawable/gray_radius.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/activity_song.xml b/UMC_6th/app/src/main/res/layout/activity_song.xml index 1d0dfcb..a4d47c4 100644 --- a/UMC_6th/app/src/main/res/layout/activity_song.xml +++ b/UMC_6th/app/src/main/res/layout/activity_song.xml @@ -214,7 +214,7 @@ android:id="@+id/song_miniplayer_next_iv" android:layout_width="50dp" android:layout_height="50dp" - android:src="@drawable/btn_miniplayer_next"/> + android:src="@drawable/btn_miniplayer_next" /> + + + + + + - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + app:layout_constraintEnd_toEndOf="parent"/> - - \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/fragment_banner.xml b/UMC_6th/app/src/main/res/layout/fragment_banner.xml new file mode 100644 index 0000000..1ead6e6 --- /dev/null +++ b/UMC_6th/app/src/main/res/layout/fragment_banner.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/fragment_detail.xml b/UMC_6th/app/src/main/res/layout/fragment_detail.xml new file mode 100644 index 0000000..1671e7a --- /dev/null +++ b/UMC_6th/app/src/main/res/layout/fragment_detail.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/fragment_home.xml b/UMC_6th/app/src/main/res/layout/fragment_home.xml index 921add8..527a609 100644 --- a/UMC_6th/app/src/main/res/layout/fragment_home.xml +++ b/UMC_6th/app/src/main/res/layout/fragment_home.xml @@ -11,17 +11,38 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - + + + + + + + + + + + + + - + + + + + + + + + + android:layout_height="100dp" + android:layout_marginTop="15dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/home_today_hsv"/> + + diff --git a/UMC_6th/app/src/main/res/layout/fragment_locker.xml b/UMC_6th/app/src/main/res/layout/fragment_locker.xml index b8d9345..dd54e00 100644 --- a/UMC_6th/app/src/main/res/layout/fragment_locker.xml +++ b/UMC_6th/app/src/main/res/layout/fragment_locker.xml @@ -1,7 +1,58 @@ + + + + + + + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/fragment_musicfile.xml b/UMC_6th/app/src/main/res/layout/fragment_musicfile.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/UMC_6th/app/src/main/res/layout/fragment_musicfile.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/fragment_pannel.xml b/UMC_6th/app/src/main/res/layout/fragment_pannel.xml new file mode 100644 index 0000000..ff28a66 --- /dev/null +++ b/UMC_6th/app/src/main/res/layout/fragment_pannel.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/fragment_savedalbum.xml b/UMC_6th/app/src/main/res/layout/fragment_savedalbum.xml new file mode 100644 index 0000000..77d9ef6 --- /dev/null +++ b/UMC_6th/app/src/main/res/layout/fragment_savedalbum.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/fragment_savedsong.xml b/UMC_6th/app/src/main/res/layout/fragment_savedsong.xml new file mode 100644 index 0000000..b8b598b --- /dev/null +++ b/UMC_6th/app/src/main/res/layout/fragment_savedsong.xml @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/fragment_song.xml b/UMC_6th/app/src/main/res/layout/fragment_song.xml new file mode 100644 index 0000000..a51a063 --- /dev/null +++ b/UMC_6th/app/src/main/res/layout/fragment_song.xml @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/layout/fragment_video.xml b/UMC_6th/app/src/main/res/layout/fragment_video.xml new file mode 100644 index 0000000..7baceee --- /dev/null +++ b/UMC_6th/app/src/main/res/layout/fragment_video.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file