package pt.passarola.utils;

import android.content.Context;

import com.google.android.gms.common.GoogleApiAvailability;

import static com.google.android.gms.common.ConnectionResult.SUCCESS;

/**
 * Created by ruigoncalo on 22/10/15.
 */
public class Utils {

    /**
     * Validate if device has GooglePlayServices app installed
     */
    public static boolean isGooglePlayServicesAvailable(Context context) {
        return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == SUCCESS;
    }
}
@@ -53,16 +53,60 @@
 Context;
+%0Aimport android.support.annotation.Nullable;
 %0A%0Aimport
@@ -160,16 +160,162 @@
 ility;%0A%0A
+import java.text.DateFormat;%0Aimport java.text.ParseException;%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Date;%0Aimport java.util.Locale;%0A%0A
 import s
@@ -705,11 +705,1090 @@
 SS;%0A
-
     %7D%0A
+%0A    /**%0A     * Normalize the value of a distance expressed in meters.%0A     * 989 meters = 989 meters%0A     * 1000 meters = 1.0 km%0A     * 1500 meters = 1.5 km%0A     *%0A     * @param distanceInMeters distance number in meters%0A     * @return distance normalized with distance units%0A     */%0A    public static String getNormalizedDistance(int distanceInMeters)%7B%0A        float distance = (float) distanceInMeters;%0A        if(distance %3C 1000)%7B%0A            return distanceInMeters + %22 meters%22;%0A        %7D else %7B%0A            return String.format(%22%25.02f%22, distance/1000) + %22 km%22;%0A        %7D%0A    %7D%0A%0A    /**%0A     * Generate a date object from a string%0A     *%0A     * @param date string date%0A     * @return date object that follows the format %22yyyy-mm-dd%22%0A     */%0A    @Nullable%0A    public static Date getDateFromString(String date)%7B%0A        Date result;%0A        DateFormat dateFormat = new SimpleDateFormat(%22yyyy-mm-dd%22, Locale.UK);%0A%0A        try %7B%0A            result = dateFormat.parse(date);%0A        %7D catch (ParseException e)%7B%0A            result = null;%0A        %7D%0A%0A        return result;%0A    %7D%0A%0A
 %7D

Add new utils methods