Merge pull request #3495 from Stypox/fix-rotation

Fix rotation
This commit is contained in:
Tobias Groza 2020-04-27 09:18:08 +02:00 committed by GitHub
commit f4f4f062cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -131,16 +131,15 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
} }
private int getFocusedPosition() { private int getFocusedPosition() {
View focusedItem = itemsList.getFocusedChild(); try {
if (focusedItem != null) { final View focusedItem = itemsList.getFocusedChild();
RecyclerView.ViewHolder itemHolder = itemsList.findContainingViewHolder(focusedItem); final RecyclerView.ViewHolder itemHolder =
if (itemHolder != null) { itemsList.findContainingViewHolder(focusedItem);
return itemHolder.getAdapterPosition(); return itemHolder.getAdapterPosition();
} } catch (NullPointerException e) {
}
return -1; return -1;
} }
}
@Override @Override
public void writeTo(final Queue<Object> objectsToSave) { public void writeTo(final Queue<Object> objectsToSave) {