Minor refactoring of FloatingHeaderView and PredictionRowView.

The main purpose of the CL is to let the let the PredictionRowView
calculate its own height instead of setting it from outside and cleaning
up dead code in FloatingHeaderView.

Change-Id: I7d63ee51a1a2f64618f7fd287bcf4cdb8476caa2
This commit is contained in:
Mario Bertschler
2017-12-07 10:51:41 -08:00
parent ead0e7255b
commit 527051aaba
3 changed files with 62 additions and 77 deletions

View File

@@ -552,20 +552,9 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
return;
}
mHeader.setVisibility(View.VISIBLE);
mHeader.setup(mAH, mComponentToAppMap, mNumPredictedAppsPerRow);
boolean usePredictionRow = mHasPredictions && !mSearchModeWhileUsingTabs;
int contentHeight = usePredictionRow ? mLauncher.getDeviceProfile().allAppsCellHeightPx : 0;;
if (usePredictionRow && !mUsingTabs) {
contentHeight += getResources()
.getDimensionPixelSize(R.dimen.all_apps_prediction_row_divider_height);
}
AllAppsRecyclerView mainRV = mAH[AdapterHolder.MAIN].recyclerView;
AllAppsRecyclerView workRV = mAH[AdapterHolder.WORK].recyclerView;
mHeader.setup(mainRV, workRV, contentHeight);
mHeader.getPredictionRow().setup(mAH[AdapterHolder.MAIN].adapter,
mComponentToAppMap, mNumPredictedAppsPerRow);
int padding = contentHeight;
int padding = mHeader.getPredictionRow().getExpectedHeight();
if (mHasPredictions && !mUsingTabs) {
padding += mHeader.getPaddingTop() + mHeader.getPaddingBottom();
}