diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-29 22:18:59 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-29 22:18:59 -0700 |
commit | f981c3e26b2a651326d8b5170fe086fa6fff3990 (patch) | |
tree | 593f3dc5e415a695bcec1d0cea249a11069590bd /library/src/main | |
parent | fc7e19ef72ecbc361d41e8cbd6ef803c588ff0df (diff) | |
download | kau-f981c3e26b2a651326d8b5170fe086fa6fff3990.tar.gz kau-f981c3e26b2a651326d8b5170fe086fa6fff3990.tar.bz2 kau-f981c3e26b2a651326d8b5170fe086fa6fff3990.zip |
Annotate static
Diffstat (limited to 'library/src/main')
5 files changed, 31 insertions, 4 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt b/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt index 74e933c..302d9dc 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt @@ -89,7 +89,7 @@ internal enum class ChangelogType(val tag: String, val attr: String, @LayoutRes ITEM("item", "text", R.layout.kau_changelog_content); companion object { - val values = values() + @JvmStatic val values = values() } /** diff --git a/library/src/main/kotlin/ca/allanwang/kau/dialogs/color/CircleView.kt b/library/src/main/kotlin/ca/allanwang/kau/dialogs/color/CircleView.kt index 1b5e0fe..3430b42 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/dialogs/color/CircleView.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/dialogs/color/CircleView.kt @@ -197,6 +197,7 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet companion object { @ColorInt + @JvmStatic private fun translucentColor(color: Int): Int { val factor = 0.7f val alpha = Math.round(Color.alpha(color) * factor) @@ -207,6 +208,7 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet } @ColorInt + @JvmStatic fun shiftColor(@ColorInt color: Int, @FloatRange(from = 0.0, to = 2.0) by: Float): Int { if (by == 1f) return color @@ -216,9 +218,11 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet } @ColorInt + @JvmStatic fun shiftColorDown(@ColorInt color: Int): Int = shiftColor(color, 0.9f) @ColorInt + @JvmStatic fun shiftColorUp(@ColorInt color: Int): Int = shiftColor(color, 1.1f) } }
\ No newline at end of file diff --git a/library/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt b/library/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt index c690468..9992cc1 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt @@ -28,7 +28,7 @@ class CardIItem(val builder: Config.() -> Unit = {} ) : AbstractItem<CardIItem, CardIItem.ViewHolder>(), ThemableIItem by ThemableIItemDelegate() { companion object { - fun bindClickEvents(fastAdapter: FastAdapter<CardIItem>) { + @JvmStatic fun bindClickEvents(fastAdapter: FastAdapter<CardIItem>) { fastAdapter.withEventHook(object : ClickEventHook<CardIItem>() { override fun onBindMany(viewHolder: RecyclerView.ViewHolder): List<View>? { return if (viewHolder is ViewHolder) listOf(viewHolder.card, viewHolder.button) else null diff --git a/library/src/main/kotlin/ca/allanwang/kau/iitems/LibraryIItem.kt b/library/src/main/kotlin/ca/allanwang/kau/iitems/LibraryIItem.kt index 0b1b7cb..a66a563 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/iitems/LibraryIItem.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/iitems/LibraryIItem.kt @@ -13,7 +13,9 @@ import ca.allanwang.kau.utils.bindView import ca.allanwang.kau.utils.gone import ca.allanwang.kau.utils.visible import com.mikepenz.aboutlibraries.entity.Library +import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.items.AbstractItem +import com.mikepenz.fastadapter.listeners.ClickEventHook /** * Created by Allan Wang on 2017-06-27. @@ -21,6 +23,27 @@ import com.mikepenz.fastadapter.items.AbstractItem class LibraryIItem(val lib: Library ) : AbstractItem<LibraryIItem, LibraryIItem.ViewHolder>(), ThemableIItem by ThemableIItemDelegate() { + companion object { + @JvmStatic fun bindClickEvents(fastAdapter: FastAdapter<CardIItem>) { + fastAdapter.withEventHook(object : ClickEventHook<CardIItem>() { + override fun onBindMany(viewHolder: RecyclerView.ViewHolder): List<View>? { + return if (viewHolder is CardIItem.ViewHolder) listOf(viewHolder.card, viewHolder.button) else null + } + + override fun onClick(v: View, position: Int, adapter: FastAdapter<CardIItem>, item: CardIItem) { + with(item.configs) { + when (v.id) { + R.id.kau_card_container -> cardClick?.onClick(v) + R.id.kau_card_button -> buttonClick?.onClick(v) + else -> { + } + } + } + } + }) + } + } + override fun getType(): Int = R.id.kau_item_library override fun getLayoutRes(): Int = R.layout.kau_iitem_library diff --git a/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt b/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt index 60727a5..8c5ad0a 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt @@ -31,8 +31,8 @@ class SearchItem(val key: String, ) : AbstractItem<SearchItem, SearchItem.ViewHolder>() { companion object { - var foregroundColor: Int = 0xdd000000.toInt() - var backgroundColor: Int = 0xfffafafa.toInt() + @JvmStatic var foregroundColor: Int = 0xdd000000.toInt() + @JvmStatic var backgroundColor: Int = 0xfffafafa.toInt() } var styledContent: SpannableStringBuilder? = null |