Space out empty taskbar hotseat views when on home screen

This ensures the taskbar hotseat aligns with the home screen
hotseat, as the latter supports empty cells. When in apps,
the taskbar still collapses the empty cells.

Test: Turn off hotseat predictions, remove some hotseat items,
and ensure the taskbar hotseat spreads out when on home.

Bug: 179886115
Bug: 171917176
Change-Id: I6047c3c5691685edcd8b3519e0305812b1295550
This commit is contained in:
Tony Wickham
2021-03-03 17:33:28 -08:00
parent 634f600848
commit 64edc22c8b
2 changed files with 56 additions and 5 deletions

View File

@@ -182,25 +182,44 @@ public class TaskbarView extends LinearLayout implements FolderIcon.FolderIconPa
&& hotseatItemInfo instanceof WorkspaceItemInfo) {
((BubbleTextView) hotseatView).applyFromWorkspaceItem(
(WorkspaceItemInfo) hotseatItemInfo);
hotseatView.setVisibility(VISIBLE);
hotseatView.setOnClickListener(mControllerCallbacks.getItemOnClickListener());
hotseatView.setOnLongClickListener(
mControllerCallbacks.getItemOnLongClickListener());
} else if (isFolder) {
hotseatView.setVisibility(VISIBLE);
hotseatView.setOnClickListener(mControllerCallbacks.getItemOnClickListener());
hotseatView.setOnLongClickListener(
mControllerCallbacks.getItemOnLongClickListener());
} else {
hotseatView.setVisibility(GONE);
hotseatView.setOnClickListener(null);
hotseatView.setOnLongClickListener(null);
}
updateHotseatItemVisibility(hotseatView);
}
updateHotseatRecentsDividerVisibility();
}
protected void updateHotseatItemsVisibility() {
for (int i = mHotseatStartIndex; i <= mHotseatEndIndex; i++) {
updateHotseatItemVisibility(getChildAt(i));
}
}
private void updateHotseatItemVisibility(View hotseatView) {
if (hotseatView.getTag() != null) {
hotseatView.setVisibility(VISIBLE);
} else {
int oldVisibility = hotseatView.getVisibility();
int newVisibility = mControllerCallbacks.getEmptyHotseatViewVisibility();
hotseatView.setVisibility(newVisibility);
if (oldVisibility == GONE && newVisibility != GONE) {
// By default, the layout transition only runs when going to VISIBLE,
// but we want it to run when going to GONE to INVISIBLE as well.
getLayoutTransition().showChild(this, hotseatView, oldVisibility);
}
}
}
private View addDivider(int dividerIndex) {
View divider = inflate(R.layout.taskbar_divider);
addView(divider, dividerIndex);