@@ -240,21 +240,21 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
240240 moduleList.addOnScrollListener(object : RecyclerView .OnScrollListener () {
241241 override fun onScrollStateChanged (recyclerView : RecyclerView , newState : Int ) {
242242 if (newState != RecyclerView .SCROLL_STATE_IDLE ) searchView.clearFocus()
243- // hide search view and reboot fab when scrolling
243+ // hide search view and reboot fab when scrolling - we have to account for padding, corners, and shadows
244244 if (newState == RecyclerView .SCROLL_STATE_DRAGGING ) {
245- searchCard.animate().translationY(- searchCard.height.toFloat())
246- .setInterpolator(AccelerateInterpolator (2f )).start()
247- rebootFab.animate().translationY(rebootFab.height.toFloat())
248- .setInterpolator(AccelerateInterpolator (2f )).start()
245+ searchCard.animate().translationY(- searchCard.height.toFloat() - 2 * 8 - 2 * 2 )
246+ .setInterpolator(DecelerateInterpolator (2f )).start()
247+ rebootFab.animate().translationY(rebootFab.height.toFloat() + 2 * 8 + 2 * 2 )
248+ .setInterpolator(DecelerateInterpolator (2f )).start()
249249 }
250250 }
251251
252252 override fun onScrolled (recyclerView : RecyclerView , dx : Int , dy : Int ) {
253253 super .onScrolled(recyclerView, dx, dy)
254254 // if the user scrolled up, show the search bar
255255 if (dy < 0 ) {
256- searchCard.animate().translationY(0f )
257- .setInterpolator( DecelerateInterpolator ( 2f )). start()
256+ searchCard.animate().translationY(0f ).setInterpolator( DecelerateInterpolator ( 2f ))
257+ .start()
258258 rebootFab.animate().translationY(0f ).setInterpolator(DecelerateInterpolator (2f ))
259259 .start()
260260 }
@@ -266,10 +266,10 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
266266 if (newState != RecyclerView .SCROLL_STATE_IDLE ) searchView.clearFocus()
267267 // hide search view when scrolling
268268 if (newState == RecyclerView .SCROLL_STATE_DRAGGING ) {
269- searchCard.animate().translationY(- searchCard.height.toFloat())
270- .setInterpolator(AccelerateInterpolator (2f )).start()
271- rebootFab.animate().translationY(rebootFab.height.toFloat())
272- .setInterpolator(AccelerateInterpolator (2f )).start()
269+ searchCard.animate().translationY(- searchCard.height.toFloat() - 2 * 8 - 2 * 2 )
270+ .setInterpolator(DecelerateInterpolator (2f )).start()
271+ rebootFab.animate().translationY(rebootFab.height.toFloat() + 2 * 8 + 2 * 2 )
272+ .setInterpolator(DecelerateInterpolator (2f )).start()
273273 }
274274 }
275275
0 commit comments