aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt53
1 files changed, 34 insertions, 19 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
index 1211b742..6eacf48e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package com.pitchedapps.frost.iitems
import android.content.Context
@@ -32,25 +48,25 @@ interface ClickableIItemContract {
companion object {
fun bindEvents(adapter: IAdapter<IItem<*, *>>) {
adapter.fastAdapter.withSelectable(false)
- .withOnClickListener { v, _, item, _ ->
- if (item is ClickableIItemContract) {
- item.click(v!!.context)
- true
- } else
- false
- }
+ .withOnClickListener { v, _, item, _ ->
+ if (item is ClickableIItemContract) {
+ item.click(v!!.context)
+ true
+ } else
+ false
+ }
}
}
-
}
/**
* Generic header item
* Not clickable with an accent color
*/
-open class HeaderIItem(val text: String?,
- itemId: Int = R.layout.iitem_header)
- : KauIItem<HeaderIItem, HeaderIItem.ViewHolder>(R.layout.iitem_header, ::ViewHolder, itemId) {
+open class HeaderIItem(
+ val text: String?,
+ itemId: Int = R.layout.iitem_header
+) : KauIItem<HeaderIItem, HeaderIItem.ViewHolder>(R.layout.iitem_header, ::ViewHolder, itemId) {
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<HeaderIItem>(itemView) {
@@ -66,18 +82,18 @@ open class HeaderIItem(val text: String?,
text.text = null
}
}
-
}
/**
* Generic text item
* Clickable with text color
*/
-open class TextIItem(val text: String?,
- override val url: String?,
- itemId: Int = R.layout.iitem_text)
- : KauIItem<TextIItem, TextIItem.ViewHolder>(R.layout.iitem_text, ::ViewHolder, itemId),
- ClickableIItemContract {
+open class TextIItem(
+ val text: String?,
+ override val url: String?,
+ itemId: Int = R.layout.iitem_text
+) : KauIItem<TextIItem, TextIItem.ViewHolder>(R.layout.iitem_text, ::ViewHolder, itemId),
+ ClickableIItemContract {
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<TextIItem>(itemView) {
@@ -93,5 +109,4 @@ open class TextIItem(val text: String?,
text.text = null
}
}
-
-} \ No newline at end of file
+}