aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/ui/CacheDetailsCreator.java')
-rw-r--r--main/src/cgeo/geocaching/ui/CacheDetailsCreator.java27
1 files changed, 12 insertions, 15 deletions
diff --git a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
index 2a83ddc..e98bd77 100644
--- a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
+++ b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
@@ -1,7 +1,7 @@
package cgeo.geocaching.ui;
+import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
-import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.geopoint.Units;
@@ -35,7 +35,7 @@ public final class CacheDetailsCreator {
}
public TextView add(final int nameId, final CharSequence value) {
- final RelativeLayout layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.cache_item, null);
+ final RelativeLayout layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.cache_information_item, null);
final TextView nameView = (TextView) layout.findViewById(R.id.name);
nameView.setText(res.getString(nameId));
lastValueView = (TextView) layout.findViewById(R.id.value);
@@ -49,23 +49,22 @@ public final class CacheDetailsCreator {
}
public RelativeLayout addStars(final int nameId, final float value) {
- final RelativeLayout layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.cache_layout, null);
+ final RelativeLayout layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.cache_information_item, null);
final TextView nameView = (TextView) layout.findViewById(R.id.name);
lastValueView = (TextView) layout.findViewById(R.id.value);
final LinearLayout layoutStars = (LinearLayout) layout.findViewById(R.id.stars);
nameView.setText(activity.getResources().getString(nameId));
lastValueView.setText(String.format("%.1f", value) + ' ' + activity.getResources().getString(R.string.cache_rating_of) + " 5");
- layoutStars.addView(createStarImages(value), 1);
+ createStarImages(layoutStars, value);
+ layoutStars.setVisibility(View.VISIBLE);
parentView.addView(layout);
return layout;
}
- private LinearLayout createStarImages(final float value) {
+ private void createStarImages(final ViewGroup starsContainer, final float value) {
final LayoutInflater inflater = LayoutInflater.from(activity);
- final LinearLayout starsContainer = new LinearLayout(activity);
- starsContainer.setOrientation(LinearLayout.HORIZONTAL);
for (int i = 0; i < 5; i++) {
ImageView star = (ImageView) inflater.inflate(R.layout.star, null);
@@ -78,11 +77,9 @@ public final class CacheDetailsCreator {
}
starsContainer.addView(star);
}
-
- return starsContainer;
}
- public void addCacheState(cgCache cache) {
+ public void addCacheState(Geocache cache) {
if (cache.isLogOffline() || cache.isArchived() || cache.isDisabled() || cache.isPremiumMembersOnly() || cache.isFound()) {
final List<String> states = new ArrayList<String>(5);
if (cache.isLogOffline()) {
@@ -104,7 +101,7 @@ public final class CacheDetailsCreator {
}
}
- public void addRating(cgCache cache) {
+ public void addRating(Geocache cache) {
if (cache.getRating() > 0) {
final RelativeLayout itemLayout = addStars(R.string.cache_rating, cache.getRating());
if (cache.getVotes() > 0) {
@@ -115,25 +112,25 @@ public final class CacheDetailsCreator {
}
}
- public void addSize(cgCache cache) {
+ public void addSize(Geocache cache) {
if (null != cache.getSize() && cache.showSize()) {
add(R.string.cache_size, cache.getSize().getL10n());
}
}
- public void addDifficulty(cgCache cache) {
+ public void addDifficulty(Geocache cache) {
if (cache.getDifficulty() > 0) {
addStars(R.string.cache_difficulty, cache.getDifficulty());
}
}
- public void addTerrain(cgCache cache) {
+ public void addTerrain(Geocache cache) {
if (cache.getTerrain() > 0) {
addStars(R.string.cache_terrain, cache.getTerrain());
}
}
- public void addDistance(final cgCache cache, final TextView cacheDistanceView) {
+ public void addDistance(final Geocache cache, final TextView cacheDistanceView) {
Float distance = null;
if (cache.getCoords() != null) {
final Geopoint currentCoords = cgeoapplication.getInstance().currentGeo().getCoords();