From 6c751752a8d1a03dbb23780541fc4130bde0444d Mon Sep 17 00:00:00 2001 From: ayman abdelghany Date: Fri, 20 May 2016 15:34:08 +0200 Subject: [PATCH] Utility classes should not have public constructors --- .../java/com/twofortyfouram/locale/PackageUtilities.java | 3 +++ .../com/integreight/onesheeld/plugin/BundleScrubber.java | 3 +++ .../onesheeld/shields/controller/utils/CameraUtils.java | 3 +++ .../onesheeld/shields/controller/utils/FoursquareUtils.java | 3 +++ .../onesheeld/shields/controller/utils/ImageUtils.java | 3 +++ .../onesheeld/shields/controller/utils/SensorUtil.java | 3 +++ .../java/com/integreight/onesheeld/utils/ArrayUtils.java | 3 +++ .../main/java/com/integreight/onesheeld/utils/BitsUtils.java | 3 +++ .../com/integreight/onesheeld/utils/CrashlyticsUtils.java | 3 +++ .../onesheeld/utils/customviews/PinsColumnContainer.java | 3 +++ .../utils/customviews/PluginPinsColumnContainer.java | 3 +++ .../onesheeld/utils/customviews/utils/LockPatternUtils.java | 3 +++ .../com/handmark/pulltorefresh/library/AlphaAnimator.java | 5 ++++- .../com/handmark/pulltorefresh/library/OverscrollHelper.java | 3 +++ .../com/handmark/pulltorefresh/library/internal/Utils.java | 4 ++++ 15 files changed, 47 insertions(+), 1 deletion(-) diff --git a/localeapi/src/main/java/com/twofortyfouram/locale/PackageUtilities.java b/localeapi/src/main/java/com/twofortyfouram/locale/PackageUtilities.java index a4b623ce4..81d293d9d 100644 --- a/localeapi/src/main/java/com/twofortyfouram/locale/PackageUtilities.java +++ b/localeapi/src/main/java/com/twofortyfouram/locale/PackageUtilities.java @@ -45,6 +45,9 @@ public final class PackageUtilities */ private static final Set COMPATIBLE_PACKAGES = constructPackageSet(); + private PackageUtilities() { + } + /** * @return a list wrapped in {@link Collections#unmodifiableList(List)} that represents the set of * Locale-compatible packages. diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/plugin/BundleScrubber.java b/oneSheeld/src/main/java/com/integreight/onesheeld/plugin/BundleScrubber.java index 929ad6ce1..1a4408b94 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/plugin/BundleScrubber.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/plugin/BundleScrubber.java @@ -16,6 +16,9 @@ import android.os.Bundle; public final class BundleScrubber { + private BundleScrubber() { + } + public static boolean scrub(final Intent intent) { if (null == intent) { return false; diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraUtils.java index 3070f6674..865891a61 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraUtils.java @@ -23,6 +23,9 @@ public class CameraUtils { private static SharedPreferences.Editor editor; private static final String sharedPreferencesKey = "LastImage"; + private CameraUtils() { + } + public static Camera.Size getBiggestPictureSize( Camera.Parameters parameters) { Camera.Size result = null; diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/FoursquareUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/FoursquareUtils.java index df7b5c688..e48df8452 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/FoursquareUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/FoursquareUtils.java @@ -24,6 +24,9 @@ public final class FoursquareUtils { + private FoursquareUtils() { + } + public static String encodePostBody(Bundle parameters, String boundary) { if (parameters == null) return ""; diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/ImageUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/ImageUtils.java index 8bdcf106f..b274716ac 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/ImageUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/ImageUtils.java @@ -19,6 +19,9 @@ import java.util.Map; public class ImageUtils { + private ImageUtils() { + } + public static Bitmap decodeFile(File f, int required_size) { try { // Decode image size diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/SensorUtil.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/SensorUtil.java index 82dcd64f2..ce9c5db25 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/SensorUtil.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/SensorUtil.java @@ -7,6 +7,9 @@ public class SensorUtil { public static PackageManager PM; public static boolean sensor; + private SensorUtil() { + } + public static Boolean isDeviceHasSensor(String sensorType, Context mContext) { PM = mContext.getPackageManager(); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/ArrayUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/ArrayUtils.java index a7444d7e4..93d506466 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/ArrayUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/ArrayUtils.java @@ -1,6 +1,9 @@ package com.integreight.onesheeld.utils; public class ArrayUtils { + private ArrayUtils() { + } + public static byte[] copyOfRange(byte[] from, int start, int end) { int length = end - start; byte[] result = new byte[length]; diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/BitsUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/BitsUtils.java index 91ae3922f..4aab0592a 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/BitsUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/BitsUtils.java @@ -2,6 +2,9 @@ public class BitsUtils { + private BitsUtils() { + } + public static byte setBit(byte b, int bit) { if (bit < 0 || bit >= 8) return b; return (byte) (b | (1 << bit)); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/CrashlyticsUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/CrashlyticsUtils.java index 3674086f9..782c9fe0e 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/CrashlyticsUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/CrashlyticsUtils.java @@ -1,6 +1,9 @@ package com.integreight.onesheeld.utils; public class CrashlyticsUtils { + private CrashlyticsUtils() { + } + public static void setString(String key, String value) { try { com.crashlytics.android.Crashlytics.setString(key, value); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/PinsColumnContainer.java b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/PinsColumnContainer.java index fec759931..9cedf6d3a 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/PinsColumnContainer.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/PinsColumnContainer.java @@ -240,6 +240,9 @@ public static final class TYPE { public final static int NOT_CONNECTED_AND_ENABLED = R.drawable.arduino_default_pin; public final static int DISABLED = R.drawable.arduino_red_pin; public final static int DUMMY = R.drawable.arduino_dummy_pin; + + private TYPE() { + } } } diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/PluginPinsColumnContainer.java b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/PluginPinsColumnContainer.java index e3b2c2188..0ec8ad12c 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/PluginPinsColumnContainer.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/PluginPinsColumnContainer.java @@ -226,6 +226,9 @@ public static final class TYPE { public final static int NOT_CONNECTED_AND_ENABLED = R.drawable.arduino_default_pin; public final static int DISABLED = R.drawable.arduino_red_pin; public final static int DUMMY = R.drawable.arduino_dummy_pin; + + private TYPE() { + } } } diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/utils/LockPatternUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/utils/LockPatternUtils.java index ef5cc18a6..ac5ec39aa 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/utils/LockPatternUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/utils/LockPatternUtils.java @@ -25,6 +25,9 @@ */ public class LockPatternUtils { + private LockPatternUtils() { + } + /** * Deserialize a pattern. * diff --git a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/AlphaAnimator.java b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/AlphaAnimator.java index f69c5a900..1a067c563 100644 --- a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/AlphaAnimator.java +++ b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/AlphaAnimator.java @@ -25,7 +25,10 @@ * */ class AlphaAnimator { - + + private AlphaAnimator() { + } + public static void fadein(View view, int duration) { fadein(view, duration, null); } diff --git a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/OverscrollHelper.java b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/OverscrollHelper.java index 806ddb5ef..8be7c6262 100644 --- a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/OverscrollHelper.java +++ b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/OverscrollHelper.java @@ -29,6 +29,9 @@ public final class OverscrollHelper { static final String LOG_TAG = "OverscrollHelper"; static final float DEFAULT_OVERSCROLL_SCALE = 1f; + private OverscrollHelper() { + } + /** * Helper method for Overscrolling that encapsulates all of the necessary * function. diff --git a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java index e25f111ba..624283f89 100644 --- a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java +++ b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java @@ -36,6 +36,10 @@ public class Utils { * Invalid android attribute (temporarily defined, to check android attributes' values) */ static final int INVALID_INT_VALUE = -1; + + private Utils() { + } + /** * Delegate warn logs at where some deprecated method has been called * @param depreacted Deprecated method name