Bug 1258789 - Remove allowEmptyLoops I added previously to simplify things. r=grisha draft
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 13 Apr 2016 11:22:41 -0700
changeset 350426 2677a416fabf5672d3fc259ed85424a1b2e96b6f
parent 350425 caacb08f22c88048f9f845a8c5a76a8d57a6e340
child 518334 2f7a7461c10f808bd02a502002bc47fe410d7a90
push id15341
push usermichael.l.comella@gmail.com
push dateWed, 13 Apr 2016 18:23:14 +0000
reviewersgrisha
bugs1258789
milestone48.0a1
Bug 1258789 - Remove allowEmptyLoops I added previously to simplify things. r=grisha MozReview-Commit-ID: 7iL8VjkMSTh
mobile/android/app/checkstyle.xml
mobile/android/base/java/org/mozilla/gecko/RemoteTabsExpandableListAdapter.java
mobile/android/base/java/org/mozilla/gecko/gfx/Axis.java
mobile/android/base/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
mobile/android/base/java/org/mozilla/gecko/toolbar/SiteIdentityPopup.java
mobile/android/base/java/org/mozilla/gecko/util/INIParser.java
--- a/mobile/android/app/checkstyle.xml
+++ b/mobile/android/app/checkstyle.xml
@@ -52,13 +52,12 @@
         <module name="WhitespaceAfter">
             <!-- TODO: (bug 1263059) Remove specific tokens to enable CAST check. -->
             <property name="tokens" value="COMMA, SEMI"/>
         </module>
         <module name="WhitespaceAround">
             <property name="allowEmptyConstructors" value="true"/>
             <property name="allowEmptyMethods" value="true"/>
             <property name="allowEmptyTypes" value="true"/>
-            <property name="allowEmptyLoops" value="true"/>
         </module>
     </module>
 
 </module>
--- a/mobile/android/base/java/org/mozilla/gecko/RemoteTabsExpandableListAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/RemoteTabsExpandableListAdapter.java
@@ -148,17 +148,17 @@ public class RemoteTabsExpandableListAda
         // indicator.
         final int deviceTypeResId;
         final int textColorResId;
         final int deviceExpandedResId;
 
         if (isExpanded && !client.tabs.isEmpty()) {
             deviceTypeResId = "desktop".equals(client.deviceType) ? R.drawable.sync_desktop : R.drawable.sync_mobile;
             textColorResId = R.color.placeholder_active_grey;
-            deviceExpandedResId = showGroupIndicator ? R.drawable.arrow_down: R.drawable.home_group_collapsed;
+            deviceExpandedResId = showGroupIndicator ? R.drawable.arrow_down : R.drawable.home_group_collapsed;
         } else {
             deviceTypeResId = "desktop".equals(client.deviceType) ? R.drawable.sync_desktop_inactive : R.drawable.sync_mobile_inactive;
             textColorResId = R.color.tabs_tray_icon_grey;
             deviceExpandedResId = showGroupIndicator ? R.drawable.home_group_collapsed : 0;
         }
 
         // Now update the UI.
         holder.nameView.setText(client.name);
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/Axis.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/Axis.java
@@ -260,31 +260,31 @@ abstract class Axis {
 
         return (3 * y1)
              + t * (6 * y2 - 12 * y1)
              + t * t * (9 * y1 - 9 * y2 + 3);
     }
 
     // Calculates and returns the value of the bezier curve with the given parameter t and control points p1 and p2
     float cubicBezier(float p1, float p2, float t) {
-        return (3 * t * (1-t) * (1-t) * p1)
-             + (3 * t * t * (1-t) * p2)
+        return (3 * t * (1 - t) * (1 - t) * p1)
+             + (3 * t * t * (1 - t) * p2)
              + (t * t * t);
     }
 
     // Responsible for mapping the physical velocity to a the velocity obtained after applying bezier curve (with control points (X1,Y1) and (X2,Y2))
     float flingCurve(float By) {
         int ni = FLING_CURVE_NEWTON_ITERATIONS;
         float[] guess = new float[ni];
         float y1 = FLING_CURVE_FUNCTION_Y1;
         float y2 = FLING_CURVE_FUNCTION_Y2;
         guess[0] = By;
 
         for (int i = 1; i < ni; i++) {
-            guess[i] = guess[i-1] - (cubicBezier(y1, y2, guess[i-1]) - By) / getSlope(guess[i-1]);
+            guess[i] = guess[i - 1] - (cubicBezier(y1, y2, guess[i - 1]) - By) / getSlope(guess[i - 1]);
         }
         // guess[4] is the final approximate root the cubic equation.
         float t = guess[4];
 
         float x1 = FLING_CURVE_FUNCTION_X1;
         float x2 = FLING_CURVE_FUNCTION_X2;
         return cubicBezier(x1, x2, t);
     }
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
@@ -206,17 +206,17 @@ class JavaPanZoomController
             MESSAGE_TOUCH_LISTENER);
         mSubscroller.destroy();
         mTouchEventHandler.destroy();
     }
 
     private final static float easeOut(float t) {
         // ease-out approx.
         // -(t-1)^2+1
-        t = t-1;
+        t = t - 1;
         return -t * t + 1;
     }
 
     private void setState(PanZoomState state) {
         if (state != mState) {
             GeckoAppShell.notifyObservers("PanZoom:StateChange", state.toString());
             mState = state;
 
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/SiteIdentityPopup.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/SiteIdentityPopup.java
@@ -417,17 +417,17 @@ public class SiteIdentityPopup extends A
     }
 
     private void addTrackingContentNotification(boolean blocked) {
         // Remove any existing tracking content notification.
         removeTrackingContentNotification();
 
         final DoorhangerConfig config = new DoorhangerConfig(DoorHanger.Type.TRACKING, mContentButtonClickListener);
 
-        final int icon = blocked ? R.drawable.shield_enabled: R.drawable.shield_disabled;
+        final int icon = blocked ? R.drawable.shield_enabled : R.drawable.shield_disabled;
 
         final JSONObject options = new JSONObject();
         final JSONObject tracking = new JSONObject();
         try {
             tracking.put("enabled", blocked);
             options.put("tracking_protection", tracking);
         } catch (JSONException e) {
             Log.e(LOGTAG, "Error adding tracking protection options", e);
--- a/mobile/android/base/java/org/mozilla/gecko/util/INIParser.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/INIParser.java
@@ -111,17 +111,17 @@ public final class INIParser extends INI
             if (line != null)
                 line = line.trim();
 
             // blank line or a comment. ignore it
             if (line == null || line.length() == 0 || line.charAt(0) == ';') {
                 debug("Ignore line: " + line);
             } else if (line.charAt(0) == '[') {
                 debug("Parse as section: " + line);
-                currentSection = new INISection(line.substring(1, line.length()-1));
+                currentSection = new INISection(line.substring(1, line.length() - 1));
                 mSections.put(currentSection.getName(), currentSection);
             } else {
                 debug("Parse as property: " + line);
 
                 String[] pieces = line.split("=");
                 if (pieces.length != 2)
                     continue;