summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElektroschmock <elektroschmock78@googlemail.com>2015-06-10 22:29:40 +0200
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-06-15 17:16:28 +0000
commit92bffe8c9ac8e8f235b7a5f8d7208957d286a844 (patch)
tree7f99e67faa7e290004a42ddeb14fcc65ebfc2535
parentf4182190f49a6520dd23825e86138bb17821c96d (diff)
downloadandroid_packages_apps_Trebuchet-92bffe8c9ac8e8f235b7a5f8d7208957d286a844.tar.gz
android_packages_apps_Trebuchet-92bffe8c9ac8e8f235b7a5f8d7208957d286a844.tar.bz2
android_packages_apps_Trebuchet-92bffe8c9ac8e8f235b7a5f8d7208957d286a844.zip
Trebuchet: FloatMath is deprecated in API22
Change-Id: Icbb1cd06d3965a741061554ac641d41d2116c692
-rw-r--r--WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java7
-rw-r--r--WallpaperPicker/src/com/android/launcher3/CropView.java5
-rw-r--r--src/com/android/launcher3/LauncherScroller.java5
3 files changed, 7 insertions, 10 deletions
diff --git a/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java b/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java
index a671ed2b9..de78cb05c 100644
--- a/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java
+++ b/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java
@@ -23,7 +23,6 @@ import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.os.Build;
-import android.util.FloatMath;
import android.util.Log;
import java.io.ByteArrayOutputStream;
@@ -72,7 +71,7 @@ public class BitmapUtils {
&& minSideLength == UNCONSTRAINED) return 1;
int lowerBound = (maxNumOfPixels == UNCONSTRAINED) ? 1 :
- (int) FloatMath.ceil(FloatMath.sqrt((float) (w * h) / maxNumOfPixels));
+ (int) Math.ceil(Math.sqrt((double) (w * h) / maxNumOfPixels));
if (minSideLength == UNCONSTRAINED) {
return lowerBound;
@@ -96,7 +95,7 @@ public class BitmapUtils {
// Find the min x that 1 / x >= scale
public static int computeSampleSizeLarger(float scale) {
- int initialSize = (int) FloatMath.floor(1f / scale);
+ int initialSize = (int) Math.floor(1f / scale);
if (initialSize <= 1) return 1;
return initialSize <= 8
@@ -107,7 +106,7 @@ public class BitmapUtils {
// Find the max x that 1 / x <= scale.
public static int computeSampleSize(float scale) {
Utils.assertTrue(scale > 0);
- int initialSize = Math.max(1, (int) FloatMath.ceil(1 / scale));
+ int initialSize = Math.max(1, (int) Math.ceil(1 / scale));
return initialSize <= 8
? Utils.nextPowerOf2(initialSize)
: (initialSize + 7) / 8 * 8;
diff --git a/WallpaperPicker/src/com/android/launcher3/CropView.java b/WallpaperPicker/src/com/android/launcher3/CropView.java
index 578b8eafd..50f779add 100644
--- a/WallpaperPicker/src/com/android/launcher3/CropView.java
+++ b/WallpaperPicker/src/com/android/launcher3/CropView.java
@@ -21,7 +21,6 @@ import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.RectF;
import android.util.AttributeSet;
-import android.util.FloatMath;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.ScaleGestureDetector.OnScaleGestureListener;
@@ -300,12 +299,12 @@ public class CropView extends TiledImageView implements OnScaleGestureListener {
adjustment[0] = (edges.right - getWidth()) / scale;
}
if (edges.top > 0) {
- adjustment[1] = FloatMath.ceil(edges.top / scale);
+ adjustment[1] = (float) Math.ceil(edges.top / scale);
} else if (edges.bottom < getHeight()) {
adjustment[1] = (edges.bottom - getHeight()) / scale;
}
for (int dim = 0; dim <= 1; dim++) {
- if (coef[dim] > 0) adjustment[dim] = FloatMath.ceil(adjustment[dim]);
+ if (coef[dim] > 0) adjustment[dim] = (float) Math.ceil(adjustment[dim]);
}
mInverseRotateMatrix.mapPoints(adjustment);
diff --git a/src/com/android/launcher3/LauncherScroller.java b/src/com/android/launcher3/LauncherScroller.java
index 3bd0a78c4..a9b49556b 100644
--- a/src/com/android/launcher3/LauncherScroller.java
+++ b/src/com/android/launcher3/LauncherScroller.java
@@ -20,7 +20,6 @@ import android.animation.TimeInterpolator;
import android.content.Context;
import android.hardware.SensorManager;
import android.os.Build;
-import android.util.FloatMath;
import android.view.ViewConfiguration;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
@@ -409,7 +408,7 @@ public class LauncherScroller {
float dx = (float) (mFinalX - mStartX);
float dy = (float) (mFinalY - mStartY);
- float hyp = FloatMath.sqrt(dx * dx + dy * dy);
+ float hyp = (float) Math.hypot(dx, dy);
float ndx = dx / hyp;
float ndy = dy / hyp;
@@ -426,7 +425,7 @@ public class LauncherScroller {
mMode = FLING_MODE;
mFinished = false;
- float velocity = FloatMath.sqrt(velocityX * velocityX + velocityY * velocityY);
+ float velocity = (float) Math.hypot(velocityX, velocityY);
mVelocity = velocity;
mDuration = getSplineFlingDuration(velocity);