diff --git a/app/src/main/java/co/kr/bemyplan/domain/model/main/myplan/MyPlanData.kt b/app/src/main/java/co/kr/bemyplan/domain/model/main/myplan/MyPlanData.kt index 89b164b4..b5b29fc7 100644 --- a/app/src/main/java/co/kr/bemyplan/domain/model/main/myplan/MyPlanData.kt +++ b/app/src/main/java/co/kr/bemyplan/domain/model/main/myplan/MyPlanData.kt @@ -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, diff --git a/app/src/main/java/co/kr/bemyplan/ui/main/home/HomeFragment.kt b/app/src/main/java/co/kr/bemyplan/ui/main/home/HomeFragment.kt index f54e89da..297dcf27 100644 --- a/app/src/main/java/co/kr/bemyplan/ui/main/home/HomeFragment.kt +++ b/app/src/main/java/co/kr/bemyplan/ui/main/home/HomeFragment.kt @@ -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() @@ -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() @@ -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) diff --git a/app/src/main/java/co/kr/bemyplan/ui/main/myplan/MyPlanFragment.kt b/app/src/main/java/co/kr/bemyplan/ui/main/myplan/MyPlanFragment.kt index ac053b08..dfc19d2c 100644 --- a/app/src/main/java/co/kr/bemyplan/ui/main/myplan/MyPlanFragment.kt +++ b/app/src/main/java/co/kr/bemyplan/ui/main/myplan/MyPlanFragment.kt @@ -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 } diff --git a/app/src/main/java/co/kr/bemyplan/ui/main/myplan/adapter/MyPlanAdapter.kt b/app/src/main/java/co/kr/bemyplan/ui/main/myplan/adapter/MyPlanAdapter.kt index bb16c468..daeef46b 100644 --- a/app/src/main/java/co/kr/bemyplan/ui/main/myplan/adapter/MyPlanAdapter.kt +++ b/app/src/main/java/co/kr/bemyplan/ui/main/myplan/adapter/MyPlanAdapter.kt @@ -15,13 +15,6 @@ class MyPlanAdapter( private val scrapClick: (MyPlanData.Data) -> Unit ) : ListAdapter(MyPlanComparator()) { - //private var purchaseTourList = listOf() - - /*@SuppressLint("NotifyDataSetChanged") - fun setItems(items: List) { - purchaseTourList = items - notifyDataSetChanged() - }*/ class ExistMyPlanViewHolder( private val binding: ItemMyPlanPurchaseListBinding, @@ -52,6 +45,7 @@ class MyPlanAdapter( } else { data.isScrapped = false }*/ + data.scrapStatus = !data.scrapStatus binding.model = data } }