From f619522bd805e0e090fe9d47ed7b23c4210c634d Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 22 Nov 2017 12:49:56 -0500 Subject: 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 --- app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt | 4 +--- app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'app/src/main/kotlin') 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) { -- cgit v1.2.3