title: How to inject DialogFragment with Dagger?
body: <p>please i am using dagger 2  for the DI  , how to inject dialog fragment into my activity , and how to use the DaggerDialogFragment class provided by dagger</p>
  
  <p>i create my DialogFragmentFactory </p>
  
  <pre><code> class DialogFragmentFactory @Inject constructor(
  private val providers: Map&lt;Class&lt;out Fragment&gt;, @JvmSuppressWildcards 
   Provider&lt;DialogFragment&gt;&gt;
   ) : FragmentFactory() {
  
  override fun instantiate(classLoader: ClassLoader, className: String): 
  Fragment {
      // loadFragmentClass is a static method of FragmentFactory
      // and will return the Class of the fragment
      val fragmentClass = loadFragmentClass(classLoader, className)
  
      // we will then be able to use fragmentClass to get the provider
      // of the Fragment from the providers map
      val provider = providers[fragmentClass]
  
      if (provider != null) {
          return provider.get()
      }
  
      // The provider for the fragment could be null
      // if the Fragment class is not binded to the Daggers graph
      // in this case, we will default to the default implementation
      // which will attempt to instantiate the Fragment
      // through the no-arg constructor
      return super.instantiate(classLoader, className)
     }
  }
  </code></pre>
  
  <p>and then i create my DialogFragment Module</p>
  
  <pre><code>  @Module
   class DialogFragmentsModule {
  
    @Singleton
    @Provides
    fun myDialogFragment() = MainAlertDialogFragment()
  
   }
  </code></pre>
  
  <p>i create this annontation </p>
  
  <pre><code>          @MustBeDocumented
  @Target(
      AnnotationTarget.FUNCTION,
      AnnotationTarget.PROPERTY_GETTER,
      AnnotationTarget.PROPERTY_SETTER
  )
  @Retention(AnnotationRetention.RUNTIME)
  @MapKey
  annotation class DialogFragmentKey(val value: KClass&lt;out DialogFragment&gt;)
  </code></pre>
  
  <p>i inject AndroidInjectionModule and AndroidSupportInjectionModule , ApplicationComponent ,DialogFragmentsModule</p>
  
  <p>this is my dialog fragment header </p>
  
  <pre><code> class MainAlertDialogFragment @Inject constructor() : 
   DaggerDialogFragment(), HasAndroidInjector {
  </code></pre>
  
  <p>and i wanna inject it like that </p>
  
  <pre><code>      @Inject
  lateinit var dialog: MainAlertDialogFragment
  </code></pre>