diff options
Diffstat (limited to 'sample/src')
5 files changed, 12 insertions, 10 deletions
diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt index cc45b4e..9f01163 100644 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt @@ -50,7 +50,6 @@ import org.junit.runner.RunWith */ @RunWith(AndroidJUnit4::class) @HiltAndroidTest -@UninstallModules(PrefFactoryModule::class) class KPrefViewTest : BaseTest() { val activity: ActivityTestRule<MainActivity> = ActivityTestRule(MainActivity::class.java) diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/SampleTestApp.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/SampleTestApp.kt index 89e74c7..f6ffdb1 100644 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/SampleTestApp.kt +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/SampleTestApp.kt @@ -22,8 +22,8 @@ import androidx.test.runner.AndroidJUnitRunner import dagger.hilt.EntryPoint import dagger.hilt.InstallIn import dagger.hilt.android.EntryPointAccessors -import dagger.hilt.android.components.ApplicationComponent import dagger.hilt.android.testing.HiltTestApplication +import dagger.hilt.components.SingletonComponent import org.junit.rules.TestRule import org.junit.runner.Description import org.junit.runners.model.Statement @@ -41,7 +41,7 @@ class SampleTestRunner : AndroidJUnitRunner() { class SampleTestRule : TestRule { @EntryPoint - @InstallIn(ApplicationComponent::class) + @InstallIn(SingletonComponent::class) interface SampleTestRuleEntryPoint { fun pref(): KPrefSample } diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt index 74da014..1615d2f 100644 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt @@ -17,13 +17,16 @@ package ca.allanwang.kau.sample.test import ca.allanwang.kau.kpref.KPrefFactory import ca.allanwang.kau.kpref.KPrefFactoryInMemory +import ca.allanwang.kau.sample.PrefFactoryModule import dagger.Module import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.android.components.ApplicationComponent +import dagger.hilt.components.SingletonComponent +import dagger.hilt.testing.TestInstallIn @Module -@InstallIn(ApplicationComponent::class) +@TestInstallIn( + components = [SingletonComponent::class], + replaces = [PrefFactoryModule::class]) object PrefFactoryTestModule { @Provides fun factory(): KPrefFactory = KPrefFactoryInMemory diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt index ee39184..970d3eb 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt @@ -23,8 +23,8 @@ import ca.allanwang.kau.kpref.KPrefFactoryAndroid import dagger.Module import dagger.Provides import dagger.hilt.InstallIn -import dagger.hilt.android.components.ApplicationComponent import dagger.hilt.android.qualifiers.ApplicationContext +import dagger.hilt.components.SingletonComponent /** * Created by Allan Wang on 2017-06-07. @@ -44,14 +44,14 @@ class KPrefSample(factory: KPrefFactory) : KPref("pref_sample", factory = factor } @Module -@InstallIn(ApplicationComponent::class) +@InstallIn(SingletonComponent::class) object PrefModule { @Provides fun pref(factory: KPrefFactory): KPrefSample = KPrefSample(factory) } @Module -@InstallIn(ApplicationComponent::class) +@InstallIn(SingletonComponent::class) object PrefFactoryModule { @Provides fun factory(@ApplicationContext context: Context): KPrefFactory = KPrefFactoryAndroid(context) diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index 7ee1ea5..fc56b2d 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -33,7 +33,7 @@ <item text=":core: Remove statusBarLight toggle" /> <item text=":core: Remove kau_status_bar_height; height should be found programmatically" /> <item text=":fastadapter: Migrate fastadapter to v4.x.x" /> - <item text=":fastadapter-viewbinding: Create helper items for ViewBinding" /> + <item text=":fastadapter-viewbinding: Create helper items for ViewBinding" />g <item text="Update translations" /> <version title="v5.1.0" /> |