summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrettyWhite <geekman3454@protonmail.com>2019-05-09 14:24:13 -0400
committerBrettyWhite <geekman3454@protonmail.com>2019-05-09 14:24:13 -0400
commit4002fde89c275d74f98c9e18ffc4616e2083ff1d (patch)
treed88d96dcd4b90c32fdd3e8c1feb0b800c1b08e2a
parentd17b59749162d82b15531fca8b138cd9a76a419b (diff)
downloadsdl_android-4002fde89c275d74f98c9e18ffc4616e2083ff1d.tar.gz
fix per comments
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java7
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java4
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java4
13 files changed, 35 insertions, 57 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
index 00b34865a..720611358 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
@@ -59,7 +59,7 @@ public class MenuCellTests extends AndroidTestCase2 {
public void testSettersAndGetters(){
// set everything
- MenuCell menuCell = new MenuCell(Test.GENERAL_STRING, menuSelectionListener);
+ MenuCell menuCell = new MenuCell(Test.GENERAL_STRING, null, null, menuSelectionListener);
menuCell.setIcon(Test.GENERAL_ARTWORK);
menuCell.setVoiceCommands(Test.GENERAL_STRING_LIST);
menuCell.setMenuSelectionListener(menuSelectionListener);
@@ -83,7 +83,7 @@ public class MenuCellTests extends AndroidTestCase2 {
assertEquals(menuCell3.getVoiceCommands(), Test.GENERAL_STRING_LIST);
assertEquals(menuCell3.getMenuSelectionListener(), menuSelectionListener);
- MenuCell menuCell4 =new MenuCell(Test.GENERAL_STRING, menuSelectionListener);
+ MenuCell menuCell4 =new MenuCell(Test.GENERAL_STRING,null, null, menuSelectionListener);
assertEquals(menuCell4.getTitle(), Test.GENERAL_STRING);
assertEquals(menuCell4.getMenuSelectionListener(), menuSelectionListener);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
index e0e56f220..b94a9bf98 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
@@ -81,7 +81,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
FileManager fileManager = mock(FileManager.class);
// When internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, OnRPCNotificationListener) is called
- // inside PermissionManager's constructor, then keep a reference to the OnRPCNotificationListener so we can trigger it later
+ // inside MenuManager's constructor, then keep a reference to the OnRPCNotificationListener so we can trigger it later
// to emulate what Core does when it sends OnHMIStatus notification
Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
@Override
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
index 617e2e22a..db662c31f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
@@ -80,7 +80,7 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
ISdl internalInterface = mock(ISdl.class);
// When internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, OnRPCNotificationListener) is called
- // inside PermissionManager's constructor, then keep a reference to the OnRPCNotificationListener so we can trigger it later
+ // inside the VoiceCommandManager's constructor, then keep a reference to the OnRPCNotificationListener so we can trigger it later
// to emulate what Core does when it sends OnHMIStatus notification
Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
@Override
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
index 3a75cd55b..a27587aae 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -453,7 +453,7 @@ public class Test {
public static final List<WeatherAlert> GENERAL_WEATHERALERT_LIST = Arrays.asList(GENERAL_WEATHERALERT);
public static final List<NavigationInstruction> GENERAL_NAVIGATION_INSTRUCTION_LIST = Arrays.asList(GENERAL_NAVIGATION_INSTRUCTION);
public static final int GENERAL_MENU_MAX_ID = 2000000000;
- public static final MenuCell GENERAL_MENUCELL = new MenuCell(GENERAL_STRING, new MenuSelectionListener() {
+ public static final MenuCell GENERAL_MENUCELL = new MenuCell(GENERAL_STRING,null, null, new MenuSelectionListener() {
@Override
public void onTriggered(TriggerSource trigger) {
//
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
index 4a28a2792..c244d0d39 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
@@ -42,9 +42,9 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
*
* The MenuManager takes MenuCell objects and creates and sends all necessary RPCs to build out a menu
*/
-public class MenuManager extends BaseMenuManager {
+class MenuManager extends BaseMenuManager {
- public MenuManager(ISdl internalInterface, FileManager fileManager) {
+ MenuManager(ISdl internalInterface, FileManager fileManager) {
// setup
super(internalInterface, fileManager);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
index a892d3a2c..a5492a384 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
@@ -41,9 +41,9 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
*
* The VoiceCommandManager takes a List of VoiceCommand objects and sets them on the Head unit for you.
*/
-public class VoiceCommandManager extends BaseVoiceCommandManager {
+class VoiceCommandManager extends BaseVoiceCommandManager {
- public VoiceCommandManager(ISdl internalInterface) {
+ VoiceCommandManager(ISdl internalInterface) {
// setup
super(internalInterface);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
index ec560dfd9..f5721c153 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
@@ -73,13 +73,13 @@ abstract class BaseScreenManager extends BaseSubManager {
DebugTool.logInfo("Starting screen manager, all sub managers are in ready state");
transitionToState(READY);
} else if (softButtonManager.getState() == BaseSubManager.ERROR && textAndGraphicManager.getState() == BaseSubManager.ERROR && voiceCommandManager.getState() == BaseSubManager.ERROR && menuManager.getState() == BaseSubManager.ERROR) {
- Log.e(TAG, "ERROR starting screen manager, both sub managers in error state");
+ Log.e(TAG, "ERROR starting screen manager, one or more sub managers in error state");
transitionToState(ERROR);
} else if (textAndGraphicManager.getState() == BaseSubManager.SETTING_UP || softButtonManager.getState() == BaseSubManager.SETTING_UP || voiceCommandManager.getState() == BaseSubManager.SETTING_UP || menuManager.getState() == BaseSubManager.SETTING_UP) {
- DebugTool.logInfo("SETTING UP screen manager, one sub manager is still setting up");
+ DebugTool.logInfo("SETTING UP screen manager, at least one sub manager is still setting up");
transitionToState(SETTING_UP);
} else {
- Log.w(TAG, "LIMITED starting screen manager, one sub manager in error state and the other is ready");
+ Log.w(TAG, "LIMITED starting screen manager, at least one sub manager in error state and the other is ready");
transitionToState(LIMITED);
}
} else {
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
index ebcb318dd..55d271a1e 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
@@ -101,11 +101,6 @@ abstract class BaseMenuManager extends BaseSubManager {
this.fileManager = new WeakReference<>(fileManager);
currentSystemContext = SystemContext.SYSCTXT_MAIN;
currentHMILevel = HMILevel.HMI_NONE;
- menuCells = new ArrayList<>();
- oldMenuCells = new ArrayList<>();
- waitingUpdateMenuCells = new ArrayList<>();
- inProgressUpdate = new ArrayList<>();
-
lastMenuId = menuCellIdMin;
addListeners();
}
@@ -197,12 +192,12 @@ abstract class BaseMenuManager extends BaseSubManager {
DebugTool.logInfo("Menu Artworks Uploaded");
}
// proceed
- updateMenuWithListener();
+ update();
}
});
}else{
// No Artworks to be uploaded, send off
- updateMenuWithListener();
+ update();
}
}
@@ -216,7 +211,7 @@ abstract class BaseMenuManager extends BaseSubManager {
// UPDATING SYSTEM
- private void updateMenuWithListener(){
+ private void update(){
if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE) || currentSystemContext.equals(SystemContext.SYSCTXT_MENU)){
// We are in NONE or the menu is in use, bail out of here
@@ -246,7 +241,7 @@ abstract class BaseMenuManager extends BaseSubManager {
}
if (hasQueuedUpdate){
- updateMenuWithListener();
+ update();
hasQueuedUpdate = false;
}
}
@@ -313,7 +308,7 @@ abstract class BaseMenuManager extends BaseSubManager {
List<RPCRequest> mainMenuCommands;
final List<RPCRequest> subMenuCommands;
- if (findAllArtworksToBeUploadedFromCells(menuCells).size() > 0 || !supportsImages()){
+ if (findAllArtworksToBeUploadedFromCells(menuCells).size() == 0 || !supportsImages()){
// Send artwork-less menu
mainMenuCommands = mainMenuCommandsForCells(menuCells, false);
subMenuCommands = subMenuCommandsForCells(menuCells, false);
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
index bb5708880..e8effa5bf 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
@@ -78,8 +78,6 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
currentHMILevel = HMILevel.HMI_NONE;
addListeners();
lastVoiceCommandId = voiceCommandIdMin;
- voiceCommands = new ArrayList<>();
- oldVoiceCommands = new ArrayList<>();
}
@Override
@@ -131,7 +129,7 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
oldVoiceCommands = new ArrayList<>(voiceCommands);
this.voiceCommands = new ArrayList<>(voiceCommands);
- updateWithListener();
+ update();
}
public List<VoiceCommand> getVoiceCommands(){
@@ -140,7 +138,7 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
// UPDATING SYSTEM
- private void updateWithListener(){
+ private void update(){
if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE)){
waitingOnHMIUpdate = true;
@@ -163,7 +161,7 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
inProgressUpdate = null;
if (hasQueuedUpdate){
- updateWithListener();
+ update();
hasQueuedUpdate = false;
}
@@ -183,7 +181,7 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
if (oldVoiceCommands == null || oldVoiceCommands.size() == 0){
if (listener != null){
- listener.onComplete(false);
+ listener.onComplete(true);
}
return;
}
@@ -276,9 +274,8 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
}
private AddCommand commandForVoiceCommand(VoiceCommand voiceCommand){
- AddCommand command = new AddCommand();
+ AddCommand command = new AddCommand(voiceCommand.getCommandId());
command.setVrCommands(voiceCommand.getVoiceCommands());
- command.setCmdID(voiceCommand.getCommandId());
return command;
}
@@ -304,8 +301,6 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
if (oldHMILevel.equals(HMILevel.HMI_NONE) && !currentHMILevel.equals(HMILevel.HMI_NONE)){
if (waitingOnHMIUpdate){
setVoiceCommands(voiceCommands);
- }else{
- updateWithListener();
}
}
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java
index 0ec33541a..27b539430 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java
@@ -83,19 +83,7 @@ public class MenuCell {
// CONSTRUCTORS
- // SINGLE MENU ITEM CONSTRUCTORS
-
- /**
- * Creates a new MenuCell Object with just the title set.
- * @param title The cell's primary text
- * @param listener a listener that notifies you when the cell was selected and lets you know its trigger source
- */
- public MenuCell(@NonNull String title, @Nullable MenuSelectionListener listener) {
- setTitle(title); // title is the only required param
- setMenuSelectionListener(listener);
- setCellId(MAX_ID);
- setParentCellId(MAX_ID);
- }
+ // SINGLE MENU ITEM CONSTRUCTOR
/**
* Creates a new MenuCell Object with multiple parameters set
@@ -252,9 +240,10 @@ public class MenuCell {
* Get the description of the cell
* @return a String description of the cell object
*/
- public String getDescription(){
- return "MenuCell - ID: "+cellId+ " title: "+ title + " ArtworkName: "+
- icon.getName() + " VoiceCommands: "+ voiceCommands.size() + " isSubCell: " + (parentCellId != Integer.MAX_VALUE ? "YES":"NO")+
- " hasSubCells: "+ (subCells != null && subCells.size() > 0 ? "YES":"NO");
+ @Override
+ public String toString(){
+ return "MenuCell - ID: "+cellId+ " - title: "+ title + " - ArtworkName: "+
+ (icon != null && icon.getName() != null ? icon.getName() : "Artwork is null") + " - VoiceCommands Size: "+ (voiceCommands != null ? voiceCommands.size() : "0") + " - isSubCell: " + (parentCellId != MAX_ID ? "YES":"NO")+
+ " - hasSubCells: "+ (subCells != null && subCells.size() > 0 ? "YES":"NO");
}
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java
index c912f36fb..02a7afff9 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java
@@ -35,8 +35,6 @@ package com.smartdevicelink.managers.screen.menu;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import com.smartdevicelink.managers.screen.menu.VoiceCommandSelectionListener;
-
import java.util.List;
public class VoiceCommand {
@@ -126,7 +124,8 @@ public class VoiceCommand {
* Get the description of the cell
* @return a String description of the cell object
*/
- public String getDescription(){
- return "VOICE COMMAND - ID: "+commandId+ " First Object: "+ voiceCommands.get(0)+ " Voice Commands: "+ voiceCommands.size();
+ @Override
+ public String toString(){
+ return "VOICE COMMAND - ID: "+commandId+ " - First Object: "+ ((voiceCommands.size() > 0) ? voiceCommands.get(0) : "Empty List")+ " - Voice Command List Size: "+ voiceCommands.size();
}
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
index 4a28a2792..c244d0d39 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
@@ -42,9 +42,9 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
*
* The MenuManager takes MenuCell objects and creates and sends all necessary RPCs to build out a menu
*/
-public class MenuManager extends BaseMenuManager {
+class MenuManager extends BaseMenuManager {
- public MenuManager(ISdl internalInterface, FileManager fileManager) {
+ MenuManager(ISdl internalInterface, FileManager fileManager) {
// setup
super(internalInterface, fileManager);
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
index a892d3a2c..a5492a384 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
@@ -41,9 +41,9 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
*
* The VoiceCommandManager takes a List of VoiceCommand objects and sets them on the Head unit for you.
*/
-public class VoiceCommandManager extends BaseVoiceCommandManager {
+class VoiceCommandManager extends BaseVoiceCommandManager {
- public VoiceCommandManager(ISdl internalInterface) {
+ VoiceCommandManager(ISdl internalInterface) {
// setup
super(internalInterface);
}