diff options
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/CacheDetailActivity.java | 55 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/LogViewHolder.java | 46 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/TrackableActivity.java | 23 |
3 files changed, 56 insertions, 68 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index bdc1921..58765bc 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -2156,7 +2156,6 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc LogViewHolder holder = (LogViewHolder) rowView.getTag(); if (null == holder) { holder = new LogViewHolder(rowView); - rowView.setTag(holder); } holder.setPosition(position); @@ -2173,11 +2172,11 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc holder.author.setText(StringEscapeUtils.unescapeHtml4(log.author)); // finds count - holder.count.setVisibility(View.VISIBLE); + holder.countOrLocation.setVisibility(View.VISIBLE); if (log.found == -1) { - holder.count.setVisibility(View.GONE); + holder.countOrLocation.setVisibility(View.GONE); } else { - holder.count.setText(res.getQuantityString(R.plurals.cache_counts, log.found, log.found)); + holder.countOrLocation.setText(res.getQuantityString(R.plurals.cache_counts, log.found, log.found)); } // logtext, avoid parsing HTML if not necessary @@ -2215,11 +2214,11 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc // colored marker int marker = log.type.markerId; if (marker != 0) { - holder.statusMarker.setVisibility(View.VISIBLE); - holder.statusMarker.setImageResource(marker); + holder.marker.setVisibility(View.VISIBLE); + holder.marker.setImageResource(marker); } else { - holder.statusMarker.setVisibility(View.GONE); + holder.marker.setVisibility(View.GONE); } if (null == convertView) { @@ -2263,48 +2262,6 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } - private class LogViewHolder { - final TextView date; - final TextView type; - final TextView author; - final TextView count; - final TextView text; - final TextView images; - final ImageView statusMarker; - private int position; - - 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); - count = (TextView) base.findViewById(R.id.count_or_location); - text = (TextView) base.findViewById(R.id.log); - images = (TextView) base.findViewById(R.id.log_images); - statusMarker = (ImageView) base.findViewById(R.id.log_mark); - } - - /** - * Read the position of the cursor pointed to by this holder. <br/> - * This must be called by the UI thread. - * - * @return the cursor position - */ - public int getPosition() { - return position; - } - - /** - * Set the position of the cursor pointed to by this holder. <br/> - * This must be called by the UI thread. - * - * @param position - * the cursor position - */ - public void setPosition(final int position) { - this.position = position; - } - - } } private class WaypointsViewCreator extends AbstractCachingPageViewCreator<ScrollView> { diff --git a/main/src/cgeo/geocaching/LogViewHolder.java b/main/src/cgeo/geocaching/LogViewHolder.java new file mode 100644 index 0000000..1fb3f55 --- /dev/null +++ b/main/src/cgeo/geocaching/LogViewHolder.java @@ -0,0 +1,46 @@ +package cgeo.geocaching; + +import butterknife.InjectView; +import butterknife.Views; + +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +public class LogViewHolder { + @InjectView(R.id.added) protected TextView date ; + @InjectView(R.id.type) protected TextView type; + @InjectView(R.id.author) protected TextView author; + @InjectView(R.id.count_or_location) protected TextView countOrLocation; + @InjectView(R.id.log) protected TextView text; + @InjectView(R.id.log_images) protected TextView images; + @InjectView(R.id.log_mark) protected ImageView marker; + + private int position; + + public LogViewHolder(View rowView) { + Views.inject(this, rowView); + rowView.setTag(this); + } + + /** + * Read the position of the cursor pointed to by this holder. <br/> + * This must be called by the UI thread. + * + * @return the cursor position + */ + public int getPosition() { + return position; + } + + /** + * Set the position of the cursor pointed to by this holder. <br/> + * This must be called by the UI thread. + * + * @param position + * the cursor position + */ + public void setPosition(final int position) { + this.position = position; + } +}
\ No newline at end of file diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java index 1295181..383b327 100644 --- a/main/src/cgeo/geocaching/TrackableActivity.java +++ b/main/src/cgeo/geocaching/TrackableActivity.java @@ -387,21 +387,6 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi public class LogsViewCreator extends AbstractCachingPageViewCreator<ListView> { - protected class LogViewHolder { - @InjectView(R.id.added) protected TextView added ; - @InjectView(R.id.type) protected TextView type; - @InjectView(R.id.author) protected TextView author; - @InjectView(R.id.count_or_location) protected TextView location; - @InjectView(R.id.log) protected TextView text; - @InjectView(R.id.log_images) protected TextView images; - @InjectView(R.id.log_mark) protected ImageView marker; - - public LogViewHolder(View rowView) { - Views.inject(this, rowView); - rowView.setTag(this); - } - } - @Override public ListView getDispatchedView() { view = (ListView) getLayoutInflater().inflate(R.layout.trackable_logs_view, null); @@ -430,19 +415,19 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi protected void fillViewHolder(LogViewHolder holder, final LogEntry log) { if (log.date > 0) { - holder.added.setText(Formatter.formatShortDateVerbally(log.date)); + holder.date.setText(Formatter.formatShortDateVerbally(log.date)); } holder.type.setText(log.type.getL10n()); holder.author.setText(Html.fromHtml(log.author), TextView.BufferType.SPANNABLE); if (StringUtils.isBlank(log.cacheName)) { - holder.location.setVisibility(View.GONE); + holder.countOrLocation.setVisibility(View.GONE); } else { - holder.location.setText(Html.fromHtml(log.cacheName)); + holder.countOrLocation.setText(Html.fromHtml(log.cacheName)); final String cacheGuid = log.cacheGuid; final String cacheName = log.cacheName; - holder.location.setOnClickListener(new View.OnClickListener() { + holder.countOrLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { CacheDetailActivity.startActivityGuid(TrackableActivity.this, cacheGuid, Html.fromHtml(cacheName).toString()); |
