This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import io.reactivex.Completable | |
import io.reactivex.observers.TestObserver | |
import io.reactivex.schedulers.Schedulers | |
import org.junit.Assert.assertEquals | |
import org.junit.Rule | |
import org.junit.Test | |
import java.util.concurrent.Executors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.stepstone.test.rule | |
import android.app.Activity | |
import android.content.Intent | |
import androidx.test.core.app.ActivityScenario | |
import org.junit.rules.ExternalResource | |
class LazyActivityScenarioRule<A : Activity> : ExternalResource { | |
constructor(launchActivity: Boolean, startActivityIntentSupplier: () -> Intent) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OfferFragment : DaggerFragment() { | |
@Inject lateinit var sharedPreferences: SharedPreferences, | |
@Inject lateinit var textProducer: TextProducer, | |
@Inject lateinit var someDep: SomeDep | |
// Fragment body | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OfferFragment | |
@Inject constructor( | |
private val sharedPreferences: SharedPreferences, | |
private val textProducer: TextProducer, | |
private val someDep: SomeDep | |
) : Fragment() { | |
// Fragment body | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<fragment | |
android:id="@+id/nav_host_fragment" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<fragment | |
android:id="@+id/nav_host_fragment" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OfferFragment | |
@Inject constructor( | |
private val sharedPreferences: SharedPreferences, | |
private val textProducer: TextProducer | |
) : Fragment() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
Timber.d("Constructor sharedPreferences: $sharedPreferences") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InjectingFragmentFactory | |
@Inject constructor( | |
private val creators: Map<Class<out Fragment>, @JvmSuppressWildcards Provider<Fragment>> | |
) : FragmentFactory() { | |
override fun instantiate(classLoader: ClassLoader, className: String): Fragment { | |
val fragmentClass = loadFragmentClass(classLoader, className) | |
val creator = creators[fragmentClass] | |
?: return createFragmentAsFallback(classLoader, className) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
abstract class FragmentBindingModule { | |
@Binds | |
@IntoMap | |
@FragmentKey(OfferFragment::class) | |
abstract fun bindMainFragment(mainFragment: OfferFragment): Fragment | |
@Binds | |
abstract fun bindFragmentFactory(factory: InjectingFragmentFactory): FragmentFactory |
NewerOlder