diff --git a/.editorconfig b/.editorconfig index 8a779c261..8be8d250e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt b/app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt index 6ca06e2f8..cf0150332 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt @@ -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) } diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/BasePlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/BasePlayerGestureListener.kt index 0453f297a..36ee5e05e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/BasePlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/BasePlayerGestureListener.kt @@ -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) diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index 435dfc79a..1cd297414 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -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 } diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt index 57dcb6d92..70cfd1e95 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt @@ -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 diff --git a/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserPlaybackPreparer.kt b/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserPlaybackPreparer.kt index f50337a22..62e8032fd 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserPlaybackPreparer.kt +++ b/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserPlaybackPreparer.kt @@ -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 -> { diff --git a/app/src/main/java/org/schabi/newpipe/util/potoken/PoTokenException.kt b/app/src/main/java/org/schabi/newpipe/util/potoken/PoTokenException.kt index 879f8f3e6..683fd48b2 100644 --- a/app/src/main/java/org/schabi/newpipe/util/potoken/PoTokenException.kt +++ b/app/src/main/java/org/schabi/newpipe/util/potoken/PoTokenException.kt @@ -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) + } } diff --git a/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt b/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt index 877070a91..86e8ce311 100644 --- a/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt +++ b/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt @@ -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