fix some leaks, try out leak_canary

This commit is contained in:
Matthieu 2021-05-08 20:12:05 +02:00
parent f408bb40cb
commit b12b8f8e0e
2 changed files with 20 additions and 18 deletions

View File

@ -194,6 +194,8 @@ dependencies {
exclude group:'androidx.test', module:'monitor'
}
//stagingImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.27.2'
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation 'junit:junit:4.13.2'

View File

@ -72,22 +72,22 @@ class MainActivity : BaseActivity() {
sendTraceDroidStackTracesIfExist("contact@pixeldroid.org", this)
setupDrawer()
val tabs: List<Fragment> = listOf(
val tabs: List<() -> Fragment> = listOf(
{
PostFeedFragment<HomeStatusDatabaseEntity>()
.apply {
arguments = Bundle().apply { putBoolean("home", true) }
}
,
SearchDiscoverFragment() ,
CameraFragment() ,
NotificationsFragment() ,
},
{ SearchDiscoverFragment() },
{ CameraFragment() },
{ NotificationsFragment() },
{
PostFeedFragment<PublicFeedStatusDatabaseEntity>()
.apply {
arguments = Bundle().apply { putBoolean("home", false) }
}
}
)
setupTabs(tabs)
}
@ -269,10 +269,10 @@ class MainActivity : BaseActivity() {
}
private fun setupTabs(tab_array: List<Fragment>){
private fun setupTabs(tab_array: List<() -> Fragment>){
binding.viewPager.adapter = object : FragmentStateAdapter(this) {
override fun createFragment(position: Int): Fragment {
return tab_array[position]
return tab_array[position]()
}
override fun getItemCount(): Int {