aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/res/values/changelog_master.xml2
-rw-r--r--main/res/values/changelog_release.xml10
-rw-r--r--main/src/cgeo/geocaching/settings/AuthorizeOcDePreference.java1
-rw-r--r--main/src/cgeo/geocaching/settings/AuthorizeTwitterPreference.java1
-rw-r--r--main/src/cgeo/geocaching/settings/SettingsActivity.java20
-rw-r--r--main/src/cgeo/geocaching/twitter/Twitter.java68
6 files changed, 40 insertions, 62 deletions
diff --git a/main/res/values/changelog_master.xml b/main/res/values/changelog_master.xml
index 3379539..6989040 100644
--- a/main/res/values/changelog_master.xml
+++ b/main/res/values/changelog_master.xml
@@ -36,7 +36,7 @@
· Save cache before allowing to add or edit a personal note\n
· Automatically use log type \"Attended\" if the date of an event cache is in the past\n
· Use log type \"Note\" for event caches if they are already logged as \"Attended\"\n
- · Avoid to accidently set the log type to \"Needs archived\" while loading the log page is still in progress\n
+ · Avoid to accidentally set the log type to \"Needs archived\" while loading the log page is still in progress\n
· Ignore hiding of owned caches when explicitly searching for owned caches\n
· Do not allow to select \"..\" as valid source directory for files\n
· Exclude inaccessible directories from selection list\n
diff --git a/main/res/values/changelog_release.xml b/main/res/values/changelog_release.xml
index 7e6dd96..0ca942d 100644
--- a/main/res/values/changelog_release.xml
+++ b/main/res/values/changelog_release.xml
@@ -2,6 +2,12 @@
<resources>
<!-- changelog for the release branch -->
<string name="changelog_release" translatable="false">\n
+ <b>Next bugfix release</b>\n
+ <b>Changes:</b>\n
+ · A warning message is shown if an android version less than 2.1 is used\n
+ c:geo will no longer support these devices starting with the next main release\n
+ \n
+ \n
<b>2013.06.05</b>\n
<b>Bugfixing:</b>\n
· Adaption to changes on gc.com (Logging date could be wrong in some cases)\n
@@ -85,11 +91,7 @@
In fast mode the cache type might be wrong in rare cases\n
On low zoom owned/found caches may not be hidden anymore\n
· Other:\n
- Log images with huge size cause a long loading time\n
- After uploading log images they are only shown in the logview after refreshing the cache\n
- The personal note added to a cache is not synced to geocaching.com but will be overruled by personal notes on geocaching.com\n
On devices with HD display resolution OSM maps might not work. Please use Google maps in this case.\n
- A huge amount of pictures on the image tab of a cache might cause a crash\n
<b>Old releases</b>\n
· Please refer to the release notes on the <a href="http://www.cgeo.org">c:geo-website</a>.\n
\n</string>
diff --git a/main/src/cgeo/geocaching/settings/AuthorizeOcDePreference.java b/main/src/cgeo/geocaching/settings/AuthorizeOcDePreference.java
index d6768b9..4ef3086 100644
--- a/main/src/cgeo/geocaching/settings/AuthorizeOcDePreference.java
+++ b/main/src/cgeo/geocaching/settings/AuthorizeOcDePreference.java
@@ -2,7 +2,6 @@ package cgeo.geocaching.settings;
import cgeo.geocaching.connector.oc.OCAuthorizationActivity;
-import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.preference.Preference;
diff --git a/main/src/cgeo/geocaching/settings/AuthorizeTwitterPreference.java b/main/src/cgeo/geocaching/settings/AuthorizeTwitterPreference.java
index cfccad3..1a6d908 100644
--- a/main/src/cgeo/geocaching/settings/AuthorizeTwitterPreference.java
+++ b/main/src/cgeo/geocaching/settings/AuthorizeTwitterPreference.java
@@ -2,7 +2,6 @@ package cgeo.geocaching.settings;
import cgeo.geocaching.twitter.TwitterAuthorizationActivity;
-import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.preference.Preference;
diff --git a/main/src/cgeo/geocaching/settings/SettingsActivity.java b/main/src/cgeo/geocaching/settings/SettingsActivity.java
index b9035ec..23ae7bd 100644
--- a/main/src/cgeo/geocaching/settings/SettingsActivity.java
+++ b/main/src/cgeo/geocaching/settings/SettingsActivity.java
@@ -500,26 +500,6 @@ public class SettingsActivity extends PreferenceActivity {
bindSummaryToValue(pref, value);
}
- /**
- * auto-care for the summary of the preference of int type with this key
- *
- * @param key
- */
- private static void bindSummaryToIntValue(final PreferenceActivity preferenceActivity, final String key) {
-
- Preference pref = findPreference(preferenceActivity, key);
-
- if (pref == null) {
- return;
- }
-
- int value = PreferenceManager
- .getDefaultSharedPreferences(pref.getContext())
- .getInt(pref.getKey(), 0);
-
- bindSummaryToValue(pref, value);
- }
-
@SuppressWarnings("deprecation")
public static Preference findPreference(final PreferenceActivity preferenceActivity, final CharSequence key) {
return preferenceActivity.findPreference(key);
diff --git a/main/src/cgeo/geocaching/twitter/Twitter.java b/main/src/cgeo/geocaching/twitter/Twitter.java
index a6ce7d2..7233764 100644
--- a/main/src/cgeo/geocaching/twitter/Twitter.java
+++ b/main/src/cgeo/geocaching/twitter/Twitter.java
@@ -1,7 +1,6 @@
package cgeo.geocaching.twitter;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.Trackable;
import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
@@ -11,6 +10,7 @@ import cgeo.geocaching.geopoint.GeopointFormatter.Format;
import cgeo.geocaching.network.Network;
import cgeo.geocaching.network.OAuth;
import cgeo.geocaching.network.Parameters;
+import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.Log;
import ch.boye.httpclientandroidlib.HttpResponse;
@@ -19,13 +19,20 @@ import org.apache.commons.lang3.StringUtils;
public final class Twitter {
private static final String HASH_PREFIX_WITH_BLANK = " #";
- public static final int MAX_TWEET_SIZE = 140;
+ private static final int MAX_TWEET_SIZE = 140;
- public static void postTweet(final cgeoapplication app, final String status, final Geopoint coords) {
- if (app == null) {
- return;
- }
- if (!Settings.isTwitterLoginValid()) {
+ public static void postTweetCache(String geocode) {
+ final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ postTweet(cgeoapplication.getInstance(), getStatusMessage(cache), null);
+ }
+
+ public static void postTweetTrackable(String geocode) {
+ final Trackable trackable = cgData.loadTrackable(geocode);
+ postTweet(cgeoapplication.getInstance(), getStatusMessage(trackable), null);
+ }
+
+ private static void postTweet(final cgeoapplication app, final String status, final Geopoint coords) {
+ if (app == null || !Settings.isUseTwitter() || !Settings.isTwitterLoginValid()) {
return;
}
@@ -38,19 +45,23 @@ public final class Twitter {
"display_coordinates", "true");
}
- OAuth.signOAuth("api.twitter.com", "/1/statuses/update.json", "POST", false, parameters, Settings.getTokenPublic(), Settings.getTokenSecret(), Settings.getKeyConsumerPublic(), Settings.getKeyConsumerSecret());
- final HttpResponse httpResponse = Network.postRequest("http://api.twitter.com/1/statuses/update.json", parameters);
- if (httpResponse != null && httpResponse.getStatusLine().getStatusCode() == 200) {
- Log.i("Tweet posted");
+ OAuth.signOAuth("api.twitter.com", "/1.1/statuses/update.json", "POST", false, parameters, Settings.getTokenPublic(), Settings.getTokenSecret(), Settings.getKeyConsumerPublic(), Settings.getKeyConsumerSecret());
+ final HttpResponse httpResponse = Network.postRequest("http://api.twitter.com/1.1/statuses/update.json", parameters);
+ if (httpResponse != null) {
+ if (httpResponse.getStatusLine().getStatusCode() == 200) {
+ Log.i("Tweet posted");
+ } else {
+ Log.e("Tweet could not be posted. Reason: " + httpResponse.toString());
+ }
} else {
- Log.e("Tweet could not be posted");
+ Log.e("Tweet could not be posted. Reason: httpResponse Object is null");
}
} catch (Exception e) {
Log.e("Twitter.postTweet", e);
}
}
- public static void appendHashTag(final StringBuilder status, final String tag) {
+ private static void appendHashTag(final StringBuilder status, final String tag) {
if (status.length() + HASH_PREFIX_WITH_BLANK.length() + tag.length() <= MAX_TWEET_SIZE) {
final String tagWithPrefix = HASH_PREFIX_WITH_BLANK + tag;
if (status.indexOf(tagWithPrefix, 0) == -1) {
@@ -59,14 +70,6 @@ public final class Twitter {
}
}
- public static void postTweetCache(String geocode) {
- if (!Settings.isUseTwitter() || !Settings.isTwitterLoginValid()) {
- return;
- }
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
- postTweet(cgeoapplication.getInstance(), getStatusMessage(cache), null);
- }
-
static String getStatusMessage(Geocache cache) {
String name = cache.getName();
if (name.length() > 100) {
@@ -76,20 +79,6 @@ public final class Twitter {
return fillTemplate(Settings.getCacheTwitterMessage(), name, url);
}
- private static String fillTemplate(String template, String name, final String url) {
- String result = StringUtils.replace(template, "[NAME]", name);
- result = StringUtils.replace(result, "[URL]", url);
- StringBuilder builder = new StringBuilder(result);
- appendHashTag(builder, "cgeo");
- appendHashTag(builder, "geocaching");
- return builder.toString();
- }
-
- public static void postTweetTrackable(String geocode) {
- final Trackable trackable = cgData.loadTrackable(geocode);
- postTweet(cgeoapplication.getInstance(), getStatusMessage(trackable), null);
- }
-
static String getStatusMessage(Trackable trackable) {
String name = trackable.getName();
if (name.length() > 82) {
@@ -99,4 +88,13 @@ public final class Twitter {
String status = Settings.getTrackableTwitterMessage();
return fillTemplate(status, name, url);
}
+
+ private static String fillTemplate(String template, String name, final String url) {
+ String result = StringUtils.replace(template, "[NAME]", name);
+ result = StringUtils.replace(result, "[URL]", url);
+ StringBuilder builder = new StringBuilder(result);
+ appendHashTag(builder, "cgeo");
+ appendHashTag(builder, "geocaching");
+ return builder.toString();
+ }
}