summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-05-14 12:49:22 -0700
committerWinson Chung <winsonc@google.com>2015-05-14 22:50:36 +0000
commit8c01f810ebcddeb2e9f3a6599c62f701e9c3cac9 (patch)
tree38d042525153d2248d95db4647d505f75d6cf4e9 /src/com/android/launcher3
parent41b22c0924e258fef0d0cc86db63f7b862653df2 (diff)
downloadandroid_packages_apps_Trebuchet-8c01f810ebcddeb2e9f3a6599c62f701e9c3cac9.tar.gz
android_packages_apps_Trebuchet-8c01f810ebcddeb2e9f3a6599c62f701e9c3cac9.tar.bz2
android_packages_apps_Trebuchet-8c01f810ebcddeb2e9f3a6599c62f701e9c3cac9.zip
Don't account for prediction bar height when there are no predictions.
Change-Id: Icd4d52908de8d2de9d144e8ea469adbbcfe7cad3
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r--src/com/android/launcher3/AppsContainerRecyclerView.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/launcher3/AppsContainerRecyclerView.java b/src/com/android/launcher3/AppsContainerRecyclerView.java
index 95da48fcd..e7b3d282b 100644
--- a/src/com/android/launcher3/AppsContainerRecyclerView.java
+++ b/src/com/android/launcher3/AppsContainerRecyclerView.java
@@ -359,7 +359,7 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView {
// If there is a prediction bar, then capture the appropriate area for the prediction bar
float predictionBarFraction = 0f;
- if (mPredictionBarHeight > 0) {
+ if (!mApps.getPredictedApps().isEmpty()) {
predictionBarFraction = (float) mNumPredictedAppsPerRow / mApps.getSize();
if (touchFraction <= predictionBarFraction) {
// Scroll to the top of the view, where the prediction bar is
@@ -408,12 +408,13 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView {
// Find the index and height of the first visible row (all rows have the same height)
int x;
int y;
+ int predictionBarHeight = mApps.getPredictedApps().isEmpty() ? 0 : mPredictionBarHeight;
boolean isRtl = Utilities.isRtl(getResources());
int rowCount = getNumRows();
getCurScrollState(mScrollPosState, items);
if (mScrollPosState.rowIndex != -1) {
int height = getHeight() - getPaddingTop() - getPaddingBottom();
- int totalScrollHeight = rowCount * mScrollPosState.rowHeight + mPredictionBarHeight;
+ int totalScrollHeight = rowCount * mScrollPosState.rowHeight + predictionBarHeight;
if (totalScrollHeight > height) {
int scrollbarHeight = Math.max(mScrollbarMinHeight,
(int) (height / ((float) totalScrollHeight / height)));
@@ -429,7 +430,7 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView {
// that the user has already scrolled and then map that to the scroll bar bounds
int availableY = totalScrollHeight - height;
int availableScrollY = height - scrollbarHeight;
- y = (mScrollPosState.rowIndex * mScrollPosState.rowHeight) + mPredictionBarHeight
+ y = (mScrollPosState.rowIndex * mScrollPosState.rowHeight) + predictionBarHeight
- mScrollPosState.rowTopOffset;
y = getPaddingTop() +
(int) (((float) (getPaddingTop() + y) / availableY) * availableScrollY);
@@ -479,8 +480,9 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView {
List<AlphabeticalAppsList.AdapterItem> items = mApps.getAdapterItems();
getCurScrollState(mScrollPosState, items);
if (mScrollPosState.rowIndex != -1) {
+ int predictionBarHeight = mApps.getPredictedApps().isEmpty() ? 0 : mPredictionBarHeight;
int scrollY = getPaddingTop() + (mScrollPosState.rowIndex * mScrollPosState.rowHeight) +
- mPredictionBarHeight - mScrollPosState.rowTopOffset;
+ predictionBarHeight - mScrollPosState.rowTopOffset;
updateScrollY(scrollY);
}
}