mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-25 22:34:16 +01:00
Clear or suppress some easy lint warnings
This commit is contained in:
parent
94459e01a4
commit
0949d51871
@ -87,5 +87,5 @@ data class AppItem(private val meta : AppEntry) : DataItem() {
|
||||
/**
|
||||
* The name and author is used as the key
|
||||
*/
|
||||
fun key() = meta.name + if (meta.author != null) " ${meta.author}" else ""
|
||||
fun key() = "${meta.name}${meta.author.let { it ?: "" }}"
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ open class Controller(val id : Int, var type : ControllerType, var rumbleDeviceD
|
||||
*/
|
||||
companion object {
|
||||
@JvmStatic
|
||||
private val serialVersionUID = 6529685098267757690L
|
||||
val serialVersionUID = 6529685098267757690L
|
||||
|
||||
/**
|
||||
* The value of [rumbleDeviceDescriptor] when the built-in Vibrator should be utilized
|
||||
@ -60,23 +60,39 @@ open class Controller(val id : Int, var type : ControllerType, var rumbleDeviceD
|
||||
/**
|
||||
* This Controller class is for the Handheld-ProCon controller that change based on the operation mode
|
||||
*/
|
||||
class HandheldController(id : Int) : Controller(id, ControllerType.HandheldProController)
|
||||
class HandheldController(id : Int) : Controller(id, ControllerType.HandheldProController) {
|
||||
companion object {
|
||||
private val serialVersionUID = Controller.serialVersionUID
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This Controller class is for the Pro Controller (ProCon)
|
||||
*/
|
||||
class ProController(id : Int) : Controller(id, ControllerType.ProController)
|
||||
class ProController(id : Int) : Controller(id, ControllerType.ProController) {
|
||||
companion object {
|
||||
private val serialVersionUID = Controller.serialVersionUID
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This Controller class is for the left Joy-Con controller
|
||||
*
|
||||
* @param partnerId The ID of the corresponding right Joy-Con if this is a pair
|
||||
*/
|
||||
class JoyConLeftController(id : Int, var partnerId : Int? = null) : Controller(id, ControllerType.JoyConLeft)
|
||||
class JoyConLeftController(id : Int, var partnerId : Int? = null) : Controller(id, ControllerType.JoyConLeft) {
|
||||
companion object {
|
||||
private val serialVersionUID = Controller.serialVersionUID
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This Controller class is for the right Joy-Con controller
|
||||
*
|
||||
* @param partnerId The ID of the corresponding left Joy-Con if this is a pair
|
||||
*/
|
||||
class JoyConRightController(id : Int, var partnerId : Int? = null) : Controller(id, ControllerType.JoyConRight)
|
||||
class JoyConRightController(id : Int, var partnerId : Int? = null) : Controller(id, ControllerType.JoyConRight) {
|
||||
companion object {
|
||||
private val serialVersionUID = Controller.serialVersionUID
|
||||
}
|
||||
}
|
||||
|
@ -57,8 +57,10 @@ class ControllerActivity : AppCompatActivity() {
|
||||
*/
|
||||
val axisMap = mutableMapOf<AxisId, ControllerStickViewItem>()
|
||||
|
||||
@Suppress("WeakerAccess")
|
||||
val stickItems = mutableListOf<ControllerStickViewItem>()
|
||||
|
||||
@Suppress("WeakerAccess")
|
||||
val buttonItems = mutableListOf<ControllerButtonViewItem>()
|
||||
|
||||
@Inject
|
||||
@ -191,7 +193,7 @@ class ControllerActivity : AppCompatActivity() {
|
||||
|
||||
var layoutDone = false // Tracks if the layout is complete to avoid retrieving invalid attributes
|
||||
binding.coordinatorLayout.viewTreeObserver.addOnTouchModeChangeListener { isTouchMode ->
|
||||
val layoutUpdate = { ->
|
||||
val layoutUpdate = {
|
||||
val params = binding.controllerList.layoutParams as CoordinatorLayout.LayoutParams
|
||||
if (!isTouchMode) {
|
||||
binding.titlebar.appBarLayout.setExpanded(true)
|
||||
@ -218,7 +220,7 @@ class ControllerActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
val dividerItemDecoration = object : DividerItemDecoration(this, DividerItemDecoration.VERTICAL) {
|
||||
val dividerItemDecoration = object : DividerItemDecoration(this, VERTICAL) {
|
||||
override fun onDraw(canvas : Canvas, parent : RecyclerView, state : RecyclerView.State) {
|
||||
val divider = drawable!!
|
||||
for (i in 0 until parent.childCount) {
|
||||
|
@ -76,6 +76,7 @@ class InputHandler(private val inputManager : InputManager, private val emulatio
|
||||
external fun setTouchState(points : IntArray)
|
||||
}
|
||||
|
||||
@Suppress("ArrayInDataClass")
|
||||
data class MotionSensorInput(
|
||||
var timestamp : u64 = 0uL,
|
||||
var deltaTimestamp : u64 = 0uL,
|
||||
@ -100,10 +101,10 @@ class InputHandler(private val inputManager : InputManager, private val emulatio
|
||||
* Used for adjusting motion to phone orientation
|
||||
*/
|
||||
private val motionRotationMatrix = FloatArray(9)
|
||||
private val motionGyroOrientation : FloatArray = FloatArray(3);
|
||||
private val motionAcelOrientation : FloatArray = FloatArray(3);
|
||||
private var motionAxisOrientationX = SensorManager.AXIS_Y;
|
||||
private var motionAxisOrientationY = SensorManager.AXIS_X;
|
||||
private val motionGyroOrientation : FloatArray = FloatArray(3)
|
||||
private val motionAcelOrientation : FloatArray = FloatArray(3)
|
||||
private var motionAxisOrientationX = SensorManager.AXIS_Y
|
||||
private var motionAxisOrientationY = SensorManager.AXIS_X
|
||||
|
||||
/**
|
||||
* Initializes all of the controllers from [InputManager] on the guest
|
||||
@ -151,15 +152,15 @@ class InputHandler(private val inputManager : InputManager, private val emulatio
|
||||
}
|
||||
}
|
||||
|
||||
setMotionOrientation90();
|
||||
setMotionOrientation90()
|
||||
val orientationEventListener = object : OrientationEventListener(context) {
|
||||
override fun onOrientationChanged(orientation : Int) {
|
||||
when {
|
||||
isWithinOrientationRange(orientation, 270) -> {
|
||||
setMotionOrientation270();
|
||||
setMotionOrientation270()
|
||||
}
|
||||
isWithinOrientationRange(orientation, 90) -> {
|
||||
setMotionOrientation90();
|
||||
setMotionOrientation90()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -184,8 +185,8 @@ class InputHandler(private val inputManager : InputManager, private val emulatio
|
||||
motionAcelOrientation[0] = -1.0f
|
||||
motionAcelOrientation[1] = 1.0f
|
||||
motionAcelOrientation[2] = -1.0f
|
||||
motionAxisOrientationX = SensorManager.AXIS_Y;
|
||||
motionAxisOrientationY = SensorManager.AXIS_X;
|
||||
motionAxisOrientationX = SensorManager.AXIS_Y
|
||||
motionAxisOrientationY = SensorManager.AXIS_X
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,8 +201,8 @@ class InputHandler(private val inputManager : InputManager, private val emulatio
|
||||
motionAcelOrientation[2] = -1.0f
|
||||
|
||||
// TODO: Find the correct configuration here
|
||||
motionAxisOrientationX = SensorManager.AXIS_Y;
|
||||
motionAxisOrientationY = SensorManager.AXIS_X;
|
||||
motionAxisOrientationX = SensorManager.AXIS_Y
|
||||
motionAxisOrientationY = SensorManager.AXIS_X
|
||||
}
|
||||
|
||||
/**
|
||||
@ -320,7 +321,7 @@ class InputHandler(private val inputManager : InputManager, private val emulatio
|
||||
motionSensor.quaternion[2] = event.values[2]
|
||||
motionSensor.quaternion[3] = event.values[3]
|
||||
SensorManager.getRotationMatrixFromVector(motionRotationMatrix, motionSensor.quaternion)
|
||||
SensorManager.remapCoordinateSystem(motionRotationMatrix, motionAxisOrientationX, motionAxisOrientationY, motionSensor.orientationMatrix);
|
||||
SensorManager.remapCoordinateSystem(motionRotationMatrix, motionAxisOrientationX, motionAxisOrientationY, motionSensor.orientationMatrix)
|
||||
}
|
||||
|
||||
Sensor.TYPE_GAME_ROTATION_VECTOR -> {
|
||||
@ -329,7 +330,7 @@ class InputHandler(private val inputManager : InputManager, private val emulatio
|
||||
motionSensor.quaternion[2] = event.values[2]
|
||||
motionSensor.quaternion[3] = event.values[3]
|
||||
SensorManager.getRotationMatrixFromVector(motionRotationMatrix, motionSensor.quaternion)
|
||||
SensorManager.remapCoordinateSystem(motionRotationMatrix, motionAxisOrientationX, motionAxisOrientationY, motionSensor.orientationMatrix);
|
||||
SensorManager.remapCoordinateSystem(motionRotationMatrix, motionAxisOrientationX, motionAxisOrientationY, motionSensor.orientationMatrix)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
@ -341,11 +342,11 @@ class InputHandler(private val inputManager : InputManager, private val emulatio
|
||||
|
||||
motionSensor.deltaTimestamp = event.timestamp.toULong() - motionSensor.timestamp
|
||||
motionSensor.timestamp = event.timestamp.toULong()
|
||||
motionDataBuffer.clear();
|
||||
motionDataBuffer.clear()
|
||||
setMotionState(0, 0, motionSensor.writeToByteBuffer(motionDataBuffer))
|
||||
motionDataBuffer.clear();
|
||||
motionDataBuffer.clear()
|
||||
setMotionState(0, 1, motionSensor.writeToByteBuffer(motionDataBuffer))
|
||||
motionDataBuffer.clear();
|
||||
motionDataBuffer.clear()
|
||||
setMotionState(0, 2, motionSensor.writeToByteBuffer(motionDataBuffer))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user