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/HtmlImage.java12
-rw-r--r--main/src/cgeo/geocaching/network/OAuth.java6
2 files changed, 10 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/network/HtmlImage.java b/main/src/cgeo/geocaching/network/HtmlImage.java
index 0019acc..f464e84 100644
--- a/main/src/cgeo/geocaching/network/HtmlImage.java
+++ b/main/src/cgeo/geocaching/network/HtmlImage.java
@@ -13,12 +13,14 @@ import cgeo.geocaching.utils.Log;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.androidextra.Base64;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+
import rx.Observable;
import rx.Observable.OnSubscribeFunc;
import rx.Observer;
@@ -123,9 +125,8 @@ public class HtmlImage implements Html.ImageGetter {
}
}));
return null;
- } else {
- return drawable.toBlockingObservable().lastOrDefault(null);
}
+ return drawable.toBlockingObservable().lastOrDefault(null);
}
public Observable<BitmapDrawable> fetchDrawable(final String url) {
@@ -176,11 +177,10 @@ public class HtmlImage implements Html.ImageGetter {
final BitmapDrawable image = loadResult.getLeft();
if (image != null) {
return image;
- } else {
- return returnErrorImage ?
- new BitmapDrawable(resources, BitmapFactory.decodeResource(resources, R.drawable.image_not_loaded)) :
- getTransparent1x1Image(resources);
}
+ return returnErrorImage ?
+ new BitmapDrawable(resources, BitmapFactory.decodeResource(resources, R.drawable.image_not_loaded)) :
+ getTransparent1x1Image(resources);
}
}).subscribe(observer);
}
diff --git a/main/src/cgeo/geocaching/network/OAuth.java b/main/src/cgeo/geocaching/network/OAuth.java
index 1e22551..fa376af 100644
--- a/main/src/cgeo/geocaching/network/OAuth.java
+++ b/main/src/cgeo/geocaching/network/OAuth.java
@@ -3,6 +3,7 @@ package cgeo.geocaching.network;
import cgeo.geocaching.utils.CryptUtils;
import ch.boye.httpclientandroidlib.NameValuePair;
+
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -36,13 +37,14 @@ public class OAuth {
}
final String keysPacked = consumerSecret + "&" + StringUtils.defaultString(tokenSecret); // both even if empty some of them!
- final String requestPacked = method + "&" + OAuth.percentEncode((https ? "https" : "http") + "://" + host + path) + "&" + OAuth.percentEncode(StringUtils.join(paramsEncoded.toArray(), '&'));
+ final @NonNull String joinedParams = StringUtils.join(paramsEncoded.toArray(), '&');
+ final String requestPacked = method + "&" + OAuth.percentEncode((https ? "https" : "http") + "://" + host + path) + "&" + OAuth.percentEncode(joinedParams);
params.put("oauth_signature", CryptUtils.base64Encode(CryptUtils.hashHmac(requestPacked, keysPacked)));
}
/**
* percent encode following http://tools.ietf.org/html/rfc5849#section-3.6
- *
+ *
* @param url
* @return
*/