aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/LogCacheActivity.java
diff options
context:
space:
mode:
authorrsudev <rasch@munin-soft.de>2013-06-27 17:46:41 +0200
committerrsudev <rasch@munin-soft.de>2013-06-27 17:46:41 +0200
commitdc53fa7be33f3052e39952112679c7b0e0b3b324 (patch)
tree6fef9b63070a08177a13401e90de8916c4a72e91 /main/src/cgeo/geocaching/LogCacheActivity.java
parentcb90fff0100a40bdefae6b57a6b12e9c113b641f (diff)
downloadcgeo-dc53fa7be33f3052e39952112679c7b0e0b3b324.zip
cgeo-dc53fa7be33f3052e39952112679c7b0e0b3b324.tar.gz
cgeo-dc53fa7be33f3052e39952112679c7b0e0b3b324.tar.bz2
Implements #2900, Support logging with password (oc)
Extends db, geocache and OKAPI to retrieve and store the property Extends logging UI and OKAPI to allow entering and sending it
Diffstat (limited to 'main/src/cgeo/geocaching/LogCacheActivity.java')
-rw-r--r--main/src/cgeo/geocaching/LogCacheActivity.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/LogCacheActivity.java b/main/src/cgeo/geocaching/LogCacheActivity.java
index 62c94ce..b3b6c09 100644
--- a/main/src/cgeo/geocaching/LogCacheActivity.java
+++ b/main/src/cgeo/geocaching/LogCacheActivity.java
@@ -71,6 +71,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
private Button postButton = null;
private CheckBox tweetCheck = null;
private LinearLayout tweetBox = null;
+ private LinearLayout logPasswordBox = null;
private boolean tbChanged = false;
private SparseArray<TrackableLog> actionButtons;
@@ -252,6 +253,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
postButton = (Button) findViewById(R.id.post);
tweetBox = (LinearLayout) findViewById(R.id.tweet_box);
tweetCheck = (CheckBox) findViewById(R.id.tweet);
+ logPasswordBox = (LinearLayout) findViewById(R.id.log_password_box);
// initialize with default values
setDefaultValues();
@@ -302,6 +304,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
tweetCheck.setChecked(true);
updateTweetBox(typeSelected);
+ updateLogPasswordBox(typeSelected);
final Button imageButton = (Button) findViewById(R.id.image_btn);
imageButton.setOnClickListener(new View.OnClickListener() {
@@ -377,6 +380,8 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
final EditText logView = (EditText) findViewById(R.id.log);
logView.setText(StringUtils.EMPTY);
+ final EditText logPasswordView = (EditText) findViewById(R.id.log_password);
+ logPasswordView.setText(StringUtils.EMPTY);
updateImageButton();
@@ -491,6 +496,14 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
}
}
+ private void updateLogPasswordBox(LogType type) {
+ if (type == LogType.FOUND_IT && cache.isLogPasswordRequired()) {
+ logPasswordBox.setVisibility(View.VISIBLE);
+ } else {
+ logPasswordBox.setVisibility(View.GONE);
+ }
+ }
+
private class DateListener implements View.OnClickListener {
@Override
@@ -507,7 +520,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
final String message = res.getString(StringUtils.isBlank(imageUri.getPath()) ?
R.string.log_saving :
R.string.log_saving_and_uploading);
- new Poster(LogCacheActivity.this, message).execute(currentLogText());
+ new Poster(LogCacheActivity.this, message).execute(currentLogText(), currentLogPassword());
}
}
@@ -520,8 +533,9 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
@Override
protected StatusCode doInBackgroundInternal(final String[] logTexts) {
final String log = logTexts[0];
+ final String logPwd = logTexts.length > 1 ? logTexts[1] : null;
try {
- final LogResult logResult = loggingManager.postLog(cache, typeSelected, date, log, trackables);
+ final LogResult logResult = loggingManager.postLog(cache, typeSelected, date, log, logPwd, trackables);
if (logResult.getPostLogResult() == StatusCode.NO_ERROR) {
final LogEntry logNow = new LogEntry(date, typeSelected, log);
@@ -593,6 +607,10 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
return ((EditText) findViewById(R.id.log)).getText().toString();
}
+ private String currentLogPassword() {
+ return ((EditText) findViewById(R.id.log_password)).getText().toString();
+ }
+
@Override
protected LogContext getLogContext() {
return new LogContext(cache);