Skip to content

Commit

Permalink
Fix random post closing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CatotheCat11 committed Dec 25, 2024
1 parent ac704fd commit a0e11d1
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions app/src/main/java/com/cato/glasssky/Timeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,16 @@ public void onImageLoaded(Bitmap bitmap) {
} catch (JSONException e) {
throw new RuntimeException(e);
}
if(!text.isEmpty()) {
extraCards = images.length() + 5;
mCardScrollView.setSelection(extraCards - (images.length() + 1));
} else {
extraCards = images.length() + 4;
mCardScrollView.setSelection(extraCards - (images.length()));
}
mAdapter.notifyDataSetChanged();
runOnUiThread(() -> {
if(!text.isEmpty()) {
extraCards = images.length() + 5;
mCardScrollView.setSelection(extraCards - (images.length() + 1));
} else {
extraCards = images.length() + 4;
mCardScrollView.setSelection(extraCards - (images.length()));
}
mAdapter.notifyDataSetChanged();
});
SetPosts(responseArray);
}
}
Expand Down Expand Up @@ -256,8 +258,10 @@ public void onImageLoaded(Bitmap bitmap) {
} else {
extraCards = 5;
}
mCardScrollView.setSelection(extraCards - 2);
mAdapter.notifyDataSetChanged();
runOnUiThread(() -> {
mCardScrollView.setSelection(extraCards - 2);
mAdapter.notifyDataSetChanged();
});
SetPosts(responseArray);
}
});
Expand Down

0 comments on commit a0e11d1

Please sign in to comment.