aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java35
-rw-r--r--main/src/cgeo/geocaching/cgData.java6
-rw-r--r--main/src/cgeo/geocaching/cgTrackable.java2
-rw-r--r--main/src/cgeo/geocaching/files/GPXImporter.java1
-rw-r--r--main/src/cgeo/geocaching/network/Network.java6
5 files changed, 26 insertions, 24 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 6fef4c4..2dcafde 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -1936,21 +1936,26 @@ public class CacheDetailActivity extends AbstractActivity {
personalNoteView.setMovementMethod(LinkMovementMethod.getInstance());
registerForContextMenu(personalNoteView);
final Button personalNoteEdit = (Button) view.findViewById(R.id.edit_personalnote);
- personalNoteEdit.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- EditorDialog editor = new EditorDialog(CacheDetailActivity.this, personalNoteView.getText());
- editor.setOnEditorUpdate(new EditorDialog.EditorUpdate() {
- @Override
- public void update(CharSequence editorText) {
- cache.setPersonalNote(editorText.toString());
- setPersonalNote(personalNoteView);
- app.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
- }
- });
- editor.show();
- }
- });
+ if (cache.isOffline()) {
+ personalNoteEdit.setVisibility(View.VISIBLE);
+ personalNoteEdit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ EditorDialog editor = new EditorDialog(CacheDetailActivity.this, personalNoteView.getText());
+ editor.setOnEditorUpdate(new EditorDialog.EditorUpdate() {
+ @Override
+ public void update(CharSequence editorText) {
+ cache.setPersonalNote(editorText.toString());
+ setPersonalNote(personalNoteView);
+ app.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ }
+ });
+ editor.show();
+ }
+ });
+ } else {
+ personalNoteEdit.setVisibility(View.INVISIBLE);
+ }
// cache hint and spoiler images
final View hintBoxView = view.findViewById(R.id.hint_box);
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java
index 773f08a..b822c2b 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/cgData.java
@@ -1915,14 +1915,14 @@ public class cgData {
}
public List<LogEntry> loadLogs(String geocode) {
+ List<LogEntry> logs = new ArrayList<LogEntry>();
+
if (StringUtils.isBlank(geocode)) {
- return null;
+ return logs;
}
init();
- List<LogEntry> logs = new ArrayList<LogEntry>();
-
Cursor cursor = database.rawQuery(
"SELECT cg_logs._id as cg_logs_id, type, author, log, date, found, friend, " + dbTableLogImages + "._id as cg_logImages_id, log_id, title, url FROM "
+ dbTableLogs + " LEFT OUTER JOIN " + dbTableLogImages
diff --git a/main/src/cgeo/geocaching/cgTrackable.java b/main/src/cgeo/geocaching/cgTrackable.java
index c9b5623..7ed3424 100644
--- a/main/src/cgeo/geocaching/cgTrackable.java
+++ b/main/src/cgeo/geocaching/cgTrackable.java
@@ -191,7 +191,7 @@ public class cgTrackable implements ILogable {
}
public void setLogs(List<LogEntry> logs) {
- this.logs = logs;
+ this.logs = logs != null ? logs : new ArrayList<LogEntry>();
}
@Override
diff --git a/main/src/cgeo/geocaching/files/GPXImporter.java b/main/src/cgeo/geocaching/files/GPXImporter.java
index 8369161..fb78360 100644
--- a/main/src/cgeo/geocaching/files/GPXImporter.java
+++ b/main/src/cgeo/geocaching/files/GPXImporter.java
@@ -374,7 +374,6 @@ public class GPXImporter {
case IMPORT_STEP_READ_FILE:
case IMPORT_STEP_READ_WPT_FILE:
- progress.setProgressDivider(1024);
progress.setMessage(res.getString(msg.arg1));
progress.setMaxProgressAndReset(msg.arg2);
break;
diff --git a/main/src/cgeo/geocaching/network/Network.java b/main/src/cgeo/geocaching/network/Network.java
index bd4b6f6..72b325e 100644
--- a/main/src/cgeo/geocaching/network/Network.java
+++ b/main/src/cgeo/geocaching/network/Network.java
@@ -1,7 +1,6 @@
package cgeo.geocaching.network;
import cgeo.geocaching.Settings;
-import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.files.LocalStorage;
import cgeo.geocaching.utils.BaseUtils;
import cgeo.geocaching.utils.Log;
@@ -40,7 +39,6 @@ import org.json.JSONException;
import org.json.JSONObject;
import android.net.Uri;
-import android.webkit.WebView;
import java.io.File;
import java.io.IOException;
@@ -52,8 +50,8 @@ public abstract class Network {
private static final int NB_DOWNLOAD_RETRIES = 4;
/** User agent id */
private final static String PC_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1";
- /** Native user agent **/
- private final static String NATIVE_USER_AGENT = new WebView(cgeoapplication.getInstance()).getSettings().getUserAgentString();
+ /** Native user agent, taken from a Android 2.2 Nexus **/
+ private final static String NATIVE_USER_AGENT = "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1";
private static final String PATTERN_PASSWORD = "(?<=[\\?&])[Pp]ass(w(or)?d)?=[^&#$]+";