Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
沉迷打码的小凳子
glide
提交
fe7154fc
G
glide
项目概览
沉迷打码的小凳子
/
glide
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
glide
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fe7154fc
编写于
6月 01, 2014
作者:
S
Sam Judd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove Glide.get() calls from requests
上级
785dc5ee
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
31 addition
and
26 deletion
+31
-26
library/src/com/bumptech/glide/BitmapRequestBuilder.java
library/src/com/bumptech/glide/BitmapRequestBuilder.java
+5
-4
library/src/com/bumptech/glide/GenericRequestBuilder.java
library/src/com/bumptech/glide/GenericRequestBuilder.java
+6
-2
library/src/com/bumptech/glide/Glide.java
library/src/com/bumptech/glide/Glide.java
+20
-20
未找到文件。
library/src/com/bumptech/glide/BitmapRequestBuilder.java
浏览文件 @
fe7154fc
...
...
@@ -12,6 +12,7 @@ import com.bumptech.glide.load.data.bitmap.CenterCrop;
import
com.bumptech.glide.load.data.bitmap.Downsampler
;
import
com.bumptech.glide.load.data.bitmap.FitCenter
;
import
com.bumptech.glide.load.data.bitmap.StreamBitmapDecoder
;
import
com.bumptech.glide.load.engine.Engine
;
import
com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
;
import
com.bumptech.glide.provider.LoadProvider
;
import
com.bumptech.glide.request.bitmap.RequestListener
;
...
...
@@ -35,8 +36,8 @@ public class BitmapRequestBuilder<ModelType> extends GenericRequestBuilder<Model
BitmapRequestBuilder
(
Context
context
,
ModelType
model
,
LoadProvider
<
ModelType
,
InputStream
,
Bitmap
>
streamLoadProvider
,
LoadProvider
<
ModelType
,
ParcelFileDescriptor
,
Bitmap
>
fileDescriptorLoadProvider
,
BitmapPool
bitmapPool
,
ImageViewTargetFactory
factory
)
{
super
(
context
,
model
,
streamLoadProvider
,
fileDescriptorLoadProvider
,
Bitmap
.
class
,
factory
);
BitmapPool
bitmapPool
,
ImageViewTargetFactory
factory
,
Engine
engine
)
{
super
(
context
,
model
,
streamLoadProvider
,
fileDescriptorLoadProvider
,
Bitmap
.
class
,
factory
,
engine
);
this
.
bitmapPool
=
bitmapPool
;
}
...
...
@@ -139,7 +140,7 @@ public class BitmapRequestBuilder<ModelType> extends GenericRequestBuilder<Model
* @return This RequestBuilder
*/
public
BitmapRequestBuilder
<
ModelType
>
centerCrop
()
{
return
transform
(
new
CenterCrop
(
Glide
.
get
(
context
).
getBitmapPool
()
));
return
transform
(
new
CenterCrop
(
bitmapPool
));
}
/**
...
...
@@ -148,7 +149,7 @@ public class BitmapRequestBuilder<ModelType> extends GenericRequestBuilder<Model
* @return This RequestBuilder
*/
public
BitmapRequestBuilder
<
ModelType
>
fitCenter
()
{
return
transform
(
new
FitCenter
(
Glide
.
get
(
context
).
getBitmapPool
()
));
return
transform
(
new
FitCenter
(
bitmapPool
));
}
@Override
...
...
library/src/com/bumptech/glide/GenericRequestBuilder.java
浏览文件 @
fe7154fc
...
...
@@ -12,6 +12,7 @@ import com.bumptech.glide.load.Transformation;
import
com.bumptech.glide.load.data.bitmap.BitmapDecoder
;
import
com.bumptech.glide.load.data.bitmap.Downsampler
;
import
com.bumptech.glide.load.data.bitmap.VideoBitmapDecoder
;
import
com.bumptech.glide.load.engine.Engine
;
import
com.bumptech.glide.load.model.ModelLoader
;
import
com.bumptech.glide.provider.ChildLoadProvider
;
import
com.bumptech.glide.provider.LoadProvider
;
...
...
@@ -48,6 +49,7 @@ public class GenericRequestBuilder<ModelType, ImageDataType, VideoDataType, Reso
private
final
ChildLoadProvider
<
ModelType
,
VideoDataType
,
ResourceType
>
videoLoadProvider
;
private
final
Class
<
ResourceType
>
resourceClass
;
private
final
ImageViewTargetFactory
viewTargetFactory
;
private
final
Engine
engine
;
private
int
animationId
;
private
Animation
animation
;
private
int
placeholderId
;
...
...
@@ -63,9 +65,11 @@ public class GenericRequestBuilder<ModelType, ImageDataType, VideoDataType, Reso
public
GenericRequestBuilder
(
Context
context
,
ModelType
model
,
LoadProvider
<
ModelType
,
ImageDataType
,
ResourceType
>
imageLoadProvider
,
LoadProvider
<
ModelType
,
VideoDataType
,
ResourceType
>
videoLoadProvider
,
Class
<
ResourceType
>
resourceClass
,
ImageViewTargetFactory
viewTargetFactory
)
{
Class
<
ResourceType
>
resourceClass
,
ImageViewTargetFactory
viewTargetFactory
,
Engine
engine
)
{
this
.
resourceClass
=
resourceClass
;
this
.
viewTargetFactory
=
viewTargetFactory
;
this
.
engine
=
engine
;
this
.
imageLoadProvider
=
imageLoadProvider
!=
null
?
new
ChildLoadProvider
<
ModelType
,
ImageDataType
,
ResourceType
>(
imageLoadProvider
)
:
null
;
this
.
videoLoadProvider
=
videoLoadProvider
!=
null
?
...
...
@@ -430,7 +434,7 @@ public class GenericRequestBuilder<ModelType, ImageDataType, VideoDataType, Reso
RequestCoordinator
requestCoordinator
)
{
return
new
GenericRequest
<
ModelType
,
Z
,
ResourceType
>(
loadProvider
,
model
,
context
,
priority
,
target
,
sizeMultiplier
,
placeholderDrawable
,
placeholderId
,
errorPlaceholder
,
errorId
,
requestListener
,
animationId
,
animation
,
requestCoordinator
,
Glide
.
get
(
context
).
getEngine
()
,
getFinalTransformation
(),
animationId
,
animation
,
requestCoordinator
,
engine
,
getFinalTransformation
(),
resourceClass
);
}
...
...
library/src/com/bumptech/glide/Glide.java
浏览文件 @
fe7154fc
...
...
@@ -167,14 +167,6 @@ public class Glide {
register
(
GlideUrl
.
class
,
InputStream
.
class
,
new
VolleyUrlLoader
.
Factory
(
requestQueue
));
}
Engine
getEngine
()
{
return
engine
;
}
BitmapPool
getBitmapPool
()
{
return
bitmapPool
;
}
private
GenericLoaderFactory
getLoaderFactory
()
{
return
loaderFactory
;
}
...
...
@@ -396,8 +388,8 @@ public class Glide {
*/
public
static
ModelRequest
with
(
Context
context
)
{
Glide
glide
=
Glide
.
get
(
context
);
return
new
ModelRequest
(
context
,
glide
.
defaultStreamProvider
,
glide
.
defaultFileDescriptorProvider
,
glide
.
bitmapPool
,
glide
.
factory
);
return
new
ModelRequest
(
context
,
glide
.
defaultStreamProvider
,
glide
.
defaultFileDescriptorProvider
,
glide
.
bitmapPool
,
glide
.
factory
,
glide
.
engine
);
}
/**
...
...
@@ -409,15 +401,17 @@ public class Glide {
private
final
DataLoadProvider
<
ParcelFileDescriptor
,
Bitmap
>
fileDescriptorDataProvider
;
private
BitmapPool
bitmapPool
;
private
ImageViewTargetFactory
factory
;
private
Engine
engine
;
private
ModelRequest
(
Context
context
,
DataLoadProvider
<
InputStream
,
Bitmap
>
streamDataProvider
,
DataLoadProvider
<
ParcelFileDescriptor
,
Bitmap
>
fileDescriptorDataProvider
,
BitmapPool
bitmapPool
,
ImageViewTargetFactory
factory
)
{
BitmapPool
bitmapPool
,
ImageViewTargetFactory
factory
,
Engine
engine
)
{
this
.
context
=
context
;
this
.
streamDataProvider
=
streamDataProvider
;
this
.
fileDescriptorDataProvider
=
fileDescriptorDataProvider
;
this
.
bitmapPool
=
bitmapPool
;
this
.
factory
=
factory
;
this
.
engine
=
engine
;
}
/**
...
...
@@ -429,7 +423,7 @@ public class Glide {
* @return A new {@link ImageModelRequest}.
*/
public
<
T
>
ImageModelRequest
<
T
>
using
(
final
StreamModelLoader
<
T
>
modelLoader
)
{
return
new
ImageModelRequest
<
T
>(
context
,
modelLoader
,
streamDataProvider
,
bitmapPool
,
factory
);
return
new
ImageModelRequest
<
T
>(
context
,
modelLoader
,
streamDataProvider
,
bitmapPool
,
factory
,
engine
);
}
/**
...
...
@@ -439,7 +433,7 @@ public class Glide {
* @return A new {@link ImageModelRequest}.
*/
public
ImageModelRequest
<
byte
[]>
using
(
StreamByteArrayLoader
modelLoader
)
{
return
new
ImageModelRequest
<
byte
[]>(
context
,
modelLoader
,
streamDataProvider
,
bitmapPool
,
factory
);
return
new
ImageModelRequest
<
byte
[]>(
context
,
modelLoader
,
streamDataProvider
,
bitmapPool
,
factory
,
engine
);
}
/**
...
...
@@ -451,7 +445,8 @@ public class Glide {
* @return A new {@link VideoModelRequest}.
*/
public
<
T
>
VideoModelRequest
<
T
>
using
(
final
FileDescriptorModelLoader
<
T
>
modelLoader
)
{
return
new
VideoModelRequest
<
T
>(
context
,
modelLoader
,
fileDescriptorDataProvider
,
bitmapPool
,
factory
);
return
new
VideoModelRequest
<
T
>(
context
,
modelLoader
,
fileDescriptorDataProvider
,
bitmapPool
,
factory
,
engine
);
}
/**
...
...
@@ -565,7 +560,7 @@ public class Glide {
LoadProvider
<
byte
[],
InputStream
,
Bitmap
>
loadProvider
=
new
FixedLoadProvider
<
byte
[],
InputStream
,
Bitmap
>(
loader
,
streamDataProvider
);
return
new
BitmapRequestBuilder
<
byte
[]>(
context
,
model
,
loadProvider
,
null
,
bitmapPool
,
factory
);
return
new
BitmapRequestBuilder
<
byte
[]>(
context
,
model
,
loadProvider
,
null
,
bitmapPool
,
factory
,
engine
);
}
/**
...
...
@@ -625,7 +620,7 @@ public class Glide {
fileDescriptorDataProvider
);
}
return
new
BitmapRequestBuilder
<
T
>(
context
,
model
,
streamLoadProvider
,
fileDescriptorLoadProvider
,
bitmapPool
,
factory
);
bitmapPool
,
factory
,
engine
);
}
}
...
...
@@ -641,21 +636,23 @@ public class Glide {
private
DataLoadProvider
<
ParcelFileDescriptor
,
Bitmap
>
dataLoadProvider
;
private
BitmapPool
bitmapPool
;
private
ImageViewTargetFactory
factory
;
private
Engine
engine
;
private
VideoModelRequest
(
Context
context
,
ModelLoader
<
T
,
ParcelFileDescriptor
>
loader
,
DataLoadProvider
<
ParcelFileDescriptor
,
Bitmap
>
dataLoadProvider
,
BitmapPool
bitmapPool
,
ImageViewTargetFactory
factory
)
{
ImageViewTargetFactory
factory
,
Engine
engine
)
{
this
.
context
=
context
;
this
.
loader
=
loader
;
this
.
dataLoadProvider
=
dataLoadProvider
;
this
.
bitmapPool
=
bitmapPool
;
this
.
factory
=
factory
;
this
.
engine
=
engine
;
}
public
BitmapRequestBuilder
<
T
>
loadFromVideo
(
T
model
)
{
return
new
BitmapRequestBuilder
<
T
>(
context
,
model
,
null
,
new
FixedLoadProvider
<
T
,
ParcelFileDescriptor
,
Bitmap
>(
loader
,
dataLoadProvider
),
bitmapPool
,
factory
);
factory
,
engine
);
}
}
...
...
@@ -671,20 +668,23 @@ public class Glide {
private
DataLoadProvider
<
InputStream
,
Bitmap
>
dataLoadProvider
;
private
BitmapPool
bitmapPool
;
private
ImageViewTargetFactory
factory
;
private
Engine
engine
;
private
ImageModelRequest
(
Context
context
,
ModelLoader
<
T
,
InputStream
>
loader
,
DataLoadProvider
<
InputStream
,
Bitmap
>
dataLoadProvider
,
BitmapPool
bitmapPool
,
ImageViewTargetFactory
factory
)
{
ImageViewTargetFactory
factory
,
Engine
engine
)
{
this
.
context
=
context
;
this
.
loader
=
loader
;
this
.
dataLoadProvider
=
dataLoadProvider
;
this
.
bitmapPool
=
bitmapPool
;
this
.
factory
=
factory
;
this
.
engine
=
engine
;
}
public
BitmapRequestBuilder
<
T
>
load
(
T
model
)
{
return
new
BitmapRequestBuilder
<
T
>(
context
,
model
,
new
FixedLoadProvider
<
T
,
InputStream
,
Bitmap
>(
loader
,
dataLoadProvider
),
null
,
bitmapPool
,
factory
);
new
FixedLoadProvider
<
T
,
InputStream
,
Bitmap
>(
loader
,
dataLoadProvider
),
null
,
bitmapPool
,
factory
,
engine
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录