Merge "Getting rid of additive blending for overscroll (issue 11072246)" into jb-ub-now-indigo-rose
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9f4f20b..3e2ffce 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -41,6 +41,8 @@
<!-- Accessibility string used as a label for a particular wallpaper in the Wallpaper Picker list.
e.g. "Wallpaper 3 of 10" -->
<string name="wallpaper_accessibility_name">Wallpaper %1$d of %2$d</string>
+ <!-- Accessibility string used to announce that an item has been selected. -->
+ <string name="announce_selection">Selected <xliff:g id="label" example="Wallpaper 3 of 10">%1$s</xliff:g></string>
<!-- Label on button to delete wallpaper(s) -->
<string name="wallpaper_delete">Delete</string>
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 1e9a025..07346f0 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -115,7 +115,6 @@
// If we're actively dragging something over this screen, mIsDragOverlapping is true
private boolean mIsDragOverlapping = false;
- private final Point mDragCenter = new Point();
boolean mUseActiveGlowBackground = false;
// These arrays are used to implement the drag visualization on x-large screens.
@@ -1022,7 +1021,12 @@
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
- mBackgroundRect.set(0, 0, w, h);
+
+ // Expand the background drawing bounds by the padding baked into the background drawable
+ Rect padding = new Rect();
+ mNormalBackground.getPadding(padding);
+ mBackgroundRect.set(-padding.left, -padding.top, w + padding.right, h + padding.bottom);
+
mForegroundRect.set(mForegroundPadding, mForegroundPadding,
w - mForegroundPadding, h - mForegroundPadding);
}
@@ -1196,12 +1200,6 @@
final int oldDragCellX = mDragCell[0];
final int oldDragCellY = mDragCell[1];
- if (v != null && dragOffset == null) {
- mDragCenter.set(originX + (v.getWidth() / 2), originY + (v.getHeight() / 2));
- } else {
- mDragCenter.set(originX, originY);
- }
-
if (dragOutline == null && v == null) {
return;
}
@@ -1216,11 +1214,6 @@
int left = topLeft[0];
int top = topLeft[1];
- // Offset icons by their padding
- if (v instanceof BubbleTextView) {
- top += v.getPaddingTop();
- }
-
if (v != null && dragOffset == null) {
// When drawing the drag outline, it did not account for margin offsets
// added by the view's parent.
@@ -1241,7 +1234,9 @@
// outline offset
left += dragOffset.x + ((mCellWidth * spanX) + ((spanX - 1) * mWidthGap)
- dragRegion.width()) / 2;
- top += dragOffset.y;
+ int cHeight = getShortcutsAndWidgets().getCellContentHeight();
+ int cellPaddingY = (int) Math.max(0, ((mCellHeight - cHeight) / 2f));
+ top += dragOffset.y + cellPaddingY;
} else {
// Center the drag outline in the cell
left += ((mCellWidth * spanX) + ((spanX - 1) * mWidthGap)
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 455265a..5aec399 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3042,7 +3042,7 @@
// Show the search bar (only animate if we were showing the drop target bar in spring
// loaded mode)
if (mSearchDropTargetBar != null) {
- mSearchDropTargetBar.showSearchBar(wasInSpringLoadedMode);
+ mSearchDropTargetBar.showSearchBar(animated && wasInSpringLoadedMode);
}
// Set focus to the AppsCustomize button
@@ -3928,8 +3928,7 @@
mIntentsOnWorkspaceFromUpgradePath = null;
}
} else {
- if (!AppsCustomizePagedView.DISABLE_ALL_APPS &&
- mAppsCustomizeContent != null) {
+ if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.setApps(apps);
}
}
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index fcd6f19..1cf4c11 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -123,6 +123,13 @@
mIsHotseatLayout = isHotseat;
}
+ int getCellContentHeight() {
+ final LauncherAppState app = LauncherAppState.getInstance();
+ final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ return Math.min(getMeasuredHeight(), mIsHotseatLayout ?
+ grid.hotseatCellHeightPx : grid.cellHeightPx);
+ }
+
public void measureChild(View child) {
final LauncherAppState app = LauncherAppState.getInstance();
final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
@@ -137,7 +144,7 @@
// Widgets have their own padding, so skip
} else {
// Otherwise, center the icon
- int cHeight = mIsHotseatLayout ? grid.hotseatCellHeightPx : Math.min(getMeasuredHeight(), grid.cellHeightPx);
+ int cHeight = getCellContentHeight();
int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
int cellPaddingX = (int) (grid.edgeMarginPx / 2f);
child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0);
diff --git a/src/com/android/launcher3/WallpaperPickerActivity.java b/src/com/android/launcher3/WallpaperPickerActivity.java
index 9d3164b..3992170 100644
--- a/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -52,6 +52,7 @@
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
+import android.view.accessibility.AccessibilityEvent;
import android.view.animation.DecelerateInterpolator;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
@@ -254,6 +255,10 @@
}
mSelectedThumb = v;
v.setSelected(true);
+ // TODO: Remove this once the accessibility framework and
+ // services have better support for selection state.
+ v.announceForAccessibility(
+ getString(R.string.announce_selection, v.getContentDescription()));
}
info.onClick(WallpaperPickerActivity.this);
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 37a1469..a23d7d0 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -338,7 +338,8 @@
ItemInfo itemInfo, boolean springLoaded) {
int[] size = new int[2];
if (getChildCount() > 0) {
- CellLayout cl = (CellLayout) mLauncher.getWorkspace().getChildAt(0);
+ // Use the first non-custom page to estimate the child position
+ CellLayout cl = (CellLayout) getChildAt(numCustomPages());
Rect r = estimateItemPosition(cl, itemInfo, 0, 0, hSpan, vSpan);
size[0] = r.width();
size[1] = r.height();