aboutsummaryrefslogtreecommitdiff
path: root/core-ui/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'core-ui/src/main/kotlin')
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt1
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt14
2 files changed, 14 insertions, 1 deletions
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt
index ebb6397..5db5eaa 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt
@@ -3,7 +3,6 @@ package ca.allanwang.kau.ui.views
import android.content.Context
import android.support.v7.widget.AppCompatImageView
import android.util.AttributeSet
-import android.widget.ImageView
/**
* Created by Allan Wang on 2017-07-14.
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt
index 995ccab..5cdfc92 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt
@@ -21,9 +21,12 @@ import android.content.Context
import android.graphics.Color
import android.os.Build
import android.support.annotation.RequiresApi
+import android.support.v7.widget.RecyclerView
+import android.transition.TransitionInflater
import android.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
+import ca.allanwang.kau.logging.KL
import ca.allanwang.kau.ui.R
import ca.allanwang.kau.utils.*
@@ -237,4 +240,15 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor(
}
}
+ fun addExitListener(activity: Activity, transitionBottom: Int = R.transition.kau_exit_slide_bottom, transitionTop: Int = R.transition.kau_exit_slide_top) {
+ addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(activity) {
+ override fun onDragDismissed() {
+ KL.d("New transition")
+ activity.window.returnTransition = TransitionInflater.from(activity)
+ .inflateTransition(if (translationY > 0) transitionBottom else transitionTop)
+ activity.finishAfterTransition()
+ }
+ })
+ }
+
}