fix crash when recycler view is null
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
package org.joinmastodon.android.fragments;
|
package org.joinmastodon.android.fragments;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
public interface IsOnTop {
|
public interface IsOnTop {
|
||||||
boolean isOnTop();
|
boolean isOnTop();
|
||||||
|
|
||||||
default boolean isRecyclerViewOnTop(RecyclerView list) {
|
default boolean isRecyclerViewOnTop(@Nullable RecyclerView list) {
|
||||||
|
if (list == null) return true;
|
||||||
return !list.canScrollVertically(-1);
|
return !list.canScrollVertically(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user