diff options
author | BrettyWhite <geekman3454@protonmail.com> | 2019-06-10 15:04:46 -0400 |
---|---|---|
committer | BrettyWhite <geekman3454@protonmail.com> | 2019-06-10 15:04:46 -0400 |
commit | af307dedefc872c281bcce54f85e40db39f1b184 (patch) | |
tree | 9a8dafa6634205742169a58ae33a395869643ba4 | |
parent | 975f87e7a3a2c3fe77aa4b6c17c34650a8f27d9f (diff) | |
download | sdl_android-af307dedefc872c281bcce54f85e40db39f1b184.tar.gz |
fix multiple issues
8 files changed, 27 insertions, 23 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java index 28a19c84e..3d7a30a79 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java @@ -78,7 +78,7 @@ public class ChoiceSetTests extends AndroidTestCase2 { public void testConstructors() { // first constructor was tested in previous method, use the rest here - ChoiceSet choiceSet = new ChoiceSet(Test.GENERAL_STRING, layout, Test.GENERAL_INTEGER, Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_VRHELPITEM_LIST, choices, listener); + ChoiceSet choiceSet = new ChoiceSet(Test.GENERAL_STRING, layout, Test.GENERAL_INTEGER, Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_VRHELPITEM_LIST, Test.GENERAL_KEYBOARDPROPERTIES, choices, listener); assertEquals(choiceSet.getTitle(), Test.GENERAL_STRING); assertEquals(choiceSet.getInitialPrompt().get(0).getText(),Test.GENERAL_STRING); assertEquals(choiceSet.getHelpPrompt().get(0).getText(), Test.GENERAL_STRING); @@ -88,7 +88,7 @@ public class ChoiceSetTests extends AndroidTestCase2 { assertEquals(choiceSet.getChoices(), choices); assertEquals(choiceSet.getChoiceSetSelectionListener(), listener); - ChoiceSet choiceSet2 = new ChoiceSet(Test.GENERAL_STRING, layout, Test.GENERAL_INTEGER, Test.GENERAL_TTSCHUNK_LIST, Test.GENERAL_TTSCHUNK_LIST, Test.GENERAL_TTSCHUNK_LIST, Test.GENERAL_VRHELPITEM_LIST, choices, listener); + ChoiceSet choiceSet2 = new ChoiceSet(Test.GENERAL_STRING, layout, Test.GENERAL_INTEGER, Test.GENERAL_TTSCHUNK_LIST, Test.GENERAL_TTSCHUNK_LIST, Test.GENERAL_TTSCHUNK_LIST, Test.GENERAL_VRHELPITEM_LIST, Test.GENERAL_KEYBOARDPROPERTIES, choices, listener); assertEquals(choiceSet2.getTitle(), Test.GENERAL_STRING); assertEquals(choiceSet2.getInitialPrompt(),Test.GENERAL_TTSCHUNK_LIST); assertEquals(choiceSet2.getHelpPrompt(), Test.GENERAL_TTSCHUNK_LIST); 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 fde586576..381e979e1 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java @@ -464,12 +464,12 @@ abstract class BaseScreenManager extends BaseSubManager { /** * Presents a keyboard on the Head unit to capture user input - * @param initialText - The initial text that is used as a placeholder text + * @param initialText - The initial text that is used as a placeholder text. It might not work on some head units. * @param customKeyboardProperties - the custom keyboard configuration to be used when the keyboard is displayed * @param keyboardListener - A keyboard listener to capture user input */ - public void presentKeyboardWithInitialText(String initialText, KeyboardProperties customKeyboardProperties, KeyboardListener keyboardListener){ - this.choiceSetManager.presentKeyboardWithInitialText(initialText, customKeyboardProperties, keyboardListener); + public void presentKeyboard(String initialText, KeyboardProperties customKeyboardProperties, KeyboardListener keyboardListener){ + this.choiceSetManager.presentKeyboard(initialText, customKeyboardProperties, keyboardListener); } /** diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java index 5cd089abd..a77a7c01e 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java @@ -277,7 +277,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager { if (this.pendingPresentationSet != null && pendingPresentOperation != null){ pendingPresentOperation.cancel(true); DebugTool.logWarning("Presenting a choice set while one is currently presented. Cancelling previous and continuing"); - return; } this.pendingPresentationSet = choiceSet; @@ -328,7 +327,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager { } - public void presentKeyboardWithInitialText(String initialText, KeyboardProperties customKeyboardConfig, KeyboardListener listener){ + public void presentKeyboard(String initialText, KeyboardProperties customKeyboardConfig, KeyboardListener listener){ if (!isReady()){ return; } @@ -351,7 +350,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager { // SETTERS public void setKeyboardConfiguration(KeyboardProperties keyboardConfiguration){ - if (keyboardConfiguration == null){ this.keyboardConfiguration = defaultKeyboardConfiguration(); } else{ @@ -423,7 +421,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager { // LISTENERS private void addListeners(){ - // DISPLAY CAPABILITIES - via SCM displayListener = new OnSystemCapabilityListener() { @Override @@ -467,7 +464,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager { } }; internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener); - } // ADDITIONAL HELPERS diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/CheckChoiceVROptionalOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/CheckChoiceVROptionalOperation.java index 88856ede5..02b976359 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/CheckChoiceVROptionalOperation.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/CheckChoiceVROptionalOperation.java @@ -56,6 +56,7 @@ public class CheckChoiceVROptionalOperation implements Runnable { @Override public void run() { + DebugTool.logInfo("Choice Operation: Executing check vr optional operation"); sendTestChoiceNoVR(); } diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/DeleteChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/DeleteChoicesOperation.java index 482c3de4f..39cb93126 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/DeleteChoicesOperation.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/DeleteChoicesOperation.java @@ -60,6 +60,7 @@ public class DeleteChoicesOperation implements Runnable { @Override public void run() { + DebugTool.logInfo("Choice Operation: Executing delete choices operation"); sendDeletions(); } diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PreloadChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PreloadChoicesOperation.java index 6e728a5e0..42c7b9d7a 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PreloadChoicesOperation.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PreloadChoicesOperation.java @@ -82,6 +82,7 @@ public class PreloadChoicesOperation implements Runnable { @Override public void run() { + DebugTool.logInfo("Choice Operation: Executing preload choices operation"); preloadCellArtworks(new CompletionListener() { @Override public void onComplete(boolean success) { diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PresentChoiceSetOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PresentChoiceSetOperation.java index 590e1b553..b9bcf51e6 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PresentChoiceSetOperation.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PresentChoiceSetOperation.java @@ -88,12 +88,12 @@ public class PresentChoiceSetOperation implements Runnable { @Override public void run() { + DebugTool.logInfo("Choice Operation: Executing present choice set operation"); addListeners(); start(); } private void start(){ - // Check if we're using a keyboard (searchable) choice set and setup keyboard properties if we need to if (keyboardListener != null && choiceSet.getCustomKeyboardConfiguration() != null){ keyboardProperties = choiceSet.getCustomKeyboardConfiguration(); @@ -111,14 +111,12 @@ public class PresentChoiceSetOperation implements Runnable { // SENDING REQUESTS private void updateKeyboardProperties(final CompletionListener listener){ - if (keyboardProperties == null){ if (listener != null){ listener.onComplete(false); } return; } - SetGlobalProperties setGlobalProperties = new SetGlobalProperties(); setGlobalProperties.setKeyboardProperties(keyboardProperties); setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() { @@ -136,6 +134,11 @@ public class PresentChoiceSetOperation implements Runnable { } } }); + if (internalInterface.get() != null){ + internalInterface.get().sendRPC(setGlobalProperties); + } else { + DebugTool.logError("Internal interface null - present choice set op - choice"); + } } private void presentChoiceSet() { @@ -156,7 +159,7 @@ public class PresentChoiceSetOperation implements Runnable { setSelectedCellWithId(performInteractionResponse.getChoiceID()); selectedTriggerSource = performInteractionResponse.getTriggerSource(); - if (choiceSetSelectionListener != null){ + if (choiceSetSelectionListener != null && selectedCell != null && selectedTriggerSource != null && selectedCellRow != null){ choiceSetSelectionListener.onChoiceSelected(selectedCell, selectedTriggerSource, selectedCellRow); } @@ -208,7 +211,6 @@ public class PresentChoiceSetOperation implements Runnable { } private LayoutMode getLayoutMode() { - switch (choiceSet.getLayout()){ case CHOICE_SET_LAYOUT_LIST: return keyboardListener != null ? LayoutMode.LIST_WITH_SEARCH : LayoutMode.LIST_ONLY; @@ -230,12 +232,14 @@ public class PresentChoiceSetOperation implements Runnable { // HELPERS private void setSelectedCellWithId(Integer cellId){ - List<ChoiceCell> cells = choiceSet.getChoices(); - for (int i = 0; i < cells.size(); i++) { - if (cells.get(i).getChoiceId() == cellId){ - selectedCell = cells.get(i); - selectedCellRow = i; - return; + if (choiceSet.getChoices() != null && cellId != null) { + List<ChoiceCell> cells = choiceSet.getChoices(); + for (int i = 0; i < cells.size(); i++) { + if (cells.get(i).getChoiceId() == cellId) { + selectedCell = cells.get(i); + selectedCellRow = i; + return; + } } } } @@ -249,6 +253,7 @@ public class PresentChoiceSetOperation implements Runnable { public void onNotified(RPCNotification notification) { if (Thread.interrupted()){ + DebugTool.logWarning("Choice Operation - Present: Thread has been interrupted. Cleaning up"); finishOperation(); return; } @@ -287,7 +292,6 @@ public class PresentChoiceSetOperation implements Runnable { // Notify of abort / Cancellation keyboardListener.onKeyboardDidAbortWithReason(onKeyboard.getEvent()); } - } }; diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PresentKeyboardOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PresentKeyboardOperation.java index 617767472..6ca189a2f 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PresentKeyboardOperation.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/operations/PresentKeyboardOperation.java @@ -80,7 +80,7 @@ public class PresentKeyboardOperation implements Runnable { } private void start(){ - + DebugTool.logInfo("Choice Operation: Executing present keyboard operation"); if (keyboardListener != null){ keyboardProperties = customConfig; updatedKeyboardProperties = true; @@ -193,6 +193,7 @@ public class PresentKeyboardOperation implements Runnable { public void onNotified(RPCNotification notification) { if (Thread.interrupted()){ + DebugTool.logWarning("Choice Operation - keyboard: Thread has been interrupted. Cleaning up"); finishOperation(); return; } |