summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-06-05 18:09:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-05 18:09:35 +0000
commit6103501fa6c70ca112ac867e18e5f82021bf4f7c (patch)
tree7a371d309afdabb03f7db35bb17288ecc065cdf4 /src/com/android/launcher3/allapps
parent7501adf4b71bb17d0785a5939efbcac4b39125c3 (diff)
parent2c6e5ccbcd7c3f87e7e85029782440600dc0a3d8 (diff)
downloadandroid_packages_apps_Trebuchet-6103501fa6c70ca112ac867e18e5f82021bf4f7c.tar.gz
android_packages_apps_Trebuchet-6103501fa6c70ca112ac867e18e5f82021bf4f7c.tar.bz2
android_packages_apps_Trebuchet-6103501fa6c70ca112ac867e18e5f82021bf4f7c.zip
Merge "Ensuring that we use the screen width more optimally in AllApps." into ub-launcher3-burnaby
Diffstat (limited to 'src/com/android/launcher3/allapps')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java19
-rw-r--r--src/com/android/launcher3/allapps/AllAppsGridAdapter.java5
2 files changed, 14 insertions, 10 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 09f6a2c4d..855a4430d 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -20,6 +20,7 @@ import android.annotation.TargetApi;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -239,11 +240,11 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
mLauncher = (Launcher) context;
DeviceProfile grid = mLauncher.getDeviceProfile();
- mContainerInset = context.getResources().getDimensionPixelSize(
- R.dimen.all_apps_container_inset);
- mPredictionBarHeight = grid.allAppsIconSizePx + grid.iconDrawablePaddingOriginalPx +
- grid.allAppsIconTextSizePx +
- 2 * res.getDimensionPixelSize(R.dimen.all_apps_prediction_icon_top_bottom_padding);
+ mContainerInset = res.getDimensionPixelSize(R.dimen.all_apps_container_inset);
+ mPredictionBarHeight = (int) (grid.allAppsIconSizePx + grid.iconDrawablePaddingOriginalPx +
+ Utilities.calculateTextHeight(grid.allAppsIconTextSizePx) +
+ 2 * res.getDimensionPixelSize(R.dimen.all_apps_icon_top_bottom_padding) +
+ res.getDimensionPixelSize(R.dimen.all_apps_prediction_bar_bottom_padding));
mLayoutInflater = LayoutInflater.from(context);
@@ -498,11 +499,11 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
int startMargin = grid.isPhone ? mContentMarginStart : 0;
int inset = mFixedBounds.isEmpty() ? mContainerInset : mFixedBoundsContainerInset;
if (isRtl) {
- mAppsRecyclerView.setPadding(inset + mAppsRecyclerView.getScrollbarWidth(), inset,
- inset + startMargin, inset);
+ mAppsRecyclerView.setPadding(inset + mAppsRecyclerView.getScrollbarWidth(), 0,
+ inset + startMargin, 0);
} else {
- mAppsRecyclerView.setPadding(inset + startMargin, inset,
- inset + mAppsRecyclerView.getScrollbarWidth(), inset);
+ mAppsRecyclerView.setPadding(inset + startMargin, 0,
+ inset + mAppsRecyclerView.getScrollbarWidth(), 0);
}
// Update the header bar
diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
index 02a950fde..4b8b2dfc8 100644
--- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
+++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -140,7 +140,7 @@ class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.ViewHol
if (shouldDrawItemDivider(holder, items) && !hasDrawnPredictedAppsDivider) {
// Draw the divider under the predicted apps
- int top = child.getTop() + child.getHeight();
+ int top = child.getTop() + child.getHeight() - mPredictionBarBottomPadding / 2;
c.drawLine(mBackgroundPadding.left, top,
parent.getWidth() - mBackgroundPadding.right, top,
mPredictedAppsDividerPaint);
@@ -295,6 +295,7 @@ class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.ViewHol
private View.OnLongClickListener mIconLongClickListener;
@Thunk final Rect mBackgroundPadding = new Rect();
@Thunk int mPredictionBarHeight;
+ @Thunk int mPredictionBarBottomPadding;
@Thunk int mAppsPerRow;
@Thunk boolean mIsRtl;
private String mEmptySearchText;
@@ -337,6 +338,8 @@ class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.ViewHol
mPredictedAppsDividerPaint.setStrokeWidth(Utilities.pxFromDp(1f, res.getDisplayMetrics()));
mPredictedAppsDividerPaint.setColor(0x1E000000);
mPredictedAppsDividerPaint.setAntiAlias(true);
+ mPredictionBarBottomPadding =
+ res.getDimensionPixelSize(R.dimen.all_apps_prediction_bar_bottom_padding);
}
/**