public class POBUtils
extends java.lang.Object
| Constructor and Description |
|---|
POBUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
convertDpToPixel(int value)
Method is used to covert DP into pixel
|
static int |
convertPixelToDp(int value)
Method is used to convert Pixel into DP
|
static double |
convertToSeconds(java.lang.String duration,
java.lang.String skipOffset)
Calculates time in seconds whether skip offset is in time format or percentage
|
static android.app.Activity |
getActivity(android.content.Context context)
Returns Weak reference of the activity from the webview context
It also checks whether the context is from ContextThemeWrapper(Dialog) or from activity
and returns specific activity context
|
static boolean |
getBooleanValue(java.lang.String data) |
static int |
getDeviceOrientation(android.content.Context context) |
static int |
getIntegerValue(java.lang.String data) |
static POBLocation |
getLocation(PMLocationDetector locationDetector)
Method identifies isLocationDetectionEnabled
if enabled then fetch last known location of the device
if disabled then get location provided by the publisher
|
static int |
getScreenHeight()
Method to get screen height in DP
|
static int |
getScreenWidth()
Method to get screen width in DP
|
static double |
getSeconds(java.lang.String time)
Utility method to convert time string to seconds
|
static int |
getTimeOffsetInMinutes()
Returns local time as the number +/- of minutes from UTC.
|
static int[] |
getViewXYPosition(android.view.View view)
Method is used get x, y position of View
|
static boolean |
hasPermission(android.content.Context context,
java.lang.String permission)
Method is used to check app has user permission
|
static boolean |
isNull(java.lang.Object[] obj)
Method to check Object array is Null or one of the object inside the object array is null
|
static boolean |
isNullOrEmpty(java.lang.String str)
Method to check String isNull or isEmpty
|
static boolean |
isTablet(android.content.Context context) |
static java.lang.String |
loadMraid(android.content.Context context,
java.lang.String file)
Utility method to load mraid JS from assets
|
static java.lang.String |
md5(java.lang.String string)
Method is used generate MD5 String
|
static boolean |
openExternalBrowser(android.content.Context context,
java.lang.String url)
Opens url in external app of browser
|
static java.lang.String |
readFile(android.content.Context context,
java.lang.String path)
Utility method to read file content from given path
|
static java.lang.String |
sha1(java.lang.String string)
Method is used to generate SHA1 string
|
static void |
writeFile(java.lang.String content,
java.lang.String fileName)
Utility method to write string content to file
|
public static java.lang.String sha1(java.lang.String string)
string - on which SHA1 to be performpublic static java.lang.String md5(java.lang.String string)
string - on which MD5 algorithm to be performpublic static boolean hasPermission(android.content.Context context,
java.lang.String permission)
context - android app contextpermission - string of app permissionpublic static boolean openExternalBrowser(android.content.Context context,
java.lang.String url)
context - android app contexturl - which is going to be opened in external browser/applicationpublic static boolean isNullOrEmpty(java.lang.String str)
str - which is going to checkedpublic static boolean isNull(java.lang.Object[] obj)
obj - accepts array of objectpublic static POBLocation getLocation(PMLocationDetector locationDetector)
locationDetector - instance of PMLocationDetectorpublic static android.app.Activity getActivity(android.content.Context context)
context - accepts android contextpublic static int getScreenWidth()
public static int getScreenHeight()
public static int[] getViewXYPosition(android.view.View view)
view - on which operation to be performedpublic static int convertDpToPixel(int value)
value - of DPpublic static int convertPixelToDp(int value)
value - in Pixelpublic static int getDeviceOrientation(android.content.Context context)
public static java.lang.String loadMraid(android.content.Context context,
java.lang.String file)
context - instance of Contextfile - name of filepublic static void writeFile(java.lang.String content,
java.lang.String fileName)
content - content to writefileName - name of filepublic static java.lang.String readFile(android.content.Context context,
java.lang.String path)
context - instance of Contextpath - absolute path of filepublic static boolean isTablet(android.content.Context context)
public static int getTimeOffsetInMinutes()
public static double getSeconds(java.lang.String time)
time - time can be in format HH:MM:SS.mmm, HH:MM:SS, MM:SS, SS etcpublic static double convertToSeconds(@Nullable
java.lang.String duration,
@Nullable
java.lang.String skipOffset)
duration - should be in format HH:MM:SS.mmm, HH:MM:SS, MM:SS, SS etcskipOffset - should be in format HH:MM:SS.mmm or HH:MM:SS or in percentagepublic static int getIntegerValue(@Nullable
java.lang.String data)
public static boolean getBooleanValue(@Nullable
java.lang.String data)