ktlint: Fix multi-line if-else violations

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta 2026-01-21 16:44:28 +08:00
parent 2c808b0e86
commit 0641c19388
8 changed files with 37 additions and 21 deletions

View file

@ -26,7 +26,6 @@ ktlint_standard_kdoc = disabled
ktlint_standard_max-line-length = disabled ktlint_standard_max-line-length = disabled
ktlint_standard_mixed-condition-operators = disabled ktlint_standard_mixed-condition-operators = disabled
ktlint_standard_multiline-expression-wrapping = disabled ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_multiline-if-else = disabled
ktlint_standard_no-blank-line-in-list = disabled ktlint_standard_no-blank-line-in-list = disabled
ktlint_standard_no-consecutive-comments = disabled ktlint_standard_no-consecutive-comments = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled ktlint_standard_no-empty-first-line-in-class-body = disabled

View file

@ -73,12 +73,13 @@ class FeedViewModel(
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
.map { (event, showPlayedItems, showPartiallyPlayedItems, showFutureItems, notLoadedCount, oldestUpdate) -> .map { (event, showPlayedItems, showPartiallyPlayedItems, showFutureItems, notLoadedCount, oldestUpdate) ->
val streamItems = if (event is SuccessResultEvent || event is IdleEvent) val streamItems = if (event is SuccessResultEvent || event is IdleEvent) {
feedDatabaseManager feedDatabaseManager
.getStreams(groupId, showPlayedItems, showPartiallyPlayedItems, showFutureItems) .getStreams(groupId, showPlayedItems, showPartiallyPlayedItems, showFutureItems)
.blockingGet(arrayListOf()) .blockingGet(arrayListOf())
else } else {
arrayListOf() arrayListOf()
}
CombineResultDataHolder(event, streamItems, notLoadedCount, oldestUpdate) CombineResultDataHolder(event, streamItems, notLoadedCount, oldestUpdate)
} }

View file

@ -86,8 +86,9 @@ abstract class BasePlayerGestureListener(
// /////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////
override fun onDown(e: MotionEvent): Boolean { override fun onDown(e: MotionEvent): Boolean {
if (DEBUG) if (DEBUG) {
Log.d(TAG, "onDown called with e = [$e]") Log.d(TAG, "onDown called with e = [$e]")
}
if (isDoubleTapping && isDoubleTapEnabled) { if (isDoubleTapping && isDoubleTapEnabled) {
doubleTapControls?.onDoubleTapProgressDown(getDisplayPortion(e)) doubleTapControls?.onDoubleTapProgressDown(getDisplayPortion(e))
@ -108,8 +109,9 @@ abstract class BasePlayerGestureListener(
} }
override fun onDoubleTap(e: MotionEvent): Boolean { override fun onDoubleTap(e: MotionEvent): Boolean {
if (DEBUG) if (DEBUG) {
Log.d(TAG, "onDoubleTap called with e = [$e]") Log.d(TAG, "onDoubleTap called with e = [$e]")
}
onDoubleTap(e, getDisplayPortion(e)) onDoubleTap(e, getDisplayPortion(e))
return true return true
@ -136,8 +138,9 @@ abstract class BasePlayerGestureListener(
private fun startMultiDoubleTap(e: MotionEvent) { private fun startMultiDoubleTap(e: MotionEvent) {
if (!isDoubleTapping) { if (!isDoubleTapping) {
if (DEBUG) if (DEBUG) {
Log.d(TAG, "startMultiDoubleTap called with e = [$e]") Log.d(TAG, "startMultiDoubleTap called with e = [$e]")
}
keepInDoubleTapMode() keepInDoubleTapMode()
doubleTapControls?.onDoubleTapStarted(getDisplayPortion(e)) doubleTapControls?.onDoubleTapStarted(getDisplayPortion(e))
@ -145,8 +148,9 @@ abstract class BasePlayerGestureListener(
} }
fun keepInDoubleTapMode() { fun keepInDoubleTapMode() {
if (DEBUG) if (DEBUG) {
Log.d(TAG, "keepInDoubleTapMode called") Log.d(TAG, "keepInDoubleTapMode called")
}
isDoubleTapping = true isDoubleTapping = true
doubleTapHandler.removeCallbacksAndMessages(DOUBLE_TAP) doubleTapHandler.removeCallbacksAndMessages(DOUBLE_TAP)
@ -161,8 +165,9 @@ abstract class BasePlayerGestureListener(
} }
fun endMultiDoubleTap() { fun endMultiDoubleTap() {
if (DEBUG) if (DEBUG) {
Log.d(TAG, "endMultiDoubleTap called") Log.d(TAG, "endMultiDoubleTap called")
}
isDoubleTapping = false isDoubleTapping = false
doubleTapHandler.removeCallbacksAndMessages(DOUBLE_TAP) doubleTapHandler.removeCallbacksAndMessages(DOUBLE_TAP)

View file

@ -51,15 +51,18 @@ class MainPlayerGestureListener(
} }
override fun onSingleTapConfirmed(e: MotionEvent): Boolean { override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
if (DEBUG) if (DEBUG) {
Log.d(TAG, "onSingleTapConfirmed() called with: e = [$e]") Log.d(TAG, "onSingleTapConfirmed() called with: e = [$e]")
}
if (isDoubleTapping) if (isDoubleTapping) {
return true return true
}
super.onSingleTapConfirmed(e) super.onSingleTapConfirmed(e)
if (player.currentState != Player.STATE_BLOCKED) if (player.currentState != Player.STATE_BLOCKED) {
onSingleTap() onSingleTap()
}
return true return true
} }

View file

@ -205,13 +205,16 @@ class PopupPlayerGestureListener(
} }
override fun onSingleTapConfirmed(e: MotionEvent): Boolean { override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
if (DEBUG) if (DEBUG) {
Log.d(TAG, "onSingleTapConfirmed() called with: e = [$e]") Log.d(TAG, "onSingleTapConfirmed() called with: e = [$e]")
}
if (isDoubleTapping) if (isDoubleTapping) {
return true return true
if (player.exoPlayerIsNull()) }
if (player.exoPlayerIsNull()) {
return false return false
}
onSingleTap() onSingleTap()
return true return true

View file

@ -185,10 +185,11 @@ class MediaBrowserPlaybackPreparer(
} }
val playlistId = path[0].toLong() val playlistId = path[0].toLong()
val index = path[1].toInt() val index = path[1].toInt()
return if (playlistType == ID_LOCAL) return if (playlistType == ID_LOCAL) {
extractLocalPlayQueue(playlistId, index) extractLocalPlayQueue(playlistId, index)
else } else {
extractRemotePlayQueue(playlistId, index) extractRemotePlayQueue(playlistId, index)
}
} }
ID_URL -> { ID_URL -> {

View file

@ -6,8 +6,9 @@ class PoTokenException(message: String) : Exception(message)
class BadWebViewException(message: String) : Exception(message) class BadWebViewException(message: String) : Exception(message)
fun buildExceptionForJsError(error: String): Exception { fun buildExceptionForJsError(error: String): Exception {
return if (error.contains("SyntaxError")) return if (error.contains("SyntaxError")) {
BadWebViewException(error) BadWebViewException(error)
else } else {
PoTokenException(error) PoTokenException(error)
}
} }

View file

@ -52,8 +52,9 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
private var initTap: Boolean = false private var initTap: Boolean = false
override fun onDoubleTapStarted(portion: DisplayPortion) { override fun onDoubleTapStarted(portion: DisplayPortion) {
if (DEBUG) if (DEBUG) {
Log.d(TAG, "onDoubleTapStarted called with portion = [$portion]") Log.d(TAG, "onDoubleTapStarted called with portion = [$portion]")
}
initTap = false initTap = false
@ -64,7 +65,7 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
val shouldForward: Boolean = val shouldForward: Boolean =
performListener?.getFastSeekDirection(portion)?.directionAsBoolean ?: return performListener?.getFastSeekDirection(portion)?.directionAsBoolean ?: return
if (DEBUG) if (DEBUG) {
Log.d( Log.d(
TAG, TAG,
"onDoubleTapProgressDown called with " + "onDoubleTapProgressDown called with " +
@ -72,6 +73,7 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
"wasForwarding = [$wasForwarding], " + "wasForwarding = [$wasForwarding], " +
"initTap = [$initTap], " "initTap = [$initTap], "
) )
}
/* /*
* Check if a initial tap occurred or if direction was switched * Check if a initial tap occurred or if direction was switched
@ -97,8 +99,9 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
} }
override fun onDoubleTapFinished() { override fun onDoubleTapFinished() {
if (DEBUG) if (DEBUG) {
Log.d(TAG, "onDoubleTapFinished called with initTap = [$initTap]") Log.d(TAG, "onDoubleTapFinished called with initTap = [$initTap]")
}
if (initTap) performListener?.onDoubleTapEnd() if (initTap) performListener?.onDoubleTapEnd()
initTap = false initTap = false