aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/utils
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/utils')
-rw-r--r--main/src/cgeo/geocaching/utils/AngleUtils.java8
-rw-r--r--main/src/cgeo/geocaching/utils/ImageHelper.java11
-rw-r--r--main/src/cgeo/geocaching/utils/TranslationUtils.java5
3 files changed, 12 insertions, 12 deletions
diff --git a/main/src/cgeo/geocaching/utils/AngleUtils.java b/main/src/cgeo/geocaching/utils/AngleUtils.java
index e2b4a66..6e59a91 100644
--- a/main/src/cgeo/geocaching/utils/AngleUtils.java
+++ b/main/src/cgeo/geocaching/utils/AngleUtils.java
@@ -8,9 +8,11 @@ public class AngleUtils {
/**
* Return the angle to turn of to go from an angle to the other
- *
- * @param from the origin angle in degrees
- * @param to the target angle in degreees
+ *
+ * @param from
+ * the origin angle in degrees
+ * @param to
+ * the target angle in degrees
* @return a value in degrees, in the [-180, 180[ range
*/
public static float difference(final float from, final float to) {
diff --git a/main/src/cgeo/geocaching/utils/ImageHelper.java b/main/src/cgeo/geocaching/utils/ImageHelper.java
index 4c18b06..98cad64 100644
--- a/main/src/cgeo/geocaching/utils/ImageHelper.java
+++ b/main/src/cgeo/geocaching/utils/ImageHelper.java
@@ -1,13 +1,12 @@
package cgeo.geocaching.utils;
import cgeo.geocaching.cgeoapplication;
+import cgeo.geocaching.compatibility.Compatibility;
-import android.content.Context;
import android.graphics.Bitmap;
+import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
-import android.view.Display;
-import android.view.WindowManager;
public class ImageHelper {
@@ -24,9 +23,9 @@ public class ImageHelper {
*/
public static BitmapDrawable scaleBitmapToFitDisplay(final Bitmap image) {
final cgeoapplication app = cgeoapplication.getInstance();
- final Display display = ((WindowManager) app.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
- final int maxWidth = display.getWidth() - 25;
- final int maxHeight = display.getHeight() - 25;
+ Point displaySize = Compatibility.getDisplaySize();
+ final int maxWidth = displaySize.x - 25;
+ final int maxHeight = displaySize.y - 25;
Bitmap result = image;
int width = image.getWidth();
diff --git a/main/src/cgeo/geocaching/utils/TranslationUtils.java b/main/src/cgeo/geocaching/utils/TranslationUtils.java
index a29c5a7..4d318f0 100644
--- a/main/src/cgeo/geocaching/utils/TranslationUtils.java
+++ b/main/src/cgeo/geocaching/utils/TranslationUtils.java
@@ -1,12 +1,11 @@
package cgeo.geocaching.utils;
import cgeo.geocaching.activity.AbstractActivity;
+import cgeo.geocaching.network.Network;
import android.content.Intent;
import android.net.Uri;
-import java.net.URLEncoder;
-
/**
* Utilities used for translating
*/
@@ -30,7 +29,7 @@ public final class TranslationUtils {
* @return URI ready to be parsed
*/
private static String buildTranslationURI(final String toLang, final String text) {
- String content = URLEncoder.encode(text);
+ String content = Network.encode(text);
// the app works better without the "+", the website works better with "+", therefore assume using the app if installed
if (ProcessUtils.isInstalled(TRANSLATION_APP)) {
content = content.replace("+", "%20");