diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-08-09 22:19:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-08-09 22:19:57 +0000 |
commit | 52b28f09264cb9689f3f88ca6d2f6f49ba654102 (patch) | |
tree | 3616fd58ddf96139fc3f811b94ec50e69fa51ce7 | |
parent | 431ec79c99fb0258d77dff2ca23e820e7b030d21 (diff) | |
parent | 05d98c246b05d86531d2734efdddbfa50c08a9bb (diff) | |
download | packages_apps_Trebuchet-52b28f09264cb9689f3f88ca6d2f6f49ba654102.tar.gz packages_apps_Trebuchet-52b28f09264cb9689f3f88ca6d2f6f49ba654102.tar.bz2 packages_apps_Trebuchet-52b28f09264cb9689f3f88ca6d2f6f49ba654102.zip |
Merge "Adjust notification dots" into ub-launcher3-master
-rw-r--r-- | res/values/attrs.xml | 1 | ||||
-rw-r--r-- | res/values/styles.xml | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 12 | ||||
-rw-r--r-- | src/com/android/launcher3/badge/BadgeRenderer.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/folder/FolderIcon.java | 6 | ||||
-rw-r--r-- | src/com/android/launcher3/folder/PreviewBackground.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher3/graphics/ShadowGenerator.java | 2 |
7 files changed, 18 insertions, 11 deletions
diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 30091a5f7..045e4e98c 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -33,6 +33,7 @@ <attr name="workspaceKeyShadowColor" format="color" /> <attr name="workspaceStatusBarScrim" format="reference" /> <attr name="widgetsTheme" format="reference" /> + <attr name="folderBadgeColor" format="color" /> <!-- BubbleTextView specific attributes. --> <declare-styleable name="BubbleTextView"> diff --git a/res/values/styles.xml b/res/values/styles.xml index 07bd80071..7ea28ccf0 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -42,6 +42,7 @@ <item name="workspaceKeyShadowColor">#44000000</item> <item name="workspaceStatusBarScrim">@drawable/workspace_bg</item> <item name="widgetsTheme">@style/WidgetContainerTheme</item> + <item name="folderBadgeColor">?android:attr/colorPrimary</item> </style> <style name="LauncherTheme" parent="@style/BaseLauncherThemeWithCustomAttrs"></style> @@ -70,6 +71,7 @@ <item name="popupColorSecondary">#424242</item> <!-- Gray 800 --> <item name="popupColorTertiary">#757575</item> <!-- Gray 600 --> <item name="widgetsTheme">@style/WidgetContainerTheme.Dark</item> + <item name="folderBadgeColor">#FF464646</item> <item name="isMainColorDark">true</item> </style> diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index fb7c0ced4..fae199259 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -386,10 +386,14 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, } public void getIconBounds(Rect outBounds) { - int top = getPaddingTop(); - int left = (getWidth() - mIconSize) / 2; - int right = left + mIconSize; - int bottom = top + mIconSize; + getIconBounds(this, outBounds, mIconSize); + } + + public static void getIconBounds(View iconView, Rect outBounds, int iconSize) { + int top = iconView.getPaddingTop(); + int left = (iconView.getWidth() - iconSize) / 2; + int right = left + iconSize; + int bottom = top + iconSize; outBounds.set(left, top, right, bottom); } diff --git a/src/com/android/launcher3/badge/BadgeRenderer.java b/src/com/android/launcher3/badge/BadgeRenderer.java index 948742727..8998b24ed 100644 --- a/src/com/android/launcher3/badge/BadgeRenderer.java +++ b/src/com/android/launcher3/badge/BadgeRenderer.java @@ -60,6 +60,7 @@ public class BadgeRenderer { int size = (int) (DOT_SCALE * mDotCenterOffset); ShadowGenerator.Builder builder = new ShadowGenerator.Builder(Color.TRANSPARENT); + builder.ambientShadowAlpha = 88; mBackgroundWithShadow = builder.setupBlurForSize(size).createPill(size, size); mCircleRadius = builder.radius; diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java index 95a6bbd20..a60216c53 100644 --- a/src/com/android/launcher3/folder/FolderIcon.java +++ b/src/com/android/launcher3/folder/FolderIcon.java @@ -25,7 +25,6 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Point; import android.graphics.Rect; -import android.graphics.Region; import android.graphics.drawable.Drawable; import android.os.Parcelable; import android.support.annotation.NonNull; @@ -483,10 +482,7 @@ public class FolderIcon extends FrameLayout implements FolderListener { public void drawBadge(Canvas canvas) { if ((mBadgeInfo != null && mBadgeInfo.hasBadge()) || mBadgeScale > 0) { - int offsetX = mBackground.getOffsetX(); - int offsetY = mBackground.getOffsetY(); - int previewSize = (int) (mBackground.previewSize * mBackground.mScale); - mTempBounds.set(offsetX, offsetY, offsetX + previewSize, offsetY + previewSize); + BubbleTextView.getIconBounds(this, mTempBounds, mLauncher.getDeviceProfile().iconSizePx); // If we are animating to the accepting state, animate the badge out. float badgeScale = Math.max(0, mBadgeScale - mBackground.getScaleProgress()); diff --git a/src/com/android/launcher3/folder/PreviewBackground.java b/src/com/android/launcher3/folder/PreviewBackground.java index 069ec4ba1..b162fcf32 100644 --- a/src/com/android/launcher3/folder/PreviewBackground.java +++ b/src/com/android/launcher3/folder/PreviewBackground.java @@ -38,6 +38,7 @@ import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAnimUtils; +import com.android.launcher3.R; import com.android.launcher3.util.Themes; /** @@ -70,6 +71,7 @@ public class PreviewBackground { float mScale = 1f; private float mColorMultiplier = 1f; private int mBgColor; + private int mBadgeColor; private float mStrokeWidth; private int mStrokeAlpha = MAX_BG_OPACITY; private int mShadowAlpha = 255; @@ -132,6 +134,7 @@ public class PreviewBackground { int availableSpaceX, int topPadding) { mInvalidateDelegate = invalidateDelegate; mBgColor = Themes.getAttrColor(launcher, android.R.attr.colorPrimary); + mBadgeColor = Themes.getAttrColor(launcher, R.attr.folderBadgeColor); DeviceProfile grid = launcher.getDeviceProfile(); previewSize = grid.folderIconSizePx; @@ -198,7 +201,7 @@ public class PreviewBackground { } public int getBadgeColor() { - return mBgColor; + return mBadgeColor; } public void drawBackground(Canvas canvas) { diff --git a/src/com/android/launcher3/graphics/ShadowGenerator.java b/src/com/android/launcher3/graphics/ShadowGenerator.java index 88da853d6..52d45accf 100644 --- a/src/com/android/launcher3/graphics/ShadowGenerator.java +++ b/src/com/android/launcher3/graphics/ShadowGenerator.java @@ -120,7 +120,7 @@ public class ShadowGenerator { } public Builder setupBlurForSize(int height) { - shadowBlur = height * 1f / 32; + shadowBlur = height * 1f / 24; keyShadowDistance = height * 1f / 16; return this; } |