Merge "Updating the search hint to contain the icon as a span object." into ub-launcher3-calgary
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index c9d5cff..15f47b4 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -378,12 +378,32 @@
padding.set(desiredWorkspaceLeftRightMarginPx,
topWorkspacePadding,
desiredWorkspaceLeftRightMarginPx,
- hotseatBarHeightPx + pageIndicatorHeightPx);
+ paddingBottom);
}
}
return padding;
}
+ /**
+ * @return the bounds for which the open folders should be contained within
+ */
+ public Rect getAbsoluteOpenFolderBounds() {
+ if (isVerticalBarLayout()) {
+ // Folders should only appear right of the drop target bar and left of the hotseat
+ return new Rect(mInsets.left + dropTargetBarSizePx + edgeMarginPx,
+ mInsets.top,
+ mInsets.left + availableWidthPx - hotseatBarHeightPx - edgeMarginPx,
+ mInsets.top + availableHeightPx);
+ } else {
+ // Folders should only appear below the drop target bar and above the hotseat
+ return new Rect(mInsets.left,
+ mInsets.top + dropTargetBarSizePx + edgeMarginPx,
+ mInsets.left + availableWidthPx,
+ mInsets.top + availableHeightPx - hotseatBarHeightPx - pageIndicatorHeightPx -
+ edgeMarginPx);
+ }
+ }
+
private int getWorkspacePageSpacing() {
if (isVerticalBarLayout() || isLargeTablet) {
// In landscape mode the page spacing is set to the default.
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 43c7281..f8b7c74 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2511,7 +2511,8 @@
if (v instanceof FolderIcon) {
onClickFolderIcon(v);
}
- } else if (v instanceof PageIndicator || (v == mAllAppsButton && mAllAppsButton != null)) {
+ } else if ((FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && v instanceof PageIndicator) ||
+ (v == mAllAppsButton && mAllAppsButton != null)) {
onClickAllAppsButton(v);
} else if (tag instanceof AppInfo) {
startAppShortcutOrInfoActivity(v);
@@ -3157,7 +3158,8 @@
if (isWorkspaceLocked()) return false;
if (mState != State.WORKSPACE) return false;
- if (v == mAllAppsButton && mAllAppsButton != null) {
+ if ((FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && v instanceof PageIndicator) ||
+ (v == mAllAppsButton && mAllAppsButton != null)) {
onLongClickAllAppsButton(v);
return true;
}
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 2fbbad5..fdbb214 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -1030,27 +1030,25 @@
}
private void centerAboutIcon() {
- DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
+ DeviceProfile grid = mLauncher.getDeviceProfile();
+ DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
int height = getFolderHeight();
float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, sTempRect);
-
- DeviceProfile grid = mLauncher.getDeviceProfile();
-
- int centerX = (int) (sTempRect.left + sTempRect.width() * scale / 2);
- int centerY = (int) (sTempRect.top + sTempRect.height() * scale / 2);
+ int centerX = sTempRect.centerX();
+ int centerY = sTempRect.centerY();
int centeredLeft = centerX - width / 2;
int centeredTop = centerY - height / 2;
// We need to bound the folder to the currently visible workspace area
mLauncher.getWorkspace().getPageAreaRelativeToDragLayer(sTempRect);
int left = Math.min(Math.max(sTempRect.left, centeredLeft),
- sTempRect.left + sTempRect.width() - width);
+ sTempRect.right- width);
int top = Math.min(Math.max(sTempRect.top, centeredTop),
- sTempRect.top + sTempRect.height() - height);
+ sTempRect.bottom - height);
int distFromEdgeOfScreen = mLauncher.getWorkspace().getPaddingLeft() + getPaddingLeft();
@@ -1064,7 +1062,14 @@
left = sTempRect.left + (sTempRect.width() - width) / 2;
}
if (height >= sTempRect.height()) {
+ // Folder height is greater than page height, center on page
top = sTempRect.top + (sTempRect.height() - height) / 2;
+ } else {
+ // Folder height is less than page height, so bound it to the absolute open folder
+ // bounds if necessary
+ Rect folderBounds = grid.getAbsoluteOpenFolderBounds();
+ left = Math.max(folderBounds.left, Math.min(left, folderBounds.right - width));
+ top = Math.max(folderBounds.top, Math.min(top, folderBounds.bottom - height));
}
int folderPivotX = width / 2 + (centeredLeft - left);
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java b/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
index 1eee59e..fea47a9 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
@@ -52,6 +52,7 @@
Launcher l = (Launcher) context;
setOnTouchListener(l.getHapticFeedbackTouchListener());
setOnClickListener(l);
+ setOnLongClickListener(l);
setOnFocusChangeListener(l.mFocusHandler);
}
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java b/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java
index fbfb61b..0b94791 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java
@@ -136,6 +136,7 @@
mLauncher = (Launcher) context;
setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
setOnClickListener(mLauncher);
+ setOnLongClickListener(mLauncher);
setOnFocusChangeListener(mLauncher.mFocusHandler);
setCaretDrawable(new CaretDrawable(context));
mLineHeight = res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_line_height);