|
|
@ -5,6 +5,7 @@ import com.bumptech.glide.load.Options |
|
|
|
import com.bumptech.glide.load.model.GlideUrl |
|
|
|
import com.bumptech.glide.load.model.GlideUrl |
|
|
|
import com.bumptech.glide.load.model.ModelLoader |
|
|
|
import com.bumptech.glide.load.model.ModelLoader |
|
|
|
import io.legado.app.model.analyzeRule.AnalyzeUrl |
|
|
|
import io.legado.app.model.analyzeRule.AnalyzeUrl |
|
|
|
|
|
|
|
import io.legado.app.utils.isAbsUrl |
|
|
|
|
|
|
|
|
|
|
|
import java.io.InputStream |
|
|
|
import java.io.InputStream |
|
|
|
|
|
|
|
|
|
|
@ -19,7 +20,11 @@ object OkHttpModelLoader : ModelLoader<GlideUrl?, InputStream?> { |
|
|
|
height: Int, |
|
|
|
height: Int, |
|
|
|
options: Options |
|
|
|
options: Options |
|
|
|
): ModelLoader.LoadData<InputStream?> { |
|
|
|
): ModelLoader.LoadData<InputStream?> { |
|
|
|
val modelWithHeader = AnalyzeUrl(model.toString()).getGlideUrl() |
|
|
|
val cacheKey = model.toString() |
|
|
|
|
|
|
|
var modelWithHeader = model |
|
|
|
|
|
|
|
if (cacheKey.isAbsUrl()) { |
|
|
|
|
|
|
|
modelWithHeader = AnalyzeUrl(cacheKey).getGlideUrl() |
|
|
|
|
|
|
|
} |
|
|
|
return ModelLoader.LoadData(modelWithHeader, OkHttpStreamFetcher(modelWithHeader, options)) |
|
|
|
return ModelLoader.LoadData(modelWithHeader, OkHttpStreamFetcher(modelWithHeader, options)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|