diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 75cb584..9db8803 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -7,7 +7,6 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.android.kotlin) alias(libs.plugins.kotlin.ksp) - alias(libs.plugins.hilt) alias(libs.plugins.kotlin.serialization) alias(libs.plugins.kotlin.parcelize) alias(libs.plugins.compose.compiler) @@ -121,6 +120,12 @@ android { } } applicationVariants.all { + val variantName = name + sourceSets { + getByName("main") { + java.srcDir(File("build/generated/ksp/$variantName/kotlin")) + } + } outputs.all { (this as com.android.build.gradle.internal.api.BaseVariantOutputImpl).outputFileName = "Metadator-${defaultConfig.versionName}-${name}.apk" @@ -128,8 +133,10 @@ android { } } + ksp { arg(RoomSchemaArgProvider(File(projectDir, "schemas"))) + arg("KOIN_CONFIG_CHECK", "true") } dependencies { @@ -160,9 +167,7 @@ dependencies { implementation(project(":app:mediaplayer")) //---------------Dependency Injection---------------// - implementation(libs.bundles.hilt) - ksp(libs.hilt.ext.compiler) - ksp(libs.hilt.compiler) + implementation(libs.bundles.koin) //-------------------Database-------------------// implementation(libs.room.runtime) diff --git a/app/mediaplayer/build.gradle.kts b/app/mediaplayer/build.gradle.kts index c389eb3..674f17f 100644 --- a/app/mediaplayer/build.gradle.kts +++ b/app/mediaplayer/build.gradle.kts @@ -2,7 +2,6 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.android.kotlin) alias(libs.plugins.kotlin.ksp) - alias(libs.plugins.hilt) alias(libs.plugins.compose.compiler) } @@ -26,6 +25,14 @@ android { ) } } + libraryVariants.all { + val variantName = name + sourceSets { + getByName("main") { + java.srcDir(File("build/generated/ksp/$variantName/kotlin")) + } + } + } compileOptions { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 @@ -35,15 +42,17 @@ android { } } +ksp { + arg("KOIN_CONFIG_CHECK", "true") +} + dependencies { implementation(libs.core.ktx) implementation(libs.core.appcompat) implementation(libs.androidx.legacy.support.v4) // Needed MediaSessionCompat.Token //DI (Dependency Injection - Hilt) - implementation(libs.bundles.hilt) - ksp(libs.hilt.ext.compiler) - ksp(libs.hilt.compiler) + implementation(libs.bundles.koin) //Media3 implementation(libs.bundles.media3) diff --git a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/di/MediaPlayerModule.kt b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/di/MediaPlayerModule.kt index c11fc21..0ee3eb4 100644 --- a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/di/MediaPlayerModule.kt +++ b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/di/MediaPlayerModule.kt @@ -1,10 +1,6 @@ -package com.bobbyesp.mediaplayer.di - import android.app.PendingIntent -import android.content.Context import android.os.Build import androidx.annotation.OptIn -import androidx.annotation.RequiresApi import androidx.media3.common.AudioAttributes import androidx.media3.common.C import androidx.media3.common.util.UnstableApi @@ -17,87 +13,69 @@ import com.bobbyesp.mediaplayer.service.MediaServiceHandler import com.bobbyesp.mediaplayer.service.notifications.MediaNotificationManager import com.bobbyesp.mediaplayer.service.notifications.customLayout.MediaSessionLayoutHandler import com.bobbyesp.mediaplayer.service.notifications.customLayout.MediaSessionLayoutHandlerImpl -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 +import org.koin.android.ext.koin.androidContext +import org.koin.core.module.Module +import org.koin.dsl.module @OptIn(UnstableApi::class) -@Module -@InstallIn(SingletonComponent::class) -object MediaPlayerModule { - @Provides - @Singleton - fun provideAudioAttributes(): AudioAttributes = - AudioAttributes.Builder().setContentType(C.AUDIO_CONTENT_TYPE_MOVIE).setUsage(C.USAGE_MEDIA) +val mediaplayerInternalsModule: Module = module { + single { + AudioAttributes.Builder() + .setContentType(C.AUDIO_CONTENT_TYPE_MUSIC) + .setUsage(C.USAGE_MEDIA) .build() + } - @Provides - @Singleton - @UnstableApi - fun providePlayer( - @ApplicationContext context: Context, audioAttributes: AudioAttributes - ): ExoPlayer = ExoPlayer.Builder(context) - .setSeekBackIncrementMs(5000) - .setSeekForwardIncrementMs(5000) - .setAudioAttributes(audioAttributes, true) - .setHandleAudioBecomingNoisy(true) - .setTrackSelector(DefaultTrackSelector(context)) - .setAudioAttributes( - AudioAttributes.Builder() - .setUsage(C.USAGE_MEDIA) - .setContentType(C.AUDIO_CONTENT_TYPE_MUSIC) - .build(), true - ) - .build() - - @RequiresApi(Build.VERSION_CODES.O) - @Provides - @Singleton - fun provideNotificationManager( - @ApplicationContext context: Context, player: ExoPlayer - ): MediaNotificationManager = MediaNotificationManager( - context = context, player = player - ) - - @Provides - @Singleton - fun provideMediaLibrarySession( - @ApplicationContext context: Context, - player: ExoPlayer, - mediaLibrarySessionCallback: MediaLibrarySessionCallback, - ): MediaLibrarySession = - MediaLibrarySession.Builder(context, player, mediaLibrarySessionCallback) - .setSessionActivity( - PendingIntent.getActivity( - context, - 0, - context.packageManager.getLaunchIntentForPackage(context.packageName), - PendingIntent.FLAG_IMMUTABLE - ) + single { + ExoPlayer.Builder(androidContext()) + .setSeekBackIncrementMs(5000) + .setSeekForwardIncrementMs(5000) + .setAudioAttributes(get(), true) + .setHandleAudioBecomingNoisy(true) + .setTrackSelector(DefaultTrackSelector(androidContext())) + .setAudioAttributes( + get(), + true ) .build() + } - @Provides - @Singleton - fun provideServiceHandler( - player: ExoPlayer - ): MediaServiceHandler = + single { MediaServiceHandler( - player = player + player = get() ) + } - @Provides - @Singleton - fun provideConnectionHandler(): ConnectionHandler = ConnectionHandler() + single { ConnectionHandler() } - @Provides - @Singleton - fun provideMediaSessionLayoutHandler( - @ApplicationContext context: Context, - mediaLibrarySession: MediaLibrarySession - ): MediaSessionLayoutHandler = - MediaSessionLayoutHandlerImpl(context, mediaLibrarySession) -} \ No newline at end of file + single { + MediaLibrarySession.Builder( + androidContext(), + get(), + MediaLibrarySessionCallback(androidContext()) + ).setSessionActivity( + PendingIntent.getActivity( + androidContext(), + 0, + androidContext().packageManager.getLaunchIntentForPackage(androidContext().packageName), + PendingIntent.FLAG_IMMUTABLE + ) + ).build() + } + + single { + MediaSessionLayoutHandlerImpl( + androidContext(), + get() + ) + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + single { + MediaNotificationManager( + context = androidContext(), + player = get() + ) + } + } +} diff --git a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaLibrarySessionCallback.kt b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaLibrarySessionCallback.kt index 72fc96f..1a584a5 100644 --- a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaLibrarySessionCallback.kt +++ b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaLibrarySessionCallback.kt @@ -17,12 +17,11 @@ import com.bobbyesp.mediaplayer.service.MediaSessionConstants.CommandToggleRepea import com.bobbyesp.mediaplayer.service.MediaSessionConstants.CommandToggleShuffle import com.google.common.util.concurrent.Futures import com.google.common.util.concurrent.ListenableFuture -import dagger.hilt.android.qualifiers.ApplicationContext -import javax.inject.Inject +import org.koin.core.component.KoinComponent -class MediaLibrarySessionCallback @Inject constructor( - @ApplicationContext val context: Context, -) : MediaLibrarySession.Callback { +class MediaLibrarySessionCallback( + val context: Context, +) : KoinComponent, MediaLibrarySession.Callback { private val availableCommands = listOf( CommandToggleShuffle, diff --git a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaServiceHandler.kt b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaServiceHandler.kt index b8dbb52..58e3e6f 100644 --- a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaServiceHandler.kt +++ b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaServiceHandler.kt @@ -27,7 +27,7 @@ import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import javax.inject.Inject +import org.koin.core.component.KoinComponent /** * This class is responsible for handling media playback events and managing the state of the media player. @@ -35,9 +35,9 @@ import javax.inject.Inject * It also provides methods to manage the media queue such as set, add, and remove media items. */ @UnstableApi -class MediaServiceHandler @Inject constructor( +class MediaServiceHandler( private val player: ExoPlayer -) : Player.Listener, PlaybackStatsListener.Callback { +) : KoinComponent, Player.Listener, PlaybackStatsListener.Callback { private val _mediaState = MutableStateFlow(MediaState.Idle) val mediaState = _mediaState.asStateFlow() diff --git a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaplayerService.kt b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaplayerService.kt index 8fb6fbf..c78160b 100644 --- a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaplayerService.kt +++ b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/MediaplayerService.kt @@ -10,26 +10,16 @@ import androidx.media3.session.MediaSession import com.bobbyesp.mediaplayer.service.notifications.MediaNotificationManager import com.bobbyesp.mediaplayer.service.notifications.customLayout.MediaSessionLayoutHandler import com.google.common.util.concurrent.MoreExecutors -import dagger.hilt.android.AndroidEntryPoint -import javax.inject.Inject +import org.koin.android.ext.android.inject @UnstableApi -@AndroidEntryPoint class MediaplayerService : MediaLibraryService(), MediaController.Listener { - @Inject - lateinit var mediaSession: MediaLibrarySession - @Inject - lateinit var mediaServiceHandler: MediaServiceHandler - - @Inject - lateinit var notificationManager: MediaNotificationManager - - @Inject - lateinit var mediaSessionLayoutHandler: MediaSessionLayoutHandler - - @Inject - lateinit var connectionHandler: ConnectionHandler + val mediaSession: MediaLibrarySession by inject() + val mediaServiceHandler: MediaServiceHandler by inject() + val notificationManager: MediaNotificationManager by inject() + val mediaSessionLayoutHandler: MediaSessionLayoutHandler by inject() + val connectionHandler: ConnectionHandler by inject() /** * This method is called by the system every time a client explicitly starts the service by calling diff --git a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/notifications/MediaNotificationManager.kt b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/notifications/MediaNotificationManager.kt index 12c7b8d..d581655 100644 --- a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/notifications/MediaNotificationManager.kt +++ b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/notifications/MediaNotificationManager.kt @@ -16,15 +16,13 @@ import androidx.media3.session.MediaSession import androidx.media3.session.MediaSessionService import androidx.media3.ui.PlayerNotificationManager import com.bobbyesp.mediaplayer.R -import dagger.hilt.android.qualifiers.ApplicationContext -import javax.inject.Inject +import org.koin.core.component.KoinComponent @UnstableApi -class MediaNotificationManager @OptIn(UnstableApi::class) -@Inject constructor( - @ApplicationContext private val context: Context, +class MediaNotificationManager @OptIn(UnstableApi::class) constructor( + private val context: Context, private val player: ExoPlayer -) { +) : KoinComponent { private val notificationManager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager diff --git a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/notifications/customLayout/MediaSessionLayoutHandlerImpl.kt b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/notifications/customLayout/MediaSessionLayoutHandlerImpl.kt index bc85fe6..1833883 100644 --- a/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/notifications/customLayout/MediaSessionLayoutHandlerImpl.kt +++ b/app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/notifications/customLayout/MediaSessionLayoutHandlerImpl.kt @@ -11,13 +11,12 @@ import com.bobbyesp.mediaplayer.R import com.bobbyesp.mediaplayer.service.MediaSessionConstants.CommandToggleRepeatMode import com.bobbyesp.mediaplayer.service.MediaSessionConstants.CommandToggleShuffle import com.google.common.collect.ImmutableList -import dagger.hilt.android.qualifiers.ApplicationContext -import javax.inject.Inject +import org.koin.core.component.KoinComponent -class MediaSessionLayoutHandlerImpl @Inject constructor( - @ApplicationContext private val context: Context, +class MediaSessionLayoutHandlerImpl( + private val context: Context, private val mediaSession: MediaLibraryService.MediaLibrarySession, -) : MediaSessionLayoutHandler { +) : KoinComponent, MediaSessionLayoutHandler { override fun updateNotificationLayout() { val commandButtons = ImmutableList.of( diff --git a/app/src/main/java/com/bobbyesp/metadator/App.kt b/app/src/main/java/com/bobbyesp/metadator/App.kt index d96f276..3e04b4f 100644 --- a/app/src/main/java/com/bobbyesp/metadator/App.kt +++ b/app/src/main/java/com/bobbyesp/metadator/App.kt @@ -9,16 +9,30 @@ import android.os.Build import androidx.core.content.getSystemService import com.bobbyesp.crashhandler.CrashHandler.setupCrashHandler import com.bobbyesp.crashhandler.ReportInfo +import com.bobbyesp.metadator.di.appMainViewModels +import com.bobbyesp.metadator.di.mediaplayerViewModels +import com.bobbyesp.metadator.di.utilitiesViewModels +import com.bobbyesp.metadator.features.spotify.di.spotifyMainModule +import com.bobbyesp.metadator.features.spotify.di.spotifyServicesModule import com.tencent.mmkv.MMKV -import dagger.hilt.android.HiltAndroidApp import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.SupervisorJob +import mediaplayerInternalsModule +import org.koin.android.ext.koin.androidContext +import org.koin.android.ext.koin.androidLogger +import org.koin.core.context.GlobalContext.startKoin import kotlin.properties.Delegates -@HiltAndroidApp class App : Application() { override fun onCreate() { MMKV.initialize(this) + startKoin { + androidLogger() + androidContext(this@App) + modules(mediaplayerInternalsModule) + modules(appMainViewModels, utilitiesViewModels, mediaplayerViewModels) + modules(spotifyMainModule, spotifyServicesModule) + } packageInfo = packageManager.run { if (Build.VERSION.SDK_INT >= 33) getPackageInfo( packageName, PackageManager.PackageInfoFlags.of(0) diff --git a/app/src/main/java/com/bobbyesp/metadator/MainActivity.kt b/app/src/main/java/com/bobbyesp/metadator/MainActivity.kt index a1916ab..ae24897 100644 --- a/app/src/main/java/com/bobbyesp/metadator/MainActivity.kt +++ b/app/src/main/java/com/bobbyesp/metadator/MainActivity.kt @@ -12,43 +12,36 @@ import androidx.activity.enableEdgeToEdge import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen -import androidx.core.view.ViewCompat -import androidx.core.view.WindowCompat import androidx.media3.common.util.UnstableApi import com.bobbyesp.mediaplayer.service.ConnectionHandler import com.bobbyesp.mediaplayer.service.MediaplayerService import com.bobbyesp.metadator.presentation.Navigator import com.bobbyesp.metadator.presentation.common.AppLocalSettingsProvider import com.bobbyesp.metadator.presentation.theme.MetadatorTheme -import dagger.hilt.android.AndroidEntryPoint +import org.koin.android.ext.android.inject +import org.koin.compose.KoinContext import setCrashlyticsCollection -import javax.inject.Inject @androidx.annotation.OptIn(UnstableApi::class) -@AndroidEntryPoint class MainActivity : ComponentActivity() { private var isMusicPlayerServiceStarted = false - @Inject - lateinit var connectionHandler: ConnectionHandler + private val connectionHandler: ConnectionHandler by inject() @OptIn(ExperimentalMaterial3WindowSizeClassApi::class) override fun onCreate(savedInstanceState: Bundle?) { installSplashScreen() enableEdgeToEdge() super.onCreate(savedInstanceState) - WindowCompat.setDecorFitsSystemWindows(window, false) - ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { view, insets -> - view.setPadding(0, 0, 0, 0) - insets - } activity = this setCrashlyticsCollection() setContent { - val windowSizeClass = calculateWindowSizeClass(this) - AppLocalSettingsProvider(windowSizeClass.widthSizeClass, connectionHandler) { - MetadatorTheme { - Navigator() + KoinContext { + val windowSizeClass = calculateWindowSizeClass(this) + AppLocalSettingsProvider(windowSizeClass.widthSizeClass, connectionHandler) { + MetadatorTheme { + Navigator() + } } } } @@ -93,7 +86,6 @@ class MainActivity : ComponentActivity() { } } - companion object { private lateinit var activity: MainActivity fun getActivity(): MainActivity = activity diff --git a/app/src/main/java/com/bobbyesp/metadator/di/ViewModelsModule.kt b/app/src/main/java/com/bobbyesp/metadator/di/ViewModelsModule.kt new file mode 100644 index 0000000..f6805b1 --- /dev/null +++ b/app/src/main/java/com/bobbyesp/metadator/di/ViewModelsModule.kt @@ -0,0 +1,21 @@ +package com.bobbyesp.metadator.di + +import com.bobbyesp.metadator.presentation.pages.MediaStorePageViewModel +import com.bobbyesp.metadator.presentation.pages.mediaplayer.MediaplayerViewModel +import com.bobbyesp.metadator.presentation.pages.utilities.tageditor.MetadataEditorVM +import com.bobbyesp.metadator.presentation.pages.utilities.tageditor.spotify.MetadataBsVM +import org.koin.core.module.dsl.viewModel +import org.koin.dsl.module + +val appMainViewModels = module { + viewModel { MediaStorePageViewModel(get()) } +} + +val utilitiesViewModels = module { + viewModel { MetadataEditorVM(get(), get()) } + viewModel { MetadataBsVM(get()) } +} + +val mediaplayerViewModels = module { + viewModel { MediaplayerViewModel(get(), get(), get(), get()) } +} \ No newline at end of file diff --git a/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/remote/SpotifyServiceImpl.kt b/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/remote/SpotifyServiceImpl.kt index 1edb8c3..8149fa4 100644 --- a/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/remote/SpotifyServiceImpl.kt +++ b/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/remote/SpotifyServiceImpl.kt @@ -7,12 +7,15 @@ import com.adamratzman.spotify.models.Token import com.adamratzman.spotify.spotifyAppApi import com.bobbyesp.metadator.features.spotify.domain.services.SpotifyService import com.bobbyesp.utilities.Logging.isDebug -import javax.inject.Inject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject +import org.koin.core.qualifier.named + +class SpotifyServiceImpl : SpotifyService, KoinComponent { + + private val clientId: String by inject(named("client_id")) + private val clientSecret: String by inject(named("client_secret")) -class SpotifyServiceImpl @Inject constructor( - private val clientId: String, - private val clientSecret: String -) : SpotifyService { private var token: Token? = null private var api: SpotifyAppApi? = null diff --git a/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/remote/search/SpotifySearchServiceImpl.kt b/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/remote/search/SpotifySearchServiceImpl.kt index 31011e7..a5da7e2 100644 --- a/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/remote/search/SpotifySearchServiceImpl.kt +++ b/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/remote/search/SpotifySearchServiceImpl.kt @@ -9,11 +9,12 @@ import com.adamratzman.spotify.models.Track import com.bobbyesp.metadator.features.spotify.domain.pagination.TracksPagingSource import com.bobbyesp.metadator.features.spotify.domain.services.SpotifyService import com.bobbyesp.metadator.features.spotify.domain.services.search.SpotifySearchService -import javax.inject.Inject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject + +class SpotifySearchServiceImpl : SpotifySearchService, KoinComponent { + private val spotifyService by inject() -class SpotifySearchServiceImpl @Inject constructor( - private val spotifyService: SpotifyService, -) : SpotifySearchService { override suspend fun search( query: String, vararg searchTypes: SearchApi.SearchType, diff --git a/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/repository/SearchRepositoryImpl.kt b/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/repository/SearchRepositoryImpl.kt index 2bc9509..c992070 100644 --- a/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/repository/SearchRepositoryImpl.kt +++ b/app/src/main/java/com/bobbyesp/metadator/features/spotify/data/repository/SearchRepositoryImpl.kt @@ -4,11 +4,12 @@ import com.adamratzman.spotify.endpoints.pub.SearchApi import com.adamratzman.spotify.models.Track import com.bobbyesp.metadator.features.spotify.domain.repositories.SearchRepository import com.bobbyesp.metadator.features.spotify.domain.services.search.SpotifySearchService -import javax.inject.Inject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject + +class SearchRepositoryImpl : SearchRepository, KoinComponent { + private val searchService by inject() -class SearchRepositoryImpl @Inject constructor( - private val searchService: SpotifySearchService -) : SearchRepository { /** * Search for tracks on Spotify. The search does support pagination but this implementation * does not support it. For now, it will only return up to 50 results. diff --git a/app/src/main/java/com/bobbyesp/metadator/features/spotify/di/SpotifyModule.kt b/app/src/main/java/com/bobbyesp/metadator/features/spotify/di/SpotifyModule.kt index fd9b1f1..9c7ba2e 100644 --- a/app/src/main/java/com/bobbyesp/metadator/features/spotify/di/SpotifyModule.kt +++ b/app/src/main/java/com/bobbyesp/metadator/features/spotify/di/SpotifyModule.kt @@ -5,42 +5,15 @@ import com.bobbyesp.metadator.features.spotify.data.remote.SpotifyServiceImpl import com.bobbyesp.metadator.features.spotify.data.remote.search.SpotifySearchServiceImpl import com.bobbyesp.metadator.features.spotify.domain.services.SpotifyService import com.bobbyesp.metadator.features.spotify.domain.services.search.SpotifySearchService -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import javax.inject.Named -import javax.inject.Singleton +import org.koin.core.qualifier.named +import org.koin.dsl.module -@Module -@InstallIn(SingletonComponent::class) -object SpotifyModule { - @Provides - @Named("client_id") - fun provideClientId(): String { - return BuildConfig.CLIENT_ID - } +val spotifyMainModule = module { + single(named("client_id")) { BuildConfig.CLIENT_ID } + single(named("client_secret")) { BuildConfig.CLIENT_SECRET } + single { SpotifyServiceImpl() } +} - @Provides - @Named("client_secret") - fun provideClientSecret(): String { - return BuildConfig.CLIENT_SECRET - } - - @Provides - @Singleton - fun provideSpotifyApiService( - @Named("client_id") clientId: String, - @Named("client_secret") clientSecret: String - ): SpotifyService { - return SpotifyServiceImpl(clientId, clientSecret) - } - - @Provides - @Singleton - fun provideSpotifySearchService( - spotifyService: SpotifyService, - ): SpotifySearchService { - return SpotifySearchServiceImpl(spotifyService) - } +val spotifyServicesModule = module { + single { SpotifySearchServiceImpl() } } \ No newline at end of file diff --git a/app/src/main/java/com/bobbyesp/metadator/features/spotify/di/SpotifyRepositoriesModule.kt b/app/src/main/java/com/bobbyesp/metadator/features/spotify/di/SpotifyRepositoriesModule.kt deleted file mode 100644 index 9d9dc24..0000000 --- a/app/src/main/java/com/bobbyesp/metadator/features/spotify/di/SpotifyRepositoriesModule.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.bobbyesp.metadator.features.spotify.di - -import com.bobbyesp.metadator.features.spotify.data.repository.SearchRepositoryImpl -import com.bobbyesp.metadator.features.spotify.domain.repositories.SearchRepository -import com.bobbyesp.metadator.features.spotify.domain.services.search.SpotifySearchService -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import javax.inject.Singleton - -@Module -@InstallIn(SingletonComponent::class) -object SpotifyRepositoriesModule { - @Provides - @Singleton - fun provideSearchRepository( - spotifySearchService: SpotifySearchService, - ): SearchRepository { - return SearchRepositoryImpl(spotifySearchService) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/Navigation.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/Navigation.kt index 073fb29..f0303af 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/Navigation.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/Navigation.kt @@ -55,7 +55,6 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.util.fastAny -import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.NavGraph.Companion.findStartDestination import androidx.navigation.NavGraphBuilder @@ -92,9 +91,10 @@ import com.bobbyesp.ui.motion.slideInVerticallyComposable import com.bobbyesp.utilities.navigation.parcelableType import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch +import org.koin.androidx.compose.koinViewModel import kotlin.reflect.typeOf -@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") +@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter", "UnusedBoxWithConstraintsScope") @Composable fun Navigator() { val navController = LocalNavController.current @@ -122,8 +122,8 @@ fun Navigator() { mutableStateOf(mainNavigators.fastAny { navigator -> navigator.qualifiedName() == currentNavigator.value }) } - val mediaStoreViewModel = hiltViewModel() - val mediaplayerViewModel = hiltViewModel() + val mediaStoreViewModel = koinViewModel() + val mediaplayerViewModel = koinViewModel() val density = LocalDensity.current val windowsInsets = WindowInsets.systemBars @@ -224,8 +224,9 @@ fun Navigator() { } }, icon = { - Icon(imageVector = destinationInfo?.icon - ?: Icons.Rounded.Square, + Icon( + imageVector = destinationInfo?.icon + ?: Icons.Rounded.Square, contentDescription = destinationInfo?.title?.let { stringResource(id = it) }) @@ -291,27 +292,28 @@ fun Navigator() { } }, ) { - Scaffold(modifier = Modifier.windowInsetsPadding( - insets = WindowInsets( - left = WindowInsets.safeDrawing.getLeft( - density, layoutDirection = LocalLayoutDirection.current - ), - right = WindowInsets.safeDrawing.getRight( - density, layoutDirection = LocalLayoutDirection.current - ), - ) - ), snackbarHost = { - SnackbarHost( - hostState = snackbarHostState - ) { dataReceived -> - Snackbar( - modifier = Modifier, - snackbarData = dataReceived, - containerColor = MaterialTheme.colorScheme.inverseSurface, - contentColor = MaterialTheme.colorScheme.inverseOnSurface, + Scaffold( + modifier = Modifier.windowInsetsPadding( + insets = WindowInsets( + left = WindowInsets.safeDrawing.getLeft( + density, layoutDirection = LocalLayoutDirection.current + ), + right = WindowInsets.safeDrawing.getRight( + density, layoutDirection = LocalLayoutDirection.current + ), ) - } - }) { + ), snackbarHost = { + SnackbarHost( + hostState = snackbarHostState + ) { dataReceived -> + Snackbar( + modifier = Modifier, + snackbarData = dataReceived, + containerColor = MaterialTheme.colorScheme.inverseSurface, + contentColor = MaterialTheme.colorScheme.inverseOnSurface, + ) + } + }) { NavHost( modifier = Modifier .fillMaxWidth() @@ -358,8 +360,8 @@ fun NavGraphBuilder.utilitiesNavigation( ) { val song = it.toRoute() - val viewModel = hiltViewModel() - val bsViewModel = hiltViewModel() + val viewModel = koinViewModel() + val bsViewModel = koinViewModel() val state = viewModel.state.collectAsStateWithLifecycle() val bsState = bsViewModel.viewStateFlow.collectAsStateWithLifecycle() diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStorePage.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStorePage.kt index 7077cc4..f4fa49c 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStorePage.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStorePage.kt @@ -81,11 +81,13 @@ fun MediaStorePage( .background(MaterialTheme.colorScheme.background), state = lazyGridState ) { - items(count = songsList.size, + items( + count = songsList.size, key = { index -> songsList[index].id }, contentType = { index -> songsList[index].id.toString() }) { index -> val song = songsList[index] - VerticalSongCard(song = song, + VerticalSongCard( + song = song, modifier = Modifier.animateItem( fadeInSpec = null, fadeOutSpec = null ), @@ -111,11 +113,13 @@ fun MediaStorePage( .background(MaterialTheme.colorScheme.background), state = lazyListState, ) { - items(count = songsList.size, + items( + count = songsList.size, key = { index -> songsList[index].id }, contentType = { index -> songsList[index].id.toString() }) { index -> val song = songsList[index] - HorizontalSongCard(song = song, + HorizontalSongCard( + song = song, modifier = Modifier.animateItem( fadeInSpec = null, fadeOutSpec = null ), diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStoreViewModel.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStorePageViewModel.kt similarity index 81% rename from app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStoreViewModel.kt rename to app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStorePageViewModel.kt index 83a4b53..96b5849 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStoreViewModel.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/MediaStorePageViewModel.kt @@ -6,27 +6,23 @@ import androidx.lifecycle.viewModelScope import com.bobbyesp.utilities.mediastore.MediaStoreReceiver.Advanced.observeSongs import com.bobbyesp.utilities.model.Song import com.bobbyesp.utilities.states.ResourceState -import dagger.hilt.android.lifecycle.HiltViewModel -import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch -import javax.inject.Inject +import org.koin.core.component.KoinComponent -@HiltViewModel -class MediaStorePageViewModel @Inject constructor( - @ApplicationContext private val applicationContext: Context -) : ViewModel() { +class MediaStorePageViewModel( + context: Context +) : KoinComponent, ViewModel() { private val _songs: MutableStateFlow>> = MutableStateFlow(ResourceState.Loading()) val songs = _songs.asStateFlow() private val mediaStoreSongsFlow = - applicationContext.contentResolver.observeSongs() - + context.contentResolver.observeSongs() private fun songsCollection() { viewModelScope.launch(Dispatchers.IO) { diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/home/HomePage.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/home/HomePage.kt index 1819246..128f93e 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/home/HomePage.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/home/HomePage.kt @@ -59,6 +59,7 @@ import com.bobbyesp.metadator.presentation.common.LocalNavController import com.bobbyesp.metadator.presentation.common.Route import com.bobbyesp.metadator.presentation.pages.MediaStorePage import com.bobbyesp.metadator.presentation.pages.MediaStorePageViewModel +import com.bobbyesp.metadator.presentation.pages.home.LayoutType.entries import com.bobbyesp.ui.components.dropdown.AnimatedDropdownMenu import com.bobbyesp.ui.components.dropdown.DropdownItemContainer import com.bobbyesp.ui.components.text.AutoResizableText diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/MediaplayerPage.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/MediaplayerPage.kt index b6d77ec..b070b55 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/MediaplayerPage.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/MediaplayerPage.kt @@ -140,7 +140,8 @@ fun MediaplayerPage( contentPadding = PaddingValues(horizontal = 8.dp), state = mediaStoreLazyColumnState, ) { - items(count = songs.size, + items( + count = songs.size, key = { index -> songs[index].id }, contentType = { index -> songs[index].id.toString() }) { index -> val song = songs[index] diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/MediaplayerViewModel.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/MediaplayerViewModel.kt index 7ba4f4e..900e21a 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/MediaplayerViewModel.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/MediaplayerViewModel.kt @@ -20,8 +20,6 @@ import com.bobbyesp.utilities.Time.formatDuration import com.bobbyesp.utilities.mediastore.MediaStoreReceiver.Advanced.getSongs import com.bobbyesp.utilities.mediastore.MediaStoreReceiver.Advanced.observeSongs import com.bobbyesp.utilities.model.Song -import dagger.hilt.android.lifecycle.HiltViewModel -import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow @@ -29,12 +27,10 @@ import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import java.io.File -import javax.inject.Inject @OptIn(UnstableApi::class) -@HiltViewModel -class MediaplayerViewModel @Inject constructor( - @ApplicationContext private val applicationContext: Context, +class MediaplayerViewModel( + private val applicationContext: Context, private val serviceHandler: MediaServiceHandler, private val mediaSession: MediaLibrarySession, val connectionHandler: ConnectionHandler diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/player/PlayerControls.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/player/PlayerControls.kt index fe9f246..b68e8b1 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/player/PlayerControls.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/player/PlayerControls.kt @@ -100,9 +100,10 @@ fun PlayerControls( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(4.dp) ) { - transition.AnimatedContent(modifier = Modifier - .padding(horizontal = 24.dp) - .align(Alignment.Start), + transition.AnimatedContent( + modifier = Modifier + .padding(horizontal = 24.dp) + .align(Alignment.Start), transitionSpec = { AnimatedTextContentTransformation }) { Column { Text( @@ -199,7 +200,8 @@ fun PlayerControls( isShuffleEnabled = isShuffleEnabled ) } - IconButton(modifier = Modifier.size(SeekToButtonSize), + IconButton( + modifier = Modifier.size(SeekToButtonSize), onClick = { viewModel.seekToPrevious() }) { Icon( modifier = Modifier.fillMaxSize(), diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/player/views/MiniplayerContent.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/player/views/MiniplayerContent.kt index a07e7c8..4025773 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/player/views/MiniplayerContent.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/mediaplayer/player/views/MiniplayerContent.kt @@ -103,9 +103,10 @@ fun MiniplayerContent( } } - DynamicButton(modifier = Modifier - .size(42.dp) - .padding(4.dp), icon = { + DynamicButton( + modifier = Modifier + .size(42.dp) + .padding(4.dp), icon = { Icon( imageVector = Icons.Rounded.Pause, contentDescription = stringResource( diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorPage.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorPage.kt index f2a53f6..2d724a2 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorPage.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorPage.kt @@ -235,15 +235,16 @@ fun MetadataEditorPage( .padding(8.dp), contentAlignment = Alignment.BottomEnd ) { - IconButton(colors = IconButtonDefaults.iconButtonColors( - containerColor = Color.Black.copy(alpha = 0.5f) - ), onClick = { - singleImagePickerLauncher.launch( - PickVisualMediaRequest( - ActivityResultContracts.PickVisualMedia.ImageOnly + IconButton( + colors = IconButtonDefaults.iconButtonColors( + containerColor = Color.Black.copy(alpha = 0.5f) + ), onClick = { + singleImagePickerLauncher.launch( + PickVisualMediaRequest( + ActivityResultContracts.PickVisualMedia.ImageOnly + ) ) - ) - }) { + }) { Icon( imageVector = Icons.Rounded.Edit, tint = Color.White.harmonize(Color.Black.copy(alpha = 0.5f)), @@ -291,15 +292,16 @@ fun MetadataEditorPage( .padding(8.dp), contentAlignment = Alignment.BottomEnd ) { - IconButton(colors = IconButtonDefaults.iconButtonColors( - containerColor = Color.Black.copy(alpha = 0.5f) - ), onClick = { - singleImagePickerLauncher.launch( - PickVisualMediaRequest( - ActivityResultContracts.PickVisualMedia.ImageOnly + IconButton( + colors = IconButtonDefaults.iconButtonColors( + containerColor = Color.Black.copy(alpha = 0.5f) + ), onClick = { + singleImagePickerLauncher.launch( + PickVisualMediaRequest( + ActivityResultContracts.PickVisualMedia.ImageOnly + ) ) - ) - }) { + }) { Icon( imageVector = Icons.Rounded.Edit, tint = Color.White.harmonize(Color.Black.copy(alpha = 0.5f)), diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorVM.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorVM.kt index c05d74c..83ae422 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorVM.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorVM.kt @@ -24,26 +24,22 @@ import com.kyant.taglib.Metadata import com.kyant.taglib.Picture import com.kyant.taglib.PropertyMap import com.kyant.taglib.TagLib -import dagger.hilt.android.lifecycle.HiltViewModel -import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.asSharedFlow -import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import javax.inject.Inject +import org.koin.core.component.KoinComponent -@HiltViewModel -class MetadataEditorVM @Inject constructor( - @ApplicationContext private val context: Context, +class MetadataEditorVM( + private val context: Context, private val stateHandle: SavedStateHandle -) : ViewModel() { +) : KoinComponent, ViewModel() { private val mutableState = MutableStateFlow(PageViewState()) val state = mutableState.onStart { stateHandle.get("path")?.let { diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/spotify/MetadataBsVM.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/spotify/MetadataBsVM.kt index d26c0dd..49a222b 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/spotify/MetadataBsVM.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/spotify/MetadataBsVM.kt @@ -7,7 +7,6 @@ import androidx.paging.cachedIn import com.adamratzman.spotify.models.Track import com.bobbyesp.metadator.features.spotify.domain.services.search.SpotifySearchService import com.bobbyesp.utilities.states.ResourceState -import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow @@ -16,12 +15,11 @@ import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch -import javax.inject.Inject +import org.koin.core.component.KoinComponent -@HiltViewModel -class MetadataBsVM @Inject constructor( +class MetadataBsVM( private val searchService: SpotifySearchService -) : ViewModel() { +) : KoinComponent, ViewModel() { private val mutableViewStateFlow = MutableStateFlow(ViewState()) val viewStateFlow = mutableViewStateFlow.asStateFlow() diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/spotify/stages/SpMetadataBsSearch.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/spotify/stages/SpMetadataBsSearch.kt index ebee04c..f185f26 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/spotify/stages/SpMetadataBsSearch.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/spotify/stages/SpMetadataBsSearch.kt @@ -78,7 +78,9 @@ fun SpMetadataBsSearch( horizontalArrangement = Arrangement.Center ) { // TODO: Be able to change the query Row( - modifier = Modifier.fillMaxWidth().padding(4.dp), + modifier = Modifier + .fillMaxWidth() + .padding(4.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), ) { Column( diff --git a/app/ui/src/main/java/com/bobbyesp/ui/components/dropdown/DropdownMenuImplementation.kt b/app/ui/src/main/java/com/bobbyesp/ui/components/dropdown/DropdownMenuImplementation.kt index d88db36..1b26808 100644 --- a/app/ui/src/main/java/com/bobbyesp/ui/components/dropdown/DropdownMenuImplementation.kt +++ b/app/ui/src/main/java/com/bobbyesp/ui/components/dropdown/DropdownMenuImplementation.kt @@ -466,9 +466,10 @@ fun DropdownMenuContent( durationMillis = DURATION_EXIT, easing = EmphasizedAccelerate ), shrinkTowards = Alignment.Top, - ) + slideOutVertically(animationSpec = tween( - durationMillis = DURATION_EXIT, easing = EmphasizedAccelerate - ), targetOffsetY = { -it / 10 }), modifier = Modifier + ) + slideOutVertically( + animationSpec = tween( + durationMillis = DURATION_EXIT, easing = EmphasizedAccelerate + ), targetOffsetY = { -it / 10 }), modifier = Modifier ) { Column( modifier = Modifier diff --git a/app/ui/src/main/java/com/bobbyesp/ui/components/preferences/PreferencesItems.kt b/app/ui/src/main/java/com/bobbyesp/ui/components/preferences/PreferencesItems.kt index c00b0a6..9c6e824 100644 --- a/app/ui/src/main/java/com/bobbyesp/ui/components/preferences/PreferencesItems.kt +++ b/app/ui/src/main/java/com/bobbyesp/ui/components/preferences/PreferencesItems.kt @@ -779,12 +779,13 @@ fun PreferenceInfo( icon: ImageVector = Icons.Outlined.Info, applyPaddings: Boolean = true ) { - Column(modifier = modifier - .fillMaxWidth() - .run { - if (applyPaddings) padding(horizontal = 16.dp, vertical = 16.dp) - else this - }) { + Column( + modifier = modifier + .fillMaxWidth() + .run { + if (applyPaddings) padding(horizontal = 16.dp, vertical = 16.dp) + else this + }) { Icon( modifier = Modifier.padding(), imageVector = icon, contentDescription = null ) diff --git a/build.gradle.kts b/build.gradle.kts index aad5195..121339e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,6 @@ plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.android.kotlin) apply false alias(libs.plugins.android.library) apply false - alias(libs.plugins.hilt) apply false alias(libs.plugins.kotlin.serialization) apply false alias(libs.plugins.kotlin.parcelize) apply false alias(libs.plugins.kotlin.ksp) apply false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 821e2bc..c3f0639 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -48,6 +48,7 @@ ktor = "3.0.0" #For me the best client #Dependency injection hilt = "2.51.1" hilt-ext = "1.2.0" +koin = "4.0.0" #Database room = "2.6.1" @@ -150,6 +151,10 @@ hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } hilt-ext-compiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hilt-ext" } +koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koin" } +koin-compose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koin" } +koin-ksp-compiler = { group = "io.insert-koin", name = "koin-ksp-compiler", version.ref = "koin" } + #Media 3 media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3" } media3-ui = { group = "androidx.media3", name = "media3-ui", version.ref = "media3" } @@ -221,6 +226,7 @@ ktor = ["ktor-android", "ktor-okhttp" ,"ktor-core", "ktor-serialization", "ktor- accompanist = ["accompanist-navigation-animation", "accompanist-permissions", "accompanist-webview", "accompanist-pager-layouts", "accompanist-pager-indicators", "accompanist-flowlayout", "accompanist-material"] compose = ["compose-ui-util", "compose-graphics", "compose-runtime", "compose-foundation", "compose-material-iconsExtended", "compose-animation", "compose-ui", "compose-material3", "compose-navigation", "compose-material3-windowSizeClass", "compose-constraintLayout"] hilt = ["compose-hilt-navigation", "hilt-android"] +koin = ["koin-android", "koin-compose"] pagination = ["paging-compose", "paging-runtime"] googleServices = ["firebase-auth", "gms-playservices-auth", "google-services"] coroutines = ["kotlinx-coroutines-core", "kotlinx-coroutines-android"]