Bug 1263056 - Add WhitespaceAfter comma & fix issues. r=sebastian draft
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 07 Apr 2016 18:07:29 -0700
changeset 348718 fc708f6fac7b7245a1da6541c4ff44d8e231b879
parent 348717 106f9ce8ec75d024ccb68af95129f1ef6f08de16
child 348719 a88bed32638ef44b93b8ba9d1682793588593614
push id14899
push usermichael.l.comella@gmail.com
push dateFri, 08 Apr 2016 01:24:40 +0000
reviewerssebastian
bugs1263056
milestone48.0a1
Bug 1263056 - Add WhitespaceAfter comma & fix issues. r=sebastian Fixed via: gsed -i"" -e "s/,\([^[:space:]\"']\)/, \1/g" **/*.java And hand curation. MozReview-Commit-ID: DHaXJbW4plY
mobile/android/app/checkstyle.xml
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/base/java/org/mozilla/gecko/db/TabsProvider.java
mobile/android/base/java/org/mozilla/gecko/gfx/BitmapUtils.java
mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java
mobile/android/base/java/org/mozilla/gecko/prompts/ColorPickerInput.java
mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarProgressView.java
mobile/android/base/java/org/mozilla/gecko/widget/BasicColorPicker.java
mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
--- a/mobile/android/app/checkstyle.xml
+++ b/mobile/android/app/checkstyle.xml
@@ -40,13 +40,13 @@
     </module>
 
     <module name="TreeWalker">
         <module name="NoLineWrap">
             <property name="tokens" value="IMPORT,PACKAGE_DEF"/>
         </module>
         <module name="OuterTypeFilename"/> <!-- `class Lol` only in Lol.java -->
         <module name="WhitespaceAfter">
-            <property name="tokens" value="SEMI"/>
+            <property name="tokens" value="COMMA, SEMI"/>
         </module>
     </module>
 
 </module>
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -958,17 +958,17 @@ public abstract class GeckoApp
             if (image != null) {
                 // Some devices don't have a DCIM folder and the Media.insertImage call will fail.
                 File dcimDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
 
                 if (!dcimDir.mkdirs() && !dcimDir.isDirectory()) {
                     SnackbarHelper.showSnackbar(this, getString(R.string.set_image_path_fail), Snackbar.LENGTH_LONG);
                     return;
                 }
-                String path = Media.insertImage(getContentResolver(),image, null, null);
+                String path = Media.insertImage(getContentResolver(), image, null, null);
                 if (path == null) {
                     SnackbarHelper.showSnackbar(this, getString(R.string.set_image_path_fail), Snackbar.LENGTH_LONG);
                     return;
                 }
                 final Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
                 intent.addCategory(Intent.CATEGORY_DEFAULT);
                 intent.setData(Uri.parse(path));
 
@@ -2236,22 +2236,22 @@ public abstract class GeckoApp
         super.onConfigurationChanged(newConfig);
     }
 
     public String getContentProcessName() {
         return AppConstants.MOZ_CHILD_PROCESS_NAME;
     }
 
     public void addEnvToIntent(Intent intent) {
-        Map<String,String> envMap = System.getenv();
-        Set<Map.Entry<String,String>> envSet = envMap.entrySet();
-        Iterator<Map.Entry<String,String>> envIter = envSet.iterator();
+        Map<String, String> envMap = System.getenv();
+        Set<Map.Entry<String, String>> envSet = envMap.entrySet();
+        Iterator<Map.Entry<String, String>> envIter = envSet.iterator();
         int c = 0;
         while (envIter.hasNext()) {
-            Map.Entry<String,String> entry = envIter.next();
+            Map.Entry<String, String> entry = envIter.next();
             intent.putExtra("env" + c, entry.getKey() + "="
                             + entry.getValue());
             c++;
         }
     }
 
     @Override
     public void doRestart() {
--- a/mobile/android/base/java/org/mozilla/gecko/db/TabsProvider.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/TabsProvider.java
@@ -323,17 +323,17 @@ public class TabsProvider extends Shared
 
                 final String excludeStaleClientsTable = String.format(EXCLUDE_STALE_CLIENTS_SUBQUERY, oneWeekAgo, threeWeeksAgo);
 
                 qb.setProjectionMap(CLIENTS_RECENCY_PROJECTION_MAP);
 
                 // Use a subquery to quietly exclude stale duplicate client records.
                 qb.setTables(excludeStaleClientsTable + " AS " + TABLE_CLIENTS + " LEFT OUTER JOIN " + TABLE_TABS +
                         " ON (" + projectColumn(TABLE_CLIENTS, Clients.GUID) +
-                        " = " + projectColumn(TABLE_TABS,Tabs.CLIENT_GUID) + ")");
+                        " = " + projectColumn(TABLE_TABS, Tabs.CLIENT_GUID) + ")");
                 groupBy = projectColumn(TABLE_CLIENTS, Clients.GUID);
                 break;
 
             default:
                 throw new UnsupportedOperationException("Unknown query URI " + uri);
         }
 
         trace("Running built query.");
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/BitmapUtils.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/BitmapUtils.java
@@ -273,17 +273,17 @@ public final class BitmapUtils {
     }
 
     public static int getDominantColor(Bitmap source) {
         return getDominantColor(source, true);
     }
 
     public static int getDominantColor(Bitmap source, boolean applyThreshold) {
       if (source == null)
-        return Color.argb(255,255,255,255);
+        return Color.argb(255, 255, 255, 255);
 
       // Keep track of how many times a hue in a given bin appears in the image.
       // Hue values range [0 .. 360), so dividing by 10, we get 36 bins.
       int[] colorBins = new int[36];
 
       // The bin with the most colors. Initialize to -1 to prevent accidentally
       // thinking the first bin holds the dominant color.
       int maxBin = -1;
@@ -326,17 +326,17 @@ public final class BitmapUtils {
           // Keep track of the bin that holds the most colors.
           if (maxBin < 0 || colorBins[bin] > colorBins[maxBin])
             maxBin = bin;
         }
       }
 
       // maxBin may never get updated if the image holds only transparent and/or black/white pixels.
       if (maxBin < 0)
-        return Color.argb(255,255,255,255);
+        return Color.argb(255, 255, 255, 255);
 
       // Return a color with the average hue/saturation/value of the bin with the most colors.
       hsv[0] = sumHue[maxBin]/colorBins[maxBin];
       hsv[1] = sumSat[maxBin]/colorBins[maxBin];
       hsv[2] = sumVal[maxBin]/colorBins[maxBin];
       return Color.HSVToColor(hsv);
     }
 
--- a/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java
@@ -249,17 +249,17 @@ public class CombinedHistoryAdapter exte
                 info = new HomeContextMenuInfo(view, position, -1);
                 return CombinedHistoryPanel.populateChildInfoFromTab(info, clientChildren.get(position));
             case HISTORY:
                 info = new HomeContextMenuInfo(view, position, -1);
                 historyCursor.moveToPosition(transformAdapterPositionForDataStructure(ItemType.HISTORY, position));
                 return CombinedHistoryPanel.populateHistoryInfoFromCursor(info, historyCursor);
             case CLIENT:
                 final int clientPosition = transformAdapterPositionForDataStructure(ItemType.CLIENT, position);
-                info = new CombinedHistoryPanel.RemoteTabsClientContextMenuInfo(view, position,-1, remoteClients.get(clientPosition));
+                info = new CombinedHistoryPanel.RemoteTabsClientContextMenuInfo(view, position, -1, remoteClients.get(clientPosition));
                 return info;
         }
         return null;
     }
 
     @Override
     public CombinedHistoryItem onCreateViewHolder(ViewGroup viewGroup, int viewType) {
         final LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext());
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/ColorPickerInput.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/ColorPickerInput.java
@@ -19,19 +19,19 @@ public class ColorPickerInput extends Pr
     public static final String LOGTAG = "GeckoColorPickerInput";
 
     private final boolean mShowAdvancedButton = true;
     private final int mInitialColor;
 
     public ColorPickerInput(JSONObject obj) {
         super(obj);
         String init = obj.optString("value");
-        mInitialColor = Color.rgb(Integer.parseInt(init.substring(1,3), 16),
-                                  Integer.parseInt(init.substring(3,5), 16),
-                                  Integer.parseInt(init.substring(5,7), 16));
+        mInitialColor = Color.rgb(Integer.parseInt(init.substring(1, 3), 16),
+                                  Integer.parseInt(init.substring(3, 5), 16),
+                                  Integer.parseInt(init.substring(5, 7), 16));
     }
 
     @Override
     public View getView(Context context) throws UnsupportedOperationException {
         LayoutInflater inflater = LayoutInflater.from(context);
         mView = inflater.inflate(R.layout.basic_color_picker_dialog, null);
 
         BasicColorPicker cp = (BasicColorPicker) mView.findViewById(R.id.colorpicker);
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
@@ -212,19 +212,19 @@ public class PromptInput {
                     try {
                         calendar.setTime(new SimpleDateFormat("HH:mm").parse(mValue));
                     } catch (Exception e) { }
                 }
                 input.setCurrentHour(calendar.get(GregorianCalendar.HOUR_OF_DAY));
                 input.setCurrentMinute(calendar.get(GregorianCalendar.MINUTE));
                 mView = (View)input;
             } else if (mType.equals("datetime-local") || mType.equals("datetime")) {
-                DateTimePicker input = new DateTimePicker(context, "yyyy-MM-dd HH:mm", mValue.replace("T"," ").replace("Z", ""),
+                DateTimePicker input = new DateTimePicker(context, "yyyy-MM-dd HH:mm", mValue.replace("T", " ").replace("Z", ""),
                                                           DateTimePicker.PickersState.DATETIME, 
-                                                          mMinValue.replace("T"," ").replace("Z",""), mMaxValue.replace("T"," ").replace("Z", ""));
+                                                          mMinValue.replace("T", " ").replace("Z", ""), mMaxValue.replace("T", " ").replace("Z", ""));
                 input.toggleCalendar(true);
                 mView = (View)input;
             } else if (mType.equals("month")) {
                 DateTimePicker input = new DateTimePicker(context, "yyyy-MM", mValue,
                                                           DateTimePicker.PickersState.MONTH, mMinValue, mMaxValue);
                 mView = (View)input;
             }
             return mView;
@@ -234,34 +234,34 @@ public class PromptInput {
             return new SimpleDateFormat(dateFormat).format(calendar.getTime());
         }
 
         @Override
         public Object getValue() {
             if (mType.equals("time")) {
                 TimePicker tp = (TimePicker)mView;
                 GregorianCalendar calendar =
-                    new GregorianCalendar(0,0,0,tp.getCurrentHour(),tp.getCurrentMinute());
-                return formatDateString("HH:mm",calendar);
+                    new GregorianCalendar(0, 0, 0, tp.getCurrentHour(), tp.getCurrentMinute());
+                return formatDateString("HH:mm", calendar);
             } else {
                 DateTimePicker dp = (DateTimePicker)mView;
                 GregorianCalendar calendar = new GregorianCalendar();
                 calendar.setTimeInMillis(dp.getTimeInMillis());
                 if (mType.equals("date")) {
-                    return formatDateString("yyyy-MM-dd",calendar);
+                    return formatDateString("yyyy-MM-dd", calendar);
                 } else if (mType.equals("week")) {
-                    return formatDateString("yyyy-'W'ww",calendar);
+                    return formatDateString("yyyy-'W'ww", calendar);
                 } else if (mType.equals("datetime-local")) {
-                    return formatDateString("yyyy-MM-dd'T'HH:mm",calendar);
+                    return formatDateString("yyyy-MM-dd'T'HH:mm", calendar);
                 } else if (mType.equals("datetime")) {
-                    calendar.set(GregorianCalendar.ZONE_OFFSET,0);
+                    calendar.set(GregorianCalendar.ZONE_OFFSET, 0);
                     calendar.setTimeInMillis(dp.getTimeInMillis());
-                    return formatDateString("yyyy-MM-dd'T'HH:mm'Z'",calendar);
+                    return formatDateString("yyyy-MM-dd'T'HH:mm'Z'", calendar);
                 } else if (mType.equals("month")) {
-                    return formatDateString("yyyy-MM",calendar);
+                    return formatDateString("yyyy-MM", calendar);
                 }
             }
             return super.getValue();
         }
     }
 
     public static class MenulistInput extends PromptInput {
         public static final String INPUT_TYPE = "menulist";
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarProgressView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarProgressView.java
@@ -62,17 +62,17 @@ public class ToolbarProgressView extends
     }
 
     public ToolbarProgressView(Context context, AttributeSet attrs) {
         super(context, attrs);
         init(context);
     }
 
     private void init(Context ctx) {
-        mBounds = new Rect(0,0,0,0);
+        mBounds = new Rect(0, 0, 0, 0);
         mTargetProgress = 0;
 
         mPrivateBrowsingColorFilter = new PorterDuffColorFilter(
                 ContextCompat.getColor(ctx, R.color.private_browsing_purple), PorterDuff.Mode.SRC_IN);
 
         mHandler = new ToolbarProgressHandler(this);
     }
 
--- a/mobile/android/base/java/org/mozilla/gecko/widget/BasicColorPicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/BasicColorPicker.java
@@ -25,25 +25,25 @@ import android.widget.AdapterView;
 import android.widget.CheckedTextView;
 import android.widget.ListView;
 import android.util.AttributeSet;
 import android.util.DisplayMetrics;
 import android.util.TypedValue;
 
 public class BasicColorPicker extends ListView {
     private final static String LOGTAG = "GeckoBasicColorPicker";
-    private final static List<Integer> DEFAULT_COLORS = Arrays.asList(Color.rgb(215,57,32),
-                                                                      Color.rgb(255,134,5),
-                                                                      Color.rgb(255,203,19),
-                                                                      Color.rgb(95,173,71),
-                                                                      Color.rgb(84,201,168),
-                                                                      Color.rgb(33,161,222),
-                                                                      Color.rgb(16,36,87),
-                                                                      Color.rgb(91,32,103),
-                                                                      Color.rgb(212,221,228),
+    private final static List<Integer> DEFAULT_COLORS = Arrays.asList(Color.rgb(215, 57, 32),
+                                                                      Color.rgb(255, 134, 5),
+                                                                      Color.rgb(255, 203, 19),
+                                                                      Color.rgb(95, 173, 71),
+                                                                      Color.rgb(84, 201, 168),
+                                                                      Color.rgb(33, 161, 222),
+                                                                      Color.rgb(16, 36, 87),
+                                                                      Color.rgb(91, 32, 103),
+                                                                      Color.rgb(212, 221, 228),
                                                                       Color.BLACK);
 
     private static Drawable mCheckDrawable;
     int mSelected;
     final ColorPickerListAdapter mAdapter;
 
     public BasicColorPicker(Context context) {
         this(context, null);
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
@@ -117,39 +117,39 @@ public class DateTimePicker extends Fram
                     int old = mTempDate.get(Calendar.MONTH);
                     setTempDate(Calendar.MONTH, old, newVal, Calendar.JANUARY, Calendar.DECEMBER);
                 } else if (picker == mWeekSpinner) {
                     int old = mTempDate.get(Calendar.WEEK_OF_YEAR);
                     int maxWeekOfYear = mTempDate.getActualMaximum(Calendar.WEEK_OF_YEAR);
                     setTempDate(Calendar.WEEK_OF_YEAR, old, newVal, 0, maxWeekOfYear);
                 } else if (picker == mYearSpinner && mYearEnabled) {
                     int month = mTempDate.get(Calendar.MONTH);
-                    mTempDate.set(Calendar.YEAR,newVal);
+                    mTempDate.set(Calendar.YEAR, newVal);
                     // Changing the year shouldn't change the month. (in case of non-leap year a Feb 29)
                     // change the day instead;
                     if (month != mTempDate.get(Calendar.MONTH)) {
                         mTempDate.set(Calendar.MONTH, month);
                         mTempDate.set(Calendar.DAY_OF_MONTH,
                         mTempDate.getActualMaximum(Calendar.DAY_OF_MONTH));
                     }
                 } else if (picker == mHourSpinner && mHourEnabled) {
                     if (mIs12HourMode) {
                         setTempDate(Calendar.HOUR, oldVal, newVal, 1, 12);
                     } else {
                         setTempDate(Calendar.HOUR_OF_DAY, oldVal, newVal, 0, 23);
                     }
                 } else if (picker == mMinuteSpinner && mMinuteEnabled) {
                     setTempDate(Calendar.MINUTE, oldVal, newVal, 0, 59);
                 } else if (picker == mAMPMSpinner && mHourEnabled) {
-                    mTempDate.set(Calendar.AM_PM,newVal);
+                    mTempDate.set(Calendar.AM_PM, newVal);
                 } else {
                     throw new IllegalArgumentException();
                 }
             } else {
-                if (DEBUG) Log.d(LOGTAG,"Sdk version < 10, using old behavior");
+                if (DEBUG) Log.d(LOGTAG, "Sdk version < 10, using old behavior");
                 if (picker == mDaySpinner && mDayEnabled){
                     mTempDate.set(Calendar.DAY_OF_MONTH, newVal);
                 } else if (picker == mMonthSpinner && mMonthEnabled){
                     mTempDate.set(Calendar.MONTH, newVal);
                     if (mTempDate.get(Calendar.MONTH) == newVal+1){
                         mTempDate.set(Calendar.MONTH, newVal);
                         mTempDate.set(Calendar.DAY_OF_MONTH,
                         mTempDate.getActualMaximum(Calendar.DAY_OF_MONTH));
@@ -320,23 +320,23 @@ public class DateTimePicker extends Fram
         // If we're displaying a date, the screen is wide enough
         // (and if we're using an SDK where the calendar view exists)
         // then display a calendar.
         if (Versions.feature11Plus &&
             (mState == PickersState.DATE || mState == PickersState.DATETIME) &&
             mScreenWidth >= SCREEN_SIZE_THRESHOLD) {
 
             if (DEBUG) {
-                Log.d(LOGTAG,"SDK > 10 and screen wide enough, displaying calendar");
+                Log.d(LOGTAG, "SDK > 10 and screen wide enough, displaying calendar");
             }
 
             mCalendar = new CalendarView(context);
             mCalendar.setVisibility(GONE);
 
-            LayoutParams layoutParams = new LayoutParams(250,280);
+            LayoutParams layoutParams = new LayoutParams(250, 280);
             mCalendar.setLayoutParams(layoutParams);
             mCalendar.setFocusable(true);
             mCalendar.setFocusableInTouchMode(true);
             mCalendar.setMaxDate(mMaxDate.getTimeInMillis());
             mCalendar.setMinDate(mMinDate.getTimeInMillis());
             mCalendar.setDate(mTempDate.getTimeInMillis(), false, false);
 
             mCalendar.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {