From 621c083b4ee1a81c67665ebf4b442f0ea98b5d4a Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 21 Jun 2017 21:10:18 -0700 Subject: Remapped kprefs to support sub items --- sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 7 ++++++- sample/src/main/res/menu/menu_main.xml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'sample/src/main') 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 8867a00..d4c8c6e 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -4,6 +4,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import ca.allanwang.kau.email.sendEmail +import ca.allanwang.kau.kpref.CoreAttributeContract import ca.allanwang.kau.kpref.KPrefActivity import ca.allanwang.kau.kpref.KPrefAdapterBuilder import ca.allanwang.kau.utils.* @@ -13,9 +14,12 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial class MainActivity : KPrefActivity() { - override fun onCreateKPrefs(savedInstanceState: android.os.Bundle?): KPrefAdapterBuilder.() -> Unit = { + override fun kPrefCoreAttributes(): CoreAttributeContract.() -> Unit = { textColor = { KPrefSample.textColor } accentColor = { KPrefSample.accentColor } + } + + override fun onCreateKPrefs(savedInstanceState: android.os.Bundle?): KPrefAdapterBuilder.() -> Unit = { header(R.string.header) @@ -105,6 +109,7 @@ class MainActivity : KPrefActivity() { when (item.itemId) { R.id.action_settings -> startActivity(AnimActivity::class.java, clearStack = true) R.id.action_email -> sendEmail(R.string.your_email, R.string.your_subject) + R.id.test -> prefHolder.showNext() else -> return super.onOptionsItemSelected(item) } return true diff --git a/sample/src/main/res/menu/menu_main.xml b/sample/src/main/res/menu/menu_main.xml index caafd48..dd07031 100644 --- a/sample/src/main/res/menu/menu_main.xml +++ b/sample/src/main/res/menu/menu_main.xml @@ -9,8 +9,13 @@ app:showAsAction="never" /> + -- cgit v1.2.3