diff options
author | Tony Wickham <twickham@google.com> | 2019-05-03 11:27:32 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2019-05-06 10:42:55 -0700 |
commit | e1cb93f95744e5d2be5c48fc5bd3025f1453006b (patch) | |
tree | 184bdee68538b2167d2faedd66d8ef42b1779226 /src | |
parent | 227b6e021cef474de05f7dfbd4e641bf860ac011 (diff) | |
download | android_packages_apps_Trebuchet-e1cb93f95744e5d2be5c48fc5bd3025f1453006b.tar.gz android_packages_apps_Trebuchet-e1cb93f95744e5d2be5c48fc5bd3025f1453006b.tar.bz2 android_packages_apps_Trebuchet-e1cb93f95744e5d2be5c48fc5bd3025f1453006b.zip |
Always place notification dots directly on adaptive icon path
- Calculate point on icon path nearest to top right corner, and
use that as center for the dot
- Cleanup code related to dot offset
Test:
Set each style (different icon shape) and verify dot is in correct
placement for each of:
- Folders
- Icons in folders
- Icons in all apps
- Icons on workspace
Bug: 124414511
Change-Id: I036ed3677e8af222f00d4fad4a36a7e4d9b49ad9
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 7 | ||||
-rw-r--r-- | src/com/android/launcher3/folder/FolderIcon.java | 9 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 8291acc59..bff7f4213 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -46,10 +46,12 @@ import com.android.launcher3.dot.DotInfo; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.graphics.DrawableFactory; import com.android.launcher3.graphics.IconPalette; +import com.android.launcher3.graphics.IconShape; import com.android.launcher3.graphics.PreloadIconDrawable; import com.android.launcher3.icons.DotRenderer; import com.android.launcher3.icons.IconCache.IconLoadRequest; import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver; +import com.android.launcher3.icons.LauncherIcons; import com.android.launcher3.model.PackageItemInfo; import com.android.launcher3.views.ActivityContext; @@ -388,7 +390,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, protected void drawDotIfNecessary(Canvas canvas) { if (!mForceHideDot && (hasDot() || mDotParams.scale > 0)) { getIconBounds(mDotParams.iconBounds); - mDotParams.spaceForOffset.set((getWidth() - mIconSize) / 2, getPaddingTop()); + Utilities.scaleRectAboutCenter(mDotParams.iconBounds, IconShape.getNormalizationScale()); final int scrollX = getScrollX(); final int scrollY = getScrollY(); canvas.translate(scrollX, scrollY); diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index c0affb944..3d2d7cf9e 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -24,15 +24,13 @@ import android.graphics.PointF; import android.graphics.Rect; import android.util.DisplayMetrics; import android.view.Surface; -import android.view.View; import android.view.WindowManager; import com.android.launcher3.CellLayout.ContainerType; +import com.android.launcher3.graphics.IconShape; import com.android.launcher3.icons.DotRenderer; import com.android.launcher3.icons.IconNormalizer; -import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; - public class DeviceProfile { public final InvariantDeviceProfile inv; @@ -240,7 +238,8 @@ public class DeviceProfile { updateWorkspacePadding(); // This is done last, after iconSizePx is calculated above. - mDotRenderer = new DotRenderer(iconSizePx); + mDotRenderer = new DotRenderer(iconSizePx, IconShape.getShapePath(), + IconShape.DEFAULT_PATH_SIZE); } public DeviceProfile copy(Context context) { diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java index 6fa9ba9ae..8d9c52065 100644 --- a/src/com/android/launcher3/folder/FolderIcon.java +++ b/src/com/android/launcher3/folder/FolderIcon.java @@ -36,6 +36,8 @@ import android.view.ViewDebug; import android.view.ViewGroup; import android.widget.FrameLayout; +import androidx.annotation.NonNull; + import com.android.launcher3.Alarm; import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; @@ -50,11 +52,11 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings; import com.android.launcher3.OnAlarmListener; import com.android.launcher3.R; -import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.SimpleOnStylusPressListener; import com.android.launcher3.StylusEventHelper; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; +import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.dot.FolderDotInfo; import com.android.launcher3.dragndrop.BaseItemDragListener; @@ -68,8 +70,6 @@ import com.android.launcher3.widget.PendingAddShortcutInfo; import java.util.ArrayList; import java.util.List; -import androidx.annotation.NonNull; - /** * An icon that can appear on in the workspace representing an {@link Folder}. */ @@ -510,10 +510,11 @@ public class FolderIcon extends FrameLayout implements FolderListener { Rect iconBounds = mDotParams.iconBounds; BubbleTextView.getIconBounds(this, iconBounds, mLauncher.getWallpaperDeviceProfile().iconSizePx); + float iconScale = (float) mBackground.previewSize / iconBounds.width(); + Utilities.scaleRectAboutCenter(iconBounds, iconScale); // If we are animating to the accepting state, animate the dot out. mDotParams.scale = Math.max(0, mDotScale - mBackground.getScaleProgress()); - mDotParams.spaceForOffset.set(getWidth() - iconBounds.right, iconBounds.top); mDotParams.color = mBackground.getDotColor(); mDotRenderer.draw(canvas, mDotParams); } |