From fb9ca21757068c0fb4123a5e30b1471ae4c32cf3 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 10 Dec 2017 23:39:57 -0500 Subject: Unify start activity design (#112) --- .../src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt | 12 +++++------- .../src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 7 ++++++- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'sample/src/main') diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt index f052d97..3f25ac3 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt @@ -10,10 +10,7 @@ import ca.allanwang.kau.permissions.kauRequestPermissions import ca.allanwang.kau.swipe.SWIPE_EDGE_LEFT import ca.allanwang.kau.swipe.kauSwipeOnCreate import ca.allanwang.kau.swipe.kauSwipeOnDestroy -import ca.allanwang.kau.utils.fullLinearRecycler -import ca.allanwang.kau.utils.startActivitySlideOut -import ca.allanwang.kau.utils.toast -import ca.allanwang.kau.utils.withAlpha +import ca.allanwang.kau.utils.* import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter /** @@ -36,8 +33,7 @@ class AnimActivity : KauBaseActivity() { ).map { PermissionCheckbox(it) }) adapter.withOnClickListener { _, _, item, _ -> KL.d("Perm Click") - kauRequestPermissions(item.permission) { - granted, _ -> + kauRequestPermissions(item.permission) { granted, _ -> toast("${item.permission} enabled: $granted") adapter.notifyAdapterDataSetChanged() } @@ -54,7 +50,9 @@ class AnimActivity : KauBaseActivity() { } override fun onBackPressed() { - startActivitySlideOut(MainActivity::class.java) + startActivity(MainActivity::class.java, bundleBuilder = { + withSlideOut(this@AnimActivity) + }) } } \ No newline at end of file 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 482c911..dd81ce1 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -173,7 +173,12 @@ class MainActivity : KPrefActivity() { } plainText(R.string.adapter_showcase) { - onClick = { _, _, _ -> startActivity(AdapterActivity::class.java, transition = true); false } + onClick = { _, _, _ -> + startActivity(AdapterActivity::class.java, bundleBuilder = { + withSceneTransitionAnimation(this@MainActivity) + }) + false + } } plainText(R.string.kau_about_app) { -- cgit v1.2.3