From a6ee77a4f1d78252b15059d51f2533fa03483d8c Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 27 Jun 2017 20:00:44 -0700 Subject: Testing about activity and chained adapters --- sample/src/main/AndroidManifest.xml | 3 ++ .../ca/allanwang/kau/sample/AboutActivity.kt | 34 ++++++++++++++++++++++ .../kotlin/ca/allanwang/kau/sample/MainActivity.kt | 9 +++++- sample/src/main/res/xml/changelog.xml | 2 +- 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt (limited to 'sample/src') diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index b8b54bf..2a55f62 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -22,6 +22,9 @@ + \ No newline at end of file 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() + +// override fun onCreateSections(): List>> = 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 + } + } } diff --git a/sample/src/main/res/xml/changelog.xml b/sample/src/main/res/xml/changelog.xml index 003ee8b..b3dcdde 100644 --- a/sample/src/main/res/xml/changelog.xml +++ b/sample/src/main/res/xml/changelog.xml @@ -33,7 +33,7 @@ - + -- cgit v1.2.3