diff options
author | Allan Wang <me@allanwang.ca> | 2019-10-19 22:10:33 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-10-19 22:10:33 -0700 |
commit | 193d5538a6ce73da8ee0d20469af0b9d4138e03a (patch) | |
tree | f1f909e736c029e2a02524f2290d67c0f5bd0301 /about/src | |
parent | 2889fae685edbad89c40e3cfe8a9b16f0b87ebcc (diff) | |
download | kau-193d5538a6ce73da8ee0d20469af0b9d4138e03a.tar.gz kau-193d5538a6ce73da8ee0d20469af0b9d4138e03a.tar.bz2 kau-193d5538a6ce73da8ee0d20469af0b9d4138e03a.zip |
Update AboutLibrary to 7.0.4
Diffstat (limited to 'about/src')
-rw-r--r-- | about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt | 10 | ||||
-rw-r--r-- | about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt | 43 |
2 files changed, 40 insertions, 13 deletions
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 7ba7811..6b57825 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt @@ -148,11 +148,11 @@ abstract class AboutActivityBase( open fun getLibraries(libs: Libs): List<Library> = libs.prepareLibraries( this, - null, - null, - true, - true, - true + internalLibraries = emptyArray(), // TODO remove parameter declarations; https://github.com/mikepenz/AboutLibraries/issues/449 + excludeLibraries = emptyArray(), + autoDetect = true, + checkCachedDetection = true, + sort = true ) /* 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 ba7330c..6ba632e 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt @@ -38,6 +38,7 @@ import com.mikepenz.fastadapter.GenericItem import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import java.lang.reflect.Field /** * Created by Allan Wang on 2017-08-02. @@ -96,16 +97,23 @@ abstract class AboutPanelRecycler : AboutPanelContract { override var recycler: RecyclerView? = null - override fun onInflatingPage(activity: AboutActivityBase, recycler: RecyclerView, position: Int) { + override fun onInflatingPage( + activity: AboutActivityBase, + recycler: RecyclerView, + position: Int + ) { recycler.adapter = adapter recycler.itemAnimator = KauAnimator( addAnimator = FadeScaleAnimatorAdd(scaleFactor = 0.7f, itemDelayFactor = 0.2f), changeAnimator = NoAnimatorChange - ).apply { addDuration = 300; interpolator = AnimHolder.decelerateInterpolator(recycler.context) } + ).apply { + addDuration = 300; interpolator = AnimHolder.decelerateInterpolator(recycler.context) + } } override fun inflatePage(activity: AboutActivityBase, parent: ViewGroup, position: Int): View { - val v = LayoutInflater.from(activity).inflate(R.layout.kau_recycler_detached_background, parent, false) + val v = LayoutInflater.from(activity) + .inflate(R.layout.kau_recycler_detached_background, parent, false) adapter = FastItemThemedAdapter(activity.configs) recycler = v.findViewById(R.id.kau_recycler_detached) onInflatingPage(activity, recycler!!, position) @@ -135,7 +143,12 @@ abstract class AboutPanelRecycler : AboutPanelContract { */ open class AboutPanelMain : AboutPanelRecycler() { - override fun onInflatingPage(activity: AboutActivityBase, recycler: RecyclerView, position: Int) {} + override fun onInflatingPage( + activity: AboutActivityBase, + recycler: RecyclerView, + position: Int + ) { + } override fun inflatePage(activity: AboutActivityBase, parent: ViewGroup, position: Int): View { with(activity) { @@ -145,7 +158,8 @@ open class AboutPanelMain : AboutPanelRecycler() { with(configs) { text = string(cutoutTextRes, cutoutText) drawable = drawable(cutoutDrawableRes, cutoutDrawable) - if (configs.cutoutForeground != null) foregroundColor = configs.cutoutForeground!! + if (configs.cutoutForeground != null) foregroundColor = + configs.cutoutForeground!! } }.apply { themeEnabled = configs.cutoutForeground == null @@ -170,7 +184,11 @@ open class AboutPanelMain : AboutPanelRecycler() { */ open class AboutPanelLibs : AboutPanelRecycler() { - override fun onInflatingPage(activity: AboutActivityBase, recycler: RecyclerView, position: Int) { + override fun onInflatingPage( + activity: AboutActivityBase, + recycler: RecyclerView, + position: Int + ) { super.onInflatingPage(activity, recycler, position) recycler.withMarginDecoration(16, KAU_BOTTOM) LibraryIItem.bindEvents(adapter) @@ -182,7 +200,7 @@ open class AboutPanelLibs : AboutPanelRecycler() { items = withContext(Dispatchers.Default) { getLibraries( if (rClass == null) Libs(activity) - else Libs(activity, Libs.toStringArray(rClass.fields)) + else Libs(activity, rClass.fields.toStringArray()) ).map(::LibraryIItem) } if (pageStatus[position] == 1) @@ -191,6 +209,11 @@ open class AboutPanelLibs : AboutPanelRecycler() { } } + // TODO remove and use from AboutLibrary + // https://github.com/mikepenz/AboutLibraries/issues/449 + private fun Array<Field>.toStringArray(): Array<String> = + map { it.name }.filter { it.contains("define_") }.toTypedArray() + override fun addItemsImpl(activity: AboutActivityBase, position: Int) { with(activity.configs) { adapter.add(HeaderIItem(text = libPageTitle, textRes = libPageTitleRes)) @@ -201,7 +224,11 @@ open class AboutPanelLibs : AboutPanelRecycler() { open class AboutPanelFaqs : AboutPanelRecycler() { - override fun onInflatingPage(activity: AboutActivityBase, recycler: RecyclerView, position: Int) { + override fun onInflatingPage( + activity: AboutActivityBase, + recycler: RecyclerView, + position: Int + ) { super.onInflatingPage(activity, recycler, position) FaqIItem.bindEvents(adapter) } |