aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt13
1 files changed, 8 insertions, 5 deletions
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 097aea32..462f09ae 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
@@ -30,6 +30,8 @@ import ca.allanwang.kau.utils.withAlpha
import com.mikepenz.iconics.typeface.IIcon
import com.pitchedapps.frost.databinding.ViewBadgedIconBinding
import com.pitchedapps.frost.utils.Prefs
+import org.koin.core.KoinComponent
+import org.koin.core.inject
/**
* Created by Allan Wang on 2017-06-19.
@@ -38,8 +40,9 @@ class BadgedIcon @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
-) : ConstraintLayout(context, attrs, defStyleAttr) {
+) : ConstraintLayout(context, attrs, defStyleAttr), KoinComponent {
+ private val prefs: Prefs by inject()
private val binding: ViewBadgedIconBinding =
ViewBadgedIconBinding.inflate(LayoutInflater.from(context), this, true)
@@ -49,7 +52,7 @@ class BadgedIcon @JvmOverloads constructor(
fun ViewBadgedIconBinding.init() {
val badgeColor =
- Prefs.mainActivityLayout.backgroundColor().withAlpha(255).colorToForeground(0.2f)
+ prefs.mainActivityLayout.backgroundColor(prefs).withAlpha(255).colorToForeground(0.2f)
val badgeBackground =
GradientDrawable(
GradientDrawable.Orientation.BOTTOM_TOP,
@@ -57,7 +60,7 @@ class BadgedIcon @JvmOverloads constructor(
)
badgeBackground.cornerRadius = 13.dpToPx.toFloat()
badgeText.background = badgeBackground
- badgeText.setTextColor(Prefs.mainActivityLayout.iconColor())
+ badgeText.setTextColor(prefs.mainActivityLayout.iconColor(prefs))
}
var iicon: IIcon? = null
@@ -67,13 +70,13 @@ class BadgedIcon @JvmOverloads constructor(
value?.toDrawable(
context,
sizeDp = 20,
- color = Prefs.mainActivityLayout.iconColor()
+ color = prefs.mainActivityLayout.iconColor(prefs)
)
)
}
fun setAllAlpha(alpha: Float) {
- // badgeTextView.setTextColor(Prefs.textColor.withAlpha(alpha.toInt()))
+ // badgeTextView.setTextColor(prefs.textColor.withAlpha(alpha.toInt()))
binding.badgeImage.drawable.alpha = alpha.toInt()
}