-
public class UtilsUtility class that provides various helper methods used throughout the application.
-
-
Method Summary
Modifier and Type Method Description static GsongetGsonInstance()Returns a singleton instance of Gson configured with custom adapters for Event-related classes. static intcalculateCpuUsagePercentage(int toCalculate, int maximum)Calculates CPU usage as a percentage. static booleanisNetworkAvailable(Context context)Checks if the device is connected to a network. static StringgetTimestamp()Returns the current timestamp in ISO 8601 format. -
-
Method Detail
-
getGsonInstance
static Gson getGsonInstance()
Returns a singleton instance of Gson configured with custom adapters for Event-related classes.
-
calculateCpuUsagePercentage
static int calculateCpuUsagePercentage(int toCalculate, int maximum)
Calculates CPU usage as a percentage.
- Parameters:
toCalculate- The value to calculate.maximum- The maximum value for the calculation.
-
isNetworkAvailable
static boolean isNetworkAvailable(Context context)
Checks if the device is connected to a network.
- Parameters:
context- The application context.
-
getTimestamp
static String getTimestamp()
Returns the current timestamp in ISO 8601 format.
-
-
-
-