aboutsummaryrefslogtreecommitdiff
path: root/sample/src/main/kotlin/ca
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-27 20:00:44 -0700
committerAllan Wang <me@allanwang.ca>2017-06-27 20:00:44 -0700
commita6ee77a4f1d78252b15059d51f2533fa03483d8c (patch)
treeb27b4a9cddfccce6f1edcdcdffba92c08bf33642 /sample/src/main/kotlin/ca
parent8179e50208192e2b18b4df3bfc100d9cf779891a (diff)
downloadkau-a6ee77a4f1d78252b15059d51f2533fa03483d8c.tar.gz
kau-a6ee77a4f1d78252b15059d51f2533fa03483d8c.tar.bz2
kau-a6ee77a4f1d78252b15059d51f2533fa03483d8c.zip
Testing about activity and chained adapters
Diffstat (limited to 'sample/src/main/kotlin/ca')
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt34
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt9
2 files changed, 42 insertions, 1 deletions
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
new file mode 100644
index 0000000..574922d
--- /dev/null
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
@@ -0,0 +1,34 @@
+package ca.allanwang.kau.sample
+
+import android.os.Bundle
+import android.os.PersistableBundle
+import ca.allanwang.kau.about.AboutActivityBase
+import ca.allanwang.kau.about.MainItem
+import ca.allanwang.kau.utils.string
+import com.mikepenz.fastadapter.adapters.HeaderAdapter
+
+/**
+ * Created by Allan Wang on 2017-06-27.
+ */
+class AboutActivity : AboutActivityBase(R.string::class.java) {
+
+ val mainHeader = HeaderAdapter<MainItem>()
+
+// override fun onCreateSections(): List<Pair<String, HeaderAdapter<*>>> = listOf(
+// String.format(string(R.string.kau_about_x), "KAU") to mainHeader
+// )
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+// mainHeader.add(MainItem {
+// title = string(R.string.app_name)
+// author = "Allan Wang"
+// version = BuildConfig.VERSION_NAME
+// })
+ }
+
+ override fun onPostCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
+ super.onPostCreate(savedInstanceState, persistentState)
+ recycler.adapter.notifyDataSetChanged()
+ }
+} \ 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 3cd714e..d8e7e33 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -3,6 +3,7 @@ package ca.allanwang.kau.sample
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
+import ca.allanwang.kau.about.AboutActivityBase
import ca.allanwang.kau.email.sendEmail
import ca.allanwang.kau.kpref.CoreAttributeContract
import ca.allanwang.kau.kpref.KPrefActivity
@@ -146,7 +147,13 @@ class MainActivity : KPrefActivity() {
descRes = R.string.sub_item_desc
}
- plainText(R.string.kau_lorem_ipsum)
+ plainText(R.string.kau_lorem_ipsum) {
+ onClick = {
+ _, _, _ ->
+ startActivity(AboutActivity::class.java)
+ false
+ }
+ }
}