diff options
| -rw-r--r-- | main/src/cgeo/geocaching/ui/CacheListAdapter.java | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java index 9646c6a..e7752d6 100644 --- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java +++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java @@ -61,6 +61,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { private boolean selectMode = false; private IFilter currentFilter = null; private List<Geocache> originalList = null; + private boolean isLiveList = Settings.isLiveList(); final private Set<CompassMiniView> compasses = new LinkedHashSet<CompassMiniView>(); final private Set<DistanceView> distances = new LinkedHashSet<DistanceView>(); @@ -428,26 +429,33 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { if (cache.getDistance() != null) { holder.distance.setDistance(cache.getDistance()); } - if (cache.getCoords() != null) { - holder.direction.setVisibility(View.VISIBLE); - holder.dirImg.setVisibility(View.GONE); - holder.direction.updateAzimuth(azimuth); - if (coords != null) { - holder.distance.update(coords); - holder.direction.updateCurrentCoords(coords); + + if (cache.getCoords() != null && coords != null) { + holder.distance.update(coords); + } + + // only show the direction if this is enabled in the settings + if (isLiveList) { + if (cache.getCoords() != null) { + holder.direction.setVisibility(View.VISIBLE); + holder.dirImg.setVisibility(View.GONE); + holder.direction.updateAzimuth(azimuth); + if (coords != null) { + holder.direction.updateCurrentCoords(coords); + } + } else if (cache.getDirection() != null) { + holder.direction.setVisibility(View.VISIBLE); + holder.dirImg.setVisibility(View.GONE); + holder.direction.updateAzimuth(azimuth); + holder.direction.updateHeading(cache.getDirection()); + } 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); } - } else if (cache.getDirection() != null) { - holder.direction.setVisibility(View.VISIBLE); - holder.dirImg.setVisibility(View.GONE); - holder.direction.updateAzimuth(azimuth); - holder.direction.updateHeading(cache.getDirection()); - } 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())); |
