diff options
author | Mario Bertschler <bmario@google.com> | 2017-11-17 11:34:27 -0800 |
---|---|---|
committer | Mario Bertschler <bmario@google.com> | 2017-11-30 08:51:50 -0800 |
commit | a5f5483cb0f411389d91ba938ac423a0480afbbd (patch) | |
tree | 477f282658a01a1be8ea166328cafdf91a920fce | |
parent | 2f768cb5d974b54773bf1b0c84f831bba800e5c6 (diff) | |
download | android_packages_apps_Trebuchet-a5f5483cb0f411389d91ba938ac423a0480afbbd.tar.gz android_packages_apps_Trebuchet-a5f5483cb0f411389d91ba938ac423a0480afbbd.tar.bz2 android_packages_apps_Trebuchet-a5f5483cb0f411389d91ba938ac423a0480afbbd.zip |
PredictionRowView: handling the case where no predictions are populated.
Bug: 68713881
Change-Id: I63efd5631f5ad3cb3028c02fd83deca00096b00a
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsContainerView.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index da4367f8e..a6c1e6edc 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -94,6 +94,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, private TransformingTouchDelegate mTouchDelegate; private boolean mUsingTabs; + private boolean mHasPredictions = false; private final HashMap<ComponentKey, AppInfo> mComponentToAppMap = new HashMap<>(); @@ -530,6 +531,11 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, mFloatingHeaderHandler.getContentView().setPredictedApps(apps); } mAH[AdapterHolder.MAIN].appsList.setPredictedApps(apps); + boolean hasPredictions = !apps.isEmpty(); + if (mHasPredictions != hasPredictions) { + mHasPredictions = hasPredictions; + setupHeader(); + } } public AppInfo findApp(ComponentKeyMapper<AppInfo> mapper) { @@ -553,8 +559,8 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, return; } mHeader.setVisibility(View.VISIBLE); - int contentHeight = mLauncher.getDeviceProfile().allAppsCellHeightPx; - if (!mUsingTabs) { + int contentHeight = mHasPredictions ? mLauncher.getDeviceProfile().allAppsCellHeightPx : 0; + if (mHasPredictions && !mUsingTabs) { contentHeight += getResources() .getDimensionPixelSize(R.dimen.all_apps_prediction_row_divider_height); } @@ -565,7 +571,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, mComponentToAppMap, mNumPredictedAppsPerRow); int padding = contentHeight; - if (!mUsingTabs) { + if (mHasPredictions && !mUsingTabs) { padding += mHeader.getPaddingTop() + mHeader.getPaddingBottom(); } for (int i = 0; i < mAH.length; i++) { |