add accept:image/webp for image loading
|
@ -462,6 +462,7 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
|
|||
val request = okhttp3.Request.Builder()
|
||||
.url(url)
|
||||
.cacheControl(App1.CACHE_5MIN)
|
||||
.addHeader("Accept","image/webp,image/*,*/*;q=0.8")
|
||||
.build()
|
||||
|
||||
if(! client.sendRequest(result,cached = true) {
|
||||
|
|
|
@ -19,6 +19,8 @@ import android.widget.ImageView
|
|||
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.RequestManager
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
import com.bumptech.glide.load.model.LazyHeaders
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable
|
||||
import com.bumptech.glide.load.resource.gif.MyGifDrawable
|
||||
import com.bumptech.glide.request.target.BaseTarget
|
||||
|
@ -189,10 +191,19 @@ class MyNetworkImageView : AppCompatImageView {
|
|||
return
|
||||
}
|
||||
|
||||
val glideHeaders = LazyHeaders.Builder()
|
||||
.addHeader("Accept", "image/webp,image/*,*/*;q=0.8")
|
||||
.build()
|
||||
|
||||
val glideUrl = GlideUrl(url, glideHeaders)
|
||||
|
||||
mTarget = if(mMayGif) {
|
||||
getGlide()?.load(url)?.into(MyTargetGif(url))
|
||||
getGlide()
|
||||
?.load(glideUrl)
|
||||
?.into(MyTargetGif(url))
|
||||
} else {
|
||||
getGlide()?.asBitmap()?.load(url)?.into(MyTarget(url, desiredWidth, desiredHeight))
|
||||
getGlide()?.asBitmap()?.load(glideUrl)
|
||||
?.into(MyTarget(url, desiredWidth, desiredHeight))
|
||||
}
|
||||
} catch(ex : Throwable) {
|
||||
log.trace(ex)
|
||||
|
|
Before Width: | Height: | Size: 458 B |
After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 420 B |
After Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 372 B |
After Width: | Height: | Size: 322 B |
Before Width: | Height: | Size: 363 B |
After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 719 B |
After Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 601 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 786 B |
Before Width: | Height: | Size: 933 B |
After Width: | Height: | Size: 684 B |
Before Width: | Height: | Size: 448 B |
After Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 763 B |
After Width: | Height: | Size: 552 B |
Before Width: | Height: | Size: 658 B |
After Width: | Height: | Size: 454 B |
Before Width: | Height: | Size: 241 B |
After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 303 B |
After Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 561 B |
After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 499 B |
After Width: | Height: | Size: 378 B |
Before Width: | Height: | Size: 779 B |
After Width: | Height: | Size: 558 B |
Before Width: | Height: | Size: 661 B |
After Width: | Height: | Size: 456 B |
Before Width: | Height: | Size: 506 B |
After Width: | Height: | Size: 394 B |
Before Width: | Height: | Size: 434 B |
After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 500 B |
After Width: | Height: | Size: 356 B |
Before Width: | Height: | Size: 421 B |
After Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 868 B |
Before Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 583 B |
After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 500 B |
After Width: | Height: | Size: 338 B |
Before Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 142 B |
Before Width: | Height: | Size: 971 B |
After Width: | Height: | Size: 744 B |
Before Width: | Height: | Size: 873 B |
After Width: | Height: | Size: 662 B |
Before Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 277 B |
After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 426 B |
After Width: | Height: | Size: 300 B |
Before Width: | Height: | Size: 380 B |
After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 324 B |
After Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 291 B |
After Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 311 B |
After Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 381 B |
After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 326 B |
After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 483 B |
After Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 421 B |
After Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 894 B |
After Width: | Height: | Size: 678 B |
Before Width: | Height: | Size: 798 B |
After Width: | Height: | Size: 590 B |
Before Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 212 B |