com.bumptech.glide.load.engine.cache.LruResourceCache#com.jess.arms.utils.ArmsUtils源码实例Demo

下面列出了com.bumptech.glide.load.engine.cache.LruResourceCache#com.jess.arms.utils.ArmsUtils 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MVPArms   文件: GlideConfiguration.java
@Override
public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
    final AppComponent appComponent = ArmsUtils.obtainAppComponentFromContext(context);
    builder.setDiskCache(() -> {
        // Careful: the external cache directory doesn't enforce permissions
        return DiskLruCacheWrapper.create(DataHelper.makeDirs(new File(appComponent.cacheFile(), "Glide")), IMAGE_DISK_CACHE_MAX_SIZE);
    });

    MemorySizeCalculator calculator = new MemorySizeCalculator.Builder(context).build();
    int defaultMemoryCacheSize = calculator.getMemoryCacheSize();
    int defaultBitmapPoolSize = calculator.getBitmapPoolSize();

    int customMemoryCacheSize = (int) (1.2 * defaultMemoryCacheSize);
    int customBitmapPoolSize = (int) (1.2 * defaultBitmapPoolSize);

    builder.setMemoryCache(new LruResourceCache(customMemoryCacheSize));
    builder.setBitmapPool(new LruBitmapPool(customBitmapPoolSize));

    //将配置 Glide 的机会转交给 GlideImageLoaderStrategy,如你觉得框架提供的 GlideImageLoaderStrategy
    //并不能满足自己的需求,想自定义 BaseImageLoaderStrategy,那请你最好实现 GlideAppliesOptions
    //因为只有成为 GlideAppliesOptions 的实现类,这里才能调用 applyGlideOptions(),让你具有配置 Glide 的权利
    BaseImageLoaderStrategy loadImgStrategy = appComponent.imageLoader().getLoadImgStrategy();
    if (loadImgStrategy instanceof GlideAppliesOptions) {
        ((GlideAppliesOptions) loadImgStrategy).applyGlideOptions(context, builder);
    }
}
 
@Override
public void handleResponseError(Context context, Throwable t) {
    Timber.tag("Catch-Error").w(t.getMessage());
    //这里不光只能打印错误, 还可以根据不同的错误做出不同的逻辑处理
    //这里只是对几个常用错误进行简单的处理, 展示这个类的用法, 在实际开发中请您自行对更多错误进行更严谨的处理
    String msg = "未知错误";
    if (t instanceof UnknownHostException) {
        msg = "网络不可用";
    } else if (t instanceof SocketTimeoutException) {
        msg = "请求网络超时";
    } else if (t instanceof HttpException) {
        HttpException httpException = (HttpException) t;
        msg = convertStatusCode(httpException);
    } else if (t instanceof JsonParseException || t instanceof ParseException || t instanceof JSONException || t instanceof JsonIOException) {
        msg = "数据解析错误";
    }
    ArmsUtils.snackbarText(msg);
}
 
@Override
public void handleResponseError(Context context, Throwable t) {
    Timber.tag("Catch-Error").w(t.getMessage());
    //这里不光只能打印错误, 还可以根据不同的错误做出不同的逻辑处理
    //这里只是对几个常用错误进行简单的处理, 展示这个类的用法, 在实际开发中请您自行对更多错误进行更严谨的处理
    String msg = "未知错误";
    if (t instanceof UnknownHostException) {
        msg = "网络不可用";
    } else if (t instanceof SocketTimeoutException) {
        msg = "请求网络超时";
    } else if (t instanceof HttpException) {
        HttpException httpException = (HttpException) t;
        msg = convertStatusCode(httpException);
    } else if (t instanceof JsonParseException || t instanceof ParseException || t instanceof JSONException || t instanceof JsonIOException) {
        msg = "数据解析错误";
    }
    ArmsUtils.snackbarText(msg);
}
 
