Merge branch 'leak_canary' into 'master'

fix some leaks, try out leak_canary

See merge request pixeldroid/PixelDroid!336
This commit is contained in:
Matthieu 2021-05-08 18:22:12 +00:00
commit cd417250e5
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(
PostFeedFragment<HomeStatusDatabaseEntity>()
.apply {
arguments = Bundle().apply { putBoolean("home", true) }
}
,
SearchDiscoverFragment() ,
CameraFragment() ,
NotificationsFragment() ,
PostFeedFragment<PublicFeedStatusDatabaseEntity>()
.apply {
arguments = Bundle().apply { putBoolean("home", false) }
}
val tabs: List<() -> Fragment> = listOf(
{
PostFeedFragment<HomeStatusDatabaseEntity>()
.apply {
arguments = Bundle().apply { putBoolean("home", true) }
}
},
{ 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 {