Loading res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ <!-- Sizes for managed profile badges --> <dimen name="profile_badge_size">24dp</dimen> <dimen name="profile_badge_margin">4dp</dimen> <dimen name="profile_badge_margin">5dp</dimen> <dimen name="profile_badge_minimum_top">2dp</dimen> <!-- Shadows and outlines --> Loading src/com/android/launcher3/WidgetPreviewLoader.java +6 −4 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public class WidgetPreviewLoader { private final UserManagerCompat mUserManager; private final AppWidgetManagerCompat mManager; private final CacheDb mDb; private final InvariantDeviceProfile mDeviceProfile; private final int mProfileBadgeMargin; private final MainThreadExecutor mMainThreadExecutor = new MainThreadExecutor(); @Thunk final Handler mWorkerHandler; Loading @@ -76,7 +76,8 @@ public class WidgetPreviewLoader { mUserManager = UserManagerCompat.getInstance(context); mDb = new CacheDb(context); mWorkerHandler = new Handler(LauncherModel.getWorkerLooper()); mDeviceProfile = inv; mProfileBadgeMargin = context.getResources() .getDimensionPixelSize(R.dimen.profile_badge_margin); } /** Loading Loading @@ -401,7 +402,7 @@ public class WidgetPreviewLoader { } // Draw the scaled preview into the final bitmap int x = (preview.getWidth() - previewWidth) / 2; int x = (preview.getWidth() - previewWidth - mProfileBadgeMargin) / 2; if (widgetPreviewExists) { drawable.setBounds(x, 0, x + previewWidth, previewHeight); drawable.draw(c); Loading Loading @@ -445,7 +446,8 @@ public class WidgetPreviewLoader { } catch (Resources.NotFoundException e) { } c.setBitmap(null); } return mManager.getBadgeBitmap(info, preview, Math.min(preview.getHeight(), previewHeight)); int imageHeight = Math.min(preview.getHeight(), previewHeight + mProfileBadgeMargin); return mManager.getBadgeBitmap(info, preview, imageHeight); } private Bitmap generateShortcutPreview( Loading src/com/android/launcher3/compat/AppWidgetManagerCompatV16.java +2 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,8 @@ class AppWidgetManagerCompatV16 extends AppWidgetManagerCompat { } @Override public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) { public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) { return bitmap; } } src/com/android/launcher3/compat/AppWidgetManagerCompatVL.java +5 −5 Original line number Diff line number Diff line Loading @@ -108,7 +108,8 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat { } @Override public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) { public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) { if (info.isCustomWidget || info.getProfile().equals(android.os.Process.myUserHandle())) { return bitmap; } Loading @@ -116,15 +117,14 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat { // Add a user badge in the bottom right of the image. final Resources res = mContext.getResources(); final int badgeSize = res.getDimensionPixelSize(R.dimen.profile_badge_size); final int badgeMargin = res.getDimensionPixelSize(R.dimen.profile_badge_margin); final int badgeMinTop = res.getDimensionPixelSize(R.dimen.profile_badge_minimum_top); final Rect badgeLocation = new Rect(0, 0, badgeSize, badgeSize); final int top = Math.max(imageHeight - badgeSize - badgeMargin, badgeMinTop); final int top = Math.max(imageHeight - badgeSize, badgeMinTop); if (res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { badgeLocation.offset(badgeMargin, top); badgeLocation.offset(0, top); } else { badgeLocation.offset(bitmap.getWidth() - badgeSize - badgeMargin, top); badgeLocation.offset(bitmap.getWidth() - badgeSize, top); } Drawable drawable = mPm.getUserBadgedDrawableForDensity( Loading Loading
res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ <!-- Sizes for managed profile badges --> <dimen name="profile_badge_size">24dp</dimen> <dimen name="profile_badge_margin">4dp</dimen> <dimen name="profile_badge_margin">5dp</dimen> <dimen name="profile_badge_minimum_top">2dp</dimen> <!-- Shadows and outlines --> Loading
src/com/android/launcher3/WidgetPreviewLoader.java +6 −4 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public class WidgetPreviewLoader { private final UserManagerCompat mUserManager; private final AppWidgetManagerCompat mManager; private final CacheDb mDb; private final InvariantDeviceProfile mDeviceProfile; private final int mProfileBadgeMargin; private final MainThreadExecutor mMainThreadExecutor = new MainThreadExecutor(); @Thunk final Handler mWorkerHandler; Loading @@ -76,7 +76,8 @@ public class WidgetPreviewLoader { mUserManager = UserManagerCompat.getInstance(context); mDb = new CacheDb(context); mWorkerHandler = new Handler(LauncherModel.getWorkerLooper()); mDeviceProfile = inv; mProfileBadgeMargin = context.getResources() .getDimensionPixelSize(R.dimen.profile_badge_margin); } /** Loading Loading @@ -401,7 +402,7 @@ public class WidgetPreviewLoader { } // Draw the scaled preview into the final bitmap int x = (preview.getWidth() - previewWidth) / 2; int x = (preview.getWidth() - previewWidth - mProfileBadgeMargin) / 2; if (widgetPreviewExists) { drawable.setBounds(x, 0, x + previewWidth, previewHeight); drawable.draw(c); Loading Loading @@ -445,7 +446,8 @@ public class WidgetPreviewLoader { } catch (Resources.NotFoundException e) { } c.setBitmap(null); } return mManager.getBadgeBitmap(info, preview, Math.min(preview.getHeight(), previewHeight)); int imageHeight = Math.min(preview.getHeight(), previewHeight + mProfileBadgeMargin); return mManager.getBadgeBitmap(info, preview, imageHeight); } private Bitmap generateShortcutPreview( Loading
src/com/android/launcher3/compat/AppWidgetManagerCompatV16.java +2 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,8 @@ class AppWidgetManagerCompatV16 extends AppWidgetManagerCompat { } @Override public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) { public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) { return bitmap; } }
src/com/android/launcher3/compat/AppWidgetManagerCompatVL.java +5 −5 Original line number Diff line number Diff line Loading @@ -108,7 +108,8 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat { } @Override public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) { public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) { if (info.isCustomWidget || info.getProfile().equals(android.os.Process.myUserHandle())) { return bitmap; } Loading @@ -116,15 +117,14 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat { // Add a user badge in the bottom right of the image. final Resources res = mContext.getResources(); final int badgeSize = res.getDimensionPixelSize(R.dimen.profile_badge_size); final int badgeMargin = res.getDimensionPixelSize(R.dimen.profile_badge_margin); final int badgeMinTop = res.getDimensionPixelSize(R.dimen.profile_badge_minimum_top); final Rect badgeLocation = new Rect(0, 0, badgeSize, badgeSize); final int top = Math.max(imageHeight - badgeSize - badgeMargin, badgeMinTop); final int top = Math.max(imageHeight - badgeSize, badgeMinTop); if (res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { badgeLocation.offset(badgeMargin, top); badgeLocation.offset(0, top); } else { badgeLocation.offset(bitmap.getWidth() - badgeSize - badgeMargin, top); badgeLocation.offset(bitmap.getWidth() - badgeSize, top); } Drawable drawable = mPm.getUserBadgedDrawableForDensity( Loading