package com.king.app.workhelper;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;

import org.jetbrains.annotations.NotNull;

import java.io.InputStream;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.OkHttpClient;

/**
 * @author VanceKing
 * @since 19-8-27.
 */
@GlideModule
public class CustomGlideModule extends AppGlideModule {
    @Override
    public void registerComponents(@NotNull Context context, Glide glide, @NotNull Registry registry) {
        OkHttpClient client = new OkHttpClient.Builder()
                .connectTimeout(15, TimeUnit.SECONDS)
                .readTimeout(15, TimeUnit.SECONDS)
                .connectTimeout(15, TimeUnit.SECONDS)
                .build();

        OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory((Call.Factory) client);
        glide.getRegistry().replace(GlideUrl.class, InputStream.class, factory);
    }

    @Override
    public boolean isManifestParsingEnabled() {
        return false;
    }
}

@@ -71,32 +71,109 @@
 ort 
-com.bumptech.glide.Glide
+androidx.annotation.NonNull;%0A%0Aimport com.bumptech.glide.Glide;%0Aimport com.bumptech.glide.GlideBuilder
 ;%0Aim
@@ -315,24 +315,69 @@
 pUrlLoader;%0A
+import com.bumptech.glide.load.DecodeFormat;%0A
 import com.b
@@ -464,49 +464,56 @@
 le;%0A
-%0A
 import 
-org.jetbrains.annotations.NotNull
+com.bumptech.glide.request.RequestOptions
 ;%0A%0Ai
@@ -798,17 +798,17 @@
 ents(@No
-t
+n
 Null Con
@@ -837,17 +837,17 @@
 ide, @No
-t
+n
 Null Reg
@@ -1201,16 +1201,16 @@
 lient);%0A
-
         
@@ -1289,16 +1289,356 @@
 %0A    %7D%0A%0A
+    @Override%0A    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) %7B%0A        super.applyOptions(context, builder);%0A%0A        //%E5%9C%A8Glide%E5%86%85%E9%83%A8%EF%BC%8C%E4%BC%9A%E8%AF%BB%E5%8F%96%E5%8E%9F%E5%A7%8B%E5%9B%BE%E7%89%87%E7%9A%84EXIF%E5%A4%B4%E4%BF%A1%E6%81%AF%EF%BC%8C%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E5%9B%BE%E7%89%87%E7%9A%84%E6%A0%BC%E5%BC%8F%E3%80%82%E8%8B%A5%E5%BD%93%E5%89%8D%E6%A0%BC%E5%BC%8F%E7%9A%84%E5%9B%BE%E7%89%87%E6%94%AF%E6%8C%81alpha%E9%80%9A%E9%81%93%EF%BC%8C%E5%88%99%E8%BF%98%E6%98%AF%E4%BC%9A%E8%AE%BE%E7%BD%AE%E4%B8%BAARGB_8888%E7%9A%84%E6%A0%BC%E5%BC%8F%E3%80%82%0A        builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565));%0A    %7D%0A%0A
     @Ove

设置 Glide 使用 RGB_565 模式加载图片