Skip to content

Commit 862409a

Browse files
author
Julian Kast
committed
Fix issue of overlapping softButton ID's in the screenManager
1 parent d8a0fd1 commit 862409a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,15 +742,17 @@ public void presentAlert(AlertView alert, AlertCompletionListener listener) {
742742
* @return True if ButtonID's are good, False if not.
743743
*/
744744
static boolean checkAndAssignButtonIds(List<SoftButtonObject> softButtonObjects, @ManagerLocation int location) {
745+
HashSet<Integer> buttonIdsSetHashSet = new HashSet<>();
745746
// Depending on location form which the softButtons came from, we will clear out the id list so they can be reset
746747
if (location == ManagerLocation.ALERT_MANAGER) {
747748
softButtonIDByAlertManager.clear();
749+
buttonIdsSetHashSet = (HashSet) softButtonIDBySoftButtonManager.clone();
748750
} else if (location == ManagerLocation.SOFTBUTTON_MANAGER) {
749751
softButtonIDBySoftButtonManager.clear();
752+
buttonIdsSetHashSet = (HashSet) softButtonIDByAlertManager.clone();
750753
}
751754
// Check if multiple soft button objects have the same id
752-
HashSet<Integer> buttonIdsSetHashSet = new HashSet<>();
753-
int currentSoftButtonId, numberOfButtonIdsSet = 0, maxButtonIdsSetByDev = SOFT_BUTTON_ID_MIN_VALUE;
755+
int currentSoftButtonId, numberOfButtonIdsSet = buttonIdsSetHashSet.size(), maxButtonIdsSetByDev = SOFT_BUTTON_ID_MIN_VALUE;
754756

755757
for (SoftButtonObject softButtonObject : softButtonObjects) {
756758
currentSoftButtonId = softButtonObject.getButtonId();

0 commit comments

Comments
 (0)