public class Utils
extends java.lang.Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static void |
applyLanguage(android.content.Context context,
java.lang.String newValue)
Apply language based on newValue
|
static void |
applyTheme(java.lang.String newValue)
Apply theme based on newValue
|
static int |
checkDateInputSanity(java.lang.String text)
Check if the input string is valid
|
static java.lang.String |
convertDateIntoReadable(java.lang.String s)
Convert date into readable one:
Example : 2021-10-12 -> 12 October 2021
|
static long |
getDateDiff(java.lang.String sDate1,
java.lang.String sDate2,
java.util.concurrent.TimeUnit timeUnit)
Compute the diff between two given dates
The formula is date2 - date1
|
static java.lang.String |
getdateFormatted(java.util.Date date)
Format date from Date to string using "yyyy-MM-dd HH:mm:ss" format
|
static java.util.Date |
getdateParsed(java.lang.String date)
Parse a string date into a Date object
|
static void |
sendNotification(android.content.Context context,
java.lang.String title,
java.lang.String content,
int drawable)
Send a notification on the 'normal' channel
|
static void |
sendNotificationWithQuickAnswer(android.content.Context context,
java.lang.String title,
java.lang.String content,
int drawable,
long entryId)
Send a notification on the 'normal' channel
|
static void |
setAppLocale(android.content.Context context,
java.lang.String localeCode)
Change language
|
public static void applyTheme(java.lang.String newValue)
newValue
- the new Theme to applypublic static void applyLanguage(android.content.Context context, java.lang.String newValue)
context
- contextnewValue
- the new Language to applypublic static int checkDateInputSanity(java.lang.String text)
text
- the given input stringpublic static java.lang.String getdateFormatted(java.util.Date date)
date
- The date to formatpublic static java.util.Date getdateParsed(java.lang.String date)
date
- the string date to parsepublic static long getDateDiff(java.lang.String sDate1, java.lang.String sDate2, java.util.concurrent.TimeUnit timeUnit)
sDate1
- First date in the form of a stringsDate2
- Second date in the form of a stringtimeUnit
- The timeUnit we want to return (Mostly minutes)public static java.lang.String convertDateIntoReadable(java.lang.String s)
s
- public static final void setAppLocale(android.content.Context context, java.lang.String localeCode)
context
- localeCode
- localCode to applypublic static void sendNotification(android.content.Context context, java.lang.String title, java.lang.String content, int drawable)
context
- current Contexttitle
- Notification titlecontent
- notification bodydrawable
- drawable iconpublic static void sendNotificationWithQuickAnswer(android.content.Context context, java.lang.String title, java.lang.String content, int drawable, long entryId)
context
- current Contexttitle
- Notification titlecontent
- notification bodydrawable
- drawable icon