Do not scroll to top on timeline refresh (#681)

* Do not scroll to top on timeline refresh

* Use dp for shifting timeline
main
Ivan Kupalov 6 years ago committed by Konrad Pozniak
parent 335e9ca390
commit 56752dba33
  1. 8
      app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java

@ -78,6 +78,7 @@ import java.util.regex.Pattern;
import javax.inject.Inject;
import at.connyduck.sparkbutton.helpers.Utils;
import io.reactivex.android.schedulers.AndroidSchedulers;
import retrofit2.Call;
import retrofit2.Callback;
@ -1065,11 +1066,8 @@ public class TimelineFragment extends SFragment implements
@Override
public void onInserted(int position, int count) {
adapter.notifyItemRangeInserted(position, count);
if (position == 0
&& layoutManager.findFirstVisibleItemPosition() == 0
&& (swipeRefreshLayout.getVisibility() == View.VISIBLE
|| progressBar.getVisibility() == View.VISIBLE)) {
recyclerView.post(() -> layoutManager.scrollToPosition(0));
if (position == 0) {
recyclerView.scrollBy(0, Utils.dpToPx(Objects.requireNonNull(getContext()), -30));
}
}

Loading…
Cancel
Save