Java 类com.bumptech.glide.integration.okhttp.OkHttpUrlLoader 实例源码

项目:BigApp_Discuz_Android    文件:GlideUtils.java   
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));
    }
项目:v2ex    文件:BaseActivity.java   
@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());
}
项目:Jahamanga    文件:GlobalApplication.java   
@Override
public void onCreate() {
    // TODO Auto-generated method stub
    super.onCreate();
    mContext = this;
    client = new OkHttpClient();
    Glide.get(this).register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client) );
    PushService.setDefaultPushCallback(this, MainActivity.class);
}
项目:photosearcher    文件:AppLifecycleCallbacks.java   
protected void setupGlide() {
    Glide.get(mApp).register(GlideUrl.class, InputStream.class,
            new OkHttpUrlLoader.Factory(mOkHttpClient));
}
项目:LoopSeries-Mobile    文件:LoopAnimeGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide) {
    if (BuildConfig.DEBUG) {
        OkHttpClient client = new OkHttpClient();
        client.networkInterceptors().add(new StethoInterceptor());
        OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(client);
        glide.register(GlideUrl.class, InputStream.class, factory);
    }
}
项目:placepicker-sdk-sample    文件:SampleGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide) {
    // Use OkHttp to fetch images.
    glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(new OkHttpClient()));
}
项目:Moments    文件:OkHttpGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide) {
    glide.register(GlideUrl.class, InputStream.class,
            new OkHttpUrlLoader.Factory(InstaApplication.from(context).getHttpClient()));
}