Skip to content

Commit 27184db

Browse files
HeniganHenigan
authored andcommitted
Merge branch 'bugfix/issue_1717_1718' of github.com:smartdevicelink/sdl_java_suite into bugfix/issue_1717_1718
2 parents 83bf81c + 0371f9f commit 27184db

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperationTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import java.util.Collections;
4242
import java.util.HashSet;
4343
import java.util.LinkedHashSet;
44-
import java.util.List;
4544

4645
import static junit.framework.TestCase.assertEquals;
4746
import static junit.framework.TestCase.assertFalse;

base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperation.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import com.livio.taskmaster.Task;
4141
import com.smartdevicelink.managers.CompletionListener;
4242
import com.smartdevicelink.managers.ISdl;
43-
import com.smartdevicelink.managers.ManagerUtility;
4443
import static com.smartdevicelink.managers.ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName;
4544
import static com.smartdevicelink.managers.ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName;
4645
import com.smartdevicelink.managers.file.FileManager;
@@ -96,7 +95,7 @@ class PreloadPresentChoicesOperation extends Task {
9695
private boolean choiceError = false;
9796
private HashSet<ChoiceCell> loadedCells;
9897
private final ChoiceSet choiceSet;
99-
//Start choiceId at 1 to ensure all HMIs handle it https://github.com/smartdevicelink/generic_hmi/commit/b292fbbec095b9ce11b520d47ec95b6fcff8e247
98+
// Start choiceId at 1 to ensure all HMIs handle it https://github.com/smartdevicelink/generic_hmi/commit/b292fbbec095b9ce11b520d47ec95b6fcff8e247
10099
private static Integer choiceId = 1;
101100
private static Boolean reachedMaxIds = false;
102101
private static final int MAX_CHOICE_ID = 65535;
@@ -547,12 +546,12 @@ private void assignIdsToCells(ArrayList<ChoiceCell> cells) {
547546
Collections.sort(usedIds);
548547
ArrayList<Integer> sortedUsedIds = (ArrayList<Integer>) usedIds.clone();
549548

550-
//Loop through the cells we need ids for. Get and assign those ids
549+
// Loop through the cells we need ids for. Get and assign those ids
551550
for (int i = 0; i < cells.size(); i++) {
552551
int cellId = nextChoiceIdBasedOnUsedIds(sortedUsedIds);
553552
cells.get(i).setChoiceId(cellId);
554553

555-
//Insert the ids into the usedIds sorted array in the correct position
554+
// Insert the ids into the usedIds sorted array in the correct position
556555
for (int j = 0; j < sortedUsedIds.size(); j++) {
557556
if (sortedUsedIds.get(j) > cellId) {
558557
sortedUsedIds.add(j, cellId);
@@ -565,11 +564,11 @@ private void assignIdsToCells(ArrayList<ChoiceCell> cells) {
565564
}
566565
}
567566

568-
//Find the next available choice is. Takes into account the loaded cells to ensure there are not duplicates
567+
// Find the next available choice is. Takes into account the loaded cells to ensure there are not duplicates
569568
// @param usedIds The already loaded cell ids
570569
// @return The choice id between 0 - 65535, or Not Found if no cell ids were available
571570
private int nextChoiceIdBasedOnUsedIds(ArrayList<Integer> usedIds) {
572-
//Check if we are entirely full, or if we've advanced beyond the max value, loop back
571+
// Check if we are entirely full, or if we've advanced beyond the max value, loop back
573572
if (choiceId == MAX_CHOICE_ID) {
574573
choiceId = 1;
575574
reachedMaxIds = true;
@@ -584,28 +583,28 @@ private int nextChoiceIdBasedOnUsedIds(ArrayList<Integer> usedIds) {
584583
return choiceId;
585584
}
586585

587-
//If the last value isn't the max value, just keep grabbing towards the max value
586+
// If the last value isn't the max value, just keep grabbing towards the max value
588587
int lastUsedId = usedIds.get(usedIds.size() - 1);
589588
if (lastUsedId < MAX_CHOICE_ID) {
590589
choiceId = lastUsedId + 1;
591590
return choiceId;
592591
}
593592

594-
//All our easy options are gone. Find and grab an empty slot from within the sorted list
593+
// All our easy options are gone. Find and grab an empty slot from within the sorted list
595594
for (int i = 0; i < usedIds.size(); i++) {
596595
int loopId = usedIds.get(i);
597596
if (i != loopId) {
598-
//This slot is open because the cell id does not match an open sorted slot
597+
// This slot is open because the cell id does not match an open sorted slot
599598
choiceId = i;
600599
return choiceId;
601600
}
602601
}
603602

604-
//This *shouldn't* be possible
603+
// This *shouldn't* be possible
605604
choiceId = MAX_CHOICE_ID;
606605
return choiceId;
607606
} else {
608-
//We haven't looped all the way around yet, so we'll just take the current number, then advance the item
607+
// We haven't looped all the way around yet, so we'll just take the current number, then advance the item
609608
return choiceId++;
610609
}
611610
}

0 commit comments

Comments
 (0)