-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
16 additions
and
25 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,7 @@ | |
* NEWEST LOG : | ||
* 1.setText() immediately take effect (v1.3.6) | ||
* 2.support scroll forever (v1.3.7) | ||
* <p> | ||
* <p> | ||
* <p> | ||
* <p> | ||
* | ||
* Basic knowledge:https://www.jianshu.com/p/918fec73a24d | ||
* | ||
* @author [email protected] 2013/09/02 | ||
|
@@ -86,15 +83,15 @@ public ScrollTextView(Context context, AttributeSet attrs) { | |
surfaceHolder = this.getHolder(); //get The surface holder | ||
surfaceHolder.addCallback(this); | ||
paint = new Paint(); | ||
TypedArray arr = getContext().obtainStyledAttributes(attrs, R.styleable.ScrollText); | ||
clickEnable = arr.getBoolean(R.styleable.ScrollText_clickEnable, clickEnable); | ||
isHorizontal = arr.getBoolean(R.styleable.ScrollText_isHorizontal, isHorizontal); | ||
speed = arr.getInteger(R.styleable.ScrollText_speed, speed); | ||
text = arr.getString(R.styleable.ScrollText_text); | ||
int textColor = arr.getColor(R.styleable.ScrollText_text_color, Color.BLACK); | ||
textSize = arr.getDimension(R.styleable.ScrollText_text_size, textSize); | ||
needScrollTimes = arr.getInteger(R.styleable.ScrollText_times, Integer.MAX_VALUE); | ||
isScrollForever = arr.getBoolean(R.styleable.ScrollText_isScrollForever, true); | ||
TypedArray arr = getContext().obtainStyledAttributes(attrs, R.styleable.ScrollTextView); | ||
clickEnable = arr.getBoolean(R.styleable.ScrollTextView_clickEnable, clickEnable); | ||
isHorizontal = arr.getBoolean(R.styleable.ScrollTextView_isHorizontal, isHorizontal); | ||
speed = arr.getInteger(R.styleable.ScrollTextView_speed, speed); | ||
text = arr.getString(R.styleable.ScrollTextView_text); | ||
int textColor = arr.getColor(R.styleable.ScrollTextView_text_color, Color.BLACK); | ||
textSize = arr.getDimension(R.styleable.ScrollTextView_text_size, textSize); | ||
needScrollTimes = arr.getInteger(R.styleable.ScrollTextView_times, Integer.MAX_VALUE); | ||
isScrollForever = arr.getBoolean(R.styleable.ScrollTextView_isScrollForever, true); | ||
|
||
paint.setColor(textColor); | ||
paint.setTextSize(textSize); | ||
|
@@ -202,7 +199,6 @@ public void setTimes(int times) { | |
needScrollTimes = times; | ||
isScrollForever = false; | ||
} | ||
|
||
} | ||
|
||
/** | ||
|
@@ -273,7 +269,6 @@ public boolean onTouchEvent(MotionEvent event) { | |
} | ||
|
||
|
||
|
||
/** | ||
* scroll text vertical | ||
*/ | ||
|
@@ -334,7 +329,6 @@ private void drawVerticalScroll() { | |
} | ||
} | ||
} | ||
|
||
} | ||
|
||
/** | ||
|
@@ -390,9 +384,7 @@ public void run() { | |
break; | ||
} | ||
|
||
|
||
if (isHorizontal) { | ||
|
||
if (pauseScroll) { | ||
try { | ||
Thread.sleep(500); | ||
|
@@ -409,11 +401,9 @@ public void run() { | |
--needScrollTimes; | ||
} | ||
} else { | ||
|
||
drawVerticalScroll(); | ||
isSetNewText = false; | ||
--needScrollTimes; | ||
|
||
} | ||
|
||
if (needScrollTimes <= 0 && isScrollForever) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters