image: add proper constructor to settings

Add proper @Inject constructors to ImageSettings.
This commit is contained in:
Alexander Capehart 2023-02-11 16:39:46 -07:00
parent 62bf532e21
commit 9f74fe8a20
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 6 additions and 7 deletions

View file

@ -17,12 +17,9 @@
package org.oxycblt.auxio.image package org.oxycblt.auxio.image
import android.content.Context
import dagger.Binds import dagger.Binds
import dagger.Module import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent import dagger.hilt.components.SingletonComponent
@Module @Module

View file

@ -19,6 +19,8 @@ package org.oxycblt.auxio.image
import android.content.Context import android.content.Context
import androidx.core.content.edit import androidx.core.content.edit
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import org.oxycblt.auxio.R import org.oxycblt.auxio.R
import org.oxycblt.auxio.settings.Settings import org.oxycblt.auxio.settings.Settings
import org.oxycblt.auxio.util.logD import org.oxycblt.auxio.util.logD
@ -45,7 +47,7 @@ interface ImageSettings : Settings<ImageSettings.Listener> {
} }
} }
class ImageSettingsImpl(context: Context) : class ImageSettingsImpl @Inject constructor(@ApplicationContext context: Context) :
Settings.Impl<ImageSettings.Listener>(context), ImageSettings { Settings.Impl<ImageSettings.Listener>(context), ImageSettings {
override val coverMode: CoverMode override val coverMode: CoverMode
get() = get() =

View file

@ -192,9 +192,9 @@ private class Task(context: Context, private val rawSong: RawSong) {
textFrames["TXXX:musicbrainz album id"]?.let { rawSong.albumMusicBrainzId = it.first() } textFrames["TXXX:musicbrainz album id"]?.let { rawSong.albumMusicBrainzId = it.first() }
textFrames["TALB"]?.let { rawSong.albumName = it.first() } textFrames["TALB"]?.let { rawSong.albumName = it.first() }
textFrames["TSOA"]?.let { rawSong.albumSortName = it.first() } textFrames["TSOA"]?.let { rawSong.albumSortName = it.first() }
(textFrames["TXXX:musicbrainz album type"] ?: textFrames["TXXX:releasetype"] ?: textFrames["GRP1"])?.let { (textFrames["TXXX:musicbrainz album type"]
rawSong.releaseTypes = it ?: textFrames["TXXX:releasetype"] ?: textFrames["GRP1"])
} ?.let { rawSong.releaseTypes = it }
// Artist // Artist
textFrames["TXXX:musicbrainz artist id"]?.let { rawSong.artistMusicBrainzIds = it } textFrames["TXXX:musicbrainz artist id"]?.let { rawSong.artistMusicBrainzIds = it }