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

Simplify TransitionListener #608

Merged
merged 2 commits into from
Feb 5, 2018
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import io.github.droidkaigi.confsched2018.presentation.Result
import io.github.droidkaigi.confsched2018.presentation.sessions.item.SimpleSessionsSection
import io.github.droidkaigi.confsched2018.presentation.sessions.item.SpeechSessionItem
import io.github.droidkaigi.confsched2018.util.SessionAlarm
import io.github.droidkaigi.confsched2018.util.SimpleTransitionListener
import io.github.droidkaigi.confsched2018.util.ext.observe
import io.github.droidkaigi.confsched2018.util.ext.setLinearDivider
import timber.log.Timber
Expand Down Expand Up @@ -156,8 +157,7 @@ class SpeakerDetailFragment : Fragment(), Injectable {
.inflateTransition(R.transition.shared_element_arc)
.apply {
duration = 400

addListener(object : Transition.TransitionListener {
addListener(object : SimpleTransitionListener() {
override fun onTransitionEnd(p0: android.transition.Transition?) {
removeListener(this)
// No need to start reveal anim if user pressed back button during shared element transition
Expand All @@ -166,19 +166,13 @@ class SpeakerDetailFragment : Fragment(), Injectable {
}
}

override fun onTransitionResume(p0: android.transition.Transition?) {
}

override fun onTransitionPause(p0: android.transition.Transition?) {
isEnterTransitionCanceled = true
}

override fun onTransitionCancel(p0: android.transition.Transition?) {
isEnterTransitionCanceled = true
}

override fun onTransitionStart(p0: android.transition.Transition?) {
}
})
}
} else {
Expand All @@ -190,19 +184,7 @@ class SpeakerDetailFragment : Fragment(), Injectable {
.apply {
duration = 400

addListener(object : Transition.TransitionListener {
override fun onTransitionEnd(p0: android.transition.Transition?) {
}

override fun onTransitionResume(p0: android.transition.Transition?) {
}

override fun onTransitionPause(p0: android.transition.Transition?) {
}

override fun onTransitionCancel(p0: android.transition.Transition?) {
}

addListener(object : SimpleTransitionListener() {
override fun onTransitionStart(p0: android.transition.Transition?) {
removeListener(this)
hideReveal()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.github.droidkaigi.confsched2018.util

import android.transition.Transition

open class SimpleTransitionListener: Transition.TransitionListener {
override fun onTransitionEnd(transition: Transition?) {
}

override fun onTransitionResume(transition: Transition?) {
}

override fun onTransitionPause(transition: Transition?) {
}

override fun onTransitionCancel(transition: Transition?) {
}

override fun onTransitionStart(transition: Transition?) {
}
}