源代码4 项目: Hands-Chopping   文件: GlobalConfiguration.java
@Override
public void injectFragmentLifecycle(Context context, List<FragmentManager.FragmentLifecycleCallbacks> lifecycles) {
    //当所有模块集成到宿主 App 时, 在 App 中已经执行了以下代码, 所以不需要再执行
    if (BuildConfig.IS_BUILD_MODULE) {
        lifecycles.add(new FragmentManager.FragmentLifecycleCallbacks() {
            @Override
            public void onFragmentDestroyed(FragmentManager fm, android.support.v4.app.Fragment f) {
                ((RefWatcher) ArmsUtils
                        .obtainAppComponentFromContext(f.getActivity())
                        .extras()
                        .get(RefWatcher.class.getName()))
                        .watch(f);
            }
        });
    }
}
 
源代码5 项目: Hands-Chopping   文件: GlobalConfiguration.java
@Override
public void injectFragmentLifecycle(Context context, List<FragmentManager.FragmentLifecycleCallbacks> lifecycles) {
    //当所有模块集成到宿主 App 时, 在 App 中已经执行了以下代码, 所以不需要再执行
    if (BuildConfig.IS_BUILD_MODULE) {
        lifecycles.add(new FragmentManager.FragmentLifecycleCallbacks() {
            @Override
            public void onFragmentDestroyed(FragmentManager fm, android.support.v4.app.Fragment f) {
                ((RefWatcher) ArmsUtils
                        .obtainAppComponentFromContext(f.getActivity())
                        .extras()
                        .get(RefWatcher.class.getName()))
                        .watch(f);
            }
        });
    }
}
 
源代码6 项目: Hands-Chopping   文件: GlobalConfiguration.java
@Override
public void injectFragmentLifecycle(Context context, List<FragmentManager.FragmentLifecycleCallbacks> lifecycles) {
    //当所有模块集成到宿主 App 时, 在 App 中已经执行了以下代码, 所以不需要再执行
    if (BuildConfig.IS_BUILD_MODULE) {
        lifecycles.add(new FragmentManager.FragmentLifecycleCallbacks() {
            @Override
            public void onFragmentDestroyed(FragmentManager fm, android.support.v4.app.Fragment f) {
                ((RefWatcher) ArmsUtils
                        .obtainAppComponentFromContext(f.getActivity())
                        .extras()
                        .get(RefWatcher.class.getName()))
                        .watch(f);
            }
        });
    }
}
 
源代码7 项目: Aurora   文件: FollowButton.java
private void refreshView() {
    Cache cache = ArmsUtils.obtainAppComponentFromContext(FollowButton.this.getContext()).extras();
    List<MyAttentionEntity> entities = CommonUtils.getFollowedInfo(mContext);
    if (entities != null && BmobUser.getCurrentUser() != null) {
        boolean isFollowed = false;
        for (MyAttentionEntity entity : entities) {
            if (entity.getId() == this.attention.getId()) {
                isFollowed = true;
            }
        }
        if (isFollowed) {
            setState(FOLLOWED);
        } else {
            setState(UNFOLLOWED);
        }
    }
}
 
源代码8 项目: LQRBiliBlili   文件: SummaryFragment.java
private void initOtherInfo(Summary.DataBean data) {
    List<Summary.DataBean.RelatesBean> relates = data.getRelates();
    if (relates != null) {
        mRvRelates.setLayoutManager(new LinearLayoutManager(_mActivity));
        mRvRelates.setAdapter(new BaseQuickAdapter<Summary.DataBean.RelatesBean, BaseViewHolder>(R.layout.item_relate_video_detail, relates) {
            @Override
            protected void convert(BaseViewHolder helper, Summary.DataBean.RelatesBean item) {
                ArmsUtils.obtainAppComponentFromContext(_mActivity).imageLoader().loadImage(_mActivity, ImageConfigImpl.builder().url(item.getPic()).imageView(helper.getView(R.id.iv_pic)).build());
                helper.setText(R.id.tv_title, item.getTitle())
                        .setText(R.id.tv_owner_name, item.getOwner() == null ? "" : item.getOwner().getName())
                        .setText(R.id.tv_view, item.getStat() == null ? "0" : TextHandleUtil.handleCount2TenThousand(item.getStat().getView()))
                        .setText(R.id.tv_danmaku, item.getStat() == null ? "0" : TextHandleUtil.handleCount2TenThousand(item.getStat().getDanmaku()));
            }
        });
    }
}
 
