mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
fixed the contribution crash on scroll (#4128)
* fixed the contribution crash on scroll * Investigation Just to get the Log of the issue * fixed null data causing scroll to top * Removed unneeded log import.
This commit is contained in:
parent
e1be458821
commit
7730112807
2 changed files with 9 additions and 1 deletions
|
|
@ -64,6 +64,12 @@ public class ContributionViewHolder extends RecyclerView.ViewHolder {
|
|||
}
|
||||
|
||||
public void init(final int position, final Contribution contribution) {
|
||||
|
||||
//handling crashes when the contribution is null.
|
||||
if( null == contribution) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.contribution = contribution;
|
||||
this.position = position;
|
||||
titleView.setText(contribution.getMedia().getMostRelevantCaption());
|
||||
|
|
|
|||
|
|
@ -150,9 +150,11 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment impl
|
|||
public void onItemRangeInserted(int positionStart, int itemCount) {
|
||||
super.onItemRangeInserted(positionStart, itemCount);
|
||||
if (itemCount > 0 && positionStart == 0) {
|
||||
if(adapter.getContributionForPosition(positionStart)!=null) {
|
||||
rvContributionsList.scrollToPosition(0);//Newly upload items are always added to the top
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue