diff options
| author | blafoo <github@blafoo.de> | 2012-05-10 09:52:08 +0200 |
|---|---|---|
| committer | blafoo <github@blafoo.de> | 2012-05-10 20:30:50 +0200 |
| commit | 7554613d6ba3b61aac86575667e661ca8548af86 (patch) | |
| tree | aefe8dd3739e9a8e2151485b7f1ea4473d4d3a73 | |
| parent | a1872ca8261b558d6a737067bfa580921f1d6f42 (diff) | |
| download | cgeo-7554613d6ba3b61aac86575667e661ca8548af86.zip cgeo-7554613d6ba3b61aac86575667e661ca8548af86.tar.gz cgeo-7554613d6ba3b61aac86575667e661ca8548af86.tar.bz2 | |
Disable add/remove to watchlist for cache owners
| -rw-r--r-- | main/src/cgeo/geocaching/CacheDetailActivity.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 9f0e9db..1cb219a 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -1666,7 +1666,9 @@ public class CacheDetailActivity extends AbstractActivity { Button buttonRemove = (Button) view.findViewById(R.id.remove_from_watchlist); TextView text = (TextView) view.findViewById(R.id.watchlist_text); - if (cache.isOnWatchlist()) { + boolean userIsOwner = StringUtils.equals(cache.getOwnerReal(), Settings.getUsername()); + + if (cache.isOnWatchlist() || userIsOwner) { buttonAdd.setVisibility(View.GONE); buttonRemove.setVisibility(View.VISIBLE); text.setText(R.string.cache_watchlist_on); @@ -1675,6 +1677,15 @@ public class CacheDetailActivity extends AbstractActivity { buttonRemove.setVisibility(View.GONE); text.setText(R.string.cache_watchlist_not_on); } + + // the owner of a cache has it always on his watchlist. Adding causes an error + if (userIsOwner) { + buttonAdd.setEnabled(false); + buttonAdd.setVisibility(View.GONE); + buttonRemove.setEnabled(false); + buttonRemove.setVisibility(View.GONE); + } + } /** |
