summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrettyWhite <geekman3454@protonmail.com>2019-04-25 10:37:07 -0400
committerBrettyWhite <geekman3454@protonmail.com>2019-04-25 10:37:07 -0400
commitb33d613861ac4346f382a9ae3ac04a9db9e7c895 (patch)
tree4521ca9fc020c410fa7673bf2a6f0e36c47c487f
parent0a8ceb4ada774313be6e5fb81bdbec7a124b4233 (diff)
downloadsdl_android-b33d613861ac4346f382a9ae3ac04a9db9e7c895.tar.gz
voice command class - needs tests
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandSelectionListener.java39
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/cells/VoiceCommand.java52
2 files changed, 91 insertions, 0 deletions
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandSelectionListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandSelectionListener.java
new file mode 100644
index 000000000..1af92d3f4
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandSelectionListener.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.managers.screen.menu;
+
+public interface VoiceCommandSelectionListener {
+
+ void onVoiceCommandSelected();
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/cells/VoiceCommand.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/cells/VoiceCommand.java
index 7450995dc..f9e52f0b5 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/cells/VoiceCommand.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/cells/VoiceCommand.java
@@ -32,8 +32,60 @@
package com.smartdevicelink.managers.screen.menu.cells;
+import com.smartdevicelink.managers.screen.menu.VoiceCommandSelectionListener;
+
+import java.util.List;
+
public class VoiceCommand {
+ /**
+ * The strings the user can say to activate this voice command
+ */
+ private List<String> voiceCommands;
+
+ /**
+ * The listener that will be called when the command is activated
+ */
+ private VoiceCommandSelectionListener voiceCommandSelectionListener;
+
+ // CONSTRUCTOR(S)
+
+ public VoiceCommand(List<String> voiceCommands, VoiceCommandSelectionListener voiceCommandSelectionListener){
+ setVoiceCommands(voiceCommands);
+ setVoiceCommandSelectionListener(voiceCommandSelectionListener);
+ }
+
+ // SETTERS / GETTERS
+
+ /**
+ * The strings the user can say to activate this voice command
+ * @param voiceCommands - the list of commands to send to the head unit
+ */
+ public void setVoiceCommands(List<String> voiceCommands) {
+ this.voiceCommands = voiceCommands;
+ }
+
+ /**
+ * The strings the user can say to activate this voice command
+ * @return the List of voice commands
+ */
+ public List<String> getVoiceCommands() {
+ return voiceCommands;
+ }
+ /**
+ * The listener that will be called when the command is activated
+ * @param voiceCommandSelectionListener - the listener for this object
+ */
+ public void setVoiceCommandSelectionListener(VoiceCommandSelectionListener voiceCommandSelectionListener) {
+ this.voiceCommandSelectionListener = voiceCommandSelectionListener;
+ }
+ /**
+ * The listener that will be called when the command is activated
+ * @return voiceCommandSelectionListener - the listener for this object
+ */
+ public VoiceCommandSelectionListener getVoiceCommandSelectionListener() {
+ return voiceCommandSelectionListener;
+ }
}