diff --git a/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAvatarTest.kt b/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAvatarTest.kt index d6a11332..1c070086 100644 --- a/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAvatarTest.kt +++ b/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAvatarTest.kt @@ -1,8 +1,8 @@ package org.moire.ultrasonic.api.subsonic import okhttp3.mockwebserver.MockResponse -import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be` +import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should not be` import org.junit.Test diff --git a/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetCoverArtTest.kt b/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetCoverArtTest.kt index 2c047ee8..8e54d42c 100644 --- a/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetCoverArtTest.kt +++ b/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetCoverArtTest.kt @@ -1,8 +1,8 @@ package org.moire.ultrasonic.api.subsonic import okhttp3.mockwebserver.MockResponse -import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be` +import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should not be` import org.junit.Test diff --git a/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt b/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt index 9249eb35..51579a72 100644 --- a/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt +++ b/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt @@ -1,7 +1,7 @@ package org.moire.ultrasonic.api.subsonic -import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be` +import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should not be` import org.junit.Test import org.moire.ultrasonic.api.subsonic.models.MusicDirectory diff --git a/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStreamTest.kt b/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStreamTest.kt index ad16462b..d56e37f9 100644 --- a/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStreamTest.kt +++ b/core/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStreamTest.kt @@ -1,8 +1,8 @@ package org.moire.ultrasonic.api.subsonic import okhttp3.mockwebserver.MockResponse -import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be` +import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should not be` import org.junit.Test diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/EditServerFragment.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/EditServerFragment.kt index 29de1289..f0128e62 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/EditServerFragment.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/EditServerFragment.kt @@ -456,11 +456,11 @@ class EditServerFragment : Fragment(), OnBackPressedHandler { override fun done(responseString: String) { var dialogText = responseString if (arrayOf( - currentServerSetting!!.chatSupport, - currentServerSetting!!.bookmarkSupport, - currentServerSetting!!.shareSupport, - currentServerSetting!!.podcastSupport - ).any { x -> x == false } + currentServerSetting!!.chatSupport, + currentServerSetting!!.bookmarkSupport, + currentServerSetting!!.shareSupport, + currentServerSetting!!.podcastSupport + ).any { x -> x == false } ) { dialogText = String.format( Locale.ROOT, diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt index e1a145ae..02cfb4be 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt @@ -338,9 +338,9 @@ class PlayerFragment : registerForContextMenu(playlistView) if (arguments != null && requireArguments().getBoolean( - Constants.INTENT_SHUFFLE, - false - ) + Constants.INTENT_SHUFFLE, + false + ) ) { networkAndStorageChecker.warnIfNetworkOrStorageUnavailable() mediaPlayerController.isShufflePlayEnabled = true diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/CachedMusicService.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/CachedMusicService.kt index a0e79d73..f6f34f7f 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/CachedMusicService.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/CachedMusicService.kt @@ -150,19 +150,19 @@ class CachedMusicService(private val musicService: MusicService) : MusicService, @Throws(Exception::class) override fun getArtist(id: String, name: String?, refresh: Boolean): List { - checkSettingsChanged() - var cache = if (refresh) null else cachedArtist[id] - var dir = cache?.get() - if (dir == null) { - dir = musicService.getArtist(id, name, refresh) - cache = TimeLimitedCache( - Settings.directoryCacheTime.toLong(), TimeUnit.SECONDS - ) - cache.set(dir) - cachedArtist.put(id, cache) - } - return dir + checkSettingsChanged() + var cache = if (refresh) null else cachedArtist[id] + var dir = cache?.get() + if (dir == null) { + dir = musicService.getArtist(id, name, refresh) + cache = TimeLimitedCache( + Settings.directoryCacheTime.toLong(), TimeUnit.SECONDS + ) + cache.set(dir) + cachedArtist.put(id, cache) } + return dir + } @Throws(Exception::class) override fun getAlbum(id: String, name: String?, refresh: Boolean): MusicDirectory { diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.kt index 379b6d60..87288df8 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.kt @@ -149,9 +149,9 @@ class MediaPlayerLifecycleSupport : KoinComponent { } else if (state == 1) { if (!mediaPlayerController.isJukeboxEnabled && sp.getBoolean( - spKey, - false - ) && mediaPlayerController.playerState === PlayerState.PAUSED + spKey, + false + ) && mediaPlayerController.playerState === PlayerState.PAUSED ) { mediaPlayerController.start() } diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/OfflineMusicService.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/OfflineMusicService.kt index 3fc586dd..52276ded 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/OfflineMusicService.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/OfflineMusicService.kt @@ -456,8 +456,8 @@ class OfflineMusicService : MusicService, KoinComponent { @Throws(OfflineException::class) override fun getArtist(id: String, name: String?, refresh: Boolean): List { - throw OfflineException("getArtist isn't available in offline mode") - } + throw OfflineException("getArtist isn't available in offline mode") + } @Throws(OfflineException::class) override fun getAlbum(id: String, name: String?, refresh: Boolean): MusicDirectory { diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/CommunicationError.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/CommunicationError.kt index 0bd4e0b9..725f095c 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/CommunicationError.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/CommunicationError.kt @@ -30,13 +30,13 @@ import timber.log.Timber object CommunicationError { fun getHandler(context: Context?, handler: ((CoroutineContext, Throwable) -> Unit)? = null): CoroutineExceptionHandler { - return CoroutineExceptionHandler { coroutineContext, exception -> - Handler(Looper.getMainLooper()).post { - handleError(exception, context) - handler?.invoke(coroutineContext, exception) - } + return CoroutineExceptionHandler { coroutineContext, exception -> + Handler(Looper.getMainLooper()).post { + handleError(exception, context) + handler?.invoke(coroutineContext, exception) } } + } @JvmStatic fun handleError(error: Throwable?, context: Context?) { diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Settings.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Settings.kt index e5240e33..d40d039f 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Settings.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Settings.kt @@ -134,55 +134,55 @@ object Settings { @JvmStatic var shouldUseFolderForArtistName - by BooleanSetting(Constants.PREFERENCES_KEY_USE_FOLDER_FOR_ALBUM_ARTIST, false) + by BooleanSetting(Constants.PREFERENCES_KEY_USE_FOLDER_FOR_ALBUM_ARTIST, false) @JvmStatic var shouldShowTrackNumber - by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_TRACK_NUMBER, false) + by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_TRACK_NUMBER, false) @JvmStatic var defaultAlbums - by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_ALBUMS, "5") + by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_ALBUMS, "5") @JvmStatic var maxAlbums - by StringIntSetting(Constants.PREFERENCES_KEY_MAX_ALBUMS, "20") + by StringIntSetting(Constants.PREFERENCES_KEY_MAX_ALBUMS, "20") @JvmStatic var defaultSongs - by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_SONGS, "10") + by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_SONGS, "10") @JvmStatic var maxSongs - by StringIntSetting(Constants.PREFERENCES_KEY_MAX_SONGS, "25") + by StringIntSetting(Constants.PREFERENCES_KEY_MAX_SONGS, "25") @JvmStatic var maxArtists - by StringIntSetting(Constants.PREFERENCES_KEY_MAX_ARTISTS, "10") + by StringIntSetting(Constants.PREFERENCES_KEY_MAX_ARTISTS, "10") @JvmStatic var defaultArtists - by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_ARTISTS, "3") + by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_ARTISTS, "3") @JvmStatic var bufferLength - by StringIntSetting(Constants.PREFERENCES_KEY_BUFFER_LENGTH, "5") + by StringIntSetting(Constants.PREFERENCES_KEY_BUFFER_LENGTH, "5") @JvmStatic var incrementTime - by StringIntSetting(Constants.PREFERENCES_KEY_INCREMENT_TIME, "5") + by StringIntSetting(Constants.PREFERENCES_KEY_INCREMENT_TIME, "5") @JvmStatic var mediaButtonsEnabled - by BooleanSetting(Constants.PREFERENCES_KEY_MEDIA_BUTTONS, true) + by BooleanSetting(Constants.PREFERENCES_KEY_MEDIA_BUTTONS, true) @JvmStatic var showNowPlaying - by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_NOW_PLAYING, true) + by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_NOW_PLAYING, true) @JvmStatic var gaplessPlayback - by BooleanSetting(Constants.PREFERENCES_KEY_GAPLESS_PLAYBACK, false) + by BooleanSetting(Constants.PREFERENCES_KEY_GAPLESS_PLAYBACK, false) @JvmStatic var shouldTransitionOnPlayback by BooleanSetting( @@ -192,7 +192,7 @@ object Settings { @JvmStatic var shouldUseId3Tags - by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS, false) + by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS, false) @JvmStatic var tempLoss by StringIntSetting(Constants.PREFERENCES_KEY_TEMP_LOSS, "1") @@ -225,19 +225,19 @@ object Settings { ) var shouldClearPlaylist - by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_PLAYLIST, false) + by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_PLAYLIST, false) var shouldSortByDisc - by BooleanSetting(Constants.PREFERENCES_KEY_DISC_SORT, false) + by BooleanSetting(Constants.PREFERENCES_KEY_DISC_SORT, false) var shouldClearBookmark - by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_BOOKMARK, false) + by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_BOOKMARK, false) var singleButtonPlayPause - by BooleanSetting( - Constants.PREFERENCES_KEY_SINGLE_BUTTON_PLAY_PAUSE, - false - ) + by BooleanSetting( + Constants.PREFERENCES_KEY_SINGLE_BUTTON_PLAY_PAUSE, + false + ) // Inverted for readability var shouldSendBluetoothNotifications by BooleanSetting( @@ -246,20 +246,20 @@ object Settings { ) var shouldSendBluetoothAlbumArt - by BooleanSetting(Constants.PREFERENCES_KEY_SEND_BLUETOOTH_ALBUM_ART, true) + by BooleanSetting(Constants.PREFERENCES_KEY_SEND_BLUETOOTH_ALBUM_ART, true) var shouldDisableNowPlayingListSending - by BooleanSetting(Constants.PREFERENCES_KEY_DISABLE_SEND_NOW_PLAYING_LIST, false) + by BooleanSetting(Constants.PREFERENCES_KEY_DISABLE_SEND_NOW_PLAYING_LIST, false) @JvmStatic var viewRefreshInterval - by StringIntSetting(Constants.PREFERENCES_KEY_VIEW_REFRESH, "1000") + by StringIntSetting(Constants.PREFERENCES_KEY_VIEW_REFRESH, "1000") var shouldAskForShareDetails - by BooleanSetting(Constants.PREFERENCES_KEY_ASK_FOR_SHARE_DETAILS, true) + by BooleanSetting(Constants.PREFERENCES_KEY_ASK_FOR_SHARE_DETAILS, true) var defaultShareDescription - by StringSetting(Constants.PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION, "") + by StringSetting(Constants.PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION, "") @JvmStatic val shareGreeting: String?