From df1f578cdffb5314bde26c7ffbedc6b1a1d96692 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 27 Jul 2019 19:45:00 -0700 Subject: Us genericitem where applicable --- .../src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt | 3 ++- .../src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt | 9 +++++---- about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt | 9 +++++---- about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt | 3 ++- 4 files changed, 14 insertions(+), 10 deletions(-) (limited to 'about/src/main/kotlin/ca/allanwang') diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt index cc0eb91..d346090 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt @@ -33,6 +33,7 @@ import ca.allanwang.kau.utils.INVALID_ID import ca.allanwang.kau.utils.dimenPixelSize import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.entity.Library +import com.mikepenz.fastadapter.GenericItem import com.mikepenz.fastadapter.IItem import kotlinx.android.synthetic.main.kau_activity_about.* @@ -128,7 +129,7 @@ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilde * Open hook called just before the main page view is returned * Feel free to add your own items to the adapter in here */ - open fun postInflateMainPage(adapter: FastItemThemedAdapter>) { + open fun postInflateMainPage(adapter: FastItemThemedAdapter) { } /** diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt index 512516d..24f1c48 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt @@ -34,6 +34,7 @@ import ca.allanwang.kau.utils.string import ca.allanwang.kau.utils.withMarginDecoration import ca.allanwang.kau.xml.kauParseFaq import com.mikepenz.aboutlibraries.Libs +import com.mikepenz.fastadapter.GenericItem import com.mikepenz.fastadapter.IItem import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -48,11 +49,11 @@ interface AboutPanelContract { /** * Model list to be added to [adapter] */ - var items: List> + var items: List /** * The adapter, will be late initialized as it depends on configs */ - var adapter: FastItemThemedAdapter> + var adapter: FastItemThemedAdapter /** * Reference to the recyclerview, will be used to stop scrolling upon exit */ @@ -90,9 +91,9 @@ interface AboutPanelContract { abstract class AboutPanelRecycler : AboutPanelContract { - override var items: List> = emptyList() + override var items: List = emptyList() - override lateinit var adapter: FastItemThemedAdapter> + override lateinit var adapter: FastItemThemedAdapter override var recycler: RecyclerView? = null diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt index 96b9884..0a570f8 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt @@ -30,6 +30,7 @@ import ca.allanwang.kau.utils.parentViewGroup import ca.allanwang.kau.utils.setPaddingLeft import ca.allanwang.kau.xml.FaqItem import com.mikepenz.fastadapter.FastAdapter +import com.mikepenz.fastadapter.GenericItem import com.mikepenz.fastadapter.IItem import com.mikepenz.fastadapter.listeners.ClickEventHook import com.mikepenz.fastadapter.select.getSelectExtension @@ -42,9 +43,9 @@ class FaqIItem(val content: FaqItem) : KauIItem( ), ThemableIItem by ThemableIItemDelegate() { companion object { - fun bindEvents(fastAdapter: FastAdapter>) { + fun bindEvents(fastAdapter: FastAdapter) { fastAdapter.getSelectExtension().isSelectable = true - fastAdapter.addEventHook(object : ClickEventHook>() { + fastAdapter.addEventHook(object : ClickEventHook() { override fun onBind(viewHolder: RecyclerView.ViewHolder): View? = (viewHolder as? ViewHolder)?.questionContainer @@ -52,8 +53,8 @@ class FaqIItem(val content: FaqItem) : KauIItem( override fun onClick( v: View, position: Int, - fastAdapter: FastAdapter>, - item: IItem<*> + fastAdapter: FastAdapter, + item: GenericItem ) { if (item !is FaqIItem) return item.isExpanded = !item.isExpanded diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt index dcc0874..8f93422 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt @@ -29,6 +29,7 @@ import ca.allanwang.kau.utils.startLink import ca.allanwang.kau.utils.visible import com.mikepenz.aboutlibraries.entity.Library import com.mikepenz.fastadapter.FastAdapter +import com.mikepenz.fastadapter.GenericItem import com.mikepenz.fastadapter.IItem import com.mikepenz.fastadapter.select.getSelectExtension @@ -40,7 +41,7 @@ class LibraryIItem(val lib: Library) : KauIItem( ), ThemableIItem by ThemableIItemDelegate() { companion object { - fun bindEvents(fastAdapter: FastAdapter>) { + fun bindEvents(fastAdapter: FastAdapter) { fastAdapter.getSelectExtension().isSelectable = true fastAdapter.onClickListener = { v, _, item, _ -> if (item !is LibraryIItem) -- cgit v1.2.3