Skip to content

Commit 09d2165

Browse files
author
liangmutian
committed
修改动画停止后,不断绘制的bug
1 parent da5b8b6 commit 09d2165

6 files changed

Lines changed: 11 additions & 29 deletions

File tree

.idea/compiler.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.idea/copyright/profiles_settings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 23
5-
buildToolsVersion "23.0.2"
5+
buildToolsVersion "23.0.1"
66
defaultConfig {
77
applicationId "com.example.liangmutian.randomtextview"
88
minSdkVersion 15

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

randomtextviewlibrary/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
22
apply plugin: 'com.github.dcendents.android-maven'
33
android {
44
compileSdkVersion 23
5-
buildToolsVersion "23.0.2"
5+
buildToolsVersion "23.0.1"
66

77
defaultConfig {
88
minSdkVersion 15

randomtextviewlibrary/src/main/java/com/example/liangmutian/randomtextviewlibrary/RandomTextView.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.example.liangmutian.randomtextviewlibrary;
22

3+
import android.annotation.SuppressLint;
34
import android.content.Context;
45
import android.graphics.Canvas;
56
import android.graphics.Paint;
@@ -14,6 +15,7 @@
1415
* Created by lmt on 16/11/1.
1516
*/
1617

18+
@SuppressLint("AppCompatCustomView")
1719
public class RandomTextView extends TextView {
1820
//高位快
1921
public static final int FIRSTF_FIRST = 0;
@@ -115,6 +117,7 @@ public void setPianyilian(int[] list) {
115117
@Override
116118
protected void onDraw(Canvas canvas) {
117119

120+
Log.d("RandomTextView","draw");
118121
if (firstIn) {
119122
firstIn = false;
120123
super.onDraw(canvas);
@@ -159,9 +162,12 @@ private void drawNumber(Canvas canvas) {
159162
auto += overLine[k];
160163
}
161164
if (auto == numLength * 2 - 1) {
162-
this.auto = false;
165+
163166
handler.removeCallbacks(task);
167+
//修复停止后绘制问题
168+
if (this.auto)
164169
invalidate();
170+
this.auto = false;
165171
}
166172

167173
}
@@ -258,6 +264,7 @@ public void destroy() {
258264
public void run() {
259265
// TODO Auto-generated method stub
260266
if (auto) {
267+
Log.d("RandomTextView",""+auto);
261268
handler.postDelayed(this, 20);
262269

263270
for (int j = 0; j < numLength; j++) {

0 commit comments

Comments
 (0)