aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-11-22 12:49:56 -0500
committerGitHub <noreply@github.com>2017-11-22 12:49:56 -0500
commitf619522bd805e0e090fe9d47ed7b23c4210c634d (patch)
tree1a1637dc498b7ad16cbabab1716aed343a9db954 /app/src/main/kotlin
parentf6499a8741b8234770ba61c003f8065da041cdfe (diff)
downloadfrost-f619522bd805e0e090fe9d47ed7b23c4210c634d.tar.gz
frost-f619522bd805e0e090fe9d47ed7b23c4210c634d.tar.bz2
frost-f619522bd805e0e090fe9d47ed7b23c4210c634d.zip
Fix/tab layout (#510)
* Test wrap content width * Compute badge icon dimensions * Reuse views * Remove unnecessary color set * Change image bound * Set min * Change dp * Snapshot * Hardcode dimensions * Add min width
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt5
2 files changed, 3 insertions, 6 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
index 5d7e3625..57cda44a 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
@@ -210,9 +210,7 @@ class MainActivity : BaseActivity(),
}
adapter.pages.forEach {
tabs.addTab(tabs.newTab()
- .setCustomView(BadgedIcon(this).apply {
- iicon = it.icon
- }))
+ .setCustomView(BadgedIcon(this).apply { iicon = it.icon }))
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
index c1015aad..ed7a3c4f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
@@ -7,6 +7,7 @@ import android.util.AttributeSet
import android.widget.ImageView
import android.widget.TextView
import ca.allanwang.kau.utils.*
+import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
import com.pitchedapps.frost.R
import com.pitchedapps.frost.utils.Prefs
@@ -31,12 +32,10 @@ class BadgedIcon @JvmOverloads constructor(
badgeTextView.setTextColor(Prefs.mainActivityLayout.iconColor())
}
-
var iicon: IIcon? = null
- get() = field
set(value) {
field = value
- badgeImage.setImageDrawable(value?.toDrawable(context, color = Prefs.mainActivityLayout.iconColor()))
+ badgeImage.setImageDrawable(value?.toDrawable(context, sizeDp = 20, color = Prefs.mainActivityLayout.iconColor()))
}
fun setAllAlpha(alpha: Float) {