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/LibraryIItem.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/LibraryIItem.kt')
-rw-r--r-- | about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt | 45 |
1 files changed, 31 insertions, 14 deletions
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 e1e9a76..33aac09 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt @@ -1,11 +1,26 @@ +/* + * 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 android.os.Build -import androidx.recyclerview.widget.RecyclerView import android.text.Html import android.view.View import android.widget.TextView import androidx.cardview.widget.CardView +import androidx.recyclerview.widget.RecyclerView import ca.allanwang.kau.adapters.ThemableIItem import ca.allanwang.kau.adapters.ThemableIItemDelegate import ca.allanwang.kau.iitems.KauIItem @@ -20,21 +35,21 @@ import com.mikepenz.fastadapter.IItem * Created by Allan Wang on 2017-06-27. */ class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem, LibraryIItem.ViewHolder>( - R.layout.kau_iitem_library, ::ViewHolder, R.id.kau_item_library + R.layout.kau_iitem_library, ::ViewHolder, R.id.kau_item_library ), ThemableIItem by ThemableIItemDelegate() { companion object { fun bindEvents(fastAdapter: FastAdapter<IItem<*, *>>) { fastAdapter.withSelectable(false) - .withOnClickListener { v, _, item, _ -> - if (item !is LibraryIItem) - false - else - with(item.lib) { - v!!.context.startLink(libraryWebsite, repositoryLink, authorWebsite) - true - } - } + .withOnClickListener { v, _, item, _ -> + if (item !is LibraryIItem) + false + else + with(item.lib) { + v!!.context.startLink(libraryWebsite, repositoryLink, authorWebsite) + true + } + } } } @@ -48,7 +63,10 @@ class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem, LibraryIItem.ViewH @Suppress("DEPRECATION") 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) + Build.VERSION.SDK_INT >= Build.VERSION_CODES.N -> Html.fromHtml( + lib.libraryDescription, + Html.FROM_HTML_MODE_LEGACY + ) else -> Html.fromHtml(lib.libraryDescription) } bottomDivider.gone() @@ -90,5 +108,4 @@ class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem, LibraryIItem.ViewH val divider: View = v.findViewById(R.id.lib_item_top_divider) val bottomDivider: View = v.findViewById(R.id.lib_item_bottom_divider) } - -}
\ No newline at end of file +} |