aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-29 22:18:59 -0700
committerAllan Wang <me@allanwang.ca>2017-06-29 22:18:59 -0700
commitf981c3e26b2a651326d8b5170fe086fa6fff3990 (patch)
tree593f3dc5e415a695bcec1d0cea249a11069590bd
parentfc7e19ef72ecbc361d41e8cbd6ef803c588ff0df (diff)
downloadkau-f981c3e26b2a651326d8b5170fe086fa6fff3990.tar.gz
kau-f981c3e26b2a651326d8b5170fe086fa6fff3990.tar.bz2
kau-f981c3e26b2a651326d8b5170fe086fa6fff3990.zip
Annotate static
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt2
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/dialogs/color/CircleView.kt4
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt2
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/iitems/LibraryIItem.kt23
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt4
-rw-r--r--sample/src/main/res/xml/changelog.xml2
6 files changed, 33 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
diff --git a/sample/src/main/res/xml/changelog.xml b/sample/src/main/res/xml/changelog.xml
index 4ae0bae..7cfecf2 100644
--- a/sample/src/main/res/xml/changelog.xml
+++ b/sample/src/main/res/xml/changelog.xml
@@ -12,6 +12,8 @@
<item text="Added chained adapter" />
<item text="Added item animators" />
<item text="Ported some views over from Plaid" />
+ <item text="Add string arg option for sendEmail" />
+ <item text="" />
<item text="" />
<item text="" />