1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2026-01-28 22:01:20 +00:00

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 e538f691fc
commit 96bb582f53
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_mixed-condition-operators = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_multiline-if-else = disabled
ktlint_standard_no-blank-line-in-list = disabled
ktlint_standard_no-consecutive-comments = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled

View File

@@ -73,12 +73,13 @@ class FeedViewModel(
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.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
.getStreams(groupId, showPlayedItems, showPartiallyPlayedItems, showFutureItems)
.blockingGet(arrayListOf())
else
} else {
arrayListOf()
}
CombineResultDataHolder(event, streamItems, notLoadedCount, oldestUpdate)
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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