Merge "Overview - Remove Chips code" into sc-v2-dev
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index a68322d..088009a 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -631,11 +631,10 @@
@Override
public void onDisplayInfoChanged(Context context, DisplayController.Info info, int flags) {
super.onDisplayInfoChanged(context, info, flags);
- // When changing screens with live tile active, finish the recents animation to close
- // overview as it should be an interim state
- if ((flags & CHANGE_ACTIVE_SCREEN) != 0 && ENABLE_QUICKSTEP_LIVE_TILE.get()) {
- RecentsView recentsView = getOverviewPanel();
- recentsView.finishRecentsAnimation(/* toRecents= */ true, null);
+ // When changing screens, force moving to rest state similar to StatefulActivity.onStop, as
+ // StatefulActivity isn't called consistently.
+ if ((flags & CHANGE_ACTIVE_SCREEN) != 0) {
+ getStateManager().moveToRestState();
}
}
diff --git a/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java
index 63a569a..1b0f967 100644
--- a/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java
@@ -282,8 +282,7 @@
@Override
public void setInsets(Rect insets, DeviceProfile grid) {
- int leftRightPadding = grid.desiredWorkspaceLeftRightMarginPx
- + grid.cellLayoutPaddingLeftRightPx;
+ int leftRightPadding = grid.allAppsLeftRightPadding;
setPadding(leftRightPadding, getPaddingTop(), leftRightPadding, getPaddingBottom());
}
diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
index 5242b3c..9ad8bb2 100644
--- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
@@ -249,8 +249,7 @@
@Override
public void setInsets(Rect insets, DeviceProfile grid) {
- int leftRightPadding = grid.desiredWorkspaceLeftRightMarginPx
- + grid.cellLayoutPaddingLeftRightPx;
+ int leftRightPadding = grid.allAppsLeftRightPadding;
setPadding(leftRightPadding, getPaddingTop(), leftRightPadding, getPaddingBottom());
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java
index 0224bc4..6db5839 100644
--- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java
@@ -15,6 +15,10 @@
*/
package com.android.launcher3.taskbar;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ObjectAnimator;
+import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
@@ -23,15 +27,20 @@
import androidx.annotation.ColorInt;
import androidx.core.content.ContextCompat;
+import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.R;
public class StashedHandleView extends View {
+ private static final long COLOR_CHANGE_DURATION = 120;
+
private final @ColorInt int mStashedHandleLightColor;
private final @ColorInt int mStashedHandleDarkColor;
private final Rect mSampledRegion = new Rect();
private final int[] mTmpArr = new int[2];
+ private @Nullable ObjectAnimator mColorChangeAnim;
+
public StashedHandleView(Context context) {
this(context, null);
}
@@ -54,17 +63,44 @@
R.color.taskbar_stashed_handle_dark_color);
}
- public void updateSampledRegion() {
+ /**
+ * Updates mSampledRegion to be the location of the stashedHandleBounds relative to the screen.
+ * @see #getSampledRegion()
+ */
+ public void updateSampledRegion(Rect stashedHandleBounds) {
getLocationOnScreen(mTmpArr);
- mSampledRegion.set(mTmpArr[0], mTmpArr[1], mTmpArr[0] + getWidth(),
- mTmpArr[1] + getHeight());
+ mSampledRegion.set(stashedHandleBounds);
+ mSampledRegion.offset(mTmpArr[0], mTmpArr[1]);
}
public Rect getSampledRegion() {
return mSampledRegion;
}
- public void updateHandleColor(boolean isRegionDark) {
- setBackgroundColor(isRegionDark ? mStashedHandleLightColor : mStashedHandleDarkColor);
+ /**
+ * Updates the handle color.
+ * @param isRegionDark Whether the background behind the handle is dark, and thus the handle
+ * should be light (and vice versa).
+ * @param animate Whether to animate the change, or apply it immediately.
+ */
+ public void updateHandleColor(boolean isRegionDark, boolean animate) {
+ int newColor = isRegionDark ? mStashedHandleLightColor : mStashedHandleDarkColor;
+ if (mColorChangeAnim != null) {
+ mColorChangeAnim.cancel();
+ }
+ if (animate) {
+ mColorChangeAnim = ObjectAnimator.ofArgb(this,
+ LauncherAnimUtils.VIEW_BACKGROUND_COLOR, newColor);
+ mColorChangeAnim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mColorChangeAnim = null;
+ }
+ });
+ mColorChangeAnim.setDuration(COLOR_CHANGE_DURATION);
+ mColorChangeAnim.start();
+ } else {
+ setBackgroundColor(newColor);
+ }
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
index 2858d7c..10da826 100644
--- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
@@ -70,7 +70,8 @@
mPrefs = Utilities.getPrefs(mActivity);
mStashedHandleView = stashedHandleView;
mStashedHandleView.updateHandleColor(
- mPrefs.getBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, false));
+ mPrefs.getBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, false),
+ false /* animate */);
final Resources resources = mActivity.getResources();
mStashedHandleWidth = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width);
mStashedHandleHeight = resources.getDimensionPixelSize(
@@ -79,7 +80,7 @@
new RegionSamplingHelper.SamplingCallback() {
@Override
public void onRegionDarknessChanged(boolean isRegionDark) {
- mStashedHandleView.updateHandleColor(isRegionDark);
+ mStashedHandleView.updateHandleColor(isRegionDark, true /* animate */);
mPrefs.edit().putBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY,
isRegionDark).apply();
}
@@ -109,6 +110,7 @@
stashedCenterY - mStashedHandleHeight / 2,
stashedCenterX + mStashedHandleWidth / 2,
stashedCenterY + mStashedHandleHeight / 2);
+ mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
mStashedHandleRadius = view.getHeight() / 2f;
outline.setRoundRect(mStashedHandleBounds, mStashedHandleRadius);
}
@@ -154,7 +156,7 @@
public void onIsStashed(boolean isStashed) {
mRegionSamplingHelper.setWindowVisible(isStashed);
if (isStashed) {
- mStashedHandleView.updateSampledRegion();
+ mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
mRegionSamplingHelper.start(mStashedHandleView.getSampledRegion());
} else {
mRegionSamplingHelper.stop();
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 720d736..9c20e1f 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -193,6 +193,8 @@
<attr name="borderSpacingDps" format="float" />
+ <attr name="allAppsCellSpacingDps" format="float" />
+
<attr name="iconImageSize" format="float" />
<!-- landscapeIconSize defaults to iconImageSize, if not specified -->
<attr name="landscapeIconSize" format="float" />
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index c7ae373..192fe30 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -168,11 +168,13 @@
public int qsbBottomMarginPx;
// All apps
+ public int allAppsCellSpacingPx;
public int allAppsOpenVerticalTranslate;
public int allAppsCellHeightPx;
public int allAppsCellWidthPx;
public int allAppsIconSizePx;
public int allAppsIconDrawablePaddingPx;
+ public int allAppsLeftRightPadding;
public final int numShownAllAppsColumns;
public float allAppsIconTextSizePx;
@@ -283,6 +285,7 @@
folderContentPaddingTop = res.getDimensionPixelSize(R.dimen.folder_content_padding_top);
setCellLayoutBorderSpacing(pxFromDp(inv.borderSpacing, mMetrics, 1f));
+ allAppsCellSpacingPx = pxFromDp(inv.allAppsCellSpacing, mMetrics, 1f);
cellLayoutBorderSpacingOriginalPx = cellLayoutBorderSpacingPx;
folderCellLayoutBorderSpacingPx = cellLayoutBorderSpacingPx;
@@ -293,10 +296,7 @@
: res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_padding);
if (isTwoPanels) {
- cellLayoutPaddingLeftRightPx = res.getDimensionPixelSize(
- isLandscape
- ? R.dimen.two_panels_home_side_padding_landscape
- : R.dimen.two_panels_home_side_padding_portrait);
+ cellLayoutPaddingLeftRightPx = 0;
cellLayoutBottomPaddingPx = 0;
} else if (isLandscape) {
cellLayoutPaddingLeftRightPx = 0;
@@ -547,6 +547,17 @@
+ textHeight + (topBottomPadding * 2);
}
+ private void updateAllAppsWidth() {
+ if (isTwoPanels) {
+ int usedWidth = (allAppsCellWidthPx * numShownAllAppsColumns)
+ + (allAppsCellSpacingPx * (numShownAllAppsColumns + 1));
+ allAppsLeftRightPadding = Math.max(1, (availableWidthPx - usedWidth) / 2);
+ } else {
+ allAppsLeftRightPadding =
+ desiredWorkspaceLeftRightMarginPx + cellLayoutPaddingLeftRightPx;
+ }
+ }
+
/**
* Returns the amount of extra (or unused) vertical space.
*/
@@ -666,6 +677,7 @@
allAppsCellHeightPx = getCellSize().y;
}
allAppsCellWidthPx = allAppsIconSizePx + allAppsIconDrawablePaddingPx;
+ updateAllAppsWidth();
if (isVerticalLayout) {
hideWorkspaceLabelsIfNotEnoughSpace();
@@ -802,7 +814,9 @@
Point padding = getTotalWorkspacePadding();
int numColumns = isTwoPanels ? inv.numColumns * 2 : inv.numColumns;
- int screenWidthPx = availableWidthPx - padding.x - 2 * cellLayoutPaddingLeftRightPx;
+ int cellLayoutTotalPadding =
+ isTwoPanels ? 4 * cellLayoutPaddingLeftRightPx : 2 * cellLayoutPaddingLeftRightPx;
+ int screenWidthPx = availableWidthPx - padding.x - cellLayoutTotalPadding;
result.x = calculateCellWidth(screenWidthPx, cellLayoutBorderSpacingPx, numColumns);
result.y = calculateCellHeight(availableHeightPx - padding.y
- cellLayoutBottomPaddingPx, cellLayoutBorderSpacingPx, inv.numRows);
@@ -832,33 +846,15 @@
padding.right = hotseatBarSizePx;
}
} else {
+ // Pad the bottom of the workspace with search/hotseat bar sizes
int hotseatTop = hotseatBarSizePx;
int paddingBottom = hotseatTop + workspacePageIndicatorHeight
+ workspaceBottomPadding - mWorkspacePageIndicatorOverlapWorkspace;
- if (isTablet) {
- // Pad the left and right of the workspace to ensure consistent spacing
- // between all icons
- // The amount of screen space available for left/right padding.
- int availablePaddingX = Math.max(0, widthPx - ((inv.numColumns * cellWidthPx) +
- ((inv.numColumns - 1) * cellWidthPx)));
- availablePaddingX = (int) Math.min(availablePaddingX,
- widthPx * MAX_HORIZONTAL_PADDING_PERCENT);
- int hotseatVerticalPadding = hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx;
- int availablePaddingY = Math.max(0, heightPx - edgeMarginPx - paddingBottom
- - (2 * inv.numRows * cellHeightPx) - hotseatVerticalPadding);
- padding.set(availablePaddingX / 2, edgeMarginPx + availablePaddingY / 2,
- availablePaddingX / 2, paddingBottom + availablePaddingY / 2);
- if (isTwoPanels) {
- padding.set(0, padding.top, 0, padding.bottom);
- }
- } else {
- // Pad the top and bottom of the workspace with search/hotseat bar sizes
- padding.set(desiredWorkspaceLeftRightMarginPx,
- workspaceTopPadding + (isScalableGrid ? 0 : edgeMarginPx),
- desiredWorkspaceLeftRightMarginPx,
- paddingBottom);
- }
+ padding.set(desiredWorkspaceLeftRightMarginPx,
+ (isScalableGrid ? workspaceTopPadding : edgeMarginPx),
+ desiredWorkspaceLeftRightMarginPx,
+ paddingBottom);
}
}
@@ -1117,6 +1113,7 @@
writer.println(prefix + pxToDpStr("iconScale", iconScale));
writer.println(prefix + pxToDpStr("cellScaleToFit ", cellScaleToFit));
writer.println(prefix + pxToDpStr("extraSpace", extraSpace));
+ writer.println(prefix + pxToDpStr("unscaled extraSpace", extraSpace / iconScale));
if (inv.devicePaddings != null) {
int unscaledExtraSpace = (int) (extraSpace / iconScale);
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 5f441d1..8631040 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -108,6 +108,7 @@
public float iconTextSize;
public float allAppsIconSize;
public float allAppsIconTextSize;
+ public float allAppsCellSpacing;
public boolean isSplitDisplay;
public float minCellHeight;
@@ -153,7 +154,8 @@
*/
public List<DeviceProfile> supportedProfiles = Collections.EMPTY_LIST;
- @Nullable public DevicePaddings devicePaddings;
+ @Nullable
+ public DevicePaddings devicePaddings;
public Point defaultWallpaperSize;
public Rect defaultWidgetPadding;
@@ -161,7 +163,8 @@
private final ArrayList<OnIDPChangeListener> mChangeListeners = new ArrayList<>();
@VisibleForTesting
- public InvariantDeviceProfile() {}
+ public InvariantDeviceProfile() {
+ }
@TargetApi(23)
private InvariantDeviceProfile(Context context) {
@@ -219,6 +222,7 @@
result.minCellHeight = defaultDisplayOption.minCellHeight;
result.minCellWidth = defaultDisplayOption.minCellWidth;
result.borderSpacing = defaultDisplayOption.borderSpacing;
+ result.allAppsCellSpacing = defaultDisplayOption.allAppsCellSpacing;
initGrid(context, myInfo, result, false);
}
@@ -283,6 +287,7 @@
twoPanelLandscapeMinCellHeightDps = displayOption.twoPanelLandscapeMinCellHeightDps;
twoPanelLandscapeMinCellWidthDps = displayOption.twoPanelLandscapeMinCellWidthDps;
borderSpacing = displayOption.borderSpacing;
+ allAppsCellSpacing = displayOption.allAppsCellSpacing;
numShownHotseatIcons = closestProfile.numHotseatIcons;
numDatabaseHotseatIcons = isSplitDisplay
@@ -356,7 +361,7 @@
}
private Object[] toModelState() {
- return new Object[] {
+ return new Object[]{
numColumns, numRows, numDatabaseHotseatIcons, iconBitmapSize, fillResIconDpi,
numDatabaseAllAppsColumns, dbFile};
}
@@ -402,7 +407,7 @@
}
}
}
- } catch (IOException|XmlPullParserException e) {
+ } catch (IOException | XmlPullParserException e) {
throw new RuntimeException(e);
}
@@ -456,7 +461,7 @@
private int getLauncherIconDensity(int requiredSize) {
// Densities typically defined by an app.
- int[] densityBuckets = new int[] {
+ int[] densityBuckets = new int[]{
DisplayMetrics.DENSITY_LOW,
DisplayMetrics.DENSITY_MEDIUM,
DisplayMetrics.DENSITY_TV,
@@ -596,8 +601,8 @@
// We will use these two data points to extrapolate how much the wallpaper parallax effect
// to span (ie travel) at any aspect ratio:
- final float ASPECT_RATIO_LANDSCAPE = 16/10f;
- final float ASPECT_RATIO_PORTRAIT = 10/16f;
+ final float ASPECT_RATIO_LANDSCAPE = 16 / 10f;
+ final float ASPECT_RATIO_PORTRAIT = 10 / 16f;
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE = 1.5f;
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT = 1.2f;
@@ -607,7 +612,8 @@
// (10/16)x + y = 1.2
// We solve for x and y and end up with a final formula:
final float x =
- (WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE - WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT) /
+ (WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE
+ - WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT) /
(ASPECT_RATIO_LANDSCAPE - ASPECT_RATIO_PORTRAIT);
final float y = WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT - x * ASPECT_RATIO_PORTRAIT;
return x * aspectRatio + y;
@@ -719,6 +725,7 @@
private float twoPanelPortraitMinCellWidthDps;
private float twoPanelLandscapeMinCellHeightDps;
private float twoPanelLandscapeMinCellWidthDps;
+ private float allAppsCellSpacing;
private float borderSpacing;
private final float[] iconSizes = new float[COUNT_TOTAL];
@@ -750,6 +757,8 @@
R.styleable.ProfileDisplayOption_twoPanelLandscapeMinCellWidthDps,
twoPanelPortraitMinCellWidthDps);
borderSpacing = a.getFloat(R.styleable.ProfileDisplayOption_borderSpacingDps, 0);
+ allAppsCellSpacing = a.getFloat(R.styleable.ProfileDisplayOption_allAppsCellSpacingDps,
+ borderSpacing);
iconSizes[INDEX_DEFAULT] =
a.getFloat(R.styleable.ProfileDisplayOption_iconImageSize, 0);
@@ -810,6 +819,7 @@
twoPanelLandscapeMinCellHeightDps *= w;
twoPanelLandscapeMinCellWidthDps *= w;
borderSpacing *= w;
+ allAppsCellSpacing *= w;
return this;
}
@@ -825,6 +835,7 @@
twoPanelLandscapeMinCellHeightDps += p.twoPanelLandscapeMinCellHeightDps;
twoPanelLandscapeMinCellWidthDps += p.twoPanelLandscapeMinCellWidthDps;
borderSpacing += p.borderSpacing;
+ allAppsCellSpacing += p.allAppsCellSpacing;
return this;
}
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 0340694..f429d76 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2132,6 +2132,10 @@
IntSet result = new IntSet();
if (visibleIds.isEmpty()) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "getPagesToBindSynchronously (1): "
+ + result);
+ }
return result;
}
for (int id : orderedScreenIds.toArray()) {
@@ -2152,6 +2156,10 @@
// pages being hidden in single panel.
result.add(pairId);
}
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "getPagesToBindSynchronously (2): "
+ + result);
+ }
return result;
}
@@ -2297,7 +2305,7 @@
final boolean focusFirstItemForAccessibility) {
// Get the list of added items and intersect them with the set of items here
final Collection<Animator> bounceAnims = new ArrayList<>();
- final boolean animateIcons = forceAnimateIcons && canRunNewAppsAnimation();
+ boolean canAnimatePageChange = canAnimatePageChange();
Workspace workspace = mWorkspace;
int newItemsScreenId = -1;
int end = items.size();
@@ -2358,7 +2366,7 @@
}
}
workspace.addInScreenFromBind(view, item);
- if (animateIcons) {
+ if (forceAnimateIcons) {
// Animate all the applications up now
view.setAlpha(0f);
view.setScaleX(0f);
@@ -2374,7 +2382,7 @@
View viewToFocus = newView;
// Animate to the correct pager
- if (animateIcons && newItemsScreenId > -1) {
+ if (forceAnimateIcons && newItemsScreenId > -1) {
AnimatorSet anim = new AnimatorSet();
anim.playTogether(bounceAnims);
if (focusFirstItemForAccessibility && viewToFocus != null) {
@@ -2390,7 +2398,7 @@
final int newScreenIndex = mWorkspace.getPageIndexForScreenId(newItemsScreenId);
final Runnable startBounceAnimRunnable = anim::start;
- if (newItemsScreenId != currentScreenId) {
+ if (canAnimatePageChange && newItemsScreenId != currentScreenId) {
// We post the animation slightly delayed to prevent slowdowns
// when we are loading right after we return to launcher.
mWorkspace.postDelayed(new Runnable() {
@@ -2671,7 +2679,7 @@
TraceHelper.INSTANCE.endSection(traceToken);
}
- private boolean canRunNewAppsAnimation() {
+ private boolean canAnimatePageChange() {
if (mDragController.isDragging()) {
return false;
} else {
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index d534c5d..523ac72 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -638,7 +638,10 @@
}
private int getPageWidthSize(int widthSize) {
- return (widthSize - mInsets.left - mInsets.right) / getPanelCount();
+ // It's necessary to add the padding back because it is remove when measuring children,
+ // like when MeasureSpec.getSize in CellLayout.
+ return (widthSize - mInsets.left - mInsets.right - getPaddingLeft() - getPaddingRight())
+ / getPanelCount() + getPaddingLeft() + getPaddingRight();
}
@Override
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index c5e9dd2..6ce2930 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -342,16 +342,15 @@
for (int i = 0; i < numberOfScreens; i++) {
int paddingLeft = paddingLeftRight;
int paddingRight = paddingLeftRight;
+ // Add missing cellLayout border in-between panels.
if (panelCount > 1) {
if (i % panelCount == leftPanelModulus) {
- paddingLeft = paddingLeftRight;
- paddingRight = grid.cellLayoutBorderSpacingPx / 2;
+ paddingRight += grid.cellLayoutBorderSpacingPx / 2;
} else if (i % panelCount == rightPanelModulus) { // right side panel
- paddingLeft = grid.cellLayoutBorderSpacingPx / 2;
- paddingRight = paddingLeftRight;
+ paddingLeft += grid.cellLayoutBorderSpacingPx / 2;
} else { // middle panel
- paddingLeft = grid.cellLayoutBorderSpacingPx / 2;
- paddingRight = grid.cellLayoutBorderSpacingPx / 2;
+ paddingLeft += grid.cellLayoutBorderSpacingPx / 2;
+ paddingRight += grid.cellLayoutBorderSpacingPx / 2;
}
}
// SparseArrayMap doesn't keep the order
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 9a5fd05..3f1f915 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -382,12 +382,10 @@
public void setInsets(Rect insets) {
mInsets.set(insets);
DeviceProfile grid = mLauncher.getDeviceProfile();
- int leftRightPadding = grid.desiredWorkspaceLeftRightMarginPx
- + grid.cellLayoutPaddingLeftRightPx;
for (int i = 0; i < mAH.length; i++) {
mAH[i].padding.bottom = insets.bottom;
- mAH[i].padding.left = mAH[i].padding.right = leftRightPadding;
+ mAH[i].padding.left = mAH[i].padding.right = grid.allAppsLeftRightPadding;
mAH[i].applyPadding();
}
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index b4907e8..e09b38b 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -230,16 +230,19 @@
CellLayout firstScreen = mRootView.findViewById(R.id.workspace);
firstScreen.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
mDp.workspacePadding.top,
- mDp.workspacePadding.right + mDp.cellLayoutBorderSpacingPx / 2,
+ (mDp.isTwoPanels ? mDp.cellLayoutBorderSpacingPx / 2 : mDp.workspacePadding.right)
+ + mDp.cellLayoutPaddingLeftRightPx,
mDp.workspacePadding.bottom);
mWorkspaceScreens.put(FIRST_SCREEN_ID, firstScreen);
if (mDp.isTwoPanels) {
CellLayout rightPanel = mRootView.findViewById(R.id.workspace_right);
- rightPanel.setPadding(mDp.workspacePadding.left + mDp.cellLayoutBorderSpacingPx / 2,
+ rightPanel.setPadding(
+ mDp.cellLayoutBorderSpacingPx / 2 + mDp.cellLayoutPaddingLeftRightPx,
mDp.workspacePadding.top,
mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
- mDp.workspacePadding.bottom);
+ mDp.workspacePadding.bottom
+ );
mWorkspaceScreens.put(Workspace.SECOND_SCREEN_ID, rightPanel);
}
diff --git a/src/com/android/launcher3/model/BaseLoaderResults.java b/src/com/android/launcher3/model/BaseLoaderResults.java
index 0e132c2..e9feb1c 100644
--- a/src/com/android/launcher3/model/BaseLoaderResults.java
+++ b/src/com/android/launcher3/model/BaseLoaderResults.java
@@ -32,6 +32,7 @@
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.LooperExecutor;
@@ -173,8 +174,18 @@
ArrayList<LauncherAppWidgetInfo> currentAppWidgets = new ArrayList<>();
ArrayList<LauncherAppWidgetInfo> otherAppWidgets = new ArrayList<>();
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "bind (1) currentScreenIds: "
+ + currentScreenIds
+ + ", mCallBacks: "
+ + mCallbacks.getClass().getSimpleName());
+ }
filterCurrentWorkspaceItems(currentScreenIds, mWorkspaceItems, currentWorkspaceItems,
otherWorkspaceItems);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "bind (2) currentScreenIds: "
+ + currentScreenIds);
+ }
filterCurrentWorkspaceItems(currentScreenIds, mAppWidgets, currentAppWidgets,
otherAppWidgets);
final InvariantDeviceProfile idp = mApp.getInvariantDeviceProfile();
diff --git a/src/com/android/launcher3/model/ModelUtils.java b/src/com/android/launcher3/model/ModelUtils.java
index 58aa9e5..ef5eef1 100644
--- a/src/com/android/launcher3/model/ModelUtils.java
+++ b/src/com/android/launcher3/model/ModelUtils.java
@@ -31,6 +31,7 @@
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
@@ -66,6 +67,10 @@
(lhs, rhs) -> Integer.compare(lhs.container, rhs.container));
for (T info : allWorkspaceItems) {
if (info.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NULL_INT_SET, "filterCurrentWorkspaceItems: "
+ + currentScreenIds);
+ }
if (currentScreenIds.contains(info.screenId)) {
currentScreenItems.add(info);
itemsOnScreen.add(info.id);
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index ddd2534..ce01d4e 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -120,4 +120,5 @@
public static final String WORK_PROFILE_REMOVED = "b/159671700";
public static final String TASK_VIEW_ID_CRASH = "b/195430732";
public static final String NO_DROP_TARGET = "b/195031154";
+ public static final String NULL_INT_SET = "b/200572078";
}