aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-04-17 18:41:11 -0700
committerAllan Wang <me@allanwang.ca>2021-04-17 18:41:11 -0700
commit7a2026fb3f0342bf42824cb1b7d53f27730e8b01 (patch)
tree75b1f60a89b3b08baecada090227d036b871b283 /app/src/main/kotlin
parent8b233b2629039e8144fe6eef5438125cd48c8973 (diff)
downloadfrost-7a2026fb3f0342bf42824cb1b7d53f27730e8b01.tar.gz
frost-7a2026fb3f0342bf42824cb1b7d53f27730e8b01.tar.bz2
frost-7a2026fb3f0342bf42824cb1b7d53f27730e8b01.zip
Inject tab items
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt15
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt13
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt15
5 files changed, 33 insertions, 19 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
index 1b81d333..4c85a084 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
@@ -85,7 +85,7 @@ class TabCustomizerActivity : BaseActivity() {
val remaining = FbItem.values().filter { it.name[0] != '_' }.toMutableList()
remaining.removeAll(tabs)
tabs.addAll(remaining)
- adapter.set(tabs.map(::TabIItem))
+ adapter.set(tabs.map { TabIItem(it, themeProvider) })
bindSwapper(adapter, tabRecycler)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt
index f7d6b0ad..c4f7d6fb 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt
@@ -49,7 +49,6 @@ import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
-import org.koin.android.ext.android.inject
import javax.inject.Inject
import kotlin.coroutines.CoroutineContext
@@ -90,11 +89,17 @@ abstract class BaseFragment :
}
@Inject
- lateinit var mainContract: MainActivityContract
+ protected lateinit var mainContract: MainActivityContract
+
+ @Inject
+ protected lateinit var fbCookie: FbCookie
+
+ @Inject
+ protected lateinit var prefs: Prefs
+
+ @Inject
+ protected lateinit var themeProvider: ThemeProvider
- protected val fbCookie: FbCookie by inject()
- protected val prefs: Prefs by inject()
- protected val themeProvider: ThemeProvider by inject()
open lateinit var job: Job
override val coroutineContext: CoroutineContext
get() = ContextHelper.dispatcher + job
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 0fb91aca..f9f9064b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/TabIItem.kt
@@ -30,24 +30,23 @@ import com.mikepenz.fastadapter.drag.IDraggable
import com.pitchedapps.frost.R
import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.injectors.ThemeProvider
-import org.koin.core.component.KoinComponent
-import org.koin.core.component.inject
/**
* Created by Allan Wang on 26/11/17.
*/
-class TabIItem(val item: FbItem) :
+class TabIItem(val item: FbItem, private val themeProvider: ThemeProvider) :
KauIItem<TabIItem.ViewHolder>(
R.layout.iitem_tab_preview,
- { ViewHolder(it) }
+ { ViewHolder(it, themeProvider) }
),
IDraggable {
override val isDraggable: Boolean = true
- class ViewHolder(itemView: View) : FastAdapter.ViewHolder<TabIItem>(itemView), KoinComponent {
-
- private val themeProvider: ThemeProvider by inject()
+ class ViewHolder(
+ itemView: View,
+ private val themeProvider: ThemeProvider
+ ) : FastAdapter.ViewHolder<TabIItem>(itemView) {
val image: ImageView by bindView(R.id.image)
val text: TextView by bindView(R.id.text)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt
index 439838a9..81e08e71 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt
@@ -21,17 +21,20 @@ import android.content.Context
import android.content.Intent
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.L
+import dagger.hilt.android.AndroidEntryPoint
import org.koin.core.component.KoinComponent
-import org.koin.core.component.inject
+import javax.inject.Inject
/**
* Created by Allan Wang on 2017-05-31.
*
* Receiver that is triggered whenever the app updates so it can bind the notifications again
*/
+@AndroidEntryPoint
class UpdateReceiver : BroadcastReceiver(), KoinComponent {
- private val prefs: Prefs by inject()
+ @Inject
+ lateinit var prefs: Prefs
override fun onReceive(context: Context, intent: Intent) {
if (intent.action != Intent.ACTION_MY_PACKAGE_REPLACED) return
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
index ca57732c..85b58698 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
@@ -48,12 +48,14 @@ import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.frostDownload
+import dagger.hilt.android.AndroidEntryPoint
import org.koin.core.component.KoinComponent
-import org.koin.core.component.inject
+import javax.inject.Inject
/**
* Created by Allan Wang on 2017-10-13.
*/
+@AndroidEntryPoint
class FrostVideoViewer @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
@@ -88,9 +90,14 @@ class FrostVideoViewer @JvmOverloads constructor(
}
}
- private val prefs: Prefs by inject()
- private val themeProvider: ThemeProvider by inject()
- private val cookieDao: CookieDao by inject()
+ @Inject
+ lateinit var prefs: Prefs
+
+ @Inject
+ lateinit var themeProvider: ThemeProvider
+
+ @Inject
+ lateinit var cookieDao: CookieDao
private val binding: ViewVideoBinding =
ViewVideoBinding.inflate(LayoutInflater.from(context), this, true)