com.bumptech.glide.integration.okhttp.OkHttpUrlLoader Java Examples
The following examples show how to use
com.bumptech.glide.integration.okhttp.OkHttpUrlLoader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GlideUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
public static void init(final Context context) { OkHttpClient okHttpClient = new OkHttpClient(); okHttpClient.setReadTimeout(30, TimeUnit.SECONDS); okHttpClient.setConnectTimeout(30, TimeUnit.SECONDS); // okHttpClient.setProtocols(Arrays.asList(Protocol.HTTP_1_1)); GlideBuilder glideBuilder = new GlideBuilder(context) .setDiskCache(new DiskCache.Factory() { @Override public DiskCache build() { // Careful: the external cache directory doesn't enforce permissions File cacheLocation = new File(context.getExternalCacheDir(), AppConfig.CACHE_IMAGE_DIR); cacheLocation.mkdirs(); return DiskLruCacheWrapper.get(cacheLocation, 100 * 1024 * 1024); } }); if (!Glide.isSetup()) { Glide.setup(glideBuilder); } Glide.get(context).register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(okHttpClient)); }
Example #2
Source File: BaseActivity.java From v2ex with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Glide.get(this).register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(new OkHttpClient())); mHandler = new Handler(); imageLoader = new ImageLoader(this); ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayHomeAsUpEnabled(true); } mLUtils = LUtils.getInstance(this); mThemedStatusBarColor = getResources().getColor(R.color.theme_primary_dark); mNormalStatusBarColor = mThemedStatusBarColor; SyncUtils.createSyncAccount(this); getLoaderManager().restartLoader(0, buildLoaderArgs(), new AccountLoader()); }
Example #3
Source File: MirrorApplication.java From mirror with Apache License 2.0 | 4 votes |
private void initializeGlide() { Glide .get(getApplicationContext()) .register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(mOkHttpClient)); }
Example #4
Source File: OkHttpGlideModule.java From Studio with Apache License 2.0 | 4 votes |
@Override public void registerComponents(Context context, Glide glide) { glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(App.from(context).getHttpClient())); }
Example #5
Source File: AppLifecycleCallbacks.java From photosearcher with Apache License 2.0 | 4 votes |
protected void setupGlide() { Glide.get(mApp).register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(mOkHttpClient)); }