<p dir="auto">In integration wiki it is explicitly stated that glide is using volley 1.0.8 and my project is already using volley 1.0.19. Is there a workaround for it?</p>
<p dir="auto"><strong>Glide Version</strong>: 3.7.0</p>
<p dir="auto"><strong>Integration libraries</strong>: no</p>
<p dir="auto"><strong>Device/Android Version</strong>:<br>
Android Virtual Device and Samsung S7 edge 6.0</p>
<p dir="auto"><strong>Issue details / Repro steps / Use case background</strong>:<br>
I have a view where the app shows the user image to preview, then there is a button in the preview screen. User can click the button to save that image in the device. Images are loaded from URLs.</p>
<p dir="auto">I know there are already many topics regarding this being discussed but I still cannot get it. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="74049888" data-permission-text="Title is private" data-url="https://github.com/bumptech/glide/issues/459" data-hovercard-type="issue" data-hovercard-url="/bumptech/glide/issues/459/hovercard" href="https://github.com/bumptech/glide/issues/459">#459</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="91175562" data-permission-text="Title is private" data-url="https://github.com/bumptech/glide/issues/509" data-hovercard-type="issue" data-hovercard-url="/bumptech/glide/issues/509/hovercard" href="https://github.com/bumptech/glide/issues/509">#509</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="122869278" data-permission-text="Title is private" data-url="https://github.com/bumptech/glide/issues/828" data-hovercard-type="issue" data-hovercard-url="/bumptech/glide/issues/828/hovercard" href="https://github.com/bumptech/glide/issues/828">#828</a> ..etc</p>
<p dir="auto">Based on some solutions from those topics, I came up with these code but I am not sure if I am doing it correctly. The main point is to load the original size of the image to preview therefore no longer requires user to download again.</p>
<p dir="auto">This is the code to show the preview image.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Glide.with(MyFragment.this).load(mImgUrl).diskCacheStrategy(DiskCacheStrategy.ALL).into(mPrviewImageView);"><pre class="notranslate"><span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-smi">MyFragment</span>.<span class="pl-smi">this</span>).<span class="pl-en">load</span>(<span class="pl-s1">mImgUrl</span>).<span class="pl-en">diskCacheStrategy</span>(<span class="pl-smi">DiskCacheStrategy</span>.<span class="pl-c1">ALL</span>).<span class="pl-en">into</span>(<span class="pl-s1">mPrviewImageView</span>);</pre></div>
<p dir="auto">This is the code to save the image.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="new AsyncTask&lt;Void, Void, Exception&gt;() {
    @Override
    protected Exception doInBackground(Void... params) {
        try {
            File file = Glide.with(MyFragment.this)
                             .using(new NetworkDisablingLoader&lt;String&gt;())
                             .load(mImgUrl)
                             .downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
                             .get();
            FileUtils.copyFile(file, new File(AppConfig.APP_DIR_IMG_BG + &quot;/&quot; + SystemClock.currentThreadTimeMillis()));
        } catch (InterruptedException | ExecutionException | IOException e) {
            Log.e(TAG, &quot;save image file error. url: &quot; + mImgUrl, e);
            return e;
        }
        return null;
    }

    @Override
    protected void onPostExecute(Exception e) {
        if (e == null)
            Toast.makeText(getActivity(), &quot;Saved&quot;, Toast.LENGTH_SHORT).show();
        else
            Toast.makeText(getActivity(), &quot;Error occurred&quot;, Toast.LENGTH_SHORT).show();
        }
}.execute();"><pre class="notranslate"><span class="pl-k">new</span> <span class="pl-smi">AsyncTask</span>&lt;<span class="pl-smi">Void</span>, <span class="pl-smi">Void</span>, <span class="pl-smi">Exception</span>&gt;() {
    <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">protected</span> <span class="pl-smi">Exception</span> <span class="pl-en">doInBackground</span>(<span class="pl-smi">Void</span>... <span class="pl-s1">params</span>) {
        <span class="pl-k">try</span> {
            <span class="pl-smi">File</span> <span class="pl-s1">file</span> = <span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-smi">MyFragment</span>.<span class="pl-smi">this</span>)
                             .<span class="pl-en">using</span>(<span class="pl-k">new</span> <span class="pl-smi">NetworkDisablingLoader</span>&lt;<span class="pl-smi">String</span>&gt;())
                             .<span class="pl-en">load</span>(<span class="pl-s1">mImgUrl</span>)
                             .<span class="pl-en">downloadOnly</span>(<span class="pl-smi">Target</span>.<span class="pl-c1">SIZE_ORIGINAL</span>, <span class="pl-smi">Target</span>.<span class="pl-c1">SIZE_ORIGINAL</span>)
                             .<span class="pl-en">get</span>();
            <span class="pl-smi">FileUtils</span>.<span class="pl-en">copyFile</span>(<span class="pl-s1">file</span>, <span class="pl-k">new</span> <span class="pl-smi">File</span>(<span class="pl-smi">AppConfig</span>.<span class="pl-c1">APP_DIR_IMG_BG</span> + <span class="pl-s">"/"</span> + <span class="pl-smi">SystemClock</span>.<span class="pl-en">currentThreadTimeMillis</span>()));
        } <span class="pl-k">catch</span> (<span class="pl-smi">InterruptedException</span> | <span class="pl-smi">ExecutionException</span> | <span class="pl-smi">IOException</span> <span class="pl-s1">e</span>) {
            <span class="pl-smi">Log</span>.<span class="pl-en">e</span>(<span class="pl-c1">TAG</span>, <span class="pl-s">"save image file error. url: "</span> + <span class="pl-s1">mImgUrl</span>, <span class="pl-s1">e</span>);
            <span class="pl-k">return</span> <span class="pl-s1">e</span>;
        }
        <span class="pl-k">return</span> <span class="pl-c1">null</span>;
    }

    <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">protected</span> <span class="pl-smi">void</span> <span class="pl-en">onPostExecute</span>(<span class="pl-smi">Exception</span> <span class="pl-s1">e</span>) {
        <span class="pl-k">if</span> (<span class="pl-s1">e</span> == <span class="pl-c1">null</span>)
            <span class="pl-smi">Toast</span>.<span class="pl-en">makeText</span>(<span class="pl-en">getActivity</span>(), <span class="pl-s">"Saved"</span>, <span class="pl-smi">Toast</span>.<span class="pl-c1">LENGTH_SHORT</span>).<span class="pl-en">show</span>();
        <span class="pl-k">else</span>
            <span class="pl-smi">Toast</span>.<span class="pl-en">makeText</span>(<span class="pl-en">getActivity</span>(), <span class="pl-s">"Error occurred"</span>, <span class="pl-smi">Toast</span>.<span class="pl-c1">LENGTH_SHORT</span>).<span class="pl-en">show</span>();
        }
}.<span class="pl-en">execute</span>();</pre></div>
<p dir="auto">My question is: Does Glide actually returns the cache file with downloadOnly method? I was trying to fine some callback methods to validate if the image is from cache but I was not able to.</p>