Skip to content

Commit 465aa75

Browse files
author
dongxl
committed
修改无法自动播放bug
1 parent 7fe5fcc commit 465aa75

11 files changed

Lines changed: 70 additions & 40 deletions

File tree

.gitignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#Built application files
2+
*.apk
3+
*.ap_
4+
5+
# Files for the Dalvik VM
6+
*.dex
7+
8+
# Java class files
9+
*.class
10+
11+
# Generated files
12+
*/bin/
13+
*/gen/
14+
*/out/
15+
16+
# Gradle files
17+
/.gradle
18+
.gradle/
19+
*/.gradle/
20+
21+
/build
22+
build/
23+
*/build/
24+
gradlew
25+
gradlew.bat
26+
27+
# Local configuration file (sdk path, etc)
28+
local.properties
29+
30+
# Proguard folder generated by Eclipse
31+
proguard/
32+
33+
# Log Files
34+
*.log
35+
36+
# Android Studio Navigation editor temp files
37+
.navigation/
38+
39+
# Android Studio captures folder
40+
captures/
41+
42+
# Intellij
43+
*.iml
44+
*/*.iml
45+
46+
# Keystore files
47+
#*.jks
48+
#gradle wrapper
49+
gradle/
50+
51+
#some local files
52+
*/.settings/
53+
*/.DS_Store
54+
.DS_Store
55+
*/.idea/
56+
.idea/
57+
gradlew
58+
gradlew.bat
59+
unused.txt
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
136 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

animwebp/src/main/java/com/dongxl/animwebp/view/AnimatedImageView.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,15 @@ private boolean isFrameSequenceDrawable(FrameSequenceDrawable frameSequenceDrawa
321321
*/
322322
private void drawAndAutoPlay(final boolean isAutoPlay) {
323323
//添加绘制完成判断
324-
this.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
324+
this.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
325325
@Override
326-
public void onGlobalLayout() {
327-
AnimatedImageView.this.getViewTreeObserver().removeOnGlobalLayoutListener(this);
326+
public boolean onPreDraw() {
327+
AnimatedImageView.this.getViewTreeObserver().removeOnPreDrawListener(this);
328328
isDrawDone = true;
329329
if (isAutoPlay) {
330330
startAnimation();
331331
}
332+
return false;
332333
}
333334
});
334335
}

app/app.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,6 @@
164164
<orderEntry type="library" name="Gradle: com.android.support:customview:28.0.0@aar" level="project" />
165165
<orderEntry type="library" name="Gradle: com.android.support:swiperefreshlayout:28.0.0@aar" level="project" />
166166
<orderEntry type="module" module-name="animwebp" />
167+
<orderEntry type="module" module-name="animwebp" />
167168
</component>
168169
</module>

0 commit comments

Comments
 (0)