aboutsummaryrefslogtreecommitdiff
path: root/about
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-02-13 16:51:56 -0500
committerGitHub <noreply@github.com>2018-02-13 16:51:56 -0500
commitcdb1bd6eec2c90abc9d3d982814552443c7fc3b2 (patch)
tree2d21dfcce61fec76384d862b410ee61579169bc2 /about
parentf5d6ddb72a3dc369b95631a607471f9a6ea5e70f (diff)
downloadkau-cdb1bd6eec2c90abc9d3d982814552443c7fc3b2.tar.gz
kau-cdb1bd6eec2c90abc9d3d982814552443c7fc3b2.tar.bz2
kau-cdb1bd6eec2c90abc9d3d982814552443c7fc3b2.zip
Update docs (#135)
* Update docs * Update format * Update dependencies
Diffstat (limited to 'about')
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt7
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt6
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt9
3 files changed, 12 insertions, 10 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 442821f..bfbc941 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
@@ -126,7 +126,8 @@ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilde
* Method to fetch the library list
* This is fetched asynchronously and you may override it to customize the list
*/
- open fun getLibraries(libs: Libs): List<Library> = libs.prepareLibraries(this, null, null, true, true)!!
+ open fun getLibraries(libs: Libs): List<Library> =
+ libs.prepareLibraries(this, null, null, true, true, true)!!
/*
* -------------------------------------------------------------------
@@ -164,9 +165,9 @@ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilde
}
}
- override fun onPageScrollStateChanged(state: Int) {}
+ override fun onPageScrollStateChanged(state: Int) = Unit
- override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
+ override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) = Unit
override fun onPageSelected(position: Int) {
if (pageStatus[position] == 0) pageStatus[position] = 1 // mark as seen if previously null
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 47b9ac4..b6ea16b 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt
@@ -114,7 +114,7 @@ open class AboutPanelMain : AboutPanelRecycler() {
override fun inflatePage(activity: AboutActivityBase, parent: ViewGroup, position: Int): View {
with(activity) {
- adapter = FastItemThemedAdapter<IItem<*, *>>(configs)
+ adapter = FastItemThemedAdapter(configs)
recycler = fullLinearRecycler(adapter)
adapter.add(CutoutIItem {
with(configs) {
@@ -156,7 +156,7 @@ open class AboutPanelLibs : AboutPanelRecycler() {
doAsync {
with(activity) {
items = getLibraries(if (rClass == null) Libs(activity) else Libs(this, Libs.toStringArray(rClass.fields)))
- .map { LibraryIItem(it) }
+ .map(::LibraryIItem)
if (pageStatus[position] == 1)
uiThread { addItems(activity, position) }
}
@@ -181,7 +181,7 @@ open class AboutPanelFaqs : AboutPanelRecycler() {
override fun loadItems(activity: AboutActivityBase, position: Int) {
with(activity) {
kauParseFaq(configs.faqXmlRes, configs.faqParseNewLine) {
- items = it.map { FaqIItem(it) }
+ items = it.map(::FaqIItem)
if (pageStatus[position] == 1)
addItems(activity, position)
}
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 89906c3..d71f786 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
@@ -47,10 +47,11 @@ class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem, LibraryIItem.ViewH
name.text = lib.libraryName
creator.text = lib.author
@Suppress("DEPRECATION")
- description.text = if (lib.libraryDescription.isBlank()) lib.libraryDescription
- else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
- Html.fromHtml(lib.libraryDescription, Html.FROM_HTML_MODE_LEGACY)
- else Html.fromHtml(lib.libraryDescription)
+ description.text = when {
+ lib.libraryDescription.isBlank() -> lib.libraryDescription
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.N -> Html.fromHtml(lib.libraryDescription, Html.FROM_HTML_MODE_LEGACY)
+ else -> Html.fromHtml(lib.libraryDescription)
+ }
bottomDivider.gone()
if (lib.libraryVersion?.isNotBlank() == true) {
bottomDivider.visible()