源代码9 项目: LQRBiliBlili   文件: VideoDetailActivity.java
private void showVideoStartTip() {
    mRlVideoTip.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Animator circularReveal = ViewAnimationUtils.createCircularReveal(mRlVideoTip,
                mIvCover.getWidth() - ArmsUtils.dip2px(VideoDetailActivity.this, mAnchorX),
                mIvCover.getHeight() - ArmsUtils.dip2px(VideoDetailActivity.this, mAnchorY),
                0,
                ((float) Math.hypot(mIvCover.getWidth(), mIvCover.getHeight())));
        circularReveal.setDuration(800);
        circularReveal.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                mIvCover.setVisibility(View.GONE);
                mPresenter.loadPlayUrl(aid);
            }
        });
        circularReveal.start();
    } else {
        mPresenter.loadPlayUrl(aid);
    }
    // 锁定AppBarLayout
    AppBarLayout.LayoutParams layoutParams = (AppBarLayout.LayoutParams) mAppbar.getChildAt(0).getLayoutParams();
    layoutParams.setScrollFlags(0);
    mAppbar.getChildAt(0).setLayoutParams(layoutParams);
}
 
源代码10 项目: LQRBiliBlili   文件: MainActivity.java
@Override
public void onBackPressedSupport() {
    if (mDrawer.isDrawerOpen(GravityCompat.START)) {
        closeDrawer();
    } else {
        ISupportFragment topFragment = getTopFragment();
        if (!(topFragment instanceof NavHomeFragment)) {
            mNav.setCheckedItem(R.id.nav_home);
        }
        if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
            pop();
        } else {
            // 放置后台
            // moveTaskToBack(false);

            // 2秒内两次点击返回键退出应用
            long nowTime = System.currentTimeMillis();
            if (nowTime - mPreTime > 2000) {
                ArmsUtils.makeText(this, ArmsUtils.getString(this, R.string.double_click_to_exit));
                mPreTime = nowTime;
            } else {
                ArmsUtils.exitApp();
            }
        }
    }
}
 
源代码11 项目: MVPArms   文件: ResponseErrorListenerImpl.java
@Override
public void handleResponseError(Context context, Throwable t) {
    Timber.tag("Catch-Error").w(t);
    //这里不光只能打印错误, 还可以根据不同的错误做出不同的逻辑处理
    //这里只是对几个常用错误进行简单的处理, 展示这个类的用法, 在实际开发中请您自行对更多错误进行更严谨的处理
    String msg = "未知错误";
    if (t instanceof UnknownHostException) {
        msg = "网络不可用";
    } else if (t instanceof SocketTimeoutException) {
        msg = "请求网络超时";
    } else if (t instanceof HttpException) {
        HttpException httpException = (HttpException) t;
        msg = convertStatusCode(httpException);
    } else if (t instanceof JsonParseException || t instanceof ParseException || t instanceof JSONException || t instanceof JsonIOException) {
        msg = "数据解析错误";
    }
    ArmsUtils.snackbarText(msg);
}
 
源代码12 项目: lifecycle-component   文件: MainActivity.java
@Override
public void onBackPressed() {
    //获取第一次按键时间
    long mNowTime = System.currentTimeMillis();
    //比较两次按键时间差
    if ((mNowTime - mPressedTime) > 2000) {
        ArmsUtils.makeText(getApplicationContext(),
                "再按一次退出" + ArmsUtils.getString(getApplicationContext(), R.string.public_app_name));
        mPressedTime = mNowTime;
    } else {
        super.onBackPressed();
    }
}
 
源代码13 项目: lifecycle-component   文件: AppLifecyclesImpl.java
@Override
public void onCreate(@NonNull Application application) {
    if (LeakCanary.isInAnalyzerProcess(application)) {
        // This process is dedicated to LeakCanary for heap analysis.
        // You should not init your app in this process.
        return;
    }
    //leakCanary内存泄露检查
    ArmsUtils.obtainAppComponentFromContext(application).extras().put(RefWatcher.class.getName(), BuildConfig.USE_CANARY ? LeakCanary.install(application) : RefWatcher.DISABLED);
}
 
