Skip to content

Commit

Permalink
only start when attached
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyG committed May 6, 2020
1 parent 6d93ef2 commit 3b34198
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/main/java/com/discord/loadingdotsdemo/TypingDots.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ class TypingDots @JvmOverloads constructor(

init {
LayoutInflater.from(context).inflate(R.layout.typing_dots_view, this, true)
dot_3.onScaleDownCompleteListener = { start() }
dot_3.onScaleDownCompleteListener = {
if (isAttachedToWindow) {
start()
}
}
}

fun start() {
Expand Down

0 comments on commit 3b34198

Please sign in to comment.