remove unused member vars from TimelineFragment (#2561)

This commit is contained in:
Konrad Pozniak 2022-05-29 19:23:08 +02:00 committed by GitHub
parent e63cd68baf
commit 434d345d01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,9 +103,6 @@ class TimelineFragment :
private lateinit var adapter: TimelinePagingAdapter private lateinit var adapter: TimelinePagingAdapter
private var isSwipeToRefreshEnabled = true private var isSwipeToRefreshEnabled = true
private var layoutManager: LinearLayoutManager? = null
private var scrollListener: RecyclerView.OnScrollListener? = null
private var hideFab = false private var hideFab = false
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -226,7 +223,7 @@ class TimelineFragment :
if (actionButtonPresent()) { if (actionButtonPresent()) {
val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext()) val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
hideFab = preferences.getBoolean("fabHide", false) hideFab = preferences.getBoolean("fabHide", false)
scrollListener = object : RecyclerView.OnScrollListener() { binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(view: RecyclerView, dx: Int, dy: Int) { override fun onScrolled(view: RecyclerView, dx: Int, dy: Int) {
val composeButton = (activity as ActionButtonActivity).actionButton val composeButton = (activity as ActionButtonActivity).actionButton
if (composeButton != null) { if (composeButton != null) {
@ -241,9 +238,7 @@ class TimelineFragment :
} }
} }
} }
}.also { })
binding.recyclerView.addOnScrollListener(it)
}
} }
eventHub.events eventHub.events
@ -279,8 +274,7 @@ class TimelineFragment :
} }
) )
binding.recyclerView.setHasFixedSize(true) binding.recyclerView.setHasFixedSize(true)
layoutManager = LinearLayoutManager(context) binding.recyclerView.layoutManager = LinearLayoutManager(context)
binding.recyclerView.layoutManager = layoutManager
val divider = DividerItemDecoration(context, RecyclerView.VERTICAL) val divider = DividerItemDecoration(context, RecyclerView.VERTICAL)
binding.recyclerView.addItemDecoration(divider) binding.recyclerView.addItemDecoration(divider)
@ -482,7 +476,7 @@ class TimelineFragment :
override fun onReselect() { override fun onReselect() {
if (isAdded) { if (isAdded) {
layoutManager!!.scrollToPosition(0) binding.recyclerView.layoutManager?.scrollToPosition(0)
binding.recyclerView.stopScroll() binding.recyclerView.stopScroll()
} }
} }