@@ -9,6 +9,7 @@ import androidx.core.view.isVisible
9
9
import androidx.fragment.app.Fragment
10
10
import androidx.fragment.app.viewModels
11
11
import androidx.recyclerview.widget.LinearLayoutManager
12
+ import androidx.recyclerview.widget.RecyclerView
12
13
import com.github.code.gambit.R
13
14
import com.github.code.gambit.data.model.File
14
15
import com.github.code.gambit.data.model.Url
@@ -144,10 +145,30 @@ class HomeFragment : Fragment(R.layout.fragment_home), FileUrlClickCallback, Bot
144
145
}
145
146
146
147
private fun setUpFileRecyclerView () {
147
- binding.fileList.layoutManager = LinearLayoutManager (requireContext())
148
+ val layoutManager = LinearLayoutManager (requireContext())
149
+ binding.fileList.layoutManager = layoutManager
148
150
binding.fileList.setHasFixedSize(false )
149
151
binding.fileList.adapter = adapter
150
152
adapter.listener = this
153
+ binding.fileList.addOnScrollListener(object : RecyclerView .OnScrollListener () {
154
+ override fun onScrolled (recyclerView : RecyclerView , dx : Int , dy : Int ) {
155
+ if (searchBinding.root.isVisible) {
156
+ super .onScrolled(recyclerView, dx, dy)
157
+ return
158
+ }
159
+ if (dy > 0 ) {
160
+ hideBottomNav()
161
+ } else {
162
+ showBottomNav()
163
+ }
164
+ if (! recyclerView.canScrollVertically(1 ) && layoutManager.findLastVisibleItemPosition() == layoutManager.itemCount - 1 ) {
165
+ // shortToast("End of list")
166
+ println ()
167
+ }
168
+ Timber .tag(" home" ).i(" (dx: $dx , dy: $dy )" )
169
+ super .onScrolled(recyclerView, dx, dy)
170
+ }
171
+ })
151
172
}
152
173
153
174
private fun registerUrlComponent () {
0 commit comments