chore: ktlint reformat

This commit is contained in:
LisoUseInAIKyrios 2024-04-01 02:34:46 +04:00
parent 2e65ad234c
commit acd1c725a2
20 changed files with 56 additions and 56 deletions

View File

@ -12,7 +12,7 @@ import java.lang.ref.WeakReference
* @param activity activity that contains the controls_layout view
*/
class PlayerControlsVisibilityObserverImpl(
private val activity: Activity,
private val activity: Activity
) : PlayerControlsVisibilityObserver {
/**

View File

@ -42,8 +42,8 @@ object PlayerOverlays {
ChildrenChangeEventArgs(
parent,
child,
false,
),
false
)
)
}
}
@ -54,8 +54,8 @@ object PlayerOverlays {
ChildrenChangeEventArgs(
parent,
child,
true,
),
true
)
)
}
}
@ -69,15 +69,15 @@ object PlayerOverlays {
oldLeft,
oldTop,
oldRight - oldLeft,
oldBottom - oldTop,
oldBottom - oldTop
),
Rectangle(
newLeft,
newTop,
newRight - newLeft,
newBottom - newTop,
),
),
newBottom - newTop
)
)
)
}
}
@ -87,11 +87,11 @@ object PlayerOverlays {
data class ChildrenChangeEventArgs(
val overlaysLayout: ViewGroup,
val childView: View,
val wasChildRemoved: Boolean,
val wasChildRemoved: Boolean
)
data class LayoutChangeEventArgs(
val overlaysLayout: ViewGroup,
val oldRect: Rectangle,
val newRect: Rectangle,
val newRect: Rectangle
)

View File

@ -44,7 +44,7 @@ enum class PlayerType {
*/
INLINE_MINIMAL,
VIRTUAL_REALITY_FULLSCREEN,
WATCH_WHILE_PICTURE_IN_PICTURE,
WATCH_WHILE_PICTURE_IN_PICTURE
;
companion object {

View File

@ -16,7 +16,7 @@ enum class VideoState {
/**
* @see [VideoInformation.isAtEndOfVideo]
*/
ENDED,
ENDED
;

View File

@ -11,7 +11,7 @@ import app.revanced.integrations.youtube.shared.PlayerType
* @param context the context to create in
*/
class SwipeControlsConfigurationProvider(
private val context: Context,
private val context: Context
) {
//region swipe enable
/**

View File

@ -143,7 +143,7 @@ class SwipeControlsHostActivity : Activity() {
contentRoot.x.toInt(),
contentRoot.y.toInt(),
contentRoot.width,
contentRoot.height,
contentRoot.height
)
}

View File

@ -15,7 +15,7 @@ import kotlin.properties.Delegates
*/
class AudioVolumeController(
context: Context,
private val targetStream: Int = AudioManager.STREAM_MUSIC,
private val targetStream: Int = AudioManager.STREAM_MUSIC
) {
/**
@ -36,7 +36,7 @@ class AudioVolumeController(
minimumVolumeIndex =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
audioManager.getStreamMinVolume(
targetStream,
targetStream
)
} else {
0

View File

@ -10,7 +10,7 @@ import app.revanced.integrations.youtube.swipecontrols.misc.clamp
* @param host the host activity of which the brightness is adjusted
*/
class ScreenBrightnessController(
private val host: Activity,
private val host: Activity
) {
/**
* screen brightness saved by [save]

View File

@ -36,7 +36,7 @@ import kotlin.math.min
@Suppress("PrivatePropertyName")
class SwipeZonesController(
private val host: Activity,
private val fallbackScreenRect: () -> Rectangle,
private val fallbackScreenRect: () -> Rectangle
) {
/**
* 20dp, in pixels
@ -74,7 +74,7 @@ class SwipeZonesController(
p.x + _20dp,
p.y + _40dp,
p.width - _20dp,
p.height - _20dp - _80dp,
p.height - _20dp - _80dp
)
}
@ -89,7 +89,7 @@ class SwipeZonesController(
eRect.right - zoneWidth,
eRect.top,
zoneWidth,
eRect.height,
eRect.height
)
}
@ -103,7 +103,7 @@ class SwipeZonesController(
effectiveSwipeRect.left,
effectiveSwipeRect.top,
zoneWidth,
effectiveSwipeRect.height,
effectiveSwipeRect.height
)
}
@ -137,7 +137,7 @@ class SwipeZonesController(
playerView.x.toInt(),
playerView.y.toInt(),
min(playerView.width, playerWidthWithPadding),
playerView.height,
playerView.height
)
}
}

View File

@ -9,7 +9,7 @@ import app.revanced.integrations.youtube.swipecontrols.SwipeControlsHostActivity
* @param controller main controller instance
*/
class VolumeKeysController(
private val controller: SwipeControlsHostActivity,
private val controller: SwipeControlsHostActivity
) {
/**
* key event handler

View File

@ -15,7 +15,7 @@ import app.revanced.integrations.youtube.swipecontrols.misc.toPoint
* @param controller reference to the main swipe controller
*/
class ClassicSwipeController(
private val controller: SwipeControlsHostActivity,
private val controller: SwipeControlsHostActivity
) : BaseGestureController(controller),
PlayerControlsVisibilityObserver by PlayerControlsVisibilityObserverImpl(controller) {
/**
@ -98,7 +98,7 @@ class ClassicSwipeController(
from: MotionEvent,
to: MotionEvent,
distanceX: Double,
distanceY: Double,
distanceY: Double
): Boolean {
// cancel if not vertical
if (currentSwipe != SwipeDetector.SwipeDirection.VERTICAL) return false

View File

@ -13,7 +13,7 @@ import app.revanced.integrations.youtube.swipecontrols.misc.toPoint
* @param controller reference to the main swipe controller
*/
class PressToSwipeController(
private val controller: SwipeControlsHostActivity,
private val controller: SwipeControlsHostActivity
) : BaseGestureController(controller) {
/**
* monitors if the user is currently in a swipe session.
@ -59,7 +59,7 @@ class PressToSwipeController(
from: MotionEvent,
to: MotionEvent,
distanceX: Double,
distanceY: Double,
distanceY: Double
): Boolean {
// cancel if not in swipe session or vertical
if (!isInSwipeSession || currentSwipe != SwipeDetector.SwipeDirection.VERTICAL) return false

View File

@ -11,11 +11,11 @@ import app.revanced.integrations.youtube.swipecontrols.SwipeControlsHostActivity
* @param controller reference to the main swipe controller
*/
abstract class BaseGestureController(
private val controller: SwipeControlsHostActivity,
private val controller: SwipeControlsHostActivity
) : GestureController,
GestureDetector.SimpleOnGestureListener(),
SwipeDetector by SwipeDetectorImpl(
controller.config.swipeMagnitudeThreshold.toDouble(),
controller.config.swipeMagnitudeThreshold.toDouble()
),
VolumeAndBrightnessScroller by VolumeAndBrightnessScrollerImpl(
controller,
@ -23,7 +23,7 @@ abstract class BaseGestureController(
controller.screen,
controller.overlay,
10,
1,
1
) {
/**
@ -85,7 +85,7 @@ abstract class BaseGestureController(
from: MotionEvent,
to: MotionEvent,
distanceX: Float,
distanceY: Float,
distanceY: Float
): Boolean {
// submit to swipe detector
submitForSwipe(from, to, distanceX, distanceY)
@ -96,7 +96,7 @@ abstract class BaseGestureController(
from,
to,
distanceX.toDouble(),
distanceY.toDouble(),
distanceY.toDouble()
)
// if the swipe was consumed, cancel downstream events once
@ -151,6 +151,6 @@ abstract class BaseGestureController(
from: MotionEvent,
to: MotionEvent,
distanceX: Double,
distanceY: Double,
distanceY: Double
): Boolean
}

View File

@ -25,7 +25,7 @@ interface SwipeDetector {
from: MotionEvent,
to: MotionEvent,
distanceX: Float,
distanceY: Float,
distanceY: Float
)
/**
@ -50,7 +50,7 @@ interface SwipeDetector {
/**
* swipe along the Y- Axes
*/
VERTICAL,
VERTICAL
}
}
@ -60,7 +60,7 @@ interface SwipeDetector {
* @param swipeMagnitudeThreshold minimum magnitude before a swipe is detected as such
*/
class SwipeDetectorImpl(
private val swipeMagnitudeThreshold: Double,
private val swipeMagnitudeThreshold: Double
) : SwipeDetector {
override var currentSwipe = SwipeDetector.SwipeDirection.NONE
@ -68,7 +68,7 @@ class SwipeDetectorImpl(
from: MotionEvent,
to: MotionEvent,
distanceX: Float,
distanceY: Float,
distanceY: Float
) {
if (currentSwipe == SwipeDetector.SwipeDirection.NONE) {
// no swipe direction was detected yet, try to detect one

View File

@ -48,7 +48,7 @@ class VolumeAndBrightnessScrollerImpl(
private val screenController: ScreenBrightnessController?,
private val overlayController: SwipeControlsOverlay,
volumeDistance: Int = 10,
brightnessDistance: Int = 1,
brightnessDistance: Int = 1
) : VolumeAndBrightnessScroller {
// region volume
@ -56,8 +56,8 @@ class VolumeAndBrightnessScrollerImpl(
ScrollDistanceHelper(
volumeDistance.applyDimension(
context,
TypedValue.COMPLEX_UNIT_DIP,
),
TypedValue.COMPLEX_UNIT_DIP
)
) { _, _, direction ->
volumeController?.run {
volume += direction
@ -73,8 +73,8 @@ class VolumeAndBrightnessScrollerImpl(
ScrollDistanceHelper(
brightnessDistance.applyDimension(
context,
TypedValue.COMPLEX_UNIT_DIP,
),
TypedValue.COMPLEX_UNIT_DIP
)
) { _, _, direction ->
screenController?.run {
if (screenBrightness > 0 || direction > 0) {

View File

@ -7,7 +7,7 @@ import android.view.MotionEvent
*/
data class Point(
val x: Int,
val y: Int,
val y: Int
)
/**

View File

@ -7,7 +7,7 @@ data class Rectangle(
val x: Int,
val y: Int,
val width: Int,
val height: Int,
val height: Int
) {
val left = x
val right = x + width

View File

@ -11,7 +11,7 @@ import kotlin.math.sign
*/
class ScrollDistanceHelper(
private val unitDistance: Int,
private val callback: (oldDistance: Double, newDistance: Double, direction: Int) -> Unit,
private val callback: (oldDistance: Double, newDistance: Double, direction: Int) -> Unit
) {
/**
@ -35,7 +35,7 @@ class ScrollDistanceHelper(
callback.invoke(
oldDistance,
scrolledDistance,
sign(scrolledDistance).toInt(),
sign(scrolledDistance).toInt()
)
}
}

View File

@ -20,6 +20,6 @@ fun Int.applyDimension(context: Context, unit: Int): Int {
return TypedValue.applyDimension(
unit,
this.toFloat(),
context.resources.displayMetrics,
context.resources.displayMetrics
).roundToInt()
}

View File

@ -24,7 +24,7 @@ import kotlin.math.round
*/
class SwipeControlsOverlayLayout(
context: Context,
private val config: SwipeControlsConfigurationProvider,
private val config: SwipeControlsConfigurationProvider
) : RelativeLayout(context), SwipeControlsOverlay {
/**
* DO NOT use this, for tools only
@ -40,14 +40,14 @@ class SwipeControlsOverlayLayout(
private fun getDrawable(name: String, width: Int, height: Int): Drawable {
return resources.getDrawable(
Utils.getResourceIdentifier(context, name, "drawable"),
context.theme,
context.theme
).apply {
setTint(config.overlayForegroundColor)
setBounds(
0,
0,
width,
height,
height
)
}
}
@ -59,14 +59,14 @@ class SwipeControlsOverlayLayout(
feedbackTextView = TextView(context).apply {
layoutParams = LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
addRule(CENTER_IN_PARENT, TRUE)
setPadding(
feedbackTextViewPadding,
feedbackTextViewPadding,
feedbackTextViewPadding,
feedbackTextViewPadding,
feedbackTextViewPadding
)
}
background = GradientDrawable().apply {
@ -108,7 +108,7 @@ class SwipeControlsOverlayLayout(
icon,
null,
null,
null,
null
)
visibility = VISIBLE
}
@ -117,7 +117,7 @@ class SwipeControlsOverlayLayout(
override fun onVolumeChanged(newVolume: Int, maximumVolume: Int) {
showFeedbackView(
"$newVolume",
if (newVolume > 0) normalVolumeIcon else mutedVolumeIcon,
if (newVolume > 0) normalVolumeIcon else mutedVolumeIcon
)
}
@ -134,7 +134,7 @@ class SwipeControlsOverlayLayout(
@Suppress("DEPRECATION")
performHapticFeedback(
HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING,
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING
)
}
}