aboutsummaryrefslogtreecommitdiff
path: root/sample/src/main/kotlin/ca/allanwang
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-27 23:25:51 -0700
committerAllan Wang <me@allanwang.ca>2017-06-27 23:25:51 -0700
commit53a4f63bc28b1f701d2bcf815ffa2fe2e931eba0 (patch)
treecbb132de624d3bd5efc1c64488a6640702a76264 /sample/src/main/kotlin/ca/allanwang
parenta6ee77a4f1d78252b15059d51f2533fa03483d8c (diff)
downloadkau-53a4f63bc28b1f701d2bcf815ffa2fe2e931eba0.tar.gz
kau-53a4f63bc28b1f701d2bcf815ffa2fe2e931eba0.tar.bz2
kau-53a4f63bc28b1f701d2bcf815ffa2fe2e931eba0.zip
Add animators
Diffstat (limited to 'sample/src/main/kotlin/ca/allanwang')
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt51
1 files changed, 37 insertions, 14 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
index 574922d..2e4106f 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
@@ -1,34 +1,57 @@
package ca.allanwang.kau.sample
import android.os.Bundle
-import android.os.PersistableBundle
+import android.os.Handler
import ca.allanwang.kau.about.AboutActivityBase
import ca.allanwang.kau.about.MainItem
+import ca.allanwang.kau.adapters.SectionAdapter
+import ca.allanwang.kau.logging.KL
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>()
+ val mainHeader = SectionAdapter<MainItem>()
-// override fun onCreateSections(): List<Pair<String, HeaderAdapter<*>>> = listOf(
-// String.format(string(R.string.kau_about_x), "KAU") to mainHeader
-// )
+ override fun onCreateSections(): List<Pair<String, SectionAdapter<*>>> = listOf(
+ // libSection,
+ 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
-// })
+ sectionsChain.baseAdapter.withPositionBasedStateManagement(false)
}
- override fun onPostCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
- super.onPostCreate(savedInstanceState, persistentState)
- recycler.adapter.notifyDataSetChanged()
+ override fun onPostCreate() {
+ Handler().postDelayed({
+ mainHeader.add(MainItem {
+ title = string(R.string.app_name)
+ author = "Allan Wang"
+ version = BuildConfig.VERSION_NAME
+ })
+ mainHeader.add(MainItem {
+ title = string(R.string.app_name)
+ author = "Allan Wang"
+ version = BuildConfig.VERSION_NAME
+ })
+ mainHeader.add(MainItem { })
+ mainHeader.add(MainItem { })
+ KL.e(R.layout.kau_about_item_library.toString())
+ KL.e(R.layout.kau_about_item_main.toString())
+ KL.e(R.id.kau_item_about_library.toString())
+ KL.e(R.id.kau_item_about_main.toString())
+// KL.e(sectionsChain.baseAdapter.getItemViewType(0).toString())
+// KL.e(sectionsChain.baseAdapter.getItemViewType(6).toString())
+ with(sectionsChain.baseAdapter) {
+ KL.e(mainHeader.adapterItemCount.toString())
+ KL.e(getAdapter(1)?.getGlobalPosition(0)?.toString() ?: "")
+ KL.e((getItem(0) is MainItem).toString())
+ KL.e((getItem(6) is MainItem).toString())
+// KL.e((getItem(6) is MainItem).toString())
+ }
+ }, 2000)
}
} \ No newline at end of file