@SuppressWarnings("WeakerAccess") public MediaStoreImageThumbLoader(Context context) { this.context = context.getApplicationContext(); }
@SuppressWarnings("WeakerAccess") public MediaStoreVideoThumbLoader(Context context) { this.context = context.getApplicationContext(); }
NetworkCache(Context appContext, String url) { this.appContext = appContext.getApplicationContext(); this.url = url; }
public ResourceDrawableDecoder(Context context) { this.context = context.getApplicationContext(); }
public BaseImageDownloader(Context context, int connectTimeout, int readTimeout) { this.context = context.getApplicationContext(); this.connectTimeout = connectTimeout; this.readTimeout = readTimeout; }
public static void setEnabledAsync(Context context, final Class<?> componentClass, final boolean enabled) { final Context appContext = context.getApplicationContext(); AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() { @Override public void run() { setEnabledBlocking(appContext, componentClass, enabled); } }); }
MySingleton.getInstance(Context c) { // // ... needing to create ... sInstance = new MySingleton(c.getApplicationContext()); }
AndroidRefWatcherBuilder(@NonNull Context context) { this.context = context.getApplicationContext(); }
public DefaultLeakDirectoryProvider(@NonNull Context context, int maxStoredHeapDumps) { if (maxStoredHeapDumps < 1) { throw new IllegalArgumentException("maxStoredHeapDumps must be at least 1"); } this.context = context.getApplicationContext(); this.maxStoredHeapDumps = maxStoredHeapDumps; }
DefaultConnectivityMonitor(@NonNull Context context, @NonNull ConnectivityListener listener) { this.context = context.getApplicationContext(); this.listener = listener; }
static File createDefaultCacheDir(Context context) { File cache = new File(context.getApplicationContext().getCacheDir(), PICASSO_CACHE); if (!cache.exists()) { //noinspection ResultOfMethodCallIgnored cache.mkdirs(); } return cache; }
private NetworkFetcher(Context context, String url) { appContext = context.getApplicationContext(); this.url = url; networkCache = new NetworkCache(appContext, url); }
private Api(Context context) { this.requestQueue = Volley.newRequestQueue(context.getApplicationContext()); QueryListener queryListener = new QueryListener() { @Override public void onSearchCompleted(Query query, List<Photo> photos) { lastQueryResult = new QueryResult(query, photos); } @Override public void onSearchFailed(Query query, Exception e) { lastQueryResult = null; } }; queryListeners.add(queryListener); }
/** Start building a new {@link Picasso} instance. */ public Builder(@NonNull Context context) { checkNotNull(context, "context == null"); this.context = context.getApplicationContext(); }
public static void install(@NonNull Context context, @NonNull RefWatcher refWatcher) { Application application = (Application) context.getApplicationContext(); ActivityRefWatcher activityRefWatcher = new ActivityRefWatcher(application, refWatcher); application.registerActivityLifecycleCallbacks(activityRefWatcher.lifecycleCallbacks); }
public ServiceHeapDumpListener(@NonNull final Context context, @NonNull final Class<? extends AbstractAnalysisResultService> listenerServiceClass) { this.listenerServiceClass = checkNotNull(listenerServiceClass, "listenerServiceClass"); this.context = checkNotNull(context, "context").getApplicationContext(); }
@UiThread @Trace void showToast() { Toast.makeText(getContext().getApplicationContext(), "Hello World!", Toast.LENGTH_LONG).show(); }
@VisibleForTesting ByteBufferGifDecoder( Context context, List<ImageHeaderParser> parsers, BitmapPool bitmapPool, ArrayPool arrayPool, GifHeaderParserPool parserPool, GifDecoderFactory gifDecoderFactory) { this.context = context.getApplicationContext(); this.parsers = parsers; this.gifDecoderFactory = gifDecoderFactory; this.provider = new GifBitmapProvider(bitmapPool, arrayPool); this.parserPool = parserPool; }
/** * Parse an animation from raw/res. This is recommended over putting your animation in assets because * it uses a hard reference to R. * The resource id will be used as a cache key so future usages won't parse the json again. */ public static LottieTask<LottieComposition> fromRawRes(Context context, @RawRes final int rawRes) { // Prevent accidentally leaking an Activity. final Context appContext = context.getApplicationContext(); return cache(rawResCacheKey(rawRes), new Callable<LottieResult<LottieComposition>>() { @Override public LottieResult<LottieComposition> call() { return fromRawResSync(appContext, rawRes); } }); }
@VisibleForTesting public static synchronized void tearDown() { if (glide != null) { glide.getContext() .getApplicationContext() .unregisterComponentCallbacks(glide); glide.engine.shutdown(); } glide = null; }