Skip to content

Commit

Permalink
[FEAT] #262 홈프레그먼트 안쓰는 함수 삭제, 마이페이지 리사이클러뷰 스크랩 바로적용
Browse files Browse the repository at this point in the history
  • Loading branch information
briandr97 committed Jun 5, 2022
1 parent 64f0edc commit 15ca517
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class MyPlanData(
val createdAt: String,
val orderStatus: Boolean,
val planId: Int,
val scrapStatus: Boolean,
var scrapStatus: Boolean,
val thumbnailUrl: String,
val title: String,
val updatedAt: String,
Expand Down
16 changes: 0 additions & 16 deletions app/src/main/java/co/kr/bemyplan/ui/main/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class HomeFragment : Fragment() {
private lateinit var homeViewPagerAdapter: HomeViewPagerAdapter
private lateinit var recentAdapter: HomeAdapter
private lateinit var editorAdapter: HomeAdapter
private lateinit var snapHelper: LinearSnapHelper
private var _binding: FragmentHomeBinding? = null
private val binding get() = _binding ?: error("Binding이 초기화 되지 않았습니다.")
private val homeViewModel: HomeViewModel by viewModels()
Expand All @@ -42,17 +41,6 @@ class HomeFragment : Fragment() {
return binding.root
}

private fun findCenterView(layoutManager: LinearLayoutManager) : View? {
val llm : LinearLayoutManager = layoutManager
if(llm.findFirstCompletelyVisibleItemPosition() == 0){
return llm.getChildAt(0)
}
else if(llm.findLastCompletelyVisibleItemPosition() == layoutManager.itemCount -1){
return llm.getChildAt(layoutManager.itemCount-1)
}
else return null
}

override fun onDestroyView() {
_binding = null
super.onDestroyView()
Expand Down Expand Up @@ -81,10 +69,6 @@ class HomeFragment : Fragment() {
startActivity(intent)
})
binding.rvRecent.adapter = recentAdapter
// binding.rvRecent.layoutManager = LinearLayoutManager(requireContext())
// val lm = binding.rvRecent.layoutManager
val gravitySnapHelper = GravitySnapHelper(Gravity.START)
gravitySnapHelper.attachToRecyclerView(binding.rvRecent)

homeViewModel.new.observe(viewLifecycleOwner) {
recentAdapter.planList.addAll(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ class MyPlanFragment : Fragment() {
false -> viewModel.postScrap(it.planId)
}
})
binding.rvMyPlanPurchase.addOnScrollListener(object : RecyclerView.OnScrollListener(){
/*binding.rvMyPlanPurchase.addOnScrollListener(object : RecyclerView.OnScrollListener(){
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if(!binding.rvMyPlanPurchase.canScrollVertically(1)){
viewModel.getMoreMyPlanList()
}
}
})
})*/
purchaseTourAdapter.submitList(listItem)
binding.rvMyPlanPurchase.adapter = purchaseTourAdapter
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ class MyPlanAdapter(
private val scrapClick: (MyPlanData.Data) -> Unit
) :
ListAdapter<MyPlanData.Data, MyPlanAdapter.ExistMyPlanViewHolder>(MyPlanComparator()) {
//private var purchaseTourList = listOf<MyPlanData.Data>()

/*@SuppressLint("NotifyDataSetChanged")
fun setItems(items: List<MyPlanData.Data>) {
purchaseTourList = items
notifyDataSetChanged()
}*/

class ExistMyPlanViewHolder(
private val binding: ItemMyPlanPurchaseListBinding,
Expand Down Expand Up @@ -52,6 +45,7 @@ class MyPlanAdapter(
} else {
data.isScrapped = false
}*/
data.scrapStatus = !data.scrapStatus
binding.model = data
}
}
Expand Down

0 comments on commit 15ca517

Please sign in to comment.