diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2013-05-28 10:14:25 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2013-05-28 10:14:25 +0200 |
| commit | a89e683d216baae38bc5711848f3516833f5e18b (patch) | |
| tree | 1286b3067deeffc18a13345cb5d32551fc3df397 /main/src/cgeo/geocaching/ui | |
| parent | 4733c57263fb74e498f4c7d5b8edcab967c45c6b (diff) | |
| parent | 140c1fd3573811596900e9ae7bae713ba8803f93 (diff) | |
| download | cgeo-a89e683d216baae38bc5711848f3516833f5e18b.zip cgeo-a89e683d216baae38bc5711848f3516833f5e18b.tar.gz cgeo-a89e683d216baae38bc5711848f3516833f5e18b.tar.bz2 | |
Merge branch 'release' into upstream
Diffstat (limited to 'main/src/cgeo/geocaching/ui')
| -rw-r--r-- | main/src/cgeo/geocaching/ui/CacheListAdapter.java | 6 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/ui/DirectionImage.java | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java index 99ae405..7f4ceaa 100644 --- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java +++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java @@ -18,6 +18,7 @@ import cgeo.geocaching.utils.AngleUtils; import cgeo.geocaching.utils.Log; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.HashCodeBuilder; import android.app.Activity; @@ -443,10 +444,13 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { holder.dirImg.setVisibility(View.GONE); holder.direction.updateAzimuth(azimuth); holder.direction.updateHeading(cache.getDirection()); - } else { + } else if (StringUtils.isNotBlank(cache.getDirectionImg())) { holder.dirImg.setImageDrawable(DirectionImage.getDrawable(cache.getDirectionImg())); holder.dirImg.setVisibility(View.VISIBLE); holder.direction.setVisibility(View.GONE); + } else { + holder.dirImg.setVisibility(View.GONE); + holder.direction.setVisibility(View.GONE); } holder.favorite.setText(Integer.toString(cache.getFavoritePoints())); diff --git a/main/src/cgeo/geocaching/ui/DirectionImage.java b/main/src/cgeo/geocaching/ui/DirectionImage.java index df7275d..9de360c 100644 --- a/main/src/cgeo/geocaching/ui/DirectionImage.java +++ b/main/src/cgeo/geocaching/ui/DirectionImage.java @@ -3,6 +3,8 @@ package cgeo.geocaching.ui; import cgeo.geocaching.StoredList; import cgeo.geocaching.network.HtmlImage; +import org.apache.commons.lang3.StringUtils; + import android.graphics.drawable.BitmapDrawable; public class DirectionImage { @@ -16,7 +18,7 @@ public class DirectionImage { * @return a drawable with the arrow pointing into the right direction */ public static BitmapDrawable getDrawable(final String directionCode) { - return htmlImage.getDrawable("http://www.geocaching.com/images/icons/compass/" + directionCode + ".gif"); + return StringUtils.isNotBlank(directionCode) ? htmlImage.getDrawable("http://www.geocaching.com/images/icons/compass/" + directionCode + ".gif") : null; } } |
