diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-05-27 21:41:59 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-05-27 21:41:59 +0200 |
| commit | 9dd3dc16cdd31a22b0633ca3d8c08a1c5209ce12 (patch) | |
| tree | db63f9abf9ecfba53c7f3c09f6779b4c71bbd877 /main/src/cgeo/geocaching/gcvote | |
| parent | 774f16e33725cb0f540d027e6a5ba771b8fc0d4a (diff) | |
| download | cgeo-9dd3dc16cdd31a22b0633ca3d8c08a1c5209ce12.zip cgeo-9dd3dc16cdd31a22b0633ca3d8c08a1c5209ce12.tar.gz cgeo-9dd3dc16cdd31a22b0633ca3d8c08a1c5209ce12.tar.bz2 | |
#3903: gcvote rating bar
Diffstat (limited to 'main/src/cgeo/geocaching/gcvote')
| -rw-r--r-- | main/src/cgeo/geocaching/gcvote/GCVote.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/gcvote/GCVote.java b/main/src/cgeo/geocaching/gcvote/GCVote.java index 0ab1fe3..d77a4e6 100644 --- a/main/src/cgeo/geocaching/gcvote/GCVote.java +++ b/main/src/cgeo/geocaching/gcvote/GCVote.java @@ -1,6 +1,8 @@ package cgeo.geocaching.gcvote; +import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.Geocache; +import cgeo.geocaching.R; import cgeo.geocaching.network.Network; import cgeo.geocaching.network.Parameters; import cgeo.geocaching.settings.Settings; @@ -253,7 +255,7 @@ public final class GCVote { /** * Get geocodes of all the caches, which can be used with GCVote. Non-GC caches will be filtered out. - * + * * @param caches * @return */ @@ -281,4 +283,33 @@ public final class GCVote { return Settings.isGCvoteLogin() && StringUtils.isNotBlank(cache.getGuid()) && cache.supportsGCVote(); } + public static String getDescription(final float rating) { + switch (Math.round(rating * 2f)) { + case 2: + return getString(R.string.log_stars_1_description); + case 3: + return getString(R.string.log_stars_15_description); + case 4: + return getString(R.string.log_stars_2_description); + case 5: + return getString(R.string.log_stars_25_description); + case 6: + return getString(R.string.log_stars_3_description); + case 7: + return getString(R.string.log_stars_35_description); + case 8: + return getString(R.string.log_stars_4_description); + case 9: + return getString(R.string.log_stars_45_description); + case 10: + return getString(R.string.log_stars_5_description); + default: + return getString(R.string.log_no_rating); + } + } + + private static String getString(int resId) { + return CgeoApplication.getInstance().getString(resId); + } + } |
