Bug 1316015 - Fixed by replacing '==' & '!=' float comparisons with FloatUtils.fuzzyEquals(). r?sebastian
MozReview-Commit-ID: 2daF8XCHo0o
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeBanner.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeBanner.java
@@ -7,16 +7,17 @@ package org.mozilla.gecko.home;
import org.json.JSONObject;
import org.mozilla.gecko.GeckoApp;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.R;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.PropertyAnimator.Property;
import org.mozilla.gecko.animation.ViewHelper;
+import org.mozilla.gecko.util.FloatUtils;
import org.mozilla.gecko.util.ResourceDrawableUtils;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.gecko.widget.EllipsisTextView;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.Html;
@@ -286,17 +287,17 @@ public class HomeBanner extends LinearLa
if (newTranslationY < 0.0f) {
newTranslationY = 0.0f;
} else if (newTranslationY > mHeight) {
newTranslationY = mHeight;
}
// Don't change this value if it wasn't a significant movement
if (delta >= 10 || delta <= -10) {
- mUserSwipedDown = (newTranslationY == mHeight);
+ mUserSwipedDown = FloatUtils.fuzzyEquals(newTranslationY, mHeight);
}
ViewHelper.setTranslationY(this, newTranslationY);
mTouchY = curY;
break;
}
case MotionEvent.ACTION_UP:
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/CirclePageIndicator.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/CirclePageIndicator.java
@@ -29,16 +29,17 @@ import android.support.v4.view.MotionEve
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.FloatUtils;
import static android.graphics.Paint.ANTI_ALIAS_FLAG;
import static android.widget.LinearLayout.HORIZONTAL;
import static android.widget.LinearLayout.VERTICAL;
/**
* Draws circles (one for each view). The current view position is filled and
* others are only stroked.
@@ -272,17 +273,17 @@ public class CirclePageIndicator
dY = drawLong;
}
// Only paint fill if not completely transparent
if (mPaintPageFill.getAlpha() > 0) {
canvas.drawCircle(dX, dY, pageFillRadius, mPaintPageFill);
}
// Only paint stroke if a stroke width was non-zero
- if (pageFillRadius != mRadius) {
+ if (!FloatUtils.fuzzyEquals(pageFillRadius, mRadius)) {
canvas.drawCircle(dX, dY, mRadius, mPaintStroke);
}
}
//Draw the filled circle according to the current scroll
float cx = (mSnap ? mSnapPage : mCurrentPage) * threeRadius;
if (!mSnap) {
cx += mPageOffset * threeRadius;