aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2011-11-15 06:26:52 +0100
committerBananeweizen <bananeweizen@gmx.de>2011-11-15 06:26:52 +0100
commit91297b8e381d1799066d2bbf14d95e5d071ce273 (patch)
tree4c930d0bcddaf8cc9107a88a394cb551cd4f3fa1 /main/src/cgeo
parentb4f08c8f6b07a084966f1978f880d10a1de43fb9 (diff)
downloadcgeo-91297b8e381d1799066d2bbf14d95e5d071ce273.zip
cgeo-91297b8e381d1799066d2bbf14d95e5d071ce273.tar.gz
cgeo-91297b8e381d1799066d2bbf14d95e5d071ce273.tar.bz2
correctly update button label when logging, fixes #792
Diffstat (limited to 'main/src/cgeo')
-rw-r--r--main/src/cgeo/geocaching/VisitCacheActivity.java39
1 files changed, 20 insertions, 19 deletions
diff --git a/main/src/cgeo/geocaching/VisitCacheActivity.java b/main/src/cgeo/geocaching/VisitCacheActivity.java
index a478c84..c2ee127 100644
--- a/main/src/cgeo/geocaching/VisitCacheActivity.java
+++ b/main/src/cgeo/geocaching/VisitCacheActivity.java
@@ -169,6 +169,23 @@ public class VisitCacheActivity extends cgLogForm {
else {
postButton.setOnTouchListener(null);
postButton.setOnClickListener(null);
+ }
+ updatePostButtonText();
+ }
+
+ private void updatePostButtonText() {
+ if (postButton.isEnabled()) {
+ if (typeSelected == cgBase.LOG_FOUND_IT && Settings.isGCvoteLogin()) {
+ if (rating == 0) {
+ postButton.setText(res.getString(R.string.log_post_no_rate));
+ } else {
+ postButton.setText(res.getString(R.string.log_post_rate) + " " + ratingTextValue(rating) + "*");
+ }
+ } else {
+ postButton.setText(res.getString(R.string.log_post));
+ }
+ }
+ else {
postButton.setText(res.getString(R.string.log_post_not_possible));
}
}
@@ -306,12 +323,7 @@ public class VisitCacheActivity extends cgLogForm {
return true;
} else if (id >= 10 && id <= 19) {
rating = (id - 9) / 2.0;
-
- if (rating == 0.0) {
- postButton.setText(res.getString(R.string.log_post_no_rate));
- } else {
- postButton.setText(res.getString(R.string.log_post_rate) + " " + ratingTextValue(rating) + "*");
- }
+ updatePostButtonText();
return true;
}
final LogTemplate template = LogTemplateProvider.getTemplate(id);
@@ -450,9 +462,7 @@ public class VisitCacheActivity extends cgLogForm {
typeSelected = log.type;
date.setTime(new Date(log.date));
text = log.log;
- if (typeSelected == cgBase.LOG_FOUND_IT && Settings.isGCvoteLogin()) {
- postButton.setText(res.getString(R.string.log_post_no_rate));
- }
+ updatePostButtonText();
} else if (StringUtils.isNotBlank(Settings.getSignature())
&& Settings.isAutoInsertSignature()
&& StringUtils.isBlank(((EditText) findViewById(R.id.log)).getText())) {
@@ -537,16 +547,7 @@ public class VisitCacheActivity extends cgLogForm {
} else {
tweetBox.setVisibility(View.GONE);
}
-
- if (type == cgBase.LOG_FOUND_IT && Settings.isGCvoteLogin()) {
- if (rating == 0) {
- postButton.setText(res.getString(R.string.log_post_no_rate));
- } else {
- postButton.setText(res.getString(R.string.log_post_rate) + " " + ratingTextValue(rating) + "*");
- }
- } else {
- postButton.setText(res.getString(R.string.log_post));
- }
+ updatePostButtonText();
}
private class DateListener implements View.OnClickListener {