Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
I
ImageVideoBanner
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
ImageVideoBanner
Commits
8552baff
Commit
8552baff
authored
May 28, 2021
by
委座-江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
性能优化
parent
6743ccd8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
VpImageView.java
...in/java/com/widget/imagevideobanner/view/VpImageView.java
+13
-15
No files found.
imageVideoBanner/src/main/java/com/widget/imagevideobanner/view/VpImageView.java
View file @
8552baff
package
com
.
widget
.
imagevideobanner
.
view
;
package
com
.
widget
.
imagevideobanner
.
view
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.drawable.Drawable
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.v7.widget.AppCompatImageView
;
import
android.support.v7.widget.AppCompatImageView
;
...
@@ -38,6 +37,18 @@ public class VpImageView extends AppCompatImageView implements IPlayTarget {
...
@@ -38,6 +37,18 @@ public class VpImageView extends AppCompatImageView implements IPlayTarget {
}
}
};
};
private
RequestListener
requestListener
=
new
RequestListener
()
{
@Override
public
boolean
onLoadFailed
(
@Nullable
GlideException
e
,
Object
model
,
Target
target
,
boolean
isFirstResource
)
{
Log
.
e
(
TAG
,
ThrowableUtils
.
getFullStackTrace
(
e
));
return
false
;
}
@Override
public
boolean
onResourceReady
(
Object
resource
,
Object
model
,
Target
target
,
DataSource
dataSource
,
boolean
isFirstResource
)
{
return
false
;
}
};
public
VpImageView
(
Context
context
)
{
public
VpImageView
(
Context
context
)
{
super
(
context
);
super
(
context
);
...
@@ -50,24 +61,11 @@ public class VpImageView extends AppCompatImageView implements IPlayTarget {
...
@@ -50,24 +61,11 @@ public class VpImageView extends AppCompatImageView implements IPlayTarget {
}
}
private
void
setImageUrl
(
String
url
)
{
private
void
setImageUrl
(
String
url
)
{
//todo 待确定是否一定会使用缓存 缺失加载前&加载失败的备用图
Log
.
e
(
TAG
,
url
);
Log
.
e
(
TAG
,
url
);
Glide
.
with
(
getContext
()).
load
(
url
)
Glide
.
with
(
getContext
()).
load
(
url
)
.
error
(
R
.
drawable
.
load_fail
)
.
error
(
R
.
drawable
.
load_fail
)
.
placeholder
(
R
.
drawable
.
load_fail
)
.
placeholder
(
R
.
drawable
.
load_fail
)
.
listener
(
new
RequestListener
<
Drawable
>()
{
.
listener
(
requestListener
).
into
(
this
);
@Override
public
boolean
onLoadFailed
(
@Nullable
GlideException
e
,
Object
model
,
Target
<
Drawable
>
target
,
boolean
isFirstResource
)
{
Log
.
e
(
TAG
,
ThrowableUtils
.
getFullStackTrace
(
e
));
return
false
;
}
@Override
public
boolean
onResourceReady
(
Drawable
resource
,
Object
model
,
Target
<
Drawable
>
target
,
DataSource
dataSource
,
boolean
isFirstResource
)
{
Log
.
e
(
TAG
,
"onResourceReady"
);
return
false
;
}
}).
into
(
this
);
}
}
@Override
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment