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 package org.moire.ultrasonic.api.subsonic
import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockResponse
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should be` import org.amshove.kluent.`should be`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be` import org.amshove.kluent.`should not be`
import org.junit.Test import org.junit.Test

View File

@ -1,8 +1,8 @@
package org.moire.ultrasonic.api.subsonic package org.moire.ultrasonic.api.subsonic
import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockResponse
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should be` import org.amshove.kluent.`should be`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be` import org.amshove.kluent.`should not be`
import org.junit.Test import org.junit.Test

View File

@ -1,7 +1,7 @@
package org.moire.ultrasonic.api.subsonic 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`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be` import org.amshove.kluent.`should not be`
import org.junit.Test import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectory import org.moire.ultrasonic.api.subsonic.models.MusicDirectory

View File

@ -1,8 +1,8 @@
package org.moire.ultrasonic.api.subsonic package org.moire.ultrasonic.api.subsonic
import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockResponse
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should be` import org.amshove.kluent.`should be`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be` import org.amshove.kluent.`should not be`
import org.junit.Test import org.junit.Test

View File

@ -456,11 +456,11 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
override fun done(responseString: String) { override fun done(responseString: String) {
var dialogText = responseString var dialogText = responseString
if (arrayOf( if (arrayOf(
currentServerSetting!!.chatSupport, currentServerSetting!!.chatSupport,
currentServerSetting!!.bookmarkSupport, currentServerSetting!!.bookmarkSupport,
currentServerSetting!!.shareSupport, currentServerSetting!!.shareSupport,
currentServerSetting!!.podcastSupport currentServerSetting!!.podcastSupport
).any { x -> x == false } ).any { x -> x == false }
) { ) {
dialogText = String.format( dialogText = String.format(
Locale.ROOT, Locale.ROOT,

View File

@ -338,9 +338,9 @@ class PlayerFragment :
registerForContextMenu(playlistView) registerForContextMenu(playlistView)
if (arguments != null && requireArguments().getBoolean( if (arguments != null && requireArguments().getBoolean(
Constants.INTENT_SHUFFLE, Constants.INTENT_SHUFFLE,
false false
) )
) { ) {
networkAndStorageChecker.warnIfNetworkOrStorageUnavailable() networkAndStorageChecker.warnIfNetworkOrStorageUnavailable()
mediaPlayerController.isShufflePlayEnabled = true mediaPlayerController.isShufflePlayEnabled = true

View File

@ -150,19 +150,19 @@ class CachedMusicService(private val musicService: MusicService) : MusicService,
@Throws(Exception::class) @Throws(Exception::class)
override fun getArtist(id: String, name: String?, refresh: Boolean): override fun getArtist(id: String, name: String?, refresh: Boolean):
List<MusicDirectory.Album> { List<MusicDirectory.Album> {
checkSettingsChanged() checkSettingsChanged()
var cache = if (refresh) null else cachedArtist[id] var cache = if (refresh) null else cachedArtist[id]
var dir = cache?.get() var dir = cache?.get()
if (dir == null) { if (dir == null) {
dir = musicService.getArtist(id, name, refresh) dir = musicService.getArtist(id, name, refresh)
cache = TimeLimitedCache( cache = TimeLimitedCache(
Settings.directoryCacheTime.toLong(), TimeUnit.SECONDS Settings.directoryCacheTime.toLong(), TimeUnit.SECONDS
) )
cache.set(dir) cache.set(dir)
cachedArtist.put(id, cache) cachedArtist.put(id, cache)
}
return dir
} }
return dir
}
@Throws(Exception::class) @Throws(Exception::class)
override fun getAlbum(id: String, name: String?, refresh: Boolean): MusicDirectory { override fun getAlbum(id: String, name: String?, refresh: Boolean): MusicDirectory {

View File

@ -149,9 +149,9 @@ class MediaPlayerLifecycleSupport : KoinComponent {
} else if (state == 1) { } else if (state == 1) {
if (!mediaPlayerController.isJukeboxEnabled && if (!mediaPlayerController.isJukeboxEnabled &&
sp.getBoolean( sp.getBoolean(
spKey, spKey,
false false
) && mediaPlayerController.playerState === PlayerState.PAUSED ) && mediaPlayerController.playerState === PlayerState.PAUSED
) { ) {
mediaPlayerController.start() mediaPlayerController.start()
} }

View File

@ -456,8 +456,8 @@ class OfflineMusicService : MusicService, KoinComponent {
@Throws(OfflineException::class) @Throws(OfflineException::class)
override fun getArtist(id: String, name: String?, refresh: Boolean): override fun getArtist(id: String, name: String?, refresh: Boolean):
List<MusicDirectory.Album> { List<MusicDirectory.Album> {
throw OfflineException("getArtist isn't available in offline mode") throw OfflineException("getArtist isn't available in offline mode")
} }
@Throws(OfflineException::class) @Throws(OfflineException::class)
override fun getAlbum(id: String, name: String?, refresh: Boolean): MusicDirectory { override fun getAlbum(id: String, name: String?, refresh: Boolean): MusicDirectory {

View File

@ -30,13 +30,13 @@ import timber.log.Timber
object CommunicationError { object CommunicationError {
fun getHandler(context: Context?, handler: ((CoroutineContext, Throwable) -> Unit)? = null): fun getHandler(context: Context?, handler: ((CoroutineContext, Throwable) -> Unit)? = null):
CoroutineExceptionHandler { CoroutineExceptionHandler {
return CoroutineExceptionHandler { coroutineContext, exception -> return CoroutineExceptionHandler { coroutineContext, exception ->
Handler(Looper.getMainLooper()).post { Handler(Looper.getMainLooper()).post {
handleError(exception, context) handleError(exception, context)
handler?.invoke(coroutineContext, exception) handler?.invoke(coroutineContext, exception)
}
} }
} }
}
@JvmStatic @JvmStatic
fun handleError(error: Throwable?, context: Context?) { fun handleError(error: Throwable?, context: Context?) {

View File

@ -134,55 +134,55 @@ object Settings {
@JvmStatic @JvmStatic
var shouldUseFolderForArtistName 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 @JvmStatic
var shouldShowTrackNumber var shouldShowTrackNumber
by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_TRACK_NUMBER, false) by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_TRACK_NUMBER, false)
@JvmStatic @JvmStatic
var defaultAlbums var defaultAlbums
by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_ALBUMS, "5") by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_ALBUMS, "5")
@JvmStatic @JvmStatic
var maxAlbums var maxAlbums
by StringIntSetting(Constants.PREFERENCES_KEY_MAX_ALBUMS, "20") by StringIntSetting(Constants.PREFERENCES_KEY_MAX_ALBUMS, "20")
@JvmStatic @JvmStatic
var defaultSongs var defaultSongs
by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_SONGS, "10") by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_SONGS, "10")
@JvmStatic @JvmStatic
var maxSongs var maxSongs
by StringIntSetting(Constants.PREFERENCES_KEY_MAX_SONGS, "25") by StringIntSetting(Constants.PREFERENCES_KEY_MAX_SONGS, "25")
@JvmStatic @JvmStatic
var maxArtists var maxArtists
by StringIntSetting(Constants.PREFERENCES_KEY_MAX_ARTISTS, "10") by StringIntSetting(Constants.PREFERENCES_KEY_MAX_ARTISTS, "10")
@JvmStatic @JvmStatic
var defaultArtists var defaultArtists
by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_ARTISTS, "3") by StringIntSetting(Constants.PREFERENCES_KEY_DEFAULT_ARTISTS, "3")
@JvmStatic @JvmStatic
var bufferLength var bufferLength
by StringIntSetting(Constants.PREFERENCES_KEY_BUFFER_LENGTH, "5") by StringIntSetting(Constants.PREFERENCES_KEY_BUFFER_LENGTH, "5")
@JvmStatic @JvmStatic
var incrementTime var incrementTime
by StringIntSetting(Constants.PREFERENCES_KEY_INCREMENT_TIME, "5") by StringIntSetting(Constants.PREFERENCES_KEY_INCREMENT_TIME, "5")
@JvmStatic @JvmStatic
var mediaButtonsEnabled var mediaButtonsEnabled
by BooleanSetting(Constants.PREFERENCES_KEY_MEDIA_BUTTONS, true) by BooleanSetting(Constants.PREFERENCES_KEY_MEDIA_BUTTONS, true)
@JvmStatic @JvmStatic
var showNowPlaying var showNowPlaying
by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_NOW_PLAYING, true) by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_NOW_PLAYING, true)
@JvmStatic @JvmStatic
var gaplessPlayback var gaplessPlayback
by BooleanSetting(Constants.PREFERENCES_KEY_GAPLESS_PLAYBACK, false) by BooleanSetting(Constants.PREFERENCES_KEY_GAPLESS_PLAYBACK, false)
@JvmStatic @JvmStatic
var shouldTransitionOnPlayback by BooleanSetting( var shouldTransitionOnPlayback by BooleanSetting(
@ -192,7 +192,7 @@ object Settings {
@JvmStatic @JvmStatic
var shouldUseId3Tags var shouldUseId3Tags
by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS, false) by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS, false)
@JvmStatic @JvmStatic
var tempLoss by StringIntSetting(Constants.PREFERENCES_KEY_TEMP_LOSS, "1") var tempLoss by StringIntSetting(Constants.PREFERENCES_KEY_TEMP_LOSS, "1")
@ -225,19 +225,19 @@ object Settings {
) )
var shouldClearPlaylist var shouldClearPlaylist
by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_PLAYLIST, false) by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_PLAYLIST, false)
var shouldSortByDisc var shouldSortByDisc
by BooleanSetting(Constants.PREFERENCES_KEY_DISC_SORT, false) by BooleanSetting(Constants.PREFERENCES_KEY_DISC_SORT, false)
var shouldClearBookmark var shouldClearBookmark
by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_BOOKMARK, false) by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_BOOKMARK, false)
var singleButtonPlayPause var singleButtonPlayPause
by BooleanSetting( by BooleanSetting(
Constants.PREFERENCES_KEY_SINGLE_BUTTON_PLAY_PAUSE, Constants.PREFERENCES_KEY_SINGLE_BUTTON_PLAY_PAUSE,
false false
) )
// Inverted for readability // Inverted for readability
var shouldSendBluetoothNotifications by BooleanSetting( var shouldSendBluetoothNotifications by BooleanSetting(
@ -246,20 +246,20 @@ object Settings {
) )
var shouldSendBluetoothAlbumArt var shouldSendBluetoothAlbumArt
by BooleanSetting(Constants.PREFERENCES_KEY_SEND_BLUETOOTH_ALBUM_ART, true) by BooleanSetting(Constants.PREFERENCES_KEY_SEND_BLUETOOTH_ALBUM_ART, true)
var shouldDisableNowPlayingListSending 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 @JvmStatic
var viewRefreshInterval var viewRefreshInterval
by StringIntSetting(Constants.PREFERENCES_KEY_VIEW_REFRESH, "1000") by StringIntSetting(Constants.PREFERENCES_KEY_VIEW_REFRESH, "1000")
var shouldAskForShareDetails var shouldAskForShareDetails
by BooleanSetting(Constants.PREFERENCES_KEY_ASK_FOR_SHARE_DETAILS, true) by BooleanSetting(Constants.PREFERENCES_KEY_ASK_FOR_SHARE_DETAILS, true)
var defaultShareDescription var defaultShareDescription
by StringSetting(Constants.PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION, "") by StringSetting(Constants.PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION, "")
@JvmStatic @JvmStatic
val shareGreeting: String? val shareGreeting: String?