mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-10-22 20:55:44 +03:00
Fix #912 Crash because of ArrayIndexOutOfBoundsException
This commit is contained in:
parent
f2b81ed38e
commit
83024f6efe
3 changed files with 10 additions and 7 deletions
|
@ -29,14 +29,14 @@ public class GridItemDecoration extends SectionItemDecoration {
|
|||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
final int position = parent.getChildAdapterPosition(view);
|
||||
final StaggeredGridLayoutManager.LayoutParams lp = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
if (position >= 0) {
|
||||
final StaggeredGridLayoutManager.LayoutParams lp = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
|
||||
if (adapter.getItemViewType(position) == ItemAdapter.TYPE_SECTION) {
|
||||
lp.setFullSpan(true);
|
||||
} else {
|
||||
final int spanIndex = lp.getSpanIndex();
|
||||
if (adapter.getItemViewType(position) == ItemAdapter.TYPE_SECTION) {
|
||||
lp.setFullSpan(true);
|
||||
} else {
|
||||
final int spanIndex = lp.getSpanIndex();
|
||||
|
||||
if (position >= 0) {
|
||||
// First row gets some spacing at the top
|
||||
if (position < spanCount && position < adapter.getFirstPositionOfViewType(ItemAdapter.TYPE_SECTION)) {
|
||||
outRect.top = gutter;
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SectionItemDecoration extends RecyclerView.ItemDecoration {
|
|||
@CallSuper
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
final int position = parent.getChildAdapterPosition(view);
|
||||
if (adapter.getItemViewType(position) == ItemAdapter.TYPE_SECTION) {
|
||||
if (position >= 0 && adapter.getItemViewType(position) == ItemAdapter.TYPE_SECTION) {
|
||||
outRect.left = sectionLeft;
|
||||
outRect.top = sectionTop;
|
||||
outRect.right = sectionRight;
|
||||
|
|
3
fastlane/metadata/android/en-US/changelogs/2016007.txt
Normal file
3
fastlane/metadata/android/en-US/changelogs/2016007.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
- 🌎 Language updates
|
||||
- 🐞 Prevent CalledFromWrongThreadException
|
||||
- 🐞 Prevent ArrayIndexOutOfBoundsException (#912)
|
Loading…
Reference in a new issue