源代码14 项目: lifecycle-component   文件: GlobalConfiguration.java
@Override
public void injectFragmentLifecycle(Context context, List<FragmentManager.FragmentLifecycleCallbacks> lifecycles) {
    lifecycles.add(new FragmentManager.FragmentLifecycleCallbacks() {
        @Override
        public void onFragmentDestroyed(FragmentManager fm, Fragment f) {
            ((RefWatcher) ArmsUtils
                    .obtainAppComponentFromContext(f.getActivity())
                    .extras()
                    .get(RefWatcher.class.getName()))
                    .watch(f);
        }
    });
}
 
@Override
public void onActivityStarted(Activity activity) {
    Timber.i(activity + " - onActivityStarted");
    if (!activity.getIntent().getBooleanExtra("isInitToolbar", false)) {
        //由于加强框架的兼容性,故将 setContentView 放到 onActivityCreated 之后,onActivityStarted 之前执行
        //而 findViewById 必须在 Activity setContentView() 后才有效,所以将以下代码从之前的 onActivityCreated 中移动到 onActivityStarted 中执行
        activity.getIntent().putExtra("isInitToolbar", true);
        //这里全局给Activity设置toolbar和title,你想象力有多丰富,这里就有多强大,以前放到BaseActivity的操作都可以放到这里
        if (ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar") != null) {
            if (activity instanceof AppCompatActivity) {
                ((AppCompatActivity) activity).setSupportActionBar(ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar"));
                ((AppCompatActivity) activity).getSupportActionBar().setDisplayShowTitleEnabled(false);
            } else {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    activity.setActionBar(ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar"));
                    activity.getActionBar().setDisplayShowTitleEnabled(false);
                }
            }
        }
        if (ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar_title") != null) {
            ((TextView) ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar_title")).setText(activity.getTitle());
        }
        if (ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar_back") != null) {
            ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar_back").setOnClickListener(v -> {
                activity.onBackPressed();
            });
        }
    }
}
 
源代码16 项目: TikTok   文件: GlobalConfiguration.java
@Override
public void injectFragmentLifecycle(Context context, List<FragmentManager.FragmentLifecycleCallbacks> lifecycles) {
    lifecycles.add(new FragmentManager.FragmentLifecycleCallbacks() {
        @Override
        public void onFragmentDestroyed(FragmentManager fm, Fragment f) {
            ((RefWatcher) ArmsUtils
                    .obtainAppComponentFromContext(f.getActivity())
                    .extras()
                    .get(RefWatcher.class.getName()))
                    .watch(f);
        }
    });
}
 
