diff --git a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java index 535c5d8296..8bd9dba1f9 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java +++ b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java @@ -44,6 +44,7 @@ public class BaseIconFactory implements AutoCloseable { private final PackageManager mPm; private final ColorExtractor mColorExtractor; private boolean mDisableColorExtractor; + private boolean mBadgeOnLeft = false; protected final int mFillResIconDpi; protected final int mIconBitmapSize; @@ -77,6 +78,7 @@ public class BaseIconFactory implements AutoCloseable { protected void clear() { mWrapperBackgroundColor = DEFAULT_WRAPPER_BACKGROUND; mDisableColorExtractor = false; + mBadgeOnLeft = false; } public ShadowGenerator getShadowGenerator() { @@ -200,6 +202,13 @@ public class BaseIconFactory implements AutoCloseable { Math.min(scale[0], ShadowGenerator.getScaleForBounds(iconBounds))); } + /** + * Switches badging to left/right + */ + public void setBadgeOnLeft(boolean badgeOnLeft) { + mBadgeOnLeft = badgeOnLeft; + } + /** * Sets the background color used for wrapped adaptive icon */ @@ -261,8 +270,12 @@ public class BaseIconFactory implements AutoCloseable { */ public void badgeWithDrawable(Canvas target, Drawable badge) { int badgeSize = getBadgeSizeForIconSize(mIconBitmapSize); - badge.setBounds(mIconBitmapSize - badgeSize, mIconBitmapSize - badgeSize, - mIconBitmapSize, mIconBitmapSize); + if (mBadgeOnLeft) { + badge.setBounds(0, mIconBitmapSize - badgeSize, badgeSize, mIconBitmapSize); + } else { + badge.setBounds(mIconBitmapSize - badgeSize, mIconBitmapSize - badgeSize, + mIconBitmapSize, mIconBitmapSize); + } badge.draw(target); }