Skip to content

Commit

Permalink
[feat] #136 마이피드 상세페이지 피드 삭제 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
sxunea committed Aug 21, 2023
1 parent 465a502 commit 603e5fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.android.go.sopt.winey.util.view.setOnSingleClickListener
class WineyFeedAdapter(
private val likeButtonClick: (feedId: Int, isLiked: Boolean) -> Unit,
private val showPopupMenu: (View, WineyFeed) -> Unit,
private val toFeedDetail: (feedId: Int, writerLevel: Int) -> Unit
private val toFeedDetail: (feedId: Int, writerId: Int) -> Unit
) : PagingDataAdapter<WineyFeed, WineyFeedAdapter.WineyFeedViewHolder>(diffUtil) {
private val currentData: ItemSnapshotList<WineyFeed>
get() = snapshot()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.android.go.sopt.winey.util.view.setOnSingleClickListener
class MyFeedAdapter(
private val likeButtonClick: (feedId: Int, isLiked: Boolean) -> Unit,
private val showPopupMenu: (View, WineyFeed) -> Unit,
private val toFeedDetail: (feedId: Int, writerLevel: Int) -> Unit
private val toFeedDetail: (feedId: Int, writerId: Int) -> Unit
) : PagingDataAdapter<WineyFeed, MyFeedAdapter.MyFeedViewHolder>(diffUtil) {
private val currentData: ItemSnapshotList<WineyFeed>
get() = snapshot()
Expand All @@ -24,7 +24,7 @@ class MyFeedAdapter(
private val binding: ItemMyfeedPostBinding,
private val onLikeButtonClick: (feedId: Int, isLiked: Boolean) -> Unit,
private val showPopupMenu: (View, WineyFeed) -> Unit,
private val toFeedDetail: (feedId: Int, writerLevel: Int) -> Unit
private val toFeedDetail: (feedId: Int, writerId: Int) -> Unit
) : RecyclerView.ViewHolder(binding.root) {
fun onBind(data: WineyFeed?) {
binding.apply {
Expand All @@ -40,7 +40,7 @@ class MyFeedAdapter(
showPopupMenu(view, data)
}
lMyfeedPost.setOnSingleClickListener {
toFeedDetail(data.feedId, data.writerLevel)
toFeedDetail(data.feedId, data.userId)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MyFeedFragment : BindingFragment<FragmentMyfeedBinding>(R.layout.fragment_
showPopupMenu = { view, wineyFeed ->
showPopupMenu(view, wineyFeed)
},
toFeedDetail = { feedId, writerLevel -> navigateToDetail(feedId, writerLevel) }
toFeedDetail = { feedId, writerId -> navigateToDetail(feedId, writerId) }
)
binding.rvMyfeedPost.adapter = myFeedAdapter.withLoadStateFooter(wineyFeedLoadAdapter)
}
Expand Down Expand Up @@ -182,10 +182,10 @@ class MyFeedFragment : BindingFragment<FragmentMyfeedBinding>(R.layout.fragment_
}
}

private fun navigateToDetail(feedId: Int, writerLevel: Int) {
private fun navigateToDetail(feedId: Int, writerId: Int) {
val intent = Intent(requireContext(), DetailActivity::class.java)
intent.putExtra("feedId", feedId)
intent.putExtra("writerLevel", writerLevel)
intent.putExtra(KEY_FEED_ID, feedId)
intent.putExtra(KEY_FEED_WRITER_ID, writerId)
startActivity(intent)
}

Expand All @@ -198,7 +198,9 @@ class MyFeedFragment : BindingFragment<FragmentMyfeedBinding>(R.layout.fragment_
}

companion object {
private const val LV_KNIGHT = 2
private const val KEY_FEED_ID = "feedId"
private const val KEY_FEED_WRITER_ID = "feedWriterId"

private const val MSG_MYFEED_ERROR = "ERROR"
private const val TAG_DELETE_DIALOG = "DELETE_DIALOG"
}
Expand Down

0 comments on commit 603e5fc

Please sign in to comment.