mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Avoid loading the same image multiple times.
Prevents 'flashing' when content of a list item changes
This commit is contained in:
parent
9139f29716
commit
d319132c1b
1 changed files with 5 additions and 2 deletions
|
|
@ -70,14 +70,17 @@ public class ContributionsActivity extends AuthenticatedActivity implements Load
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindView(View view, Context context, Cursor cursor) {
|
public void bindView(View view, Context context, Cursor cursor) {
|
||||||
ImageView image = (ImageView)view.findViewById(R.id.contributionImage);
|
ImageView imageView = (ImageView)view.findViewById(R.id.contributionImage);
|
||||||
TextView titleView = (TextView)view.findViewById(R.id.contributionTitle);
|
TextView titleView = (TextView)view.findViewById(R.id.contributionTitle);
|
||||||
TextView stateView = (TextView)view.findViewById(R.id.contributionState);
|
TextView stateView = (TextView)view.findViewById(R.id.contributionState);
|
||||||
|
|
||||||
Uri imageUri = Uri.parse(cursor.getString(COLUMN_LOCALURI));
|
Uri imageUri = Uri.parse(cursor.getString(COLUMN_LOCALURI));
|
||||||
int state = cursor.getInt(COLUMN_STATE);
|
int state = cursor.getInt(COLUMN_STATE);
|
||||||
|
|
||||||
ImageLoader.getInstance().displayImage(imageUri.toString(), image, contributionDisplayOptions);
|
if(imageView.getTag() == null || !imageView.getTag().equals(imageUri.toString())) {
|
||||||
|
ImageLoader.getInstance().displayImage(imageUri.toString(), imageView, contributionDisplayOptions);
|
||||||
|
imageView.setTag(imageUri.toString());
|
||||||
|
}
|
||||||
|
|
||||||
titleView.setText(cursor.getString(COLUMN_FILENAME));
|
titleView.setText(cursor.getString(COLUMN_FILENAME));
|
||||||
if(state == Contribution.STATE_COMPLETED) {
|
if(state == Contribution.STATE_COMPLETED) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue