diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-16 16:07:55 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-16 16:07:55 -0700 |
commit | d9de334c67dc34dec3a93055c1b198db7d3eb3cb (patch) | |
tree | 254879625d0f72a40364c221015afd806587e6e1 | |
parent | bce8928d7ac2813a385db219fa7f40c98acac097 (diff) | |
download | kau-d9de334c67dc34dec3a93055c1b198db7d3eb3cb.tar.gz kau-d9de334c67dc34dec3a93055c1b198db7d3eb3cb.tar.bz2 kau-d9de334c67dc34dec3a93055c1b198db7d3eb3cb.zip |
Add toolbar back button by default
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt index 5b26eb0..6a188cc 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt @@ -26,6 +26,14 @@ abstract class KPrefActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.kau_activity_kpref) setSupportActionBar(toolbar) + if (supportActionBar != null) + with(supportActionBar!!) { + setDisplayHomeAsUpEnabled(true) + setDisplayShowHomeEnabled(true) + toolbar.setNavigationOnClickListener { + onBackPressed() + } + } window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION statusBarColor = 0x30000000 toolbarCanvas.set(resolveColor(R.attr.colorPrimary)) |