Skip to content

Commit

Permalink
[FEAT/#8] 리사이클러뷰 최상단으로 이동을 시도..
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyuri1114 committed Oct 24, 2023
1 parent e95612d commit 75f01df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.sopt.dosopttemplate.presentation
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView
import org.sopt.dosopttemplate.R
import org.sopt.dosopttemplate.databinding.ActivityBnvBinding
import org.sopt.dosopttemplate.util.BackPressedUtil
Expand All @@ -18,6 +19,8 @@ class BnvActivity : AppCompatActivity() {
initialFragment(R.id.fcv_home, HomeFragment())

clickBnv()

updown_Listener(RecyclerView(this))
}

private fun clickBnv() {
Expand Down Expand Up @@ -56,6 +59,12 @@ class BnvActivity : AppCompatActivity() {
backPressedUtil.BackButton()
}

fun updown_Listener(view: RecyclerView?) {
binding.bnvHome.setOnClickListener {
view?.smoothScrollToPosition(0)
}
}

private fun replaceFragment(fragment: Fragment) {
supportFragmentManager
.beginTransaction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HomeFragment : Fragment() {

val friendsSealedAdapter = FriendsSealedAdapter(requireContext())
binding.rvFriends.adapter = friendsSealedAdapter
friendsSealedAdapter.addFriendsData(ArrayList(DummyFriendsData.dummyFriendList))
friendsSealedAdapter.setFriendsData(ArrayList(DummyFriendsData.dummyFriendList))
}

override fun onDestroyView() {
Expand Down

0 comments on commit 75f01df

Please sign in to comment.