[app] Fix crash when rotating screen (#743)

This commit is contained in:
LoveSy 2021-06-11 18:59:27 +08:00 committed by GitHub
parent ccafa7d29a
commit 32329ac7d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -368,7 +368,9 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
}
}
});
binding.recyclerView.onApplyWindowInsets(requireActivity().getWindow().getDecorView().getRootWindowInsets());
var insets = requireActivity().getWindow().getDecorView().getRootWindowInsets();
if (insets != null)
binding.recyclerView.onApplyWindowInsets(insets);
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
RecyclerViewKt.addFastScroller(binding.recyclerView, binding.recyclerView);
return binding.getRoot();

View File

@ -406,7 +406,9 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
holder.recyclerView.setTag(position);
holder.recyclerView.setLayoutManager(new LinearLayoutManagerFix(requireActivity()));
holder.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setRaised(!top));
holder.recyclerView.onApplyWindowInsets(requireActivity().getWindow().getDecorView().getRootWindowInsets());
var insets = requireActivity().getWindow().getDecorView().getRootWindowInsets();
if (insets != null)
holder.recyclerView.onApplyWindowInsets(insets);
RecyclerViewKt.fixEdgeEffect(holder.recyclerView, false, true);
RecyclerViewKt.addFastScroller(holder.recyclerView, holder.itemView);
break;