Skip to content

Instantly share code, notes, and snippets.

@burakeregar
Created June 27, 2017 13:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save burakeregar/618152d6403ae40d182c16fdea90bb8b to your computer and use it in GitHub Desktop.
package com.base.di.module
import android.app.Application
import android.content.res.Resources
import dagger.Module
import dagger.Provides
import javax.inject.Singleton
import com.google.gson.Gson;
import com.google.gson.GsonBuilder
/**
* Created by Burak Eregar on 19.05.2017.
* burakeregar@gmail.com
* https://github.com/burakeregar
*/
@Module
class AppModule(val application: Application) {
@Provides
@Singleton
fun providesGson(): Gson = GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create()
@Provides
@Singleton
fun providesApplication(): Application = application
@Provides
@Singleton
fun providesResources(): Resources = application.resources
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment