-
Notifications
You must be signed in to change notification settings - Fork 246
Expand file tree
/
Copy pathAnimationSamples.kt
More file actions
36 lines (31 loc) · 1.22 KB
/
Copy pathAnimationSamples.kt
File metadata and controls
36 lines (31 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package su.levenetc.android.textsurface.sample
import android.os.Bundle
import android.view.View
import android.widget.CheckBox
import androidx.appcompat.app.AppCompatActivity
import su.levenetc.android.textsurface.TextSurface
import su.levenetc.android.textsurface.TextSurfaceDebug
import su.levenetc.android.textsurface.sample.animations.playCookieThumper
/**
* Created by Eugene Levenetc.
*/
class AnimationSamples : AppCompatActivity() {
private lateinit var textSurface: TextSurface
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.sample_activity)
textSurface = findViewById<View>(R.id.text_surface) as TextSurface
textSurface.postDelayed({ show() }, 1000)
findViewById<View>(R.id.btn_refresh).setOnClickListener { show() }
val checkDebug = findViewById<View>(R.id.check_debug) as CheckBox
checkDebug.isChecked = TextSurfaceDebug.ENABLED
checkDebug.setOnCheckedChangeListener { _, isChecked ->
TextSurfaceDebug.ENABLED = isChecked
textSurface.invalidate()
}
}
private fun show() {
textSurface.reset()
playCookieThumper(textSurface, assets)
}
}