Run KtlintFormat

This commit is contained in:
tzugen 2021-12-20 19:41:55 +01:00
parent 65347a20fa
commit c0ef964a3e
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
11 changed files with 60 additions and 60 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -150,19 +150,19 @@ class CachedMusicService(private val musicService: MusicService) : MusicService,
@Throws(Exception::class)
override fun getArtist(id: String, name: String?, refresh: Boolean):
List<MusicDirectory.Album> {
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 {

View File

@ -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()
}

View File

@ -456,8 +456,8 @@ class OfflineMusicService : MusicService, KoinComponent {
@Throws(OfflineException::class)
override fun getArtist(id: String, name: String?, refresh: Boolean):
List<MusicDirectory.Album> {
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 {

View File

@ -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?) {

View File

@ -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?