-
public class Utilitycom.facebook.internal is solely for the use of other packages within the Facebook SDK for Android. Use of any of the classes in this package is unsupported, and they may be modified or removed without warning at any time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceUtility.Predicatepublic interfaceUtility.Mapperpublic interfaceUtility.GraphMeRequestWithCacheCallbackpublic final classUtility.PermissionsListsInternal helper class that is used to hold three different permission lists (granted, declined and expired)
-
Field Summary
Fields Modifier and Type Field Description private final StringLOG_TAGprivate final IntegerDEFAULT_STREAM_BUFFER_SIZEprivate final LocaleresourceLocaleprivate final LocalecurrentLocaleprivate final static BooleanisAutoAppLinkSetupprivate final JSONObjectdataProcessingOptionsprivate final BooleanisDataProcessingRestrictedpublic final static UtilityINSTANCE
-
Method Summary
Modifier and Type Method Description final static IntArrayintersectRanges(IntArray range1, IntArray range2)Each array represents a set of closed or open Range, like so: 0,10,50,60 - Ranges are {0-9}, {50-59} 20 - Ranges are {20-} 30,40,100 - Ranges are {30-39}, {100-}All Ranges in the array have a closed lower bound. final static <T extends Any> BooleanisSubset(Collection<T> subset, Collection<T> superset)final static <T extends Any> BooleanisNullOrEmpty(Collection<T> c)final static BooleanisNullOrEmpty(String s)final static StringcoerceValueIfNullOrEmpty(String s, String valueIfNullOrEmpty)Use this when you want to normalize empty and null strings This way, Utility.areObjectsEqual can used for comparison, where a null string is to be treated the same as an empty string. final static <T extends Any> Collection<T>unmodifiableCollection(T ts)final static <T extends Any> ArrayList<T>arrayList(T ts)final static <T extends Any> HashSet<T>hashSet(T ts)final static Stringmd5hash(String key)final static Stringsha1hash(String key)final static Stringsha1hash(ByteArray bytes)final static Stringsha256hash(String key)final static Stringsha256hash(ByteArray bytes)final static UribuildUri(String authority, String path, Bundle parameters)final static BundleparseUrlQueryString(String queryString)final static UnitputNonEmptyString(Bundle b, String key, String value)final static UnitputCommaSeparatedStringList(Bundle b, String key, List<String> list)final static UnitputUri(Bundle b, String key, Uri uri)final static BooleanputJSONValueInBundle(Bundle bundle, String key, Object value)final static UnitcloseQuietly(Closeable closeable)final static UnitdisconnectQuietly(URLConnection connection)final static StringgetMetadataApplicationId(Context context)final static Map<String, Object>convertJSONObjectToHashMap(JSONObject jsonObject)final static Map<String, String>convertJSONObjectToStringMap(JSONObject jsonObject)final static List<String>convertJSONArrayToList(JSONArray jsonArray)final static ObjectgetStringPropertyAsJSON(JSONObject jsonObject, String key, String nonJSONPropertyKey)final static StringreadStreamToString(InputStream inputStream)final static IntegercopyAndCloseInputStream(InputStream inputStream, OutputStream outputStream)final static BooleanstringsEqualOrEmpty(String a, String b)final static UnitclearFacebookCookies(Context context)final static Unitlogd(String tag, Exception e)final static Unitlogd(String tag, String msg)final static Unitlogd(String tag, String msg, Throwable t)final static <T extends Any> BooleanareObjectsEqual(T a, T b)final static BooleanhasSameId(JSONObject a, JSONObject b)final static StringsafeGetStringFromResponse(JSONObject response, String propertyName)final static JSONObjecttryGetJSONObjectFromResponse(JSONObject response, String propertyKey)final static JSONArraytryGetJSONArrayFromResponse(JSONObject response, String propertyKey)final static UnitclearCaches()final static UnitdeleteDirectory(File directoryOrFile)final static <T extends Any> List<T>asListNoNulls(T array)final static List<String>jsonArrayToStringList(JSONArray jsonArray)final static Set<String>jsonArrayToSet(JSONArray jsonArray)final static StringmapToJsonStr(Map<String, String> map)final static Map<String, String>jsonStrToMap(String str)final static UnitsetAppEventAttributionParameters(JSONObject params, AttributionIdentifiers attributionIdentifiers, String anonymousAppDeviceGUID, Boolean limitEventUsage, Context context)final static StringgetAppVersion()Get the app version of the app, as specified by the manifest. final static UnitsetAppEventExtendedDeviceInfoParameters(JSONObject params, Context appContext)final static MethodgetMethodQuietly(Class<?> clazz, String methodName, Class<?> parameterTypes)final static MethodgetMethodQuietly(String className, String methodName, Class<?> parameterTypes)final static ObjectinvokeMethodQuietly(Object receiver, Method method, Object args)final static StringgetActivityName(Context context)Returns the name of the current activity if the context is an activity, otherwise return "unknown" final static <T extends Any> List<T>filter(List<T> target, Utility.Predicate<T> predicate)final static <T extends Any, K extends Any> List<K>map(List<T> target, Utility.Mapper<T, K> mapper)final static StringgetUriString(Uri uri)final static BooleanisWebUri(Uri uri)final static BooleanisContentUri(Uri uri)final static BooleanisFileUri(Uri uri)final static LonggetContentSize(Uri contentUri)final static DategetBundleLongAsDate(Bundle bundle, String key, Date dateBase)final static UnitwriteStringMapToParcel(Parcel parcel, Map<String, String> map)final static Map<String, String>readStringMapFromParcel(Parcel parcel)final static BooleanisCurrentAccessToken(AccessToken token)final static StringgetGraphDomainFromTokenDomain(String tokenGraphDomain)final static UnitgetGraphMeRequestWithCacheAsync(String accessToken, Utility.GraphMeRequestWithCacheCallback callback)final static JSONObjectawaitGetGraphMeRequestWithCache(String accessToken)final static Utility.PermissionsListshandlePermissionResponse(JSONObject result)final static StringgenerateRandomString(Integer length)final static BooleanmustFixWindowParamsForAutofill(Context context)final static BooleanisAutofillAvailable(Context context)final static BooleanisChromeOS(Context context)Determines whether the application is running on Chrome OS or not final static UnitrunOnNonUiThread(Runnable runnable)final static StringgetAppName(Context context)final StringgetLOG_TAG()final IntegergetDEFAULT_STREAM_BUFFER_SIZE()final static LocalegetResourceLocale()final static LocalegetCurrentLocale()final static BooleangetIsAutoAppLinkSetup()final static JSONObjectgetDataProcessingOptions()final static BooleangetIsDataProcessingRestricted()-
-
Method Detail
-
intersectRanges
@Deprecated(message = It will be removed in v13.0.) final static IntArray intersectRanges(IntArray range1, IntArray range2)
Each array represents a set of closed or open Range, like so: 0,10,50,60 - Ranges are {0-9}, {50-59} 20 - Ranges are {20-} 30,40,100 - Ranges are {30-39}, {100-}
All Ranges in the array have a closed lower bound. Only the last Range in each array may be open. It is assumed that the passed in arrays are sorted with ascending order. It is assumed that no two elements in a given are equal (i.e. no 0-length ranges)
The method returns an intersect of the two passed in Range-sets
- Parameters:
range1- The first rangerange2- The second range
-
isSubset
@Deprecated(message = This method should not be used in Kotlin., replaceWith = @ReplaceWith(imports = {}, expression = kotlin.collections.containsAll)) final static <T extends Any> Boolean isSubset(Collection<T> subset, Collection<T> superset)
-
isNullOrEmpty
final static <T extends Any> Boolean isNullOrEmpty(Collection<T> c)
-
isNullOrEmpty
final static Boolean isNullOrEmpty(String s)
-
coerceValueIfNullOrEmpty
final static String coerceValueIfNullOrEmpty(String s, String valueIfNullOrEmpty)
Use this when you want to normalize empty and null strings This way, Utility.areObjectsEqual can used for comparison, where a null string is to be treated the same as an empty string.
- Parameters:
s- The string to coercevalueIfNullOrEmpty- The value if s is null or empty.
-
unmodifiableCollection
@Deprecated(message = This method should not be used in Kotlin., replaceWith = @ReplaceWith(imports = {}, expression = kotlin.collections.listOf)) final static <T extends Any> Collection<T> unmodifiableCollection(T ts)
-
arrayList
@Deprecated(message = This method should not be used in Kotlin., replaceWith = @ReplaceWith(imports = {}, expression = kotlin.collections.arrayListOf)) final static <T extends Any> ArrayList<T> arrayList(T ts)
-
hashSet
@Deprecated(message = This method should not be used in Kotlin., replaceWith = @ReplaceWith(imports = {}, expression = kotlin.collections.hashSetOf)) final static <T extends Any> HashSet<T> hashSet(T ts)
-
sha256hash
final static String sha256hash(String key)
-
sha256hash
final static String sha256hash(ByteArray bytes)
-
parseUrlQueryString
final static Bundle parseUrlQueryString(String queryString)
-
putNonEmptyString
final static Unit putNonEmptyString(Bundle b, String key, String value)
-
putCommaSeparatedStringList
final static Unit putCommaSeparatedStringList(Bundle b, String key, List<String> list)
-
putJSONValueInBundle
final static Boolean putJSONValueInBundle(Bundle bundle, String key, Object value)
-
closeQuietly
final static Unit closeQuietly(Closeable closeable)
-
disconnectQuietly
final static Unit disconnectQuietly(URLConnection connection)
-
getMetadataApplicationId
final static String getMetadataApplicationId(Context context)
-
convertJSONObjectToHashMap
final static Map<String, Object> convertJSONObjectToHashMap(JSONObject jsonObject)
-
convertJSONObjectToStringMap
final static Map<String, String> convertJSONObjectToStringMap(JSONObject jsonObject)
-
convertJSONArrayToList
final static List<String> convertJSONArrayToList(JSONArray jsonArray)
-
getStringPropertyAsJSON
final static Object getStringPropertyAsJSON(JSONObject jsonObject, String key, String nonJSONPropertyKey)
-
readStreamToString
final static String readStreamToString(InputStream inputStream)
-
copyAndCloseInputStream
final static Integer copyAndCloseInputStream(InputStream inputStream, OutputStream outputStream)
-
stringsEqualOrEmpty
final static Boolean stringsEqualOrEmpty(String a, String b)
-
clearFacebookCookies
final static Unit clearFacebookCookies(Context context)
-
areObjectsEqual
final static <T extends Any> Boolean areObjectsEqual(T a, T b)
-
hasSameId
@Deprecated(message = It will be removed in v13.0.) final static Boolean hasSameId(JSONObject a, JSONObject b)
-
safeGetStringFromResponse
final static String safeGetStringFromResponse(JSONObject response, String propertyName)
-
tryGetJSONObjectFromResponse
final static JSONObject tryGetJSONObjectFromResponse(JSONObject response, String propertyKey)
-
tryGetJSONArrayFromResponse
final static JSONArray tryGetJSONArrayFromResponse(JSONObject response, String propertyKey)
-
clearCaches
@Deprecated(message = It will be removed in v13.0.) final static Unit clearCaches()
-
deleteDirectory
final static Unit deleteDirectory(File directoryOrFile)
-
asListNoNulls
@Deprecated(message = This method should not be used in Kotlin., replaceWith = @ReplaceWith(imports = {}, expression = kotlin.collections.filterNotNull)) final static <T extends Any> List<T> asListNoNulls(T array)
-
jsonArrayToStringList
final static List<String> jsonArrayToStringList(JSONArray jsonArray)
-
jsonArrayToSet
final static Set<String> jsonArrayToSet(JSONArray jsonArray)
-
mapToJsonStr
final static String mapToJsonStr(Map<String, String> map)
-
jsonStrToMap
final static Map<String, String> jsonStrToMap(String str)
-
setAppEventAttributionParameters
final static Unit setAppEventAttributionParameters(JSONObject params, AttributionIdentifiers attributionIdentifiers, String anonymousAppDeviceGUID, Boolean limitEventUsage, Context context)
-
getAppVersion
final static String getAppVersion()
Get the app version of the app, as specified by the manifest.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.
-
setAppEventExtendedDeviceInfoParameters
final static Unit setAppEventExtendedDeviceInfoParameters(JSONObject params, Context appContext)
-
getMethodQuietly
final static Method getMethodQuietly(Class<?> clazz, String methodName, Class<?> parameterTypes)
-
getMethodQuietly
final static Method getMethodQuietly(String className, String methodName, Class<?> parameterTypes)
-
invokeMethodQuietly
final static Object invokeMethodQuietly(Object receiver, Method method, Object args)
-
getActivityName
final static String getActivityName(Context context)
Returns the name of the current activity if the context is an activity, otherwise return "unknown"
-
filter
@Deprecated(message = This method should not be used in Kotlin., replaceWith = @ReplaceWith(imports = {}, expression = kotlin.collections.filter)) final static <T extends Any> List<T> filter(List<T> target, Utility.Predicate<T> predicate)
-
map
@Deprecated(message = This method should not be used in Kotlin., replaceWith = @ReplaceWith(imports = {}, expression = kotlin.collections.map)) final static <T extends Any, K extends Any> List<K> map(List<T> target, Utility.Mapper<T, K> mapper)
-
getUriString
final static String getUriString(Uri uri)
-
isContentUri
final static Boolean isContentUri(Uri uri)
-
getContentSize
final static Long getContentSize(Uri contentUri)
-
getBundleLongAsDate
final static Date getBundleLongAsDate(Bundle bundle, String key, Date dateBase)
-
writeStringMapToParcel
final static Unit writeStringMapToParcel(Parcel parcel, Map<String, String> map)
-
readStringMapFromParcel
final static Map<String, String> readStringMapFromParcel(Parcel parcel)
-
isCurrentAccessToken
final static Boolean isCurrentAccessToken(AccessToken token)
-
getGraphDomainFromTokenDomain
final static String getGraphDomainFromTokenDomain(String tokenGraphDomain)
-
getGraphMeRequestWithCacheAsync
final static Unit getGraphMeRequestWithCacheAsync(String accessToken, Utility.GraphMeRequestWithCacheCallback callback)
-
awaitGetGraphMeRequestWithCache
final static JSONObject awaitGetGraphMeRequestWithCache(String accessToken)
-
handlePermissionResponse
final static Utility.PermissionsLists handlePermissionResponse(JSONObject result)
-
generateRandomString
final static String generateRandomString(Integer length)
-
mustFixWindowParamsForAutofill
final static Boolean mustFixWindowParamsForAutofill(Context context)
-
isAutofillAvailable
final static Boolean isAutofillAvailable(Context context)
-
isChromeOS
final static Boolean isChromeOS(Context context)
Determines whether the application is running on Chrome OS or not
- Parameters:
context- the Context
-
runOnNonUiThread
final static Unit runOnNonUiThread(Runnable runnable)
-
getAppName
final static String getAppName(Context context)
-
getLOG_TAG
final String getLOG_TAG()
-
getDEFAULT_STREAM_BUFFER_SIZE
final Integer getDEFAULT_STREAM_BUFFER_SIZE()
-
getResourceLocale
final static Locale getResourceLocale()
-
getCurrentLocale
final static Locale getCurrentLocale()
-
getIsAutoAppLinkSetup
final static Boolean getIsAutoAppLinkSetup()
-
getDataProcessingOptions
final static JSONObject getDataProcessingOptions()
-
getIsDataProcessingRestricted
final static Boolean getIsDataProcessingRestricted()
-
-
-
-