From 7b3d00ad85fc0605b53f374896395e42ace63296 Mon Sep 17 00:00:00 2001
From: tobias <thinkdifferent055@gmail.com>
Date: Sun, 17 Feb 2019 13:03:17 +0100
Subject: [PATCH] Cleanup cart action handler

---
 .../playpad/action/actions/cart/CartAction.java       |  2 +-
 .../actions/cart/handler/CartActionHandler.scala      |  3 +--
 .../action/actions/cart/handler/PlayHoldHandler.scala | 11 ++++-------
 .../actions/cart/handler/PlayPauseHandler.scala       |  9 +++------
 .../action/actions/cart/handler/PlayPlayHandler.scala |  9 +++------
 .../action/actions/cart/handler/PlayStopHandler.scala |  8 ++------
 6 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/PlayWall/src/main/java/de/tobias/playpad/action/actions/cart/CartAction.java b/PlayWall/src/main/java/de/tobias/playpad/action/actions/cart/CartAction.java
index 604f9d0e..eec9a3cd 100644
--- a/PlayWall/src/main/java/de/tobias/playpad/action/actions/cart/CartAction.java
+++ b/PlayWall/src/main/java/de/tobias/playpad/action/actions/cart/CartAction.java
@@ -133,7 +133,7 @@ public class CartAction extends Action implements ColorAdjustable {
 		}
 
 		if (pad.hasVisibleContent()) {
-			handler.performAction(type, this, pad, project);
+			handler.performAction(type, this, pad);
 		}
 	}
 
diff --git a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/CartActionHandler.scala b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/CartActionHandler.scala
index 122de83f..c472bcf3 100644
--- a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/CartActionHandler.scala
+++ b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/CartActionHandler.scala
@@ -3,9 +3,8 @@ package de.tobias.playpad.action.actions.cart.handler
 import de.tobias.playpad.action.InputType
 import de.tobias.playpad.action.actions.cart.CartAction
 import de.tobias.playpad.pad.Pad
-import de.tobias.playpad.project.Project
 
 trait CartActionHandler {
 
-	def performAction(inputType: InputType, cartAction: CartAction, pad: Pad, project: Project): Unit
+	def performAction(inputType: InputType, cartAction: CartAction, pad: Pad): Unit
 }
diff --git a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayHoldHandler.scala b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayHoldHandler.scala
index a5200053..49c630e5 100644
--- a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayHoldHandler.scala
+++ b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayHoldHandler.scala
@@ -3,19 +3,16 @@ package de.tobias.playpad.action.actions.cart.handler
 import de.tobias.playpad.action.InputType
 import de.tobias.playpad.action.actions.cart.CartAction
 import de.tobias.playpad.pad.Pad
-import de.tobias.playpad.project.Project
 
 class PlayHoldHandler extends CartActionHandler {
-	override def performAction(`type`: InputType,
-							   cartAction: CartAction,
-							   pad: Pad,
-							   project: Project): Unit = {
-		if (`type` eq InputType.PRESSED) {
+
+	override def performAction(inputType: InputType, cartAction: CartAction, pad: Pad): Unit = {
+		if (inputType eq InputType.PRESSED) {
 			if (pad.isReady) { // Allow the listener to send the feedback
 				cartAction.getPadPositionListener.setSend(false)
 				pad.play()
 			}
-		} else if (`type` eq InputType.RELEASED) {
+		} else if (inputType eq InputType.RELEASED) {
 			if (pad.isPlay) {
 				pad.stop()
 			}
diff --git a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayPauseHandler.scala b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayPauseHandler.scala
index 90e322e1..8fb1cfda 100644
--- a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayPauseHandler.scala
+++ b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayPauseHandler.scala
@@ -3,14 +3,11 @@ package de.tobias.playpad.action.actions.cart.handler
 import de.tobias.playpad.action.InputType
 import de.tobias.playpad.action.actions.cart.CartAction
 import de.tobias.playpad.pad.Pad
-import de.tobias.playpad.project.Project
 
 class PlayPauseHandler extends CartActionHandler {
-	override def performAction(`type`: InputType,
-							   cartAction: CartAction,
-							   pad: Pad,
-							   project: Project): Unit = {
-		if (`type` eq InputType.PRESSED) {
+
+	override def performAction(inputType: InputType, cartAction: CartAction, pad: Pad): Unit = {
+		if (inputType eq InputType.PRESSED) {
 			if (pad.isPlay) {
 				pad.pause()
 			}
diff --git a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayPlayHandler.scala b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayPlayHandler.scala
index 1a02e846..f43a5621 100644
--- a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayPlayHandler.scala
+++ b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayPlayHandler.scala
@@ -3,14 +3,11 @@ package de.tobias.playpad.action.actions.cart.handler
 import de.tobias.playpad.action.InputType
 import de.tobias.playpad.action.actions.cart.CartAction
 import de.tobias.playpad.pad.{Pad, PadStatus}
-import de.tobias.playpad.project.Project
 
 class PlayPlayHandler extends CartActionHandler {
-	override def performAction(`type`: InputType,
-							   cartAction: CartAction,
-							   pad: Pad,
-							   project: Project): Unit = {
-		if (`type` eq InputType.PRESSED) {
+
+	override def performAction(inputType: InputType, cartAction: CartAction, pad: Pad): Unit = {
+		if (inputType eq InputType.PRESSED) {
 			pad.setStatus(PadStatus.RESTART)
 		}
 	}
diff --git a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayStopHandler.scala b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayStopHandler.scala
index 57459931..4ecc60ed 100644
--- a/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayStopHandler.scala
+++ b/PlayWall/src/main/scala/de/tobias/playpad/action/actions/cart/handler/PlayStopHandler.scala
@@ -3,15 +3,11 @@ package de.tobias.playpad.action.actions.cart.handler
 import de.tobias.playpad.action.InputType
 import de.tobias.playpad.action.actions.cart.CartAction
 import de.tobias.playpad.pad.Pad
-import de.tobias.playpad.project.Project
 
 class PlayStopHandler extends CartActionHandler {
 
-	override def performAction(`type`: InputType,
-							   cartAction: CartAction,
-							   pad: Pad,
-							   project: Project): Unit = {
-		if (`type` eq InputType.PRESSED) {
+	override def performAction(inputType: InputType, cartAction: CartAction, pad: Pad): Unit = {
+		if (inputType eq InputType.PRESSED) {
 			if (pad.isPlay) {
 				pad.stop()
 			} else { // Allow the listener to send the feedback
-- 
GitLab