private static void enqueueDownload(ImageRequest request, RequestKey key) { enqueueRequest( request, key, downloadQueue, new DownloadImageWorkItem(request.getContext(), key)); }
private static void enqueueCacheRead( ImageRequest request, RequestKey key, boolean allowCachedRedirects) { enqueueRequest( request, key, cacheReadQueue, new CacheReadWorkItem(request.getContext(), key, allowCachedRedirects)); }
synchronized static FileLruCache getCache() throws IOException{ if (urlRedirectCache == null) { urlRedirectCache = new FileLruCache(TAG, new FileLruCache.Limits()); } return urlRedirectCache; }
public static Attachment createAttachment(UUID callId, Bitmap attachmentBitmap) { Validate.notNull(callId, "callId"); Validate.notNull(attachmentBitmap, "attachmentBitmap"); return new Attachment(callId, attachmentBitmap, null); }
public static void present(AppCall appCall, FragmentWrapper fragmentWrapper) { fragmentWrapper.startActivityForResult( appCall.getRequestIntent(), appCall.getRequestCode()); appCall.setPending(); }
/** * Removes any temporary files associated with a particular native app call. * * @param callId the unique ID of the call */ public static void cleanupAttachmentsForCall(UUID callId) { File dir = getAttachmentsDirectoryForCall(callId, false); if (dir != null) { Utility.deleteDirectory(dir); } }
public static int getLatestAvailableProtocolVersionForService(final int minimumVersion) { // Services are currently always against the Facebook App return getLatestAvailableProtocolVersionForAppInfoList( facebookAppInfoList, new int[]{minimumVersion}).getProtocolVersion(); }
public static void cleanupAllAttachments() { // Attachments directory may or may not exist; we won't create it if not, since we are just // going to delete it. File dir = getAttachmentsDirectory(); Utility.deleteDirectory(dir); }
@Override public void run() { ImageResponse response = new ImageResponse( request, error, isCachedRedirect, bitmap); callback.onCompleted(response); } });
private static AppCall getAppCallFromActivityResult(int requestCode, int resultCode, Intent data) { UUID callId = NativeProtocol.getCallIdFromIntent(data); if (callId == null) { return null; } return AppCall.finishPendingCall(callId, requestCode); }
private void prioritizeWork(WorkQueue manager, WorkQueue.WorkItem workItem) { manager.validate(); workItem.moveToFront(); manager.validate(); }
/** * Gets the cache directory to use for caching responses, etc. The default will be the value * returned by Context.getCacheDir() when the SDK was initialized, but it can be overridden. * * @return the cache directory */ public static File getCacheDir() { Validate.sdkInitialized(); return cacheDir.getValue(); }
public static boolean canPresentNativeDialogWithFeature( DialogFeature feature) { return getProtocolVersionForNativeDialog(feature).getProtocolVersion() != NativeProtocol.NO_PROTOCOL_AVAILABLE; }
private static boolean runStaticCallback( int requestCode, int resultCode, Intent data) { Callback callback = getStaticCallback(requestCode); if (callback != null) { return callback.onActivityResult(resultCode, data); } return false; }
public static FacebookWebFallbackDialog newInstance( Context context, String url, String expectedRedirectUrl) { WebDialog.initDefaultTheme(context); return new FacebookWebFallbackDialog(context, url, expectedRedirectUrl); }
protected void sendSuccessToListener(Bundle values) { if (onCompleteListener != null && !listenerCalled) { listenerCalled = true; onCompleteListener.onComplete(values, null); dismiss(); } }
synchronized static FileLruCache getCache(Context context) throws IOException{ if (imageCache == null) { imageCache = new FileLruCache(TAG, new FileLruCache.Limits()); } return imageCache; }
public static Attachment createAttachment(UUID callId, Uri attachmentUri) { Validate.notNull(callId, "callId"); Validate.notNull(attachmentUri, "attachmentUri"); return new Attachment(callId, null, attachmentUri); }