Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3a1df20 authored by Hyunyoung Song's avatar Hyunyoung Song Committed by Android (Google) Code Review
Browse files

Merge "Place the work profile badge in the correct bottom right (left for RTL)...

Merge "Place the work profile badge in the correct bottom right (left for RTL) location" into ub-launcher3-burnaby
parents f7e85f85 6babf2e2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -118,4 +118,5 @@
<!-- Sizes for managed profile badges -->
    <dimen name="profile_badge_size">24dp</dimen>
    <dimen name="profile_badge_margin">4dp</dimen>
    <dimen name="profile_badge_minimum_top">2dp</dimen>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -444,7 +444,7 @@ public class WidgetPreviewLoader {
            } catch (Resources.NotFoundException e) { }
            c.setBitmap(null);
        }
        return mManager.getBadgeBitmap(info, preview);
        return mManager.getBadgeBitmap(info, preview, Math.min(preview.getHeight(), previewHeight));
    }

    private Bitmap generateShortcutPreview(
+2 −1
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ public abstract class AppWidgetManagerCompat {

    public abstract Drawable loadIcon(LauncherAppWidgetProviderInfo info, IconCache cache);

    public abstract Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap);
    public abstract Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap,
            int imageHeight);

}
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ class AppWidgetManagerCompatV16 extends AppWidgetManagerCompat {
    }

    @Override
    public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap) {
    public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) {
        return bitmap;
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat {
    }

    @Override
    public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap) {
    public Bitmap getBadgeBitmap(LauncherAppWidgetProviderInfo info, Bitmap bitmap, int imageHeight) {
        if (info.isCustomWidget || info.getProfile().equals(android.os.Process.myUserHandle())) {
            return bitmap;
        }
@@ -117,9 +117,10 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat {
        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 = bitmap.getHeight() - badgeSize - badgeMargin;
        final int top = Math.max(imageHeight - badgeSize - badgeMargin, badgeMinTop);
        if (res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
            badgeLocation.offset(badgeMargin, top);
        } else {
Loading