private void updateFavPointBox(final CacheDetailActivity activity) {
            // Favorite counts
            final int favCount = cache.getFavoritePoints();
            if (favCount >= 0 && !cache.isEventCache()) {
                favoriteLine.layout.setVisibility(View.VISIBLE);

                final int findsCount = cache.getFindsCount();
                if (findsCount > 0) {
                    favoriteLine.valueView.setText(activity.res.getString(R.string.favorite_count_percent, favCount, Math.min((float) (favCount * 100) / findsCount, 100.0f)));
                } else {
                    favoriteLine.valueView.setText(activity.res.getString(R.string.favorite_count, favCount));
                }
            } else {
                favoriteLine.layout.setVisibility(View.GONE);
            }
            final boolean supportsFavoritePoints = cache.supportsFavoritePoints();
            binding.favpointBox.setVisibility(supportsFavoritePoints ? View.VISIBLE : View.GONE);
            if (!supportsFavoritePoints) {
                return;
            }

            if (cache.isFavorite()) {
                binding.addToFavpoint.setVisibility(View.GONE);
                binding.removeFromFavpoint.setVisibility(View.VISIBLE);
                binding.favpointText.setText(R.string.cache_favpoint_on);
            } else {
                binding.addToFavpoint.setVisibility(View.VISIBLE);
                binding.removeFromFavpoint.setVisibility(View.GONE);
                binding.favpointText.setText(R.string.cache_favpoint_not_on);
            }

            // Add/remove to Favorites is only possible if the cache has been found
            if (!cache.isFound()) {
                binding.addToFavpoint.setVisibility(View.GONE);
                binding.removeFromFavpoint.setVisibility(View.GONE);
            }
        }
Show/hide buttons, set text in favorite line and box
main/src/main/java/cgeo/geocaching/CacheDetailActivity.java