{"action":"opened","issue":{"url":"https://api.github.com/repos/bumptech/glide/issues/3342","repository_url":"https://api.github.com/repos/bumptech/glide","labels_url":"https://api.github.com/repos/bumptech/glide/issues/3342/labels{/name}","comments_url":"https://api.github.com/repos/bumptech/glide/issues/3342/comments","events_url":"https://api.github.com/repos/bumptech/glide/issues/3342/events","html_url":"https://github.com/bumptech/glide/issues/3342","id":366684242,"node_id":"MDU6SXNzdWUzNjY2ODQyNDI=","number":3342,"title":"Glide does not load same image with different dimension from the disk as expected. Glide V3.7.0 ","user":{"login":"mazzouzi","id":21988512,"node_id":"MDQ6VXNlcjIxOTg4NTEy","avatar_url":"https://avatars2.githubusercontent.com/u/21988512?v=4","gravatar_id":"","url":"https://api.github.com/users/mazzouzi","html_url":"https://github.com/mazzouzi","followers_url":"https://api.github.com/users/mazzouzi/followers","following_url":"https://api.github.com/users/mazzouzi/following{/other_user}","gists_url":"https://api.github.com/users/mazzouzi/gists{/gist_id}","starred_url":"https://api.github.com/users/mazzouzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mazzouzi/subscriptions","organizations_url":"https://api.github.com/users/mazzouzi/orgs","repos_url":"https://api.github.com/users/mazzouzi/repos","events_url":"https://api.github.com/users/mazzouzi/events{/privacy}","received_events_url":"https://api.github.com/users/mazzouzi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-04T08:50:19Z","updated_at":"2018-10-04T08:50:19Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nHi.\r\n\r\nI'm using Glide V3.7.0 in my android app and it seems like Glide still loads the image the second time from network and not from the cache as expected.\r\n\r\nI have Activity A and inside it a full-screen fragment A'. \r\nIn A', I have a viewPager that displays multiple images. Each image view's dimension is 185x185.\r\nSo when I enter A', Glide loads all images of the view pager. I use diskCacheStrategy.RESULT to be sure that the original image before transformation is stored in the disk: \r\n\r\n`         Glide.with(context)\r\n                 .load(\"https://www...image.jpg\")\r\n                 .diskCacheStrategy(DiskCacheStrategy.RESULT)\r\n                 .listener(new CustomRequestListener(imageView){\r\n                     @Override\r\n                     public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {\r\n                         super.onResourceReady(resource, model, target, isFromMemoryCache, isFirstResource);\r\n                         return false;\r\n                     }\r\n                 })\r\n                 .into(new GlideDrawableImageViewTarget(imageView) {\r\n                 ...\r\n                 }\r\n`\r\n\r\nThen if I click say on the first image, I start Activity B which displays another viewPager with exact same image Urls than A'. The only difference is that the imageView's dimension is this time much bigger : \r\n\r\n`        Glide.with(container.context)\r\n            .load(\"https://www...image.jpg\")\r\n            .listener(object : RequestListener<String, GlideDrawable> {\r\n                override fun onException(\r\n                    e: Exception?,\r\n                    model: String?,\r\n                    target: Target<GlideDrawable>?,\r\n                    isFirstResource: Boolean\r\n                ): Boolean {\r\n                    return false\r\n                }\r\n\r\n                override fun onResourceReady(\r\n                    resource: GlideDrawable?,\r\n                    model: String?,\r\n                    target: Target<GlideDrawable>?,\r\n                    isFromMemoryCache: Boolean,\r\n                    isFirstResource: Boolean\r\n                ): Boolean {\r\n                    itemView\r\n                        .productImage\r\n                        .viewTreeObserver\r\n                        .addOnPreDrawListener(\r\n                            object : ViewTreeObserver.OnPreDrawListener {\r\n                                override fun onPreDraw(): Boolean {\r\n                                    itemView.productImage\r\n                                        .viewTreeObserver\r\n                                        .removeOnPreDrawListener(this)\r\n                                    ...\r\n                                    return true\r\n                                }\r\n                            }\r\n                        )\r\n                    return false\r\n                }\r\n            })\r\n            .into(itemView.productImage)\r\n`\r\n\r\n-> I would expect Glide to load these same Urls from disk the second time but it does not.\r\n-> in B, onResourceReady listener, \"isFromMemoryCache\" = false\r\n-> The sequence A' > B > A' > B works though. **when I enter B the second time, the activity does load the images from disk this time.**\r\n\r\n-> Is it because we are loading from a different activity ? Does the context matters ?\r\n-> Can you please confirm or not that Glide is supposed to load same images from the disk the first time I enter B and that even in flight mode Glide should be able to access the disk and load the image ? \r\n\r\n<!-- What version of Glide you're running, for example: 3.7.1 | 3.8.0-SNAPSHOT | 4.0.0-SNAPSHOT\r\nIt's essentially the version number from your build.gradle: `dependencies { compile '...:x.y.z' }` -->\r\n**Glide Version**:   compile 'com.github.bumptech.glide:glide:3.7.0'\r\n\r\n<!-- Do you use any integration library, like OkHttp3 or Volley? For example:\r\nFails to display with stock networking, but works with okhttp3-1.4.0 -->\r\n**Integration libraries**:\r\n    compile 'com.squareup.okhttp3:okhttp:3.6.0'\r\n    compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'\r\n\r\n<!-- What devices you managed to get the issue to come up on? For example:\r\nfails on Galaxy S4/GT-I9500 4.4.2, works fine on Nexus 6P 5.1 and Genymotion Nexus 5 5.0.1 -->\r\n**Device/Android Version**: Nexus 6\r\n\r\n<!-- How does your app look like?\r\nWe're most interested in the layout attributes and the hierarchy around the ImageView -->\r\n**Layout XML**:\r\n```xml\r\nFragment A' :\r\n\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    android:id=\"@+id/custom_view_image_layout\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\">\r\n\r\n    <ImageView\r\n        android:id=\"@+id/custom_view_image_layout_shared_element_transition_image\"\r\n        android:contentDescription=\"@string/desc_image\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_centerInParent=\"true\"\r\n        android:scaleType=\"centerInside\" />\r\n</RelativeLayout>\r\n\r\nActivity B (viewPager) :\r\n\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    android:id=\"@+id/custom_view_image_layout\"    \r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\">\r\n\r\n    <it.sephiroth.android.library.imagezoom.ImageViewTouch\r\n        android:id=\"@+id/custom_view_image_layout_image\"\r\n        android:contentDescription=\"@string/desc_image\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"match_parent\"\r\n        android:scaleType=\"fitCenter\"/>\r\n\r\n</RelativeLayout>\r\n\r\n```\r\n\r\nThanks in advance for your help !"}}
{"actor":{"display_login":"mazzouzi"}}