diff options
author | Allan Wang <me@allanwang.ca> | 2018-12-24 01:17:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-24 01:17:31 -0500 |
commit | fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b (patch) | |
tree | cc6d67461b6caa256043b9482f7646831d528a08 /about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt | |
parent | a380adea1052d39f23c9c4d432a9380ce347d6c4 (diff) | |
download | kau-fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b.tar.gz kau-fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b.tar.bz2 kau-fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b.zip |
Enhancement/ktlint (#179)
* Add spotless dependency
* Apply ktlint
* Add license headers
Diffstat (limited to 'about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt')
-rw-r--r-- | about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt | 41 |
1 files changed, 31 insertions, 10 deletions
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 6698dba..35c1322 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt @@ -1,15 +1,37 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.about -import androidx.recyclerview.widget.RecyclerView import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView import ca.allanwang.kau.adapters.FastItemThemedAdapter import ca.allanwang.kau.animators.FadeScaleAnimatorAdd import ca.allanwang.kau.animators.KauAnimator import ca.allanwang.kau.animators.NoAnimatorChange import ca.allanwang.kau.iitems.HeaderIItem -import ca.allanwang.kau.utils.* +import ca.allanwang.kau.utils.AnimHolder +import ca.allanwang.kau.utils.KAU_BOTTOM +import ca.allanwang.kau.utils.colorToForeground +import ca.allanwang.kau.utils.drawable +import ca.allanwang.kau.utils.fullLinearRecycler +import ca.allanwang.kau.utils.postDelayed +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.IItem @@ -76,8 +98,8 @@ abstract class AboutPanelRecycler : AboutPanelContract { 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() + addAnimator = FadeScaleAnimatorAdd(scaleFactor = 0.7f, itemDelayFactor = 0.2f), + changeAnimator = NoAnimatorChange() ).apply { addDuration = 300; interpolator = AnimHolder.decelerateInterpolator(recycler.context) } } @@ -136,7 +158,6 @@ open class AboutPanelMain : AboutPanelRecycler() { } override fun addItemsImpl(activity: AboutActivityBase, position: Int) {} - } /** @@ -155,7 +176,8 @@ open class AboutPanelLibs : AboutPanelRecycler() { override fun loadItems(activity: AboutActivityBase, position: Int) { doAsync { with(activity) { - items = getLibraries(if (rClass == null) Libs(activity) else Libs(this, Libs.toStringArray(rClass.fields))) + items = + getLibraries(if (rClass == null) Libs(activity) else Libs(this, Libs.toStringArray(rClass.fields))) .map(::LibraryIItem) if (pageStatus[position] == 1) uiThread { addItems(activity, position) } @@ -166,7 +188,7 @@ open class AboutPanelLibs : AboutPanelRecycler() { override fun addItemsImpl(activity: AboutActivityBase, position: Int) { with(activity.configs) { adapter.add(HeaderIItem(text = libPageTitle, textRes = libPageTitleRes)) - .add(items) + .add(items) } } } @@ -191,8 +213,7 @@ open class AboutPanelFaqs : AboutPanelRecycler() { override fun addItemsImpl(activity: AboutActivityBase, position: Int) { with(activity.configs) { adapter.add(HeaderIItem(text = faqPageTitle, textRes = faqPageTitleRes)) - .add(items) + .add(items) } } - -}
\ No newline at end of file +} |