From 434d345d0138d8aba67a66d8d47665f45bc26cff Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Sun, 29 May 2022 19:23:08 +0200 Subject: [PATCH] remove unused member vars from TimelineFragment (#2561) --- .../tusky/components/timeline/TimelineFragment.kt | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt index 96b438eba..bdc778128 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt @@ -103,9 +103,6 @@ class TimelineFragment : private lateinit var adapter: TimelinePagingAdapter private var isSwipeToRefreshEnabled = true - - private var layoutManager: LinearLayoutManager? = null - private var scrollListener: RecyclerView.OnScrollListener? = null private var hideFab = false override fun onCreate(savedInstanceState: Bundle?) { @@ -226,7 +223,7 @@ class TimelineFragment : if (actionButtonPresent()) { val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext()) hideFab = preferences.getBoolean("fabHide", false) - scrollListener = object : RecyclerView.OnScrollListener() { + binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrolled(view: RecyclerView, dx: Int, dy: Int) { val composeButton = (activity as ActionButtonActivity).actionButton if (composeButton != null) { @@ -241,9 +238,7 @@ class TimelineFragment : } } } - }.also { - binding.recyclerView.addOnScrollListener(it) - } + }) } eventHub.events @@ -279,8 +274,7 @@ class TimelineFragment : } ) binding.recyclerView.setHasFixedSize(true) - layoutManager = LinearLayoutManager(context) - binding.recyclerView.layoutManager = layoutManager + binding.recyclerView.layoutManager = LinearLayoutManager(context) val divider = DividerItemDecoration(context, RecyclerView.VERTICAL) binding.recyclerView.addItemDecoration(divider) @@ -482,7 +476,7 @@ class TimelineFragment : override fun onReselect() { if (isAdded) { - layoutManager!!.scrollToPosition(0) + binding.recyclerView.layoutManager?.scrollToPosition(0) binding.recyclerView.stopScroll() } }