Make some methods non-nullable

This commit is contained in:
tzugen 2022-07-05 23:15:05 +02:00
parent 6b0a9b788a
commit 4f79ae8e9e
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
2 changed files with 5 additions and 7 deletions

View File

@ -44,7 +44,7 @@ class BitmapUtils {
): Bitmap? { ): Bitmap? {
val albumArtFile = FileUtil.getAlbumArtFile(filename) val albumArtFile = FileUtil.getAlbumArtFile(filename)
val bitmap: Bitmap? = null val bitmap: Bitmap? = null
if (albumArtFile != null && File(albumArtFile).exists()) { if (File(albumArtFile).exists()) {
return getBitmapFromDisk(albumArtFile, size, bitmap) return getBitmapFromDisk(albumArtFile, size, bitmap)
} }
return null return null

View File

@ -114,7 +114,7 @@ object FileUtil {
* @param entry The album entry * @param entry The album entry
* @return File object. Not guaranteed that it exists * @return File object. Not guaranteed that it exists
*/ */
fun getAlbumArtFile(entry: MusicDirectory.Child): String? { fun getAlbumArtFile(entry: MusicDirectory.Child): String {
val albumDir = getAlbumDirectory(entry) val albumDir = getAlbumDirectory(entry)
return getAlbumArtFileForAlbumDir(albumDir) return getAlbumArtFileForAlbumDir(albumDir)
} }
@ -169,7 +169,7 @@ object FileUtil {
* @return File object. Not guaranteed that it exists * @return File object. Not guaranteed that it exists
*/ */
@JvmStatic @JvmStatic
fun getAlbumArtFileForAlbumDir(albumDir: String): String? { fun getAlbumArtFileForAlbumDir(albumDir: String): String {
val key = getAlbumArtKey(albumDir, true) val key = getAlbumArtKey(albumDir, true)
return getAlbumArtFile(key) return getAlbumArtFile(key)
} }
@ -180,11 +180,9 @@ object FileUtil {
* @return File object. Not guaranteed that it exists * @return File object. Not guaranteed that it exists
*/ */
@JvmStatic @JvmStatic
fun getAlbumArtFile(cacheKey: String?): String? { fun getAlbumArtFile(cacheKey: String): String {
val albumArtDir = albumArtDirectory.absolutePath val albumArtDir = albumArtDirectory.absolutePath
return if (cacheKey == null) { return "$albumArtDir/$cacheKey"
null
} else "$albumArtDir/$cacheKey"
} }
val albumArtDirectory: File val albumArtDirectory: File