Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Commit b8b06b3

Browse files
authored
Merge pull request #104 from aquagray/master
Fixing comments from previous pull requests
2 parents 79ad94d + 007445e commit b8b06b3

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

ConstraintLayoutExamples/motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/histogramdemo/HistogramActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class HistogramActivity : AppCompatActivity() {
138138

139139
fun onClickSwitch(view: View) {
140140
val animationInterruptible = (view as Switch).isChecked
141-
animationGuard.setInterruptible(animationInterruptible)
141+
animationGuard.interruptible = animationInterruptible
142142
/**
143143
* TODO: The current histogram widget does not support interruptible sort to keep it short.
144144
* This can be a fun exercise to implement yourself.

ConstraintLayoutExamples/motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/histogramdemo/HistogramAnimationGuard.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ class HistogramAnimationGuard {
3535
return animating.get()
3636
}
3737

38-
private var interruptible: Boolean = false
38+
/**
39+
* Allows animation to be interruptible or not. When interruptible, a new animation can start
40+
* before the previous animation is finished.
41+
*/
42+
var interruptible: Boolean = false
43+
3944
private val animating = AtomicBoolean(false)
4045

4146
val animationListener: MotionLayout.TransitionListener = object : MotionLayout.TransitionListener {
@@ -51,12 +56,4 @@ class HistogramAnimationGuard {
5156
override fun onTransitionChange(p0: MotionLayout?, p1: Int, p2: Int, p3: Float) { }
5257
}
5358

54-
/**
55-
* @param interruptible true if animation is interruptible. I.e. Animation does not need to be
56-
* finished before the new one starts.
57-
* False if animation must complete before new one can start.
58-
*/
59-
fun setInterruptible(interruptible: Boolean) {
60-
this.interruptible = interruptible
61-
}
6259
}

0 commit comments

Comments
 (0)