Skip to content

Commit

Permalink
Bugfix: showAndFlash must be called on UI thread, closes #2427 (#2428)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshad1 authored Oct 3, 2024
1 parent cdd623e commit 9b974c9
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -627,13 +627,14 @@ public void onLayoutChange(View v, int l, int t, int r, int b, int ol, int ot, i
public boolean scrollToAndFlash(final File file) {
final int pos = getFilePosition(file);
if (pos >= 0 && _layoutManager != null) {
doAfterChange(() -> _recyclerView.postDelayed(() -> {
final RecyclerView.ViewHolder holder = _recyclerView.findViewHolderForLayoutPosition(pos);
if (holder != null) {
GsContextUtils.blinkView(holder.itemView);
}
}, 400));
_layoutManager.scrollToPosition(pos);
_recyclerView.post(() ->
_recyclerView.postDelayed(() -> {
final RecyclerView.ViewHolder holder = _recyclerView.findViewHolderForLayoutPosition(pos);
if (holder != null) {
GsContextUtils.blinkView(holder.itemView);
}
}, 400));
return true;
}
return false;
Expand Down Expand Up @@ -782,7 +783,7 @@ private synchronized void _loadFolder(final @NonNull File folder, final @Nullabl
}
});
} else if (toShow != null && _adapterDataFiltered.contains(toShow)) {
scrollToAndFlash(toShow);
_recyclerView.post(() -> scrollToAndFlash(toShow));
}
}

Expand Down

0 comments on commit 9b974c9

Please sign in to comment.