aboutsummaryrefslogtreecommitdiff
path: root/core-ui/src
diff options
context:
space:
mode:
Diffstat (limited to 'core-ui/src')
-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
-rw-r--r--core-ui/src/main/res-public/values/styles.xml3
3 files changed, 17 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()
+ }
+ })
+ }
+
}
diff --git a/core-ui/src/main/res-public/values/styles.xml b/core-ui/src/main/res-public/values/styles.xml
index 583ede7..31c5b74 100644
--- a/core-ui/src/main/res-public/values/styles.xml
+++ b/core-ui/src/main/res-public/values/styles.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
+
<style name="Kau.Translucent">
<item name="android:windowBackground">@color/kau_shadow_overlay</item>
<item name="android:colorBackgroundCacheHint">@null</item>
@@ -13,6 +14,8 @@
<item name="android:windowAnimationStyle">@null</item>
</style>
+ <!--Transitions are only v21+-->
+
<style name="Kau.Translucent.SlideBottom" />
<style name="Kau.Translucent.SlideTop" />