From 3ad9cf0ca395b714d7d736d44e650cdaa4e4df87 Mon Sep 17 00:00:00 2001 From: panpanini Date: Mon, 5 Feb 2018 17:57:11 +0900 Subject: [PATCH 1/2] Create SimpleTransitionListener open class This should make TransitionListeners easier to use, because we only have to implement the methods we care about --- .../util/SimpleTransitionListener.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/src/main/java/io/github/droidkaigi/confsched2018/util/SimpleTransitionListener.kt diff --git a/app/src/main/java/io/github/droidkaigi/confsched2018/util/SimpleTransitionListener.kt b/app/src/main/java/io/github/droidkaigi/confsched2018/util/SimpleTransitionListener.kt new file mode 100644 index 00000000..c5070d15 --- /dev/null +++ b/app/src/main/java/io/github/droidkaigi/confsched2018/util/SimpleTransitionListener.kt @@ -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?) { + } +} From bc3484ab4ed8357bd8b9584cf5d9d2020a6dba0b Mon Sep 17 00:00:00 2001 From: panpanini Date: Mon, 5 Feb 2018 17:57:44 +0900 Subject: [PATCH 2/2] Use SimpleTransitionListener in SpeakerDetailFragment --- .../speaker/SpeakerDetailFragment.kt | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/io/github/droidkaigi/confsched2018/presentation/speaker/SpeakerDetailFragment.kt b/app/src/main/java/io/github/droidkaigi/confsched2018/presentation/speaker/SpeakerDetailFragment.kt index 0e4819f7..d409d987 100644 --- a/app/src/main/java/io/github/droidkaigi/confsched2018/presentation/speaker/SpeakerDetailFragment.kt +++ b/app/src/main/java/io/github/droidkaigi/confsched2018/presentation/speaker/SpeakerDetailFragment.kt @@ -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 @@ -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 @@ -166,9 +166,6 @@ class SpeakerDetailFragment : Fragment(), Injectable { } } - override fun onTransitionResume(p0: android.transition.Transition?) { - } - override fun onTransitionPause(p0: android.transition.Transition?) { isEnterTransitionCanceled = true } @@ -176,9 +173,6 @@ class SpeakerDetailFragment : Fragment(), Injectable { override fun onTransitionCancel(p0: android.transition.Transition?) { isEnterTransitionCanceled = true } - - override fun onTransitionStart(p0: android.transition.Transition?) { - } }) } } else { @@ -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()