@Override
public void onActivityStarted(Activity activity) {
    Timber.w(activity + " - onActivityStarted");
    if (!activity.getIntent().getBooleanExtra("isInitToolbar", false)) {
        //由于加强框架的兼容性,故将 setContentView 放到 onActivityCreated 之后,onActivityStarted 之前执行
        //而 findViewById 必须在 Activity setContentView() 后才有效,所以将以下代码从之前的 onActivityCreated 中移动到 onActivityStarted 中执行
        activity.getIntent().putExtra("isInitToolbar", true);
        //这里全局给Activity设置toolbar和title,你想象力有多丰富,这里就有多强大,以前放到BaseActivity的操作都可以放到这里
        if (ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar") != null) {
            if (activity instanceof AppCompatActivity) {
                ((AppCompatActivity) activity).setSupportActionBar(ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar"));
                ((AppCompatActivity) activity).getSupportActionBar().setDisplayShowTitleEnabled(false);
            } else {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    activity.setActionBar(ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar"));
                    activity.getActionBar().setDisplayShowTitleEnabled(false);
                }
            }
        }
        if (ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar_title") != null) {
            ((TextView) ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar_title")).setText(activity.getTitle());
        }
        if (ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar_back") != null) {
            ArmsUtils.findViewByName(activity.getApplicationContext(), activity, "public_toolbar_back").setOnClickListener(v -> {
                activity.onBackPressed();
            });
        }
    }
}
 
源代码18 项目: MVPArms   文件: BaseFragment.java
@NonNull
@Override
public synchronized Cache<String, Object> provideCache() {
    if (mCache == null) {
        //noinspection unchecked
        mCache = ArmsUtils.obtainAppComponentFromContext(getActivity()).cacheFactory().build(CacheType.FRAGMENT_CACHE);
    }
    return mCache;
}
 
源代码19 项目: Hands-Chopping   文件: AppLifecyclesImpl.java
@Override
public void onCreate(Application application) {
    if (LeakCanary.isInAnalyzerProcess(application)) {
        // This process is dedicated to LeakCanary for heap analysis.
        // You should not init your app in this process.
        return;
    }
    //使用 RetrofitUrlManager 切换 BaseUrl
    //RetrofitUrlManager.getInstance().putDomain(STEAM_DOMAIN_NAME, STEAM_DOMAIN);
    //当所有模块集成到宿主 App 时, 在 App 中已经执行了以下代码
    if (BuildConfig.IS_BUILD_MODULE) {
        //leakCanary内存泄露检查
        ArmsUtils.obtainAppComponentFromContext(application).extras().put(RefWatcher.class.getName(), BuildConfig.USE_CANARY ? LeakCanary.install(application) : RefWatcher.DISABLED);
    }
}
 
源代码20 项目: Hands-Chopping   文件: MainActivity.java
@Override
public void onBackPressed() {
    //获取第一次按键时间
    long mNowTime = System.currentTimeMillis();
    //比较两次按键时间差
    if ((mNowTime - mPressedTime) > 2000) {
        ArmsUtils.makeText(getApplicationContext(),
                "再按一次退出" + ArmsUtils.getString(getApplicationContext(), R.string.public_app_name));
        mPressedTime = mNowTime;
    } else {
        super.onBackPressed();
    }
}
 
源代码21 项目: Hands-Chopping   文件: AppLifecyclesImpl.java
@Override
public void onCreate(@NonNull Application application) {
    if (LeakCanary.isInAnalyzerProcess(application)) {
        // This process is dedicated to LeakCanary for heap analysis.
        // You should not init your app in this process.
        return;
    }
    //leakCanary内存泄露检查
    ArmsUtils.obtainAppComponentFromContext(application).extras().put(RefWatcher.class.getName(), BuildConfig.USE_CANARY ? LeakCanary.install(application) : RefWatcher.DISABLED);
}
 
源代码22 项目: Hands-Chopping   文件: GlobalConfiguration.java
@Override
public void injectFragmentLifecycle(Context context, List<FragmentManager.FragmentLifecycleCallbacks> lifecycles) {
    lifecycles.add(new FragmentManager.FragmentLifecycleCallbacks() {
        @Override
        public void onFragmentDestroyed(FragmentManager fm, Fragment f) {
            ((RefWatcher) ArmsUtils
                    .obtainAppComponentFromContext(f.getActivity())
                    .extras()
                    .get(RefWatcher.class.getName()))
                    .watch(f);
        }
    });
}
 
源代码23 项目: Hands-Chopping   文件: SaleHolder.java
public SaleHolder(View itemView) {
    super(itemView);
    mAppComponent= ArmsUtils.obtainAppComponentFromContext(itemView.getContext());
    mImageLoader=mAppComponent.imageLoader();
    imageView=(ImageView)itemView.findViewById(R.id.img);
    titleTv=(TextView)itemView.findViewById(R.id.name);
    nowpriceTv=(TextView)itemView.findViewById(R.id.nowprice);
    oldpriceTv=(TextView)itemView.findViewById(R.id.oldprice);
    offTv=(TextView)itemView.findViewById(R.id.off);

}
 
源代码24 项目: Hands-Chopping   文件: AppLifecyclesImpl.java
@Override
public void onCreate(Application application) {
    if (LeakCanary.isInAnalyzerProcess(application)) {
        // This process is dedicated to LeakCanary for heap analysis.
        // You should not init your app in this process.
        return;
    }
    //使用 RetrofitUrlManager 切换 BaseUrl
    //RetrofitUrlManager.getInstance().putDomain(STEAM_DOMAIN_NAME, STEAM_DOMAIN);
    //当所有模块集成到宿主 App 时, 在 App 中已经执行了以下代码
    if (BuildConfig.IS_BUILD_MODULE) {
        //leakCanary内存泄露检查
        ArmsUtils.obtainAppComponentFromContext(application).extras().put(RefWatcher.class.getName(), BuildConfig.USE_CANARY ? LeakCanary.install(application) : RefWatcher.DISABLED);
    }
}
 
源代码25 项目: Hands-Chopping   文件: SearchHolder.java
public SearchHolder(View itemView) {
    super(itemView);
    mAppComponent= ArmsUtils.obtainAppComponentFromContext(itemView.getContext());
    mImageLoader=mAppComponent.imageLoader();
    imageView=(ImageView)itemView.findViewById(R.id.img);
    titleTv=(TextView)itemView.findViewById(R.id.name);
    nowpriceTv=(TextView)itemView.findViewById(R.id.nowprice);
}
 
源代码26 项目: Hands-Chopping   文件: AppLifecyclesImpl.java
@Override
public void onCreate(Application application) {
    if (LeakCanary.isInAnalyzerProcess(application)) {
        // This process is dedicated to LeakCanary for heap analysis.
        // You should not init your app in this process.
        return;
    }
    //使用 RetrofitUrlManager 切换 BaseUrl
    //RetrofitUrlManager.getInstance().putDomain(STEAM_DOMAIN_NAME, STEAM_DOMAIN);
    //当所有模块集成到宿主 App 时, 在 App 中已经执行了以下代码
    if (BuildConfig.IS_BUILD_MODULE) {
        //leakCanary内存泄露检查
        ArmsUtils.obtainAppComponentFromContext(application).extras().put(RefWatcher.class.getName(), BuildConfig.USE_CANARY ? LeakCanary.install(application) : RefWatcher.DISABLED);
    }
}
 
源代码27 项目: Aurora   文件: BaseLazyLoadFragment.java
@NonNull
@Override
public synchronized Cache<String, Object> provideCache() {
    if (mCache == null) {
        mCache = ArmsUtils.obtainAppComponentFromContext(getActivity()).cacheFactory().build(CacheType.FRAGMENT_CACHE);
    }
    return mCache;
}
 
源代码28 项目: Aurora   文件: BaseActivity.java
@NonNull
@Override
public synchronized Cache<String, Object> provideCache() {
    if (mCache == null) {
        mCache = ArmsUtils.obtainAppComponentFromContext(this).cacheFactory().build(CacheType.ACTIVITY_CACHE);
    }
    return mCache;
}
 
源代码29 项目: Aurora   文件: BaseFragment.java
@NonNull
@Override
public synchronized Cache<String, Object> provideCache() {
    if (mCache == null) {
        mCache = ArmsUtils.obtainAppComponentFromContext(getActivity()).cacheFactory().build(CacheType.FRAGMENT_CACHE);
    }
    return mCache;
}
 
源代码30 项目: Aurora   文件: GlideConfiguration.java
@Override
public void applyOptions(Context context, GlideBuilder builder) {
    AppComponent appComponent = ArmsUtils.obtainAppComponentFromContext(context);
    builder.setDiskCache(new DiskCache.Factory() {
        @Override
        public DiskCache build() {
            // Careful: the external cache directory doesn't enforce permissions
            return DiskLruCacheWrapper.get(DataHelper.makeDirs(new File(appComponent.cacheFile(), "Glide")), IMAGE_DISK_CACHE_MAX_SIZE);
        }
    });

    MemorySizeCalculator calculator = new MemorySizeCalculator.Builder(context).build();
    int defaultMemoryCacheSize = calculator.getMemoryCacheSize();
    int defaultBitmapPoolSize = calculator.getBitmapPoolSize();

    int customMemoryCacheSize = (int) (1.2 * defaultMemoryCacheSize);
    int customBitmapPoolSize = (int) (1.2 * defaultBitmapPoolSize);

    builder.setMemoryCache(new LruResourceCache(customMemoryCacheSize));
    builder.setBitmapPool(new LruBitmapPool(customBitmapPoolSize));

    //将配置 Glide 的机会转交给 GlideImageLoaderStrategy,如你觉得框架提供的 GlideImageLoaderStrategy
    //并不能满足自己的需求,想自定义 BaseImageLoaderStrategy,那请你最好实现 GlideAppliesOptions
    //因为只有成为 GlideAppliesOptions 的实现类,这里才能调用 applyGlideOptions(),让你具有配置 Glide 的权利
    BaseImageLoaderStrategy loadImgStrategy = appComponent.imageLoader().getLoadImgStrategy();
    if (loadImgStrategy instanceof GlideAppliesOptions) {
        ((GlideAppliesOptions) loadImgStrategy).applyGlideOptions(context, builder);
    }
}