aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/iitems
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-01-12 21:15:08 -0800
committerAllan Wang <me@allanwang.ca>2021-01-12 21:15:08 -0800
commite01e51574613459a036c1d60383bfb229799a407 (patch)
tree4214c9803638fcc1b9d9e19159651f7115c846c4 /app/src/main/kotlin/com/pitchedapps/frost/iitems
parent0e5c1ab2dd2b574970883576e18f9a119b058788 (diff)
downloadfrost-e01e51574613459a036c1d60383bfb229799a407.tar.gz
frost-e01e51574613459a036c1d60383bfb229799a407.tar.bz2
frost-e01e51574613459a036c1d60383bfb229799a407.zip
Convert all theme access to themeprovider
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/iitems')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt13
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt11
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt6
3 files changed, 16 insertions, 14 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 47a362b4..0c53a2b1 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
@@ -28,6 +28,7 @@ import com.mikepenz.fastadapter.IAdapter
import com.mikepenz.fastadapter.select.selectExtension
import com.pitchedapps.frost.R
import com.pitchedapps.frost.facebook.FbCookie
+import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.launchWebOverlay
import org.koin.core.component.KoinComponent
@@ -79,14 +80,14 @@ open class HeaderIItem(
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<HeaderIItem>(itemView),
KoinComponent {
- private val prefs: Prefs by inject()
+ private val themeProvider: ThemeProvider by inject()
val text: TextView by bindView(R.id.item_header_text)
override fun bindView(item: HeaderIItem, payloads: List<Any>) {
- text.setTextColor(prefs.accentColor)
+ text.setTextColor(themeProvider.accentColor)
text.text = item.text
- text.setBackgroundColor(prefs.nativeBgColor)
+ text.setBackgroundColor(themeProvider.nativeBgColor)
}
override fun unbindView(item: HeaderIItem) {
@@ -108,14 +109,14 @@ open class TextIItem(
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<TextIItem>(itemView), KoinComponent {
- private val prefs: Prefs by inject()
+ private val themeProvider: ThemeProvider by inject()
val text: TextView by bindView(R.id.item_text_view)
override fun bindView(item: TextIItem, payloads: List<Any>) {
- text.setTextColor(prefs.textColor)
+ text.setTextColor(themeProvider.textColor)
text.text = item.text
- text.background = createSimpleRippleDrawable(prefs.bgColor, prefs.nativeBgColor)
+ text.background = createSimpleRippleDrawable(themeProvider.bgColor, themeProvider.nativeBgColor)
}
override fun unbindView(item: TextIItem) {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
index 56e27ccd..8e0d5bec 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
@@ -36,6 +36,7 @@ import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.parsers.FrostNotif
import com.pitchedapps.frost.glide.FrostGlide
import com.pitchedapps.frost.glide.GlideApp
+import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.isIndependent
import com.pitchedapps.frost.utils.launchWebOverlay
@@ -103,7 +104,7 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) :
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<NotificationIItem>(itemView),
KoinComponent {
- private val prefs: Prefs by inject()
+ private val themeProvider: ThemeProvider by inject()
private val frame: ViewGroup by bindView(R.id.item_frame)
private val avatar: ImageView by bindView(R.id.item_avatar)
@@ -117,11 +118,11 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) :
override fun bindView(item: NotificationIItem, payloads: List<Any>) {
val notif = item.notification
frame.background = createSimpleRippleDrawable(
- prefs.textColor,
- prefs.nativeBgColor(notif.unread)
+ themeProvider.textColor,
+ themeProvider.nativeBgColor(notif.unread)
)
- content.setTextColor(prefs.textColor)
- date.setTextColor(prefs.textColor.withAlpha(150))
+ content.setTextColor(themeProvider.textColor)
+ date.setTextColor(themeProvider.textColor.withAlpha(150))
val glide = glide
glide.load(notif.img)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
index 6f278fe2..0fd39d5c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
@@ -29,7 +29,7 @@ import com.mikepenz.fastadapter.FastAdapter
import com.mikepenz.fastadapter.drag.IDraggable
import com.pitchedapps.frost.R
import com.pitchedapps.frost.facebook.FbItem
-import com.pitchedapps.frost.prefs.Prefs
+import com.pitchedapps.frost.injectors.ThemeProvider
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
@@ -45,14 +45,14 @@ class TabIItem(val item: FbItem) : KauIItem<TabIItem.ViewHolder>(
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<TabIItem>(itemView), KoinComponent {
- private val prefs: Prefs by inject()
+ private val themeProvider: ThemeProvider by inject()
val image: ImageView by bindView(R.id.image)
val text: TextView by bindView(R.id.text)
override fun bindView(item: TabIItem, payloads: List<Any>) {
val isInToolbar = adapterPosition < 4
- val color = if (isInToolbar) prefs.iconColor else prefs.textColor
+ val color = if (isInToolbar) themeProvider.iconColor else themeProvider.textColor
image.setIcon(item.item.icon, 20, color)
if (isInToolbar)
text.invisible()