Convert AppModule to Kotlin
This commit is contained in:
parent
02069d8737
commit
50b494cef3
2 changed files with 24 additions and 29 deletions
|
@ -1,29 +0,0 @@
|
||||||
package com.wbrawner.simplemarkdown;
|
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.presentation.MarkdownPresenter;
|
|
||||||
import com.wbrawner.simplemarkdown.presentation.MarkdownPresenterImpl;
|
|
||||||
import com.wbrawner.simplemarkdown.utility.CrashlyticsErrorHandler;
|
|
||||||
import com.wbrawner.simplemarkdown.utility.ErrorHandler;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import dagger.Module;
|
|
||||||
import dagger.Provides;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by billy on 8/22/17.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Module
|
|
||||||
public class AppModule {
|
|
||||||
@Provides @Singleton
|
|
||||||
public MarkdownPresenter provideMarkdownPresenter(ErrorHandler errorHandler) {
|
|
||||||
return new MarkdownPresenterImpl(errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
ErrorHandler provideErrorHandler() {
|
|
||||||
return new CrashlyticsErrorHandler();
|
|
||||||
}
|
|
||||||
}
|
|
24
app/src/main/java/com/wbrawner/simplemarkdown/AppModule.kt
Normal file
24
app/src/main/java/com/wbrawner/simplemarkdown/AppModule.kt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package com.wbrawner.simplemarkdown
|
||||||
|
|
||||||
|
import com.wbrawner.simplemarkdown.presentation.MarkdownPresenter
|
||||||
|
import com.wbrawner.simplemarkdown.presentation.MarkdownPresenterImpl
|
||||||
|
import com.wbrawner.simplemarkdown.utility.CrashlyticsErrorHandler
|
||||||
|
import com.wbrawner.simplemarkdown.utility.ErrorHandler
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Module
|
||||||
|
class AppModule {
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideMarkdownPresenter(errorHandler: ErrorHandler): MarkdownPresenter {
|
||||||
|
return MarkdownPresenterImpl(errorHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
internal fun provideErrorHandler(): ErrorHandler {
|
||||||
|
return CrashlyticsErrorHandler()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue