Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproduce onTransitionCompleted bug #134

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ConstraintLayoutExamples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ buildscript {
targetSdkVersion = 28

appCompatVersion = '1.1.0-alpha03'
constraintLayoutVersion = '2.0.0-beta3'
constraintLayoutVersion = '2.0.0-beta6'
glideVersion = '4.8.0'
kotlinVersion = '1.3.71'
lifeCycleVersion = '2.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.google.androidstudio.motionlayoutexample

import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.ImageView
import androidx.annotation.RequiresApi
Expand Down Expand Up @@ -45,7 +46,37 @@ class DemoActivity : AppCompatActivity() {
} else {
MotionLayout.DEBUG_SHOW_NONE
}
(container as? MotionLayout)?.setDebugMode(debugMode)
(container as? MotionLayout)?.apply {
setDebugMode(debugMode)
setTransitionListener(object : MotionLayout.TransitionListener {
override fun onTransitionTrigger(
motionLayout: MotionLayout,
triggerId: Int,
positive: Boolean,
progress: Float
) = Unit

override fun onTransitionStarted(
motionLayout: MotionLayout,
startId: Int,
endId: Int
) = Unit

override fun onTransitionChange(
motionLayout: MotionLayout,
startId: Int,
endId: Int,
progress: Float
) = Unit

override fun onTransitionCompleted(motionLayout: MotionLayout, currentId: Int) {
Log.d(
"DemoActivity",
"$currentId: currentId is start: ${currentId == R.id.start}, currentId is end: ${currentId == R.id.end}"
)
}
})
}
}

fun changeState(v: View?) {
Expand Down