From 53a4f63bc28b1f701d2bcf815ffa2fe2e931eba0 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 27 Jun 2017 23:25:51 -0700 Subject: Add animators --- .../ca/allanwang/kau/sample/AboutActivity.kt | 51 ++++++++++++++++------ 1 file changed, 37 insertions(+), 14 deletions(-) (limited to 'sample/src/main/kotlin/ca/allanwang') 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() + val mainHeader = SectionAdapter() -// override fun onCreateSections(): List>> = listOf( -// String.format(string(R.string.kau_about_x), "KAU") to mainHeader -// ) + override fun onCreateSections(): List>> = 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 -- cgit v1.2.3