aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/network
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/network')
-rw-r--r--main/src/cgeo/geocaching/network/Network.java14
-rw-r--r--main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java1
-rw-r--r--main/src/cgeo/geocaching/network/StatusUpdater.java9
3 files changed, 18 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/network/Network.java b/main/src/cgeo/geocaching/network/Network.java
index 57196c5..2d2ab0b 100644
--- a/main/src/cgeo/geocaching/network/Network.java
+++ b/main/src/cgeo/geocaching/network/Network.java
@@ -1,9 +1,9 @@
package cgeo.geocaching.network;
-import cgeo.geocaching.Settings;
import cgeo.geocaching.files.LocalStorage;
-import cgeo.geocaching.utils.TextUtils;
+import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.Log;
+import cgeo.geocaching.utils.TextUtils;
import ch.boye.httpclientandroidlib.Header;
import ch.boye.httpclientandroidlib.HeaderElement;
@@ -317,12 +317,14 @@ public abstract class Network {
return null;
}
- final String etag = LocalStorage.getSavedHeader(cacheFile, "etag");
+ final String etag = LocalStorage.getSavedHeader(cacheFile, LocalStorage.HEADER_ETAG);
if (etag != null) {
+ // The ETag is a more robust check than a timestamp. If we have an ETag, it is enough
+ // to identify the right version of the resource.
return new Parameters("If-None-Match", etag);
}
- final String lastModified = LocalStorage.getSavedHeader(cacheFile, "last-modified");
+ final String lastModified = LocalStorage.getSavedHeader(cacheFile, LocalStorage.HEADER_LAST_MODIFIED);
if (lastModified != null) {
return new Parameters("If-Modified-Since", lastModified);
}
@@ -476,10 +478,10 @@ public abstract class Network {
/**
* Checks if the device has network connection.
- *
+ *
* @param context
* context of the application, cannot be null
- *
+ *
* @return <code>true</code> if the device is connected to the network.
*/
public static boolean isNetworkConnected(Context context) {
diff --git a/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java b/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java
index 751443e..8dc8b03 100644
--- a/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java
+++ b/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java
@@ -82,6 +82,7 @@ public abstract class OAuthAuthorizationActivity extends AbstractActivity {
pinEntryButton.setVisibility(View.GONE);
+ setResult(RESULT_OK);
finish();
} else {
showToast(getErrAuthProcess());
diff --git a/main/src/cgeo/geocaching/network/StatusUpdater.java b/main/src/cgeo/geocaching/network/StatusUpdater.java
index bfc77ba..ee9bc31 100644
--- a/main/src/cgeo/geocaching/network/StatusUpdater.java
+++ b/main/src/cgeo/geocaching/network/StatusUpdater.java
@@ -9,6 +9,8 @@ import cgeo.geocaching.utils.Version;
import org.json.JSONException;
import org.json.JSONObject;
+import android.os.Build.VERSION;
+import android.os.Build.VERSION_CODES;
import android.os.Looper;
import java.util.Locale;
@@ -27,6 +29,13 @@ public class StatusUpdater extends MemorySubject<StatusUpdater.Status> implement
this.icon = icon;
this.url = url;
}
+
+ final static public Status closeoutStatus =
+ new Status("", "status_closeout_warning", "attribute_abandonedbuilding", "http://faq.cgeo.org/#7_69");
+
+ final static public Status defaultStatus() {
+ return VERSION.SDK_INT < VERSION_CODES.ECLAIR_MR1 ? closeoutStatus : null;
+ }
}
@Override