fix notifications sometimes not rendering (#1905)

* fix notifications sometimes not rendering

* fix empty timeline fragment as well

* add link to github issue as explanation
This commit is contained in:
Konrad Pozniak 2020-08-21 18:51:05 +02:00 committed by GitHub
commit 6ee493d8ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -1405,7 +1405,9 @@ public class TimelineFragment extends SFragment implements
if (isAdded()) {
adapter.notifyItemRangeInserted(position, count);
Context context = getContext();
if (position == 0 && context != null) {
// scroll up when new items at the top are loaded while being in the first position
// https://github.com/tuskyapp/Tusky/pull/1905#issuecomment-677819724
if (position == 0 && context != null && adapter.getItemCount() != count) {
if (isSwipeToRefreshEnabled)
recyclerView.scrollBy(0, Utils.dpToPx(context, -30));
else