Refactor the Authentication Screen
introduction of new theming / navigation / animation.
This commit is contained in:
parent
9074b78046
commit
2a69b75d9d
64 changed files with 1809 additions and 395 deletions
|
|
@ -0,0 +1,52 @@
|
|||
package com.pixelized.biblib.module
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.room.Room
|
||||
import com.pixelized.biblib.database.BibLibDatabase
|
||||
import com.pixelized.biblib.utils.BitmapCache
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
class PersistenceModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideDatabase(
|
||||
@ApplicationContext context: Context,
|
||||
): BibLibDatabase {
|
||||
val builder = Room.databaseBuilder(
|
||||
context,
|
||||
BibLibDatabase::class.java,
|
||||
BibLibDatabase.DATABASE_NAME
|
||||
)
|
||||
return builder.fallbackToDestructiveMigration().build()
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideBitmapCache(
|
||||
@ApplicationContext context: Context,
|
||||
): BitmapCache {
|
||||
return BitmapCache(context)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun providePreferences(
|
||||
@ApplicationContext context: Context,
|
||||
): SharedPreferences {
|
||||
return context.getSharedPreferences(SHARED_PREF, Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val SHARED_PREF = "BIB_LIB_SHARED_PREF"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue