aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching')
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java33
1 files changed, 22 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 76411a2..f0cb392 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -1508,17 +1508,6 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
final String longDescription = cache.getDescription();
loadDescription(longDescription, longDescView, loadingView);
-
- // Hide the short description, if it is contained somewhere at the start of the long description.
- if (shortDescView != null) {
- final String shortDescription = cache.getShortDescription();
- if (StringUtils.isNotBlank(shortDescription)) {
- final int index = longDescription.indexOf(shortDescription);
- if (index >= 0 && index < 200) {
- shortDescView.setVisibility(View.GONE);
- }
- }
- }
}
private void warnPersonalNoteExceedsLimit() {
@@ -1611,6 +1600,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
fixTextColor(descriptionString);
descriptionView.setVisibility(View.VISIBLE);
addContextMenu(descriptionView);
+ potentiallyHideShortDescription();
}
}
@@ -1649,6 +1639,27 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
}, Schedulers.io());
}
+ /**
+ * Hide the short description, if it is contained somewhere at the start of the long description.
+ */
+ public void potentiallyHideShortDescription() {
+ final View shortView = ButterKnife.findById(this, R.id.shortdesc);
+ if (shortView == null) {
+ return;
+ }
+ if (shortView.getVisibility() == View.GONE) {
+ return;
+ }
+ final String shortDescription = cache.getShortDescription();
+ if (StringUtils.isNotBlank(shortDescription)) {
+ final int index = StringUtils.indexOf(cache.getDescription(), shortDescription);
+ // allow up to 200 characters of HTML formatting
+ if (index >= 0 && index < 200) {
+ shortView.setVisibility(View.GONE);
+ }
+ }
+ }
+
private void ensureSaved() {
if (!cache.isOffline()) {
showToast(getString(R.string.info_cache_saved));