diff options
author | Winson Chung <winsonc@google.com> | 2016-07-21 16:58:41 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-07-21 16:58:42 +0000 |
commit | 06580312edc1fd1a94746de0626022e60d8e614e (patch) | |
tree | fa347e80cb3bdc1676484edda410f6d02e188c69 /src | |
parent | 35a754bade013ce240bdfff584b250d69370fdb4 (diff) | |
parent | 6231ede10c16db8399b1d42b9b1829c95de83629 (diff) | |
download | android_packages_apps_Trebuchet-06580312edc1fd1a94746de0626022e60d8e614e.tar.gz android_packages_apps_Trebuchet-06580312edc1fd1a94746de0626022e60d8e614e.tar.bz2 android_packages_apps_Trebuchet-06580312edc1fd1a94746de0626022e60d8e614e.zip |
Merge changes I09bce218,Id5716a34 into ub-launcher3-calgary
* changes:
Matching hotseat to spec.
Fixing issue with shadow drawing over search bar.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/CellLayout.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/ClickShadowView.java | 17 | ||||
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 20 | ||||
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsRecyclerViewContainerView.java | 5 |
5 files changed, 33 insertions, 16 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 9030dae59..77f6612c1 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -406,7 +406,8 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { mTouchFeedbackView.animate().cancel(); } else { if (mTouchFeedbackView.setBitmap(background)) { - mTouchFeedbackView.alignWithIconView(icon, mShortcutsAndWidgets); + mTouchFeedbackView.alignWithIconView(icon, mShortcutsAndWidgets, + null /* clipAgainstView */); mTouchFeedbackView.animateShadow(); } } diff --git a/src/com/android/launcher3/ClickShadowView.java b/src/com/android/launcher3/ClickShadowView.java index e2bc6bac5..aad111298 100644 --- a/src/com/android/launcher3/ClickShadowView.java +++ b/src/com/android/launcher3/ClickShadowView.java @@ -21,6 +21,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Rect; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; @@ -91,13 +92,27 @@ public class ClickShadowView extends View { * Aligns the shadow with {@param view} * @param viewParent immediate parent of {@param view}. It must be a sibling of this view. */ - public void alignWithIconView(BubbleTextView view, ViewGroup viewParent) { + public void alignWithIconView(BubbleTextView view, ViewGroup viewParent, View clipAgainstView) { float leftShift = view.getLeft() + viewParent.getLeft() - getLeft(); float topShift = view.getTop() + viewParent.getTop() - getTop(); int iconWidth = view.getRight() - view.getLeft(); + int iconHeight = view.getBottom() - view.getTop(); int iconHSpace = iconWidth - view.getCompoundPaddingRight() - view.getCompoundPaddingLeft(); float drawableWidth = view.getIcon().getBounds().width(); + if (clipAgainstView != null) { + // Set the bounds to clip against + int[] coords = new int[] {0, 0}; + Utilities.getDescendantCoordRelativeToAncestor(clipAgainstView, (View) getParent(), + coords, false); + int clipLeft = (int) Math.max(0, coords[0] - leftShift - mShadowPadding); + int clipTop = (int) Math.max(0, coords[1] - topShift - mShadowPadding) ; + setClipBounds(new Rect(clipLeft, clipTop, clipLeft + iconWidth, clipTop + iconHeight)); + } else { + // Reset the clip bounds + setClipBounds(null); + } + setTranslationX(leftShift + viewParent.getTranslationX() + view.getCompoundPaddingLeft() * view.getScaleX() diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 5828dfc57..c9d5cff2e 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -460,7 +460,7 @@ public class DeviceProfile { qsbContainer.setLayoutParams(lp); // Layout the hotseat - View hotseat = launcher.findViewById(R.id.hotseat); + Hotseat hotseat = (Hotseat) launcher.findViewById(R.id.hotseat); lp = (FrameLayout.LayoutParams) hotseat.getLayoutParams(); // We want the edges of the hotseat to line up with the edges of the workspace, but the // icons in the hotseat are a different size, and so don't line up perfectly. To account for @@ -475,27 +475,25 @@ public class DeviceProfile { lp.gravity = Gravity.RIGHT; lp.width = hotseatBarHeightPx + mInsets.left + mInsets.right; lp.height = LayoutParams.MATCH_PARENT; - hotseat.findViewById(R.id.layout).setPadding(0, 2 * edgeMarginPx, 0, 2 * edgeMarginPx); - hotseat.setPadding(mInsets.left, 0, mInsets.right, 0); + hotseat.getLayout().setPadding(mInsets.left, mInsets.top, mInsets.right, + workspacePadding.bottom); } else if (isTablet) { // Pad the hotseat with the workspace padding calculated above lp.gravity = Gravity.BOTTOM; lp.width = LayoutParams.MATCH_PARENT; lp.height = hotseatBarHeightPx + mInsets.bottom; - hotseat.findViewById(R.id.layout).setPadding( - hotseatAdjustment + workspacePadding.left, 0, - hotseatAdjustment + workspacePadding.right, 2 * edgeMarginPx); - hotseat.setPadding(0, hotseatBarTopPaddingPx, 0, mInsets.bottom); + hotseat.getLayout().setPadding(hotseatAdjustment + workspacePadding.left, + hotseatBarTopPaddingPx, hotseatAdjustment + workspacePadding.right, + mInsets.bottom); } else { // For phones, layout the hotseat without any bottom margin // to ensure that we have space for the folders lp.gravity = Gravity.BOTTOM; lp.width = LayoutParams.MATCH_PARENT; lp.height = hotseatBarHeightPx + mInsets.bottom; - hotseat.findViewById(R.id.layout).setPadding( - hotseatAdjustment + workspacePadding.left, 0, - hotseatAdjustment + workspacePadding.right, 0); - hotseat.setPadding(0, hotseatBarTopPaddingPx, 0, mInsets.bottom); + hotseat.getLayout().setPadding(hotseatAdjustment + workspacePadding.left, + hotseatBarTopPaddingPx, hotseatAdjustment + workspacePadding.right, + mInsets.bottom); } hotseat.setLayoutParams(lp); diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 7b1a16c5f..ef781958c 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -113,8 +113,8 @@ public final class Utilities { && "NMR1".compareTo(VERSION.CODENAME) <= 0; } - // TODO: use Build.VERSION_CODES when available - public static final boolean ATLEAST_MARSHMALLOW = Build.VERSION.SDK_INT >= 23; + public static final boolean ATLEAST_MARSHMALLOW = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; public static final boolean ATLEAST_LOLLIPOP_MR1 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1; diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerViewContainerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerViewContainerView.java index 09a7d59bf..1d5b209c2 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerViewContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerViewContainerView.java @@ -18,6 +18,7 @@ package com.android.launcher3.allapps; import android.content.Context; import android.graphics.Bitmap; import android.util.AttributeSet; +import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -26,6 +27,7 @@ import com.android.launcher3.BubbleTextView.BubbleTextShadowHandler; import com.android.launcher3.ClickShadowView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; +import com.android.launcher3.R; /** * A container for RecyclerView to allow for the click shadow view to be shown behind an icon that @@ -63,7 +65,8 @@ public class AllAppsRecyclerViewContainerView extends FrameLayout mTouchFeedbackView.setBitmap(null); mTouchFeedbackView.animate().cancel(); } else if (mTouchFeedbackView.setBitmap(background)) { - mTouchFeedbackView.alignWithIconView(icon, (ViewGroup) icon.getParent()); + View rv = findViewById(R.id.apps_list_view); + mTouchFeedbackView.alignWithIconView(icon, (ViewGroup) icon.getParent(), rv); mTouchFeedbackView.animateShadow(); } } |