Skip to content

Commit

Permalink
[feat/mypage]: refactor store code
Browse files Browse the repository at this point in the history
  • Loading branch information
librarywon committed Jul 6, 2023
1 parent 7118363 commit 1f58ecd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class StoreFragment : Fragment(), OnPageChangedListener {
private val viewModel by viewModels<StoreViewModel>()

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return inflater.inflate(R.layout.fragment_store, container, false)
}
Expand All @@ -58,7 +58,7 @@ class StoreFragment : Fragment(), OnPageChangedListener {
storeAdapter?.submitList(storeState.data)

//최초 데이터 세팅
binding.tvStoreAlbumPhotoCount.text = storeState.data[0].photoCount.toString() + "/30"
storeState.data.firstOrNull()?.let { onPageChanged(it) }
}
}

Expand All @@ -70,9 +70,7 @@ class StoreFragment : Fragment(), OnPageChangedListener {

private fun setupViewPager() {
storeAdapter = StoreAdapter({ albumItem ->
val intent = Intent(context, AlbumListActivity::class.java).apply {
putExtra("albumId", albumItem.id)
}
val intent = Intent(context, AlbumListActivity::class.java)
startActivity(intent)
}, this)

Expand All @@ -99,7 +97,7 @@ class StoreFragment : Fragment(), OnPageChangedListener {
val text = buildSpannedString {
color(colorOf(R.color.pophory_purple)) {
textAppearance(requireContext(), R.style.TextAppearance_Pophory_HeadLineBold) {
append("포포리 앨범")
append(coloredText)
}
}
append(splittedText[1])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ class StoreAdapter(
}
}

interface OnPageChangedListener {
fun interface OnPageChangedListener {
fun onPageChanged(albumItem: AlbumItem)
}

0 comments on commit 1f58ecd

Please sign in to comment.