From cb2adc75d8e105adfdf0d5646c1a9b6d39c292f8 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 17 Apr 2021 17:09:52 -0700 Subject: Add hilt to main activity --- .../com/pitchedapps/frost/activities/BaseActivity.kt | 15 +++++++++++---- .../com/pitchedapps/frost/activities/BaseMainActivity.kt | 12 +++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'app/src') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt index 505738f3..5b2544c9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt @@ -25,16 +25,23 @@ import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.injectors.ThemeProvider import com.pitchedapps.frost.prefs.Prefs import com.pitchedapps.frost.utils.setFrostTheme -import org.koin.android.ext.android.inject +import dagger.hilt.android.AndroidEntryPoint +import javax.inject.Inject /** * Created by Allan Wang on 2017-06-12. */ +@AndroidEntryPoint abstract class BaseActivity : KauBaseActivity() { - val fbCookie: FbCookie by inject() - val prefs: Prefs by inject() - val themeProvider: ThemeProvider by inject() + @Inject + lateinit var fbCookie: FbCookie + + @Inject + lateinit var prefs: Prefs + + @Inject + lateinit var themeProvider: ThemeProvider /** * Inherited consumer to customize back press diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt index 35dd4141..b043cb2e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -128,10 +128,11 @@ import com.pitchedapps.frost.views.BadgedIcon import com.pitchedapps.frost.views.FrostVideoViewer import com.pitchedapps.frost.views.FrostViewPager import com.pitchedapps.frost.widgets.NotificationWidget +import dagger.hilt.android.AndroidEntryPoint +import javax.inject.Inject import kotlin.math.abs import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch -import org.koin.android.ext.android.inject /** * Created by Allan Wang on 20/12/17. @@ -139,6 +140,7 @@ import org.koin.android.ext.android.inject * Most of the logic that is unrelated to handling fragments */ @UseExperimental(ExperimentalCoroutinesApi::class) +@AndroidEntryPoint abstract class BaseMainActivity : BaseActivity(), MainActivityContract, FileChooserContract by FileChooserDelegate(), VideoViewHolder, SearchViewHolder { @@ -150,8 +152,12 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, override val frameWrapper: FrameLayout get() = drawerWrapperBinding.mainContainer lateinit var drawerWrapperBinding: ActivityMainDrawerWrapperBinding lateinit var contentBinding: ActivityMainContentBinding - val cookieDao: CookieDao by inject() - val genericDao: GenericDao by inject() + + @Inject + lateinit var cookieDao: CookieDao + + @Inject + lateinit var genericDao: GenericDao interface ActivityMainContentBinding { val root: View -- cgit v1.2.3