aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/iitems
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-12-11 17:52:24 -0500
committerGitHub <noreply@github.com>2017-12-11 17:52:24 -0500
commitdb262e95779e0a17275bdb94be2b0ac12819178e (patch)
tree42b89edf8796e85e362ca86dead1170cb38f6434 /app/src/main/kotlin/com/pitchedapps/frost/iitems
parent1d4380cee77fc049a54d280a27dcefa3fa6ff1fd (diff)
downloadfrost-db262e95779e0a17275bdb94be2b0ac12819178e.tar.gz
frost-db262e95779e0a17275bdb94be2b0ac12819178e.tar.bz2
frost-db262e95779e0a17275bdb94be2b0ac12819178e.zip
Feature/tab customization (#522)
* Add initial tab customizing view * Add rest of content for now * Delete project file backups * Stash * Support full tab customization * Test activity animations * Update kau and fix sound uri * Try catch download, resolves #523
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/iitems')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt52
1 files changed, 52 insertions, 0 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
new file mode 100644
index 00000000..73d80538
--- /dev/null
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
@@ -0,0 +1,52 @@
+package com.pitchedapps.frost.iitems
+
+import android.graphics.Color
+import android.view.View
+import android.widget.ImageView
+import android.widget.TextView
+import ca.allanwang.kau.iitems.KauIItem
+import ca.allanwang.kau.utils.*
+import com.mikepenz.fastadapter.FastAdapter
+import com.mikepenz.fastadapter.IItem
+import com.mikepenz.fastadapter_extensions.drag.IDraggable
+import com.pitchedapps.frost.R
+import com.pitchedapps.frost.facebook.FbItem
+import com.pitchedapps.frost.utils.L
+import com.pitchedapps.frost.utils.Prefs
+
+/**
+ * Created by Allan Wang on 26/11/17.
+ */
+class TabIItem(val item: FbItem) : KauIItem<TabIItem, TabIItem.ViewHolder>(
+ R.layout.iitem_tab_preview,
+ { ViewHolder(it) }
+), IDraggable<TabIItem, IItem<*, *>> {
+
+ override fun withIsDraggable(draggable: Boolean): TabIItem = this
+
+ override fun isDraggable() = true
+
+ class ViewHolder(itemView: View) : FastAdapter.ViewHolder<TabIItem>(itemView) {
+
+ val image: ImageView by bindView(R.id.image)
+ val text: TextView by bindView(R.id.text)
+
+ override fun bindView(item: TabIItem, payloads: MutableList<Any>) {
+ val isInToolbar = adapterPosition < 4
+ val color = if (isInToolbar) Prefs.iconColor else Prefs.textColor
+ image.setIcon(item.item.icon, 20, color)
+ if (isInToolbar)
+ text.invisible()
+ else {
+ text.visible().setText(item.item.titleId)
+ text.setTextColor(color.withAlpha(200))
+ }
+ }
+
+ override fun unbindView(item: TabIItem) {
+ image.setImageDrawable(null)
+ text.visible().text = null
+ }
+
+ }
+} \ No newline at end of file