1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Add hilt to main activity

This commit is contained in:
Allan Wang 2021-04-17 17:09:52 -07:00
parent 39db7f4c3d
commit cb2adc75d8
No known key found for this signature in database
GPG Key ID: 69D90B885D405BDB
2 changed files with 20 additions and 7 deletions

View File

@ -25,16 +25,23 @@ import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.injectors.ThemeProvider import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.Prefs import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.setFrostTheme 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. * Created by Allan Wang on 2017-06-12.
*/ */
@AndroidEntryPoint
abstract class BaseActivity : KauBaseActivity() { abstract class BaseActivity : KauBaseActivity() {
val fbCookie: FbCookie by inject() @Inject
val prefs: Prefs by inject() lateinit var fbCookie: FbCookie
val themeProvider: ThemeProvider by inject()
@Inject
lateinit var prefs: Prefs
@Inject
lateinit var themeProvider: ThemeProvider
/** /**
* Inherited consumer to customize back press * Inherited consumer to customize back press

View File

@ -128,10 +128,11 @@ import com.pitchedapps.frost.views.BadgedIcon
import com.pitchedapps.frost.views.FrostVideoViewer import com.pitchedapps.frost.views.FrostVideoViewer
import com.pitchedapps.frost.views.FrostViewPager import com.pitchedapps.frost.views.FrostViewPager
import com.pitchedapps.frost.widgets.NotificationWidget import com.pitchedapps.frost.widgets.NotificationWidget
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import kotlin.math.abs import kotlin.math.abs
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject
/** /**
* Created by Allan Wang on 20/12/17. * 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 * Most of the logic that is unrelated to handling fragments
*/ */
@UseExperimental(ExperimentalCoroutinesApi::class) @UseExperimental(ExperimentalCoroutinesApi::class)
@AndroidEntryPoint
abstract class BaseMainActivity : BaseActivity(), MainActivityContract, abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
FileChooserContract by FileChooserDelegate(), FileChooserContract by FileChooserDelegate(),
VideoViewHolder, SearchViewHolder { VideoViewHolder, SearchViewHolder {
@ -150,8 +152,12 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
override val frameWrapper: FrameLayout get() = drawerWrapperBinding.mainContainer override val frameWrapper: FrameLayout get() = drawerWrapperBinding.mainContainer
lateinit var drawerWrapperBinding: ActivityMainDrawerWrapperBinding lateinit var drawerWrapperBinding: ActivityMainDrawerWrapperBinding
lateinit var contentBinding: ActivityMainContentBinding 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 { interface ActivityMainContentBinding {
val root: View val root: View