Skip to content

Commit 308a394

Browse files
authored
Merge pull request #17083 from GitStartHQ/issue/16436-My_Site_Dashboard_List_Scrolling_positions_are_not_maintained
My Site Dashboard: List Scrolling positions are not maintained #16436
2 parents 638f9eb + 47cdf0b commit 308a394

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

WordPress/src/main/java/org/wordpress/android/ui/mysite/tabs/MySiteTabFragment.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ class MySiteTabFragment : Fragment(R.layout.my_site_tab_fragment),
176176
adapter.registerAdapterDataObserver(object : AdapterDataObserver() {
177177
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
178178
super.onItemRangeInserted(positionStart, itemCount)
179-
recyclerView.smoothScrollToPosition(0)
179+
if (itemCount == ONE_ITEM && positionStart == FIRST_ITEM) {
180+
recyclerView.smoothScrollToPosition(0)
181+
}
180182
}
181183
})
182184

@@ -615,6 +617,8 @@ class MySiteTabFragment : Fragment(R.layout.my_site_tab_fragment),
615617
private const val TAG_QUICK_START_DIALOG = "TAG_QUICK_START_DIALOG"
616618
private const val KEY_MY_SITE_TAB_TYPE = "key_my_site_tab_type"
617619
private const val CHECK_REFRESH_DELAY = 300L
620+
private const val ONE_ITEM = 1
621+
private const val FIRST_ITEM = 0
618622

619623
@JvmStatic
620624
fun newInstance(mySiteTabType: MySiteTabType) = MySiteTabFragment().apply {

0 commit comments

Comments
 (0)