public class CommonUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MINIMUM_STRING_LENGTH |
Constructor and Description |
---|
CommonUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkIfPackageIsInstalled(android.content.Context context,
java.lang.String uri)
Alternative method for checking if a package is installed
|
static android.view.animation.Animation |
createAnimation(android.content.Context context,
int animRes,
int startOffset)
Create an animation object from the values passed in
|
static android.view.ViewGroup |
createParentLayout(android.content.Context context)
Creates a FrameLayout that can be used as a parent container
|
static java.lang.String |
formatTimeStamp(java.lang.String timestamp,
java.lang.String pattern)
Formats a timestamp as required
|
static boolean |
isFirstInstall(android.content.Context context)
Checks if this is a first install of an application
|
static boolean |
isPackageInstalled(java.lang.String packageName,
android.content.Context context)
Checks if a package is installed
|
static boolean |
isPackageInstalled2(android.content.Context context,
java.lang.String packageName)
Another alternative method for checking if a package is installed
|
static void |
launchWebPage(android.content.Context context,
java.lang.String webPageUrl) |
static java.lang.String |
truncateString(java.lang.String sourceString)
Well, truncates the given string if length greater than MINIMUM_STRING_LENGTH with an ellipsis
|
public static final int MINIMUM_STRING_LENGTH
public static java.lang.String formatTimeStamp(java.lang.String timestamp, java.lang.String pattern)
timestamp
- timestamppattern
- patternpublic static java.lang.String truncateString(java.lang.String sourceString)
sourceString
- sourcepublic static android.view.animation.Animation createAnimation(android.content.Context context, int animRes, int startOffset)
context
- the contextanimRes
- animation resourcestartOffset
- animation start offsetpublic static boolean isFirstInstall(android.content.Context context)
context
- the contextpublic static boolean isPackageInstalled(java.lang.String packageName, android.content.Context context)
packageName
- package name to checkcontext
- the contextpublic static boolean checkIfPackageIsInstalled(android.content.Context context, java.lang.String uri)
context
- the contexturi
- the uripublic static boolean isPackageInstalled2(android.content.Context context, java.lang.String packageName)
context
- the contextpackageName
- the package to checkpublic static android.view.ViewGroup createParentLayout(android.content.Context context)
context
- the contextpublic static void launchWebPage(android.content.Context context, java.lang.String webPageUrl)