<p dir="auto"><strong>Glide Version</strong>: 4.12.0</p>

<p dir="auto"><strong>Device/Android Version</strong>: Explicitly tested on Pixel 5 running Android 12, but this is applicable to all devices and Android versions.</p>

<p dir="auto"><strong>Issue details / Repro steps / Use case background</strong>:</p>
<p dir="auto">When using a placeholder resource ID like so, Glide uses an unexpected Context to load the drawable:</p>
<div class="highlight highlight-source-kotlin notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="val options = RequestOptions().placeholder(R.color.some_color_resource)
Glide.with(imageView.context)
   .load(&quot;http://the.url&quot;)
   .apply(options)
   .into(imageView)"><pre class="notranslate"><span class="pl-k">val</span> options <span class="pl-k">=</span> <span class="pl-en">RequestOptions</span>().placeholder(<span class="pl-en">R</span>.color.some_color_resource)
<span class="pl-en">Glide</span>.<span class="pl-c1">with</span>(imageView.context)
   .load(<span class="pl-s"><span class="pl-pds">"</span>http://the.url<span class="pl-pds">"</span></span>)
   .<span class="pl-c1">apply</span>(options)
   .into(imageView)</pre></div>
<p dir="auto">I would expect this to use the imageView's context to load the Placeholder (which in most cases would be an <code class="notranslate">Activity</code>), but in fact it uses the application context to load the image.</p>
<p dir="auto">This is because <code class="notranslate">SingleRequest</code> <a href="https://github.com/bumptech/glide/blob/master/library/src/main/java/com/bumptech/glide/request/SingleRequest.java#L410">uses <code class="notranslate">glideContext</code> to load the drawable</a>.</p>
<p dir="auto">The reason we discovered this is this behavior <strong>does not work well with dark mode</strong>. Specifically, if the device is currently in dark mode but an application has set itself to <code class="notranslate">MODE_NIGHT_NO</code> via <code class="notranslate">AppCompatDelegate.setDefaultNightMode()</code> then the placeholder will be incorrectly loaded from <code class="notranslate">values-night</code>.</p>

<p dir="auto"><strong>Glide load line / <code class="notranslate">GlideModule</code> (if any) / list Adapter code (if any)</strong>:</p>
<div class="highlight highlight-source-kotlin notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="val options = RequestOptions().placeholder(R.color.some_color_resource)
Glide.with(imageView.context)
   .load(&quot;http://the.url&quot;)
   .apply(options)
   .into(imageView)"><pre class="notranslate"><span class="pl-k">val</span> options <span class="pl-k">=</span> <span class="pl-en">RequestOptions</span>().placeholder(<span class="pl-en">R</span>.color.some_color_resource)
<span class="pl-en">Glide</span>.<span class="pl-c1">with</span>(imageView.context)
   .load(<span class="pl-s"><span class="pl-pds">"</span>http://the.url<span class="pl-pds">"</span></span>)
   .<span class="pl-c1">apply</span>(options)
   .into(imageView)</pre></div>

<p dir="auto"><strong>values/colors.xml</strong>:</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;color name=&quot;some_color_resource&quot;&gt;#ff000000&lt;/color&gt;"><pre class="notranslate">&lt;<span class="pl-ent">color</span> <span class="pl-e">name</span>=<span class="pl-s"><span class="pl-pds">"</span>some_color_resource<span class="pl-pds">"</span></span>&gt;#ff000000&lt;/<span class="pl-ent">color</span>&gt;</pre></div>
<p dir="auto"><strong>values-night/colors.xml</strong>:</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;color name=&quot;some_color_resource&quot;&gt;#ffffffff&lt;/color&gt;"><pre class="notranslate">&lt;<span class="pl-ent">color</span> <span class="pl-e">name</span>=<span class="pl-s"><span class="pl-pds">"</span>some_color_resource<span class="pl-pds">"</span></span>&gt;#ffffffff&lt;/<span class="pl-ent">color</span>&gt;</pre></div>
<p dir="auto"><strong>SampleApplication.kt</strong>:</p>
<div class="highlight highlight-source-kotlin notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class SampleApplication : Application {
  override fun onCreate() {
    AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
  }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-en">SampleApplication</span> : <span class="pl-en">Application</span> {
  <span class="pl-k">override</span> <span class="pl-k">fun</span> <span class="pl-en">onCreate</span>() {
    <span class="pl-en">AppCompatDelegate</span>.setDefaultNightMode(<span class="pl-en">AppCompatDelegate</span>.<span class="pl-en">MODE_NIGHT_NO</span>)
  }
}</pre></div>
<p dir="auto">Hi</p>
<p dir="auto">soon with Android Q the night mode will be very important in my opinion and it would be nice if you can fix this little problem. Glide does not find pictures in the following directories:</p>
<p dir="auto">drawable-night<br>
drawable-night-hdpi    (also mdpi, xhdpi, xxhdpi and xxxhdpi)</p>
<p dir="auto">Greets</p>
<p dir="auto">Frank</p>