-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile Choice Set Manager #1080
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1080 +/- ##
============================================
- Coverage 46.48% 43.9% -2.59%
- Complexity 3852 3996 +144
============================================
Files 440 450 +10
Lines 21052 23633 +2581
Branches 2327 2976 +649
============================================
+ Hits 9787 10375 +588
- Misses 10718 12652 +1934
- Partials 547 606 +59
Continue to review full report at Codecov.
|
# Conflicts: # base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
… feature/choice_set_manager
@@ -61,7 +59,6 @@ public void testInstantiation(){ | |||
assertNull(screenManager.getSoftButtonObjectByName("test")); | |||
assertNull(screenManager.getSoftButtonObjectById(1)); | |||
assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be able to add this back?
// make sure there is at least one vr param | ||
List<String> existingVrCommands = getVrCommands(); | ||
// this is added to allow the choice set manager to disable this functionality | ||
if (!getIgnoreAddingVRItems()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a direct access to the variable as it's private and in the class. Unless you moved this to a static instance for all choice instances and then synchronized the read/write operations.
@@ -97,6 +97,7 @@ | |||
public static final String KEY_VR_COMMANDS = "vrCommands"; | |||
public static final String KEY_CHOICE_ID = "choiceID"; | |||
public static final String KEY_IMAGE = "image"; | |||
private boolean ignoreAddingVRItems; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a description to this variable so that it's clear why we have it.
int nextChoiceId; | ||
final int choiceCellIdMin = 1; | ||
|
||
SystemContext currentSystemContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra whitespace here
executor.submit(deleteChoicesOperation); | ||
} | ||
|
||
public void presentChoiceSet(@NonNull final ChoiceSet choiceSet, @Nullable final InteractionMode mode, @Nullable final KeyboardListener keyboardListener){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing javadoc
} | ||
} | ||
|
||
public void deleteChoices(@NonNull List<ChoiceCell> choices){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing javadoc
executor.submit(checkChoiceVR); | ||
} | ||
|
||
public void preloadChoices(@NonNull List<ChoiceCell> choices, @Nullable final CompletionListener listener){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing javadoc
pendingPresentOperation = executor.submit(presentOp); | ||
} | ||
|
||
public void presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing javadoc
// if this is not an instance of this class, not the same | ||
if (!(o instanceof ChoiceCell)) return false; | ||
|
||
return hashCode() == o.hashCode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'o' could be null here and that will throw an NPE
pi.setOnRPCResponseListener(new OnRPCResponseListener() { | ||
@Override | ||
public void onResponse(int correlationId, RPCResponse response) { | ||
finishOperation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't check the onError method, meaning if there is an error this will never call finishOperation
DeleteInteractionChoiceSet delete = createDeleteInteractionChoiceSet(); | ||
delete.setOnRPCResponseListener(new OnRPCResponseListener() { | ||
@Override | ||
public void onResponse(int correlationId, RPCResponse response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not overriding onError here
Fixes #764
This PR is ready for review.
Risk
This PR makes minor API changes.
Testing Plan
To be added later
Summary
This PR implements the
ChoiceSetManager
for Android, JavaSE, and JavaEE projects as described in the proposalTasks Remaining:
CLA