aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2013-05-22 00:38:27 +0200
committerSamuel Tardieu <sam@rfc1149.net>2013-05-22 00:38:27 +0200
commit2139a3f48c540044b2fbb30eea79bfc3e3c05183 (patch)
tree63a1be22d8e817db9f9a3097199bda26e08b8656 /main/src
parentf4b34e4f53b76edf700f829e98d167ad487f5723 (diff)
parent1f221d6bd93f3b14f4362fc7c3c7d8698de41516 (diff)
downloadcgeo-2139a3f48c540044b2fbb30eea79bfc3e3c05183.zip
cgeo-2139a3f48c540044b2fbb30eea79bfc3e3c05183.tar.gz
cgeo-2139a3f48c540044b2fbb30eea79bfc3e3c05183.tar.bz2
Merge branch 'issue-2749' into upstream
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index cf093af..4d3a0f0 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -2111,6 +2111,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
holder = new LogViewHolder(rowView);
rowView.setTag(holder);
}
+ holder.setPosition(position);
final LogEntry log = getItem(position);
@@ -2192,10 +2193,12 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
/** Loads the Log Images outside the ui thread. */
private class LogImageLoader extends AsyncTask<String, Progress, Spanned> {
- private LogViewHolder holder;
+ final private LogViewHolder holder;
+ final private int position;
public LogImageLoader(LogViewHolder holder) {
this.holder = holder;
+ this.position = holder.getPosition();
}
@Override
@@ -2205,7 +2208,10 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
@Override
protected void onPostExecute(Spanned result) {
- holder.text.setText(result);
+ // Ensure that this holder and its view still references the right item before updating the text.
+ if (position == holder.getPosition()) {
+ holder.text.setText(result);
+ }
}
}
@@ -2218,8 +2224,9 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
final TextView text;
final TextView images;
final ImageView statusMarker;
+ private int position;
- public LogViewHolder(View base) {
+ public LogViewHolder(final View base) {
date = (TextView) base.findViewById(R.id.added);
type = (TextView) base.findViewById(R.id.type);
author = (TextView) base.findViewById(R.id.author);
@@ -2228,6 +2235,15 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
images = (TextView) base.findViewById(R.id.log_images);
statusMarker = (ImageView) base.findViewById(R.id.log_mark);
}
+
+ public int getPosition() {
+ return position;
+ }
+
+ public void setPosition(final int position) {
+ this.position = position;
+ }
+
}
}