-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
[kara/#7] feat: 2주차 구현 완료
- 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.
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.
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.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
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.FragmentAlbumBinding | ||
|
||
class AlbumFragment : Fragment() { | ||
|
||
lateinit var binding : FragmentAlbumBinding | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
binding = FragmentAlbumBinding.inflate(inflater,container,false) | ||
|
||
//HomeFragment를 AlbumFragment로 전환할때 전달된 데이터 받는 곳(bundle을 이용해 전달 가능) | ||
binding.albumTitleTv.text = arguments?.getString("title") | ||
binding.albumSingerTv.text = arguments?.getString("singer") | ||
|
||
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() | ||
} | ||
|
||
return binding.root | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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.FragmentHomeBinding | ||
|
||
class HomeFragment : Fragment() { | ||
|
||
lateinit var binding: FragmentHomeBinding | ||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
|
||
binding = FragmentHomeBinding.inflate(inflater, container, false) | ||
binding.homeTodayAlbum1Iv.setOnClickListener { | ||
//HomeFragment를 AlbumFragment로 전환할때 데이터도 이동(bundle을 이용해 전달 가능) | ||
val bundle = Bundle() | ||
bundle.putString("title", binding.homeTodayAlbumTitleTv.text.toString()) | ||
bundle.putString("singer", binding.homeTodaySingerTv.text.toString()) | ||
|
||
val albumFragment = AlbumFragment() | ||
albumFragment.arguments = bundle | ||
|
||
(context as MainActivity).supportFragmentManager.beginTransaction() | ||
.replace(R.id.main_container, albumFragment).commitAllowingStateLoss() | ||
} | ||
return binding.root | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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 | ||
|
||
class LockerFragment : Fragment() { | ||
// 여기에 Fragment의 구현 내용을 작성합니다. | ||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
// 여기에서 Fragment의 레이아웃을 인플레이트합니다. | ||
return inflater.inflate(R.layout.fragment_locker, container, false) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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 | ||
|
||
class LookFragment : Fragment() { | ||
// 여기에 Fragment의 구현 내용을 작성합니다. | ||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
// 여기에서 Fragment의 레이아웃을 인플레이트합니다. | ||
return inflater.inflate(R.layout.fragment_look, container, false) | ||
} | ||
} |