Skip to content

Commit 9e266ff

Browse files
committed
requested-changes-applied
1 parent b1134c8 commit 9e266ff

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,15 @@ class MySiteTabFragment : Fragment(R.layout.my_site_tab_fragment),
172172
htmlCompatWrapper
173173
) { viewModel.onBloggingPromptsLearnMoreClicked() }
174174

175+
adapter.registerAdapterDataObserver(object : AdapterDataObserver() {
176+
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
177+
super.onItemRangeInserted(positionStart, itemCount)
178+
if (itemCount == ONE_ITEM && positionStart == FIRST_ITEM) {
179+
recyclerView.smoothScrollToPosition(0)
180+
}
181+
}
182+
})
183+
175184
savedInstanceState?.getBundle(KEY_NESTED_LISTS_STATES)?.let {
176185
adapter.onRestoreInstanceState(it)
177186
}
@@ -607,6 +616,8 @@ class MySiteTabFragment : Fragment(R.layout.my_site_tab_fragment),
607616
private const val TAG_QUICK_START_DIALOG = "TAG_QUICK_START_DIALOG"
608617
private const val KEY_MY_SITE_TAB_TYPE = "key_my_site_tab_type"
609618
private const val CHECK_REFRESH_DELAY = 300L
619+
private const val ONE_ITEM = 1
620+
private const val FIRST_ITEM = 0
610621

611622
@JvmStatic
612623
fun newInstance(mySiteTabType: MySiteTabType) = MySiteTabFragment().apply {

0 commit comments

Comments
 (0)