aboutsummaryrefslogtreecommitdiff
path: root/sample/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-21 21:10:18 -0700
committerAllan Wang <me@allanwang.ca>2017-06-21 21:10:18 -0700
commit621c083b4ee1a81c67665ebf4b442f0ea98b5d4a (patch)
treedfed2a9fedc185aee4315f71e5a993bd1c374438 /sample/src/main
parent5c1a82b943e148ef6109b1d1ec65f89198458735 (diff)
downloadkau-621c083b4ee1a81c67665ebf4b442f0ea98b5d4a.tar.gz
kau-621c083b4ee1a81c67665ebf4b442f0ea98b5d4a.tar.bz2
kau-621c083b4ee1a81c67665ebf4b442f0ea98b5d4a.zip
Remapped kprefs to support sub items
Diffstat (limited to 'sample/src/main')
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt7
-rw-r--r--sample/src/main/res/menu/menu_main.xml7
2 files changed, 12 insertions, 2 deletions
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" />
<item
android:id="@+id/action_email"
- android:orderInCategory="2100"
+ android:orderInCategory="200"
android:title="@string/kau_send_feedback"
app:showAsAction="never" />
+ <item
+ android:id="@+id/test"
+ android:orderInCategory="300"
+ android:title="@string/kau_menu"
+ app:showAsAction="never" />
</menu>