aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-05 22:12:15 -0700
committerAllan Wang <me@allanwang.ca>2017-07-05 22:12:15 -0700
commitd31810f1f2ce2a7ce21794c418c023137e4c79c6 (patch)
treed3f1e38ec014e182bb36fb849df39a9d3630b8bb
parent2ca2598a374de0cbf91526fbbce328f28d6de1ab (diff)
downloadkau-d31810f1f2ce2a7ce21794c418c023137e4c79c6.tar.gz
kau-d31810f1f2ce2a7ce21794c418c023137e4c79c6.tar.bz2
kau-d31810f1f2ce2a7ce21794c418c023137e4c79c6.zip
Update sample
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt10
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt8
2 files changed, 13 insertions, 5 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt
index b24c7d8..503f1fc 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt
@@ -23,11 +23,11 @@ object SwipeBackHelper {
fun onCreate(activity: Activity, builder: SwipeBackContract.() -> Unit = {}) {
val page = pageStack.firstOrNull { it.activity === activity } ?: pageStack.push(SwipeBackPage(activity).apply { builder() })
- val startAnimation: Int = with(page.edgeFlag) {
- if (this and SWIPE_EDGE_LEFT > 0) R.anim.kau_slide_in_right
- else if (this and SWIPE_EDGE_RIGHT > 0) R.anim.kau_slide_in_left
- else if (this and SWIPE_EDGE_TOP > 0) R.anim.kau_slide_in_bottom
- else R.anim.kau_slide_in_top
+ val startAnimation: Int = when (page.edgeFlag) {
+ SWIPE_EDGE_LEFT -> R.anim.kau_slide_in_right
+ SWIPE_EDGE_RIGHT -> R.anim.kau_slide_in_left
+ SWIPE_EDGE_TOP -> R.anim.kau_slide_in_bottom
+ else -> R.anim.kau_slide_in_top
}
activity.overridePendingTransition(startAnimation, 0)
}
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
index 1f2d757..899a50e 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -1,6 +1,7 @@
package ca.allanwang.kau.sample
import android.os.Bundle
+import android.os.PersistableBundle
import android.view.Menu
import android.view.MenuItem
import ca.allanwang.kau.email.sendEmail
@@ -180,6 +181,13 @@ class MainActivity : KPrefActivity() {
bgCanvas.set(KPrefSample.bgColor)
toolbarCanvas.set(KPrefSample.accentColor)
this.navigationBarColor = KPrefSample.accentColor
+
+ }
+
+ override fun onPostCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
+ super.onPostCreate(savedInstanceState, persistentState)
+ //TODO testing
+ startActivity(ImageActivity::class.java, transition = true)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {