public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkDniLetter(String n) |
static boolean |
connectionAvailable(Context ctx)
Checks if any connection is available
|
static boolean |
downloadFileGingerbread(Context context,
String url,
String fileName,
String title,
String description)
Download method for Android >= Gingerbread
|
static String |
fixLinks(String body) |
static String |
getSeenNotificationCodes(List<Model> markedNotificationsList)
Creates a string of notification codes separated by commas from a list of notifications
|
static String |
getStarsSequence(int size)
Generates the stars sequence to be showed on password field
|
static boolean |
isDbCleaned()
Indicates if the db was cleaned
|
static boolean |
isDownloadManagerAvailable(Context context) |
private static boolean |
isHTTPUrl(String url) |
static boolean |
isInteger(String str) |
static boolean |
isLong(String str) |
static boolean |
isValidDni(String dni) |
static boolean |
isValidNickname(String nickname) |
static int |
parseBoolInt(boolean b)
Function to parse from Boolean to Integer
|
static String |
parseBoolString(boolean b)
Function to parse from Boolean to String
|
static boolean |
parseIntBool(int n)
Function to parse from Integer to Boolean
|
static boolean |
parseStringBool(String s)
Function to parse from String to Boolean
|
static String |
randomString(int len)
Generates a random string of length len
|
static void |
setDbCleaned(boolean state)
Set the fact that the db was cleaned
|
private static final String TAG
public static String randomString(int len)
len
- Length of random stringpublic static boolean isDbCleaned()
public static void setDbCleaned(boolean state)
public static boolean connectionAvailable(Context ctx)
ctx
- Application contextpublic static boolean parseIntBool(int n)
n
- Integer to be parsedpublic static boolean parseStringBool(String s)
s
- String to be parsedpublic static int parseBoolInt(boolean b)
b
- Boolean to be parsedpublic static String parseBoolString(boolean b)
b
- Boolean to be parsedpublic static boolean isDownloadManagerAvailable(Context context)
context
- used to check the device version and DownloadManager informationprivate static boolean isHTTPUrl(String url)
public static boolean downloadFileGingerbread(Context context, String url, String fileName, String title, String description)
url
- URL of the file to be downloadedfileName
- filename of the file to be downloadedtitle
- title of the download notificationdescription
- description of the download notificationpublic static boolean isInteger(String str)
public static boolean isLong(String str)
public static boolean isValidDni(String dni)
public static boolean checkDniLetter(String n)
public static boolean isValidNickname(String nickname)
public static String getSeenNotificationCodes(List<Model> markedNotificationsList)
public static String getStarsSequence(int size)
size
- Length of the stars sequence