fix crash when recycler view is null

This commit is contained in:
sk 2023-01-23 08:23:15 -03:00 committed by LucasGGamerM
parent dd3bf1d1e0
commit 648c3a0c0d
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
package org.joinmastodon.android.fragments;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
public interface IsOnTop {
boolean isOnTop();
default boolean isRecyclerViewOnTop(@Nullable RecyclerView list) {
if (list == null) return true;
return !list.canScrollVertically(-1);
}
}