Fix getPagesToBindSynchronously returning wrong page pairs am: 62f129b878
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15754330 Change-Id: I78a1de91289da9cd513fedef57dd10ac42b15722
This commit is contained in:
@@ -2112,19 +2112,19 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
actualIds.add(id);
|
||||
}
|
||||
int firstId = visibleIds.getArray().get(0);
|
||||
int pairId = mWorkspace.getPagePair(firstId);
|
||||
// Double check that actual screenIds contains the visibleId, as empty screens are hidden
|
||||
// in single panel.
|
||||
if (actualIds.contains(firstId)) {
|
||||
result.add(firstId);
|
||||
|
||||
if (mDeviceProfile.isTwoPanels) {
|
||||
int index = actualIds.indexOf(firstId);
|
||||
int nextIndex = (index / 2) * 2;
|
||||
if (nextIndex == index) {
|
||||
nextIndex++;
|
||||
}
|
||||
if (nextIndex < actualIds.size()) {
|
||||
result.add(actualIds.get(nextIndex));
|
||||
}
|
||||
if (mDeviceProfile.isTwoPanels && actualIds.contains(pairId)) {
|
||||
result.add(pairId);
|
||||
}
|
||||
} else if (LauncherAppState.getIDP(this).supportedProfiles.stream().anyMatch(
|
||||
deviceProfile -> deviceProfile.isTwoPanels) && actualIds.contains(pairId)) {
|
||||
// Add the right panel if left panel is hidden when switching display, due to empty
|
||||
// pages being hidden in single panel.
|
||||
result.add(pairId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -920,12 +920,8 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
|
||||
/**
|
||||
* Returns the page that is shown together with the given page when two panel is enabled.
|
||||
* @throws IllegalStateException if called while two panel home isn't enabled.
|
||||
*/
|
||||
public int getPagePair(int page) {
|
||||
if (!isTwoPanelEnabled()) {
|
||||
throw new IllegalStateException("Two panel home isn't enabled.");
|
||||
}
|
||||
if (page % 2 == 0) {
|
||||
return page + 